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

No output from flake8 on Windows #374

Closed
akaihola opened this issue Aug 27, 2022 Discussed in #368 · 4 comments · Fixed by #378
Closed

No output from flake8 on Windows #374

akaihola opened this issue Aug 27, 2022 Discussed in #368 · 4 comments · Fixed by #378
Assignees
Labels
bug Something isn't working
Milestone

Comments

@akaihola
Copy link
Owner

Discussed in #368

Originally posted by deadkex May 20, 2022
Hi!
I am using darker in combination with pre-commit and the linters i would like to use are pylint and flake8.
The problem is that i cannot get any output from flake8, on the other hand pylint works as expected.
If you take below config and pre-commit run --file test.py, you can see that flake8 is actually running and reporting violations, but darker is not showing them. I also tried committing larger files with lots of changes or explicitly adding violations as changes.

python: 3.8.10
darker: 1.5.0
pre-commit: 2.19.0
flake8: 4.0.1
black: 22.3.0

.pre-commit-config.yaml

default_language_version:
    python: python3

repos:
-   repo: local
    hooks:
    -   id: darker
        name: darker
        entry: darker
        language: system
        types: [python]
        args: [
            "-L flake8 -v"
        ]
    -   id: flake8
        name: flake8
        entry: flake8
        language: system
        types: [ python ]

pyproject.toml

[tool.darker]
src = ["./"]
revision = ":PRE-COMMIT:"
diff = false
check = true
isort = false
# lint = [
#     "flake8"
# ]

[tool.black]
target-version = ["py38"]
include = '\.py?$'

test.py

try:
    pass
except:
    pass
