Comments (6)
In GitLab by @sigmavirus24 on Dec 27, 2014, 09:21
@joe-gordon0 a merge request would be helpful in explaining the difference between the proposed flag and the existing --diff
flag (because I've honestly forgotten how it differs since we last talked about this). Relatedly, the comment in that patch set doesn't explain how what you're doing there differs from --diff
.
from flake8.
In GitLab by @joe-gordon0 on Feb 15, 2015, 14:43
Currently flake8 -diff
takes a diff as stdin. So git diff HEAD^ | flake8 -diff
Then pep8 (as part of flake8) extracts the filenames from the diff, excludes any that do not match the filename filter (so we can ignore things that aren't python files etc.) and then runs pep8/flake8 against those files (as read from the filesystem -- which isn't obvious).
The idea here is to add support to flake8 to do the same thing without having to do manually call 'git diff HEAD^' and teach flake8 to detect if its running on files in a VCS and automatically extract the right files to run against.
This would allow users to trivially run flake8 on just the changed files any time they want. Instead of just in pre-commit git hook.
Another option is to just better document how to do this in flake8's documentation. The same thing can easily be made easier via git aliases:
[alias]
flake8 = "!git diff HEAD^ | flake8 --diff "
Thoughts on what approach is preferred?
from flake8.
In GitLab by @sigmavirus24 on Feb 22, 2015, 11:10
So as you pointed out, the --diff
handling is part of pep8. There's no reason flake8
couldn't detect the usage of --diff
sans stdin
and not try to find a vcs to pull the diff from. We already have VCS discovery code for the --install-hook
option.
+1 from me.
from flake8.
In GitLab by @adiroiban on Dec 4, 2015, 02:05
I am using something like this https://github.com/twisted/twisted/blob/fe7853b08c78756a473c8747ce1e7bd1f4cdaa5b/bin/admin/tx-pyflakes for my private project.
The example is something proposed for Twisted... but not accepted as it better to just use flake8 and not reinvent the wheel :)
The command line option can look like
flake8 --vcs-branch=master some/path
in this way it should also work for people with different main branch names
The initial implementation can only support git and later extended to hg or other tools.
VCS can be autodetected.
What do you say? Does it make sense?
Thanks!
from flake8.
In GitLab by @sigmavirus24 on Oct 20, 2018, 10:26
closed
from flake8.
In GitLab by @asottile on Oct 2, 2020, 16:38
changed the description
from flake8.
Related Issues (20)
- Warn about ignored flake8 configurations HOT 3
- Exclude violations based on function names HOT 2
- E712 recommends "worse" option HOT 1
- `AttributeError: 'EntryPoints' object has no attribute 'get'` raised when using flake8 with Python 3.12 HOT 1
- 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
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.