Comments (11)
In GitLab by @sigmavirus24 on Oct 31, 2014, 08:13
This is intentional. Some people want to forcibly check a file that is otherwise excluded. This would be a bug if you instead ran:
flake8 --config=private/lint/flake8-hook.ini django_app
from flake8.
In GitLab by @cabello on Oct 31, 2014, 09:45
Is there an alternative besides applying the exclusion policy myself?
I am getting the list of files from bash in a commit hook: py_files=$(git diff --cached --name-only --diff-filter=ACM | grep ".py$");
from flake8.
In GitLab by @sigmavirus24 on Oct 31, 2014, 10:12
Why aren't you using flake8's commit hook. I'm pretty sure it already handles this.
from flake8.
In GitLab by @cabello on Oct 31, 2014, 13:18
I managed to make it working following your suggestion, instead of checking for files, I am checking for the changed folders, worked out nicely.
I am not sure why we are not using flake8 built-in commit hook though. =/
Thanks for the quick and prompt reply & help!
from flake8.
In GitLab by @sigmavirus24 on Nov 1, 2014, 18:18
Always happy to help @cabello !
Thanks for reporting this anyway
from flake8.
In GitLab by @dwaynebailey on Apr 28, 2016, 19:52
I'm using pre-commit
and while this behaviour might be intentional it is actually massively inconsistent and undocumented.
If I supply --config to override any default config I really don't expect it to behave differently regardless of what I supply. If I supply dir/ it respects it, if I supply dir/file.py it doesn't.
It's also selectively takes configuration from my setup.cfg:
- Its takes max-line-length= and statistics=
- But ignores exclude= and ignore=
I'm sure there's a more logical way to say ignore my settings?
Current behaviour is full settings for dir/ or default, half settings for specified file.py. Pretty confusing tbh.
In the interest of those who come after. This pre-commit issue suggests some workarounds.
from flake8.
In GitLab by @sigmavirus24 on Apr 29, 2016, 05:46
Hi @dwaynebailey,
At the present time, all configuration file discovery, parsing, and management is handled by pycodestyle (formerly pep8). Flake8 3.0 has taken control of this aspect and now handles this on its own and has fixed the problem I think you are describing (where you expect --config
to ignore all other config files on disk) while providing alternative methods for retaining the existing behaviour.
from flake8.
In GitLab by @davecremins on Dec 15, 2016, 06:29
This should not have been closed, this is still an issue in flake8 3.0.4
from flake8.
In GitLab by @thejcannon on Jan 31, 2020, 09:34
Has any thought been given to "solving" this issue in the same way isort
has? By adding a flag that tells the tool to "force" the exclusions, even on cmd-line args. (See filter_files
in the docs).
It's truly unfortunate to have to specify the exclusions in more than one place: The config file (pyproject.toml
or otherwise) for tooling running on the code as a directory, and then one for each config file that controls a tool that runs on the code per-file (like pre-commit).
from flake8.
In GitLab by @asottile on Jan 31, 2020, 09:36
afaict this got "fixed" at some point:
[flake8]
exclude = t.py
import os
$ flake8 t.py
$
though I suspect it was on accident
from flake8.
In GitLab by @thejcannon on Jan 31, 2020, 09:54
Looks like that behavior is documented in issue 392, and the "bug" (un)fortunately doesn't apply to exclusion directories, just exclusion filenames. In my use case, there are several files in the directory, so I'm still out of luck 🤷
from flake8.
Related Issues (20)
- f-string like `f"{foo = }"` is detected as an error HOT 1
- Support using configuration from .editorconfig HOT 3
- Support for union type hints using "bitwise or" HOT 1
- `UnicodeDecodeError` at parsing cli's arguments HOT 1
- flake8 evaluate all setup.cfg sections HOT 1
- Q: List of available/active rules HOT 4
- Support newer versions of pycodestyle HOT 2
- Use setuptools.build_meta HOT 1
- E231 when using f-string HOT 1
- Export current configuration HOT 1
- --append-config does not extend defaults HOT 1
- Throwing a lint error when there isn't one HOT 2
- flake8 crash (string index out of range) on python 3.12 HOT 7
- Allow the enforcing of some type hint practices HOT 1
- Docu: Lookup location for ".flake8" unclear HOT 3
- Ignore "SyntaxWarning: invalid escape sequence" HOT 6
- pycodestyle entry point means "noqa" is not populated HOT 1
- Allow TODO issue with pound sign anywhere in text HOT 6
- pre-commit cache contains tests folder HOT 2
- Trailing slash breaks exclude and extend-exclude config HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flake8.