```</div>
@akaihola akaihola added the bug Something isn't working label Aug 27, 2022
@akaihola akaihola added this to the 1.5.1 milestone Aug 27, 2022
@akaihola akaihola self-assigned this Aug 27, 2022
@akaihola
Copy link
Owner Author

My hypothesis is that since Darker invokes flake8 with full paths to the .py files, flake8 may include those paths in its output but with funky Windows directory separators which Path(path).absolute().relative_to(root) doesn't understand (see darker.linting.parse_linter_line()).

@deadkex
Copy link
Collaborator

deadkex commented Aug 27, 2022

  • Using a file from my personal project
  • Python310
  • Using my personal pc
  • Using the debug branch

darker -vv -L flake8 BDBot.py

# Effective configuration:

[tool.darker]
src = [
    "BDBot.py",
]
revision = ":PRE-COMMIT:"
diff = false
stdout = false
check = true
isort = false
lint = [
    "flake8",
]
log_level = "DEBUG"
workers = 1


# Configuration options which differ from defaults:

[tool.darker]
src = [
    "BDBot.py",
]
revision = ":PRE-COMMIT:"
check = true
lint = [
    "flake8",
]
log_level = "DEBUG"



DEBUG:darker.git:[D:\Dokumente\Programming\python\_Bots\BDBot]$ git rev-parse --is-inside-work-tree
DEBUG:darker.git:[D:\Dokumente\Programming\python\_Bots\BDBot]$ git diff --name-only --relative HEAD -- BDBot.py
DEBUG:darker.git:[D:\Dokumente\Programming\python\_Bots\BDBot]$ git ls-files --others --exclude-standard -- BDBot.py
DEBUG:darker.__main__:Read 203 lines from edited file D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py
DEBUG:darker.__main__:Black reformat resulted in 280 lines
DEBUG:darker.diff:Diff between edited and reformatted has 41 opcodes
DEBUG:darker.git:[D:\Dokumente\Programming\python\_Bots\BDBot]$ git show HEAD:./BDBot.py
DEBUG:darker.git:[D:\Dokumente\Programming\python\_Bots\BDBot]$ git log -1 --format=%ct HEAD -- BDBot.py
DEBUG:darker.diff:Diff between edited and reformatted has 7 opcodes
DEBUG:darker.chooser:Found no edits on lines 1-6
DEBUG:darker.chooser:Using 6 original lines at line 1
DEBUG:darker.chooser:Found no edits on lines 7-10
DEBUG:darker.chooser:Using 4 original lines at line 7
DEBUG:darker.chooser:Found no edits on lines 11-14
DEBUG:darker.chooser:Using 4 original lines at line 11
DEBUG:darker.chooser:Found no edits on lines 15-16
DEBUG:darker.chooser:Using 2 original lines at line 15
DEBUG:darker.chooser:Found no edits on lines 17-51
DEBUG:darker.chooser:Using 35 original lines at line 17
DEBUG:darker.chooser:Found no edits on line 52
DEBUG:darker.chooser:Using 1 original line at line 52
DEBUG:darker.chooser:Found no edits on lines 53-56
DEBUG:darker.chooser:Using 4 original lines at line 53
DEBUG:darker.chooser:Found no edits on line 57
DEBUG:darker.chooser:Using 1 original line at line 57
DEBUG:darker.chooser:Found no edits on lines 58-59
DEBUG:darker.chooser:Using 2 original lines at line 58
DEBUG:darker.chooser:Found no edits on line 60
DEBUG:darker.chooser:Using 1 original line at line 60
DEBUG:darker.chooser:Found no edits on lines 61-62
DEBUG:darker.chooser:Using 2 original lines at line 61
DEBUG:darker.chooser:Found no edits on line 63
DEBUG:darker.chooser:Using 1 original line at line 63
DEBUG:darker.chooser:Found no edits on lines 64-65
DEBUG:darker.chooser:Using 2 original lines at line 64
DEBUG:darker.chooser:Found no edits on line 66
DEBUG:darker.chooser:Using 1 original line at line 66
DEBUG:darker.chooser:Found no edits on line 67
DEBUG:darker.chooser:Using 1 original line at line 67
DEBUG:darker.chooser:Found no edits on line 68
DEBUG:darker.chooser:Using 1 original line at line 68
DEBUG:darker.chooser:Found no edits on lines 69-76
DEBUG:darker.chooser:Using 8 original lines at line 69
DEBUG:darker.chooser:Found no edits on lines 77-79
DEBUG:darker.chooser:Using 3 original lines at line 77
DEBUG:darker.chooser:Found no edits on lines 80-96
DEBUG:darker.chooser:Using 17 original lines at line 80
DEBUG:darker.chooser:Found no edits on lines 97-103
DEBUG:darker.chooser:Using 7 original lines at line 97
DEBUG:darker.chooser:Found no edits on lines 104-106
DEBUG:darker.chooser:Using 3 original lines at line 104
DEBUG:darker.chooser:Found no edits on line 107
DEBUG:darker.chooser:Using 1 original line at line 107
DEBUG:darker.chooser:Found no edits on lines 108-112
DEBUG:darker.chooser:Using 5 original lines at line 108
DEBUG:darker.chooser:Found no edits on line 113
DEBUG:darker.chooser:Using 1 original line at line 113
DEBUG:darker.chooser:Found no edits on lines 114-119
DEBUG:darker.chooser:Using 6 original lines at line 114
DEBUG:darker.chooser:Found no edits on lines 120-121
DEBUG:darker.chooser:Using 2 original lines at line 120
DEBUG:darker.chooser:Found no edits on lines 122-135
DEBUG:darker.chooser:Using 14 original lines at line 122
DEBUG:darker.chooser:Found no edits on line 136
DEBUG:darker.chooser:Using 1 original line at line 136
DEBUG:darker.chooser:Found no edits on lines 137-157
DEBUG:darker.chooser:Using 21 original lines at line 137
DEBUG:darker.chooser:Found no edits on lines 158-159
DEBUG:darker.chooser:Using 2 original lines at line 158
DEBUG:darker.chooser:Found no edits on lines 160-165
DEBUG:darker.chooser:Using 6 original lines at line 160
DEBUG:darker.chooser:Found no edits on lines 166-167
DEBUG:darker.chooser:Using 2 original lines at line 166
DEBUG:darker.chooser:Found no edits on lines 168-173
DEBUG:darker.chooser:Using 6 original lines at line 168
DEBUG:darker.chooser:Found no edits on lines 174-177
DEBUG:darker.chooser:Using 4 original lines at line 174
DEBUG:darker.chooser:Found no edits on lines 178-181
DEBUG:darker.chooser:Using 4 original lines at line 178
DEBUG:darker.chooser:Found no edits on line 182
DEBUG:darker.chooser:Using 0 original lines at line 182
DEBUG:darker.chooser:Found edits on lines 182-188
DEBUG:darker.chooser:Using 7 unmodified lines at line 182
DEBUG:darker.chooser:Found edits on line 189
DEBUG:darker.chooser:Using 3 reformatted lines at line 189
DEBUG:darker.chooser:Found edits on lines 190-201
DEBUG:darker.chooser:Using 12 unmodified lines at line 190
DEBUG:darker.chooser:Found no edits on line 202
DEBUG:darker.chooser:Using 1 original line at line 202
DEBUG:darker.chooser:Found no edits on line 203
DEBUG:darker.chooser:Using 1 original line at line 203
DEBUG:darker.__main__:Verifying that the 203 original edited lines and 205 reformatted lines parse into an identical abstract syntax tree
DEBUG:darker.linting:[D:\Dokumente\Programming\python\_Bots\BDBot]$ flake8 D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:7:80: E501 line too long (112 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:9:80: E501 line too long (112 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:15:80: E501 line too long (105 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:30:80: E501 line too long (80 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:50:80: E501 line too long (87 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:51:80: E501 line too long (89 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:52:80: E501 line too long (96 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:57:80: E501 line too long (111 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:60:80: E501 line too long (94 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:63:80: E501 line too long (105 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:66:80: E501 line too long (98 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:68:80: E501 line too long (104 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:77:80: E501 line too long (108 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:78:80: E501 line too long (112 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:100:51: F541 f-string is missing placeholders
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:101:78: F541 f-string is missing placeholders
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:101:80: E501 line too long (83 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:107:80: E501 line too long (119 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:113:80: E501 line too long (109 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:120:80: E501 line too long (80 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:126:80: E501 line too long (84 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:136:80: E501 line too long (99 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:158:80: E501 line too long (88 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:159:80: E501 line too long (107 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:166:80: E501 line too long (88 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:167:80: E501 line too long (107 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:174:80: E501 line too long (82 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:175:80: E501 line too long (91 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:189:80: E501 line too long (133 > 79 characters)
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:195:1: E722 do not use bare 'except'
DEBUG:darker.linting:Unparsable linter output: D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:202:80: E501 line too long (89 > 79 characters)

@deadkex
Copy link
Collaborator

deadkex commented Aug 27, 2022

flake8 BDBot.py

D:\Dokumente\Programming\python\_Bots\BDBot>flake8 BDBot.py
BDBot.py:7:80: E501 line too long (112 > 79 characters)
BDBot.py:9:80: E501 line too long (112 > 79 characters)
BDBot.py:15:80: E501 line too long (105 > 79 characters)
BDBot.py:30:80: E501 line too long (80 > 79 characters)
BDBot.py:50:80: E501 line too long (87 > 79 characters)
BDBot.py:51:80: E501 line too long (89 > 79 characters)
BDBot.py:52:80: E501 line too long (96 > 79 characters)
BDBot.py:57:80: E501 line too long (111 > 79 characters)
BDBot.py:60:80: E501 line too long (94 > 79 characters)
BDBot.py:63:80: E501 line too long (105 > 79 characters)
BDBot.py:66:80: E501 line too long (98 > 79 characters)
BDBot.py:68:80: E501 line too long (104 > 79 characters)
BDBot.py:77:80: E501 line too long (108 > 79 characters)
BDBot.py:78:80: E501 line too long (112 > 79 characters)
BDBot.py:100:51: F541 f-string is missing placeholders
BDBot.py:101:78: F541 f-string is missing placeholders
BDBot.py:101:80: E501 line too long (83 > 79 characters)
BDBot.py:107:80: E501 line too long (119 > 79 characters)
BDBot.py:113:80: E501 line too long (109 > 79 characters)
BDBot.py:120:80: E501 line too long (80 > 79 characters)
BDBot.py:126:80: E501 line too long (84 > 79 characters)
BDBot.py:136:80: E501 line too long (99 > 79 characters)
BDBot.py:158:80: E501 line too long (88 > 79 characters)
BDBot.py:159:80: E501 line too long (107 > 79 characters)
BDBot.py:166:80: E501 line too long (88 > 79 characters)
BDBot.py:167:80: E501 line too long (107 > 79 characters)
BDBot.py:174:80: E501 line too long (82 > 79 characters)
BDBot.py:175:80: E501 line too long (91 > 79 characters)
BDBot.py:189:80: E501 line too long (133 > 79 characters)
BDBot.py:195:1: E722 do not use bare 'except'
BDBot.py:202:80: E501 line too long (89 > 79 characters)

@akaihola
Copy link
Owner Author

Thanks, this confirms my hypothesis:

DEBUG:darker.linting:
Unparsable linter output:
D:\Dokumente\Programming\python\_Bots\BDBot\BDBot.py:202:80:
E501 line too long (89 > 79 characters)

I'll add such a line as a test case, and make sure this gets fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants