Skip to content

--exclude-google-imports causing everything to be excluded #1030

@odubno

Description

@odubno

I'm using buf before cleaning up compiled files with protol

protol --exclude-google-imports --create-package --in-place --python-out ./my-packages buf --buf-path=/usr/local/bin/buf

Using --exclude-google-imports is causing everything to get ignored.

[source: github]

def _should_ignore(fd_name: str, patterns: Sequence[str]) -> bool:
    """Return whether `fd_name` should be ignored according to `patterns`.

    Examples
    --------
    >>> fd_name = "google/protobuf/empty.proto"
    >>> pattern = "google/protobuf/*"
    >>> _should_ignore(fd_name, [pattern])
    True
    >>> fd_name = "foo/bar"
    >>> _should_ignore(fd_name, [pattern])
    False
    """
    return any(fnmatch.fnmatchcase(fd_name, pattern) for pattern in patterns)

The * is causing all pattern matches to match.

So when exclude_imports_glob += ("google/protobuf/*",) is added. The * is causing everything to match. [source: github]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions