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

Neomake doesn't show errors/warnings from wemake-python-styleguide [flake8] #2444

Open
dabljues opened this issue Dec 3, 2019 · 3 comments · May be fixed by #2527
Open

Neomake doesn't show errors/warnings from wemake-python-styleguide [flake8] #2444

dabljues opened this issue Dec 3, 2019 · 3 comments · May be fixed by #2527

Comments

@dabljues
Copy link

dabljues commented Dec 3, 2019

Expected behavior

I have a virtualenv with flake8 installed. I also have wemake-python-styleguide installed. The problem is, when I run flake8 on a file, it shows many warning from WPS, but none of them are presented with neomake.

Steps to reproduce

Neomake configuration:

" Neomake ------------------------------

" Run linter on write
autocmd! BufWritePost * Neomake

" Check code as python3 by default
let g:neomake_python_enabled_makers = ['flake8']
let g:neomake_python_python_maker = neomake#makers#ft#python#python()
let g:neomake_python_flake8_maker = neomake#makers#ft#python#flake8()
let g:neomake_python_python_maker.exe = 'python3 -m py_compile'

Some errors from flake8 are shown (the same ones that I get from cmd line, but without those in WPS). And I am sure that vim "catches" the virtualenv, since I don't have flake8 installed globally. And it even gets the settings from setup.cfg

Currently I switched to: https://github.com/nvie/vim-flake8, cuz when I run it, it shows WPS errors (so that's another proof, that it has nothing to do with my virtualenv or vim setup).

Are you experiencing the same problems? Is there some way to fix it?

@blueyed
Copy link
Member

blueyed commented Dec 3, 2019

Can you post a) the verbatim output when running it manually, and b) the logfile for when using it? (see the issue template).

@dabljues
Copy link
Author

dabljues commented Dec 3, 2019

So that's the output from the command line:

tests/foo.py:19:9: WPS515 Found `open()` used without a context manager
tests/foo.py:19:14: WPS305 Found `f` string
tests/foo.py:52:9: WPS326 Found implicit string concatenation
tests/foo.py:53:9: WPS326 Found implicit string concatenation
tests/foo.py:54:9: WPS326 Found implicit string concatenation
tests/foo.py:55:9: WPS326 Found implicit string concatenation
tests/foo.py:59:9: WPS326 Found implicit string concatenation
tests/foo.py:60:9: WPS326 Found implicit string concatenation
tests/foo.py:61:9: WPS326 Found implicit string concatenation
tests/foo.py:62:9: WPS326 Found implicit string concatenation
tests/foo.py:66:1: D102 Missing docstring in public method
tests/foo.py:69:9: WPS437 Found protected attribute usage: _post
tests/foo.py:70:9: WPS437 Found protected attribute usage: _post
tests/foo.py:74:1: D102 Missing docstring in public method
tests/foo.py:76:49: WPS432 Found magic number: 500
tests/foo.py:78:20: WPS437 Found protected attribute usage: _post
tests/foo.py:78:74: WPS520 Found compare with falsy constant
tests/foo.py:80:1: D102 Missing docstring in public method
tests/foo.py:82:49: WPS432 Found magic number: 200
tests/foo.py:84:20: WPS437 Found protected attribute usage: _post
tests/foo.py:93:1: D102 Missing docstring in public method
tests/foo.py:94:34: WPS437 Found protected attribute usage: _do_something
tests/foo.py:105:1: D102 Missing docstring in public method
tests/foo.py:106:33: WPS437 Found protected attribute usage: _do_something_else
tests/foo.py:111:101: E501 line too long (111 > 100 characters)
tests/foo.py:121:1: D102 Missing docstring in public method
tests/foo.py:129:1: D101 Missing docstring in public class
tests/foo.py:142:9: WPS326 Found implicit string concatenation
tests/foo.py:143:9: WPS326 Found implicit string concatenation
tests/foo.py:144:9: WPS326 Found implicit string concatenation
tests/foo.py:145:9: WPS326 Found implicit string concatenation
tests/foo.py:149:9: WPS326 Found implicit string concatenation
tests/foo.py:150:9: WPS326 Found implicit string concatenation
tests/foo.py:151:9: WPS326 Found implicit string concatenation
tests/foo.py:152:9: WPS326 Found implicit string concatenation
tests/foo.py:156:1: D102 Missing docstring in public method
tests/foo.py:163:1: D102 Missing docstring in public method
tests/foo.py:164:33: WPS437 Found protected attribute usage: _do_something_else
tests/foo.py:169:101: E501 line too long (111 > 100 characters)
tests/foo.py:179:1: D102 Missing docstring in public method

This is the output from a log file:

