Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
odubno opened this issue Feb 27, 2024 · 0 comments
Open

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

odubno opened this issue Feb 27, 2024 · 0 comments

Comments

@odubno
Copy link

odubno commented Feb 27, 2024

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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant