coala-bears icon indicating copy to clipboard operation
coala-bears copied to clipboard

PEP8Bear: Show PEP8 error description

Open yukiisbored opened this issue 7 years ago • 5 comments

Originally created by @TheMeaningfulEngineer on https://github.com/coala/coala/issues/2511

Overview Description

Coala doesn't give a description of the error what PEP8 does.

Steps to Reproduce

Files:

example.py

# After this comment there should be two lines but I'll only put one.

class Faker:

    def __init__():
        pass

.coafile

[Default]
bears = PEP8Bear
files = *.py

Actual Results

$ coala
Executing section Default...

example.py
|   1| #•After•this•comment•there•should•be•two•lines•but•I'll•only•put•one.
|    | [NORMAL] PEP8Bear:
|    | The code does not comply to PEP8.
|----|    | /home/alan/europython/by_day/friday/coala_contribution/example.py
|    |++++| /home/alan/europython/by_day/friday/coala_contribution/example.py
|   1|   1| # After this comment there should be two lines but I'll only put one.
|    |   2|+
|   2|   3| 
|   3|   4| class Faker:
|   4|   5| 
|    | The following actions are applicable to this result:
|    |  0: Apply no further actions.
|    |  1: Open the affected file(s) in an editor.
|    |  2: Apply the patch automatically.
|    | Please enter the number of the action you want to execute (Ctrl-D to exit). 

Expected Results

It would be nice to get the error description which PEP8 gives somewhere.

$ pep8 example.py 
example.py:3:1: E302 expected 2 blank lines, found 1

yukiisbored avatar Jul 07 '17 13:07 yukiisbored

TL;DR Make PEP8Bear give error descriptions from PEP8 instead of just saying This code does not comply to PEP8

yukiisbored avatar Jul 07 '17 14:07 yukiisbored

If I recall correctly, PEP8 allows an "issue-format" that provides more detailed messages. But then we don't have patches. Best would be to have patches and issues combined.

Makman2 avatar Jul 07 '17 16:07 Makman2

We would have to rather fix this for all bears that have code correcting capabilities. I bumped into another similar issue, see https://github.com/coala/coala-bears/issues/502

yash-nisar avatar Jul 09 '17 08:07 yash-nisar

We would have to rather fix this for all bears that have code correcting capabilities. I bumped into another similar issue, see #502

PEP8Bear is an exception as it uses the python module directly, which is more flexible. For external linter executables this is a huge problem^^

Makman2 avatar Jul 10 '17 14:07 Makman2

This issue is reserved under the GSoC project Improve Generic Bear Quality.

bkhanale avatar May 11 '19 16:05 bkhanale