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/Ignore files option added. #10

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

diogoocruz
Copy link

@diogoocruz diogoocruz commented Apr 4, 2024

Added an option to ignore files listed on the pyproject.toml [tool.burocrata]["exclude"] as mentioned on this issue.
[2nd Commit] -> You can also ignore files by using --ignore "file1, file2, ..., fileN"

Relevant issues/PRs:

Issue: #7
" Add option to ignore files #7 "

Copy link

welcome bot commented Apr 4, 2024

💖 Thank you for opening your first pull request in this repository! 💖

A few things to keep in mind:

No matter what, we are really grateful that you put in the effort to do this!

Copy link
Member

@leouieda leouieda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diogoocruz thank you for taking the time to implement this! It's much appreciated 🙂

I hadn't thought of adding the command line option but after trying it a bit and reading the explanation, I think I prefer to have it only as the pyproject.toml option. The main issue is that passing multiple file names (including globs) to an option is tricky and will end up being different from the syntax to pass multiple files as inputs. So I'd prefer to avoid having that extra source of confusion and have a single way to do it.

In hind sight, the --extension option should be the same: only available through the pyproject.toml as well. For projects, it would actually be easier. No matter what the project configuration is, running this tool is always burocrata FILES or burocrata FILES --check.

Comment on lines +91 to +93
if "exclude" in config["tool"]["burocrata"]:
exclude = config["tool"]["burocrata"]["exclude"]
exclude = pathspec.PathSpec.from_lines("gitwildmatch", exclude)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be changed to always produce a valid exclude even if it's empty, like in get_gitignore. Then we don't need to check if exclude is defined when using it below.

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

Successfully merging this pull request may close these issues.

None yet

2 participants