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

Lint only project files #159

Closed
wants to merge 1 commit into from
Closed

Conversation

drhagen
Copy link
Contributor

@drhagen drhagen commented Mar 30, 2023

If Python files unrelated to the project get put into the project directory, they get linted and lots of errors appear. For example, setting virtualenvs.in-project = true will cause Poetry to create .venv at the root of the project. This PR changes lint to work like type_check and tells flake8 to only lint the project files. It is unclear if docs should be linted, but it does contain one Python file.

@johnthagen johnthagen self-assigned this Mar 30, 2023
@johnthagen
Copy link
Owner

I personally prefer keeping these broad as possible to avoid missing having to add a new directory. I'd like to default to having more things checked and exclude them than the other way around. Mypy is an example of something that simply doesn't support this.

I rely on default excludes like black and isort is configured to do to avoid linting the incorrect files, or using exclude.

It appears that flake8 does not exclude venv or .venv by default (unlike black and isort):

This is one of the reasons I like Poetry's default behaviour to keep the venvs out of the current directory.

I would recommend you also consider excluding .venv, that is what python-blueprint did before the migration to Poetry, but it is a matter of preference which you prefer.

@johnthagen johnthagen closed this Mar 30, 2023
@johnthagen johnthagen added the wontfix This will not be worked on label Mar 30, 2023
@johnthagen
Copy link
Owner

Another benefit of putting such exclusions into config files rather than only relying on noxfile.py is that CLI usage, or editor integrations will be correct when flake8 is run as well.

@drhagen
Copy link
Contributor Author

drhagen commented Mar 31, 2023

This is actually another benefit of switching to Ruff as suggested in #141. Ruff automatically excludes .venv folders.

@drhagen drhagen deleted the lint-directories branch March 31, 2023 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants