You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to have flake8 to print verbose output, if it was through pre-commit ? #1221
can you show the full output of pre-commit run --all-files? -- you also shouldn't need --config=.flake8 as flake8 will discover that file automatically
pre-commit run --all-files
pyupgrade................................................................Passed
Reorder python imports...................................................Passed
blacken-docs.............................................................Passed
black....................................................................Passed
Check for merge conflicts................................................Passed
Check for broken symlinks................................................Passed
Debug Statements (Python)................................................Passed
Fix End of Files.........................................................Passed
Fix python encoding pragma...............................................Passed
Tests should end in _test.py.............................................Passed
Trim Trailing Whitespace.................................................Passed
flake8...................................................................Failed
mypy.....................................................................Passed
check for eval().........................................................Passed
use logger.warning(......................................................Passed
type annotations not comments............................................Passed
If I was run flake8 only, here is what I got:
pre-commit run flake8 --all-files
flake8...................................................................Failed
I am using pre-commit 1.20.0 on Ubuntu 16.0.4. and there is no difference if I was running in this way:
pre-commit run flake8 --verbose --all-files
[flake8] flake8..........................................................Failed
This flake8 was newly added into .pre-commit-config.yaml file. During the first time running, it does give me failed file information. But after that, it just does not happen any more. Thanks.
Sure. One more reason I want to check is, if I was using the flake8 command directly, of the same flake8 version, it says my code was clean. So I am just curious about that. Thanks.
Failed means it is exiting nonzero, flake8; echo $? would potentially show that as well -- you may be able to flake8 -vvv to show why it's exiting nonzero
OK. I will try.
I have just installed the pre-commit of 1.19.0. running the full set does give me some extra message, but nothing is on the flake8 part:
uname -a
Linux Jenkins-CJI 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
pre-commit --version
pre-commit 1.19.0
pre-commit run --verbose --all-files
[pyupgrade] pyupgrade.............................................................Passed
[reorder-python-imports] Reorder python imports...................................Passed
[blacken-docs] blacken-docs.......................................................Passed
[black] black.....................................................................Passed
hookid: black
All done! ✨ 🍰 ✨
525 files left unchanged.
[check-merge-conflict] Check for merge conflicts..................................Passed
[check-symlinks] Check for broken symlinks........................................Passed
[debug-statements] Debug Statements (Python)......................................Passed
[end-of-file-fixer] Fix End of Files..............................................Passed
[fix-encoding-pragma] Fix python encoding pragma..................................Passed
[name-tests-test] Tests should end in _test.py....................................Passed
[trailing-whitespace] Trim Trailing Whitespace....................................Passed
[flake8] flake8...................................................................Failed
[mypy] mypy.......................................................................Passed
hookid: mypy
Success: no issues found in 525 source files
[python-no-eval] check for eval().................................................Passed
[python-no-log-warn] use logger.warning(..........................................Passed
[python-use-type-annotations] type annotations not comments.......................Passed
Added, but I don't know if there is an ending for this command. 5 mins after, this flake8 part is still on-going ( ?) That is the extra message I got on flake8 part: [flake8] flake8...................................................................
If you take one particular file from your repository does it still fail? pre-commit run flake8 --files setup.py for example (and try this with -vvv)
you can also locate the exact flake8 binary that's being used via find ~/.cache/pre-commit -type f -name flake8 and might be able to reproduce the exit code from that as well
I have a group of files, and I don't know which one causes that failure, if I in pre-commit mode. And that is the reason I am looking for the verbose message.
For the one I just sent, I was using a hello world case, which is valid for sure. I thought you were trying to check my environment.
find ~/.cache/pre-commit -type f -name flake8
/var/lib/jenkins/.cache/pre-commit/repo2cmcogb7/py_env-python3.7/bin/flake8
/var/lib/jenkins/.cache/pre-commit/repo2cmcogb7/py_env-python3.7/bin/flake8 --version
3.7.8 (mccabe: 0.6.1, pycodestyle: 2.5.0, pyflakes: 2.1.1) CPython 3.7.3 on Linux
I think I have 2 flakes, and they are of the same version.
I'm fairly certain this is something to do with your particular setup or target code as I cannot reproduce. the version information isn't really useful, I need you to run and produce log outputs as I've requested above
I was not able to run this way, "flake8; echo$?" , while the flake8 is from my ~/.cache/pre-commit dir. seems to me an endless call.
The good news is I have found a way to solve my "failure" issue, which is to clean the ~/.cache/pre-commit, and rerun that "pre-commit run --all-files" as a fresh one.
I guess what happen was my original ".pre-commit-config.yaml" did not have flake8 checking included, and I had it added later. While the yaml file was updated, the cache never gets synced ? and that causes such false failure. That explains to me when I was using /usr/local/bin/flake8 command to check directly, everything looks ok.
hmmm that should end up at the same result, the cache is meant to be partial and work after adding and removing things. but I guess now that it's fixed we won't be able to find the root problem any more.
thanks for the persistence and sorry about the run-around!
Activity
asottile commentedon Nov 13, 2019
can you show the full output of
pre-commit run --all-files? -- you also shouldn't need--config=.flake8as flake8 will discover that file automaticallychunji08 commentedon Nov 13, 2019
If I was run the full set, here is output I got:
If I was run flake8 only, here is what I got:
asottile commentedon Nov 13, 2019
what platform / version information can you provide? and does the output change if you run with
--verbose?chunji08 commentedon Nov 13, 2019
I am using pre-commit 1.20.0 on Ubuntu 16.0.4. and there is no difference if I was running in this way:
This flake8 was newly added into .pre-commit-config.yaml file. During the first time running, it does give me failed file information. But after that, it just does not happen any more. Thanks.
asottile commentedon Nov 13, 2019
hmmm we changed some stuff here recently, can you try with pre-commit 1.19 temporarily?
chunji08 commentedon Nov 13, 2019
Sure. One more reason I want to check is, if I was using the flake8 command directly, of the same flake8 version, it says my code was clean. So I am just curious about that. Thanks.
asottile commentedon Nov 13, 2019
Failedmeans it is exiting nonzero,flake8; echo $?would potentially show that as well -- you may be able toflake8 -vvvto show why it's exiting nonzerochunji08 commentedon Nov 13, 2019
OK. I will try.
I have just installed the pre-commit of 1.19.0. running the full set does give me some extra message, but nothing is on the flake8 part:
asottile commentedon Nov 13, 2019
ok, what happens if you set
args: [--config=.flake8, -vvv]?chunji08 commentedon Nov 13, 2019
Added, but I don't know if there is an ending for this command. 5 mins after, this flake8 part is still on-going ( ?) That is the extra message I got on flake8 part:
[flake8] flake8...................................................................asottile commentedon Nov 13, 2019
does
flake8 -vvvoutside of pre-commit show the same thing? (andflake8; echo $??)chunji08 commentedon Nov 13, 2019
If I was running on this flake8 on command, It does give me lots of messages. Her is my separately installed flake8 version.
asottile commentedon Nov 13, 2019
please run these commands and produce the full output
chunji08 commentedon Nov 14, 2019
for the 2nd cmd, it gives such log message,
log.txt
asottile commentedon Nov 14, 2019
that's very strange.
If you take one particular file from your repository does it still fail?
pre-commit run flake8 --files setup.pyfor example (and try this with-vvv)you can also locate the exact
flake8binary that's being used viafind ~/.cache/pre-commit -type f -name flake8and might be able to reproduce the exit code from that as wellchunji08 commentedon Nov 14, 2019
I have a group of files, and I don't know which one causes that failure, if I in pre-commit mode. And that is the reason I am looking for the verbose message.
For the one I just sent, I was using a hello world case, which is valid for sure. I thought you were trying to check my environment.
I think I have 2 flakes, and they are of the same version.
chunji08 commentedon Nov 14, 2019
asottile commentedon Nov 14, 2019
I'm fairly certain this is something to do with your particular setup or target code as I cannot reproduce. the version information isn't really useful, I need you to run and produce log outputs as I've requested above
chunji08 commentedon Nov 14, 2019
the message I submitted was using the flake8 under /usr/local/bin/, Let me try the other one.
asottile commentedon Nov 14, 2019
I'm most interested in this:
chunji08 commentedon Nov 14, 2019
I was not able to run this way, "flake8; echo$?" , while the flake8 is from my ~/.cache/pre-commit dir. seems to me an endless call.
The good news is I have found a way to solve my "failure" issue, which is to clean the ~/.cache/pre-commit, and rerun that "pre-commit run --all-files" as a fresh one.
I guess what happen was my original ".pre-commit-config.yaml" did not have flake8 checking included, and I had it added later. While the yaml file was updated, the cache never gets synced ? and that causes such false failure. That explains to me when I was using /usr/local/bin/flake8 command to check directly, everything looks ok.
asottile commentedon Nov 14, 2019
hmmm that should end up at the same result, the cache is meant to be partial and work after adding and removing things. but I guess now that it's fixed we won't be able to find the root problem any more.
thanks for the persistence and sorry about the run-around!