12:07:26 5361 [D  +239] [2.-:4:1] Running makers: flake8.
12:07:26 5361 [V      ] [2.2:4:1] Starting async job: flake8 --format=default tests/foo.py.
12:07:26 5361 [D      ] [2.2:4:1] cwd: /home/dabljues/projects/foo.
12:07:27 5361 [D +0.68] [2.2:4:1] output on stdout: ['tests/foo.py:19:9: WPS515 Found `open()` used without a context manager', 'tests/foo.py:19:14: WPS305 Found `f` string', 'tests/foo.py:52:9: WPS326 Found implicit string concatenation', 'tests/foo.py:53:9: WPS326 Found implicit string concatenation', 'tests/foo.py:54:9: WPS326 Found implicit string concatenation', 'tests/foo.py:55:9: WPS326 Found implicit string concatenation', 'tests/foo.py:59:9: WPS326 Found implicit string concatenation', 'tests/foo.py:60:9: WPS326 Found implicit string concatenation', 'tests/foo.py:61:9: WPS326 Found implicit string concatenation', 'tests/foo.py:62:9: WPS326 Found implicit string concatenation', 'tests/foo.py:66:1: D102 Missing docstring in public method', 'tests/foo.py:69:9: WPS437 Found protected attribute usage: _post', 'tests/foo.py:70:9: WPS437 Found protected attribute usage: _post', 'tests/foo.py:74:1: D102 Missing docstring in public method', 'tests/foo.py:76:49: WPS432 Found magic number: 500', 'tests/foo.py:78:20: WPS437 Found protected attribute usage: _post', 'tests/foo.py:78:74: WPS520 Found compare with falsy constant', 'tests/foo.py:80:1: D102 Missing docstring in public method', 'tests/foo.py:82:49: WPS432 Found magic number: 200', 'tests/foo.py:84:20: WPS437 Found protected attribute usage: _post', 'tests/foo.py:93:1: D102 Missing docstring in public method', 'tests/foo.py:94:34: WPS437 Found protected attribute usage: _do_something', 'tests/foo.py:105:1: D102 Missing docstring in public method', 'tests/foo.py:106:33: WPS437 Found protected attribute usage: _do_something_else', 'tests/foo.py:111:101: E501 line too long (111 > 100 characters)', 'tests/foo.py:121:1: D102 Missing docstring in public method', 'tests/foo.py:129:1: D101 Missing docstring in public class', 'tests/foo.py:142:9: WPS326 Found implicit string concatenation', 'tests/foo.py:143:9: WPS326 Found implicit string concatenation', 'tests/foo.py:144:9: WPS326 Found implicit string concatenation', 'tests/foo.py:145:9: WPS326 Found implicit string concatenation', 'tests/foo.py:149:9: WPS326 Found implicit string concatenation', 'tests/foo.py:150:9: WPS326 Found implicit string concatenation', 'tests/foo.py:151:9: WPS326 Found implicit string concatenation', 'tests/foo.py:152:9: WPS326 Found implicit string concatenation', 'tests/foo.py:156:1: D102 Missing docstring in public method', 'tests/foo.py:163:1: D102 Missing docstring in public method', 'tests/foo.py:164:33: WPS437 Found protected attribute usage: _do_something_else', 'tests/foo.py:169:101: E501 line too long (111 > 100 characters)', 'tests/foo.py:179:1: D102 Missing docstring in public method', ''].
12:07:27 5361 [D      ] [2.2:4:1] exit: flake8: 1.
12:07:27 5361 [D      ] [-.-:4:1] Using setting filter_output=function('neomake#makers#ft#python#FilterPythonWarnings') from 'maker'.
12:07:27 5361 [D      ] [2.2:4:1] Processing 40 lines of output.
12:07:27 5361 [D      ] [-.-:4:1] Using setting postprocess=function('neomake#makers#ft#python#Flake8EntryProcess') from 'maker'.
12:07:27 5361 [D      ] [2.2:4:1] Modified list entry 1 (postprocess): {'changed': {'nr': [102, -1], 'type': ['D', 'W'], 'text': ['Missing docstring in public method', 'D102 Missing docstring in public method']}}.
12:07:27 5361 [D      ] [2.2:4:1] Modified list entry 2 (postprocess): {'changed': {'nr': [102, -1], 'type': ['D', 'W'], 'text': ['Missing docstring in public method', 'D102 Missing docstring in public method']}}.
12:07:27 5361 [D      ] [2.2:4:1] Modified list entry 3 (postprocess): {'changed': {'nr': [102, -1], 'type': ['D', 'W'], 'text': ['Missing docstring in public method', 'D102 Missing docstring in public method']}}.
12:07:27 5361 [D      ] [2.2:4:1] Modified list entry 4 (postprocess): {'changed': {'nr': [102, -1], 'type': ['D', 'W'], 'text': ['Missing docstring in public method', 'D102 Missing docstring in public method']}}.
12:07:27 5361 [D      ] [2.2:4:1] Modified list entry 5 (postprocess): {'changed': {'nr': [102, -1], 'type': ['D', 'W'], 'text': ['Missing docstring in public method', 'D102 Missing docstring in public method']}}.
12:07:27 5361 [D      ] [2.2:4:1] Modified list entry 6 (postprocess): {'changed': {'nr': [501, -1], 'type': ['E', 'W'], 'text': ['line too long (111 > 100 characters)', 'E501 line too long (111 > 100 characters)']}}.
12:07:27 5361 [D      ] [2.2:4:1] Modified list entry 7 (postprocess): {'changed': {'nr': [102, -1], 'type': ['D', 'W'], 'text': ['Missing docstring in public method', 'D102 Missing docstring in public method']}}.
12:07:27 5361 [D      ] [2.2:4:1] Modified list entry 8 (postprocess): {'changed': {'nr': [101, -1], 'type': ['D', 'W'], 'text': ['Missing docstring in public class', 'D101 Missing docstring in public class']}}.
12:07:27 5361 [D      ] [2.2:4:1] Modified list entry 9 (postprocess): {'changed': {'nr': [102, -1], 'type': ['D', 'W'], 'text': ['Missing docstring in public method', 'D102 Missing docstring in public method']}}.
12:07:27 5361 [D      ] [2.2:4:1] Modified list entry 10 (postprocess): {'changed': {'nr': [102, -1], 'type': ['D', 'W'], 'text': ['Missing docstring in public method', 'D102 Missing docstring in public method']}}.
12:07:27 5361 [D      ] [2.2:4:1] Modified list entry 11 (postprocess): {'changed': {'nr': [501, -1], 'type': ['E', 'W'], 'text': ['line too long (111 > 100 characters)', 'E501 line too long (111 > 100 characters)']}}.
12:07:27 5361 [D      ] [2.2:4:1] Modified list entry 12 (postprocess): {'changed': {'nr': [102, -1], 'type': ['D', 'W'], 'text': ['Missing docstring in public method', 'D102 Missing docstring in public method']}}.
12:07:27 5361 [D      ] [2.-:4:1] Adding 12 list entries.
12:07:27 5361 [D      ] [2.-:4:1] Creating location list for entries.
12:07:27 5361 [D      ] list: call: set: [0, [], ' ', {'context': {'neomake': {'make_info': 'make_id=2'}}, 'items': [], 'title': 'Neomake[file]: t/p/a/i/foo.py (flake8...)'}].
12:07:27 5361 [D      ] list: got qfid (action=set): 4.
12:07:27 5361 [D      ] list: call: set: [0, [], 'a', {'id': 4, 'items': [{'lnum': 66, 'bufnr': 4, 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'W', 'pattern': '', 'text': 'D102 Missing docstring in public method'}, {'lnum': 74, 'bufnr': 4, 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'W', 'pattern': '', 'text': 'D102 Missing docstring in public method'}, {'lnum': 80, 'bufnr': 4, 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'W', 'pattern': '', 'text': 'D102 Missing docstring in public method'}, {'lnum': 93, 'bufnr': 4, 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'W', 'pattern': '', 'text': 'D102 Missing docstring in public method'}, {'lnum': 105, 'bufnr': 4, 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'module': '', 'type': 'W', 'pattern': '', 'text': 'D102 Missing docstring in public method'}, '... (12 total)'], 'title': 'Neomake[file]: t/p/a/i/foo.py (flake8...)'}].
12:07:27 5361 [D      ] list: call: "get", returning items: [['getloclist', [0, {'id': 4, 'items': 1}]]].
12:07:27 5361 [D      ] [2.2:4:1] Processing 12 entries.
12:07:27 5361 [D      ] [2.-:4:1] File-level errors cleaned.
12:07:27 5361 [D      ] [-.-:4:1] Reused 12 signs.
12:07:27 5361 [D      ] [2.2:4:1] flake8: completed with exit code 1.
12:07:27 5361 [D      ] [2.2:4:1] Cleaning jobinfo.
12:07:27 5361 [D      ] [-.-:4:1] Cleaning 0 old signs.
12:07:27 5361 [D      ] list: call: "title": [0, [], 'a', {'id': 4, 'title': 'Neomake[file]: t/p/a/i/foo.py (flake8(12))'}].
12:07:27 5361 [D      ] [2.-:4:1] Cleaning make info.

As you can see, there are WPS warnings, but they are not displayed on the editor (I checked by going on the line with a warning, nothing pops up in the status bar)

@blueyed blueyed linked a pull request May 16, 2021 that will close this issue
@blueyed
Copy link
Member

blueyed commented May 16, 2021

This is because e.g. WPS123 does not match the used errorformat of %t%d (i.e. a single letter indicating a type, and then a number).
I've started revisiting the flake8 maker in #2527.

Currently it would assign type="W" to all WPSXXX codes.
Those could be further redefined using the table at https://wemake-python-stylegui.de/en/latest/pages/usage/violations/index.html - but it's an issue with flake8 (plugins) in general, which do not have a clear indication of issue levels (error, warning, info, …).

@blueyed blueyed changed the title Neomake doesn't show errors/warnings from wemake-python-styleguide Neomake doesn't show errors/warnings from wemake-python-styleguide [flake8] May 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants