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

PEP8Bear: Show PEP8 error description #1897

Open
yukiisbored opened this issue Jul 7, 2017 · 5 comments
Open

PEP8Bear: Show PEP8 error description #1897

yukiisbored opened this issue Jul 7, 2017 · 5 comments

Comments

@yukiisbored
Copy link
Member

yukiisbored commented Jul 7, 2017

Originally created by @TheMeaningfulEngineer on coala/coala#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
Copy link
Member Author

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

JohnMoutafis added a commit to JohnMoutafis/coala-bears that referenced this issue Jul 7, 2017
Add PEP8 error message description for every error
found by autopep8 during PEP8Bear analysis.

Closes coala#1897
@Makman2
Copy link
Member

Makman2 commented Jul 7, 2017

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.

@yash-nisar
Copy link
Member

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

JohnMoutafis added a commit to JohnMoutafis/coala-bears that referenced this issue Jul 10, 2017
Add PEP8 error message description for every error
found by autopep8 during PEP8Bear analysis.
Utilizes pycodestyle (as autopep8).

Closes coala#1897
@Makman2
Copy link
Member

Makman2 commented Jul 10, 2017

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^^

JohnMoutafis added a commit to JohnMoutafis/coala-bears that referenced this issue Jul 10, 2017
Add PEP8 error message description for every error
found by autopep8 during PEP8Bear analysis.
Utilizes pycodestyle (as autopep8).

Closes coala#1897
JohnMoutafis added a commit to JohnMoutafis/coala-bears that referenced this issue Jul 10, 2017
Add PEP8 error message description for every error
found by autopep8 during PEP8Bear analysis.
Utilizes pycodestyle (as autopep8).

Closes coala#1897
JohnMoutafis added a commit to JohnMoutafis/coala-bears that referenced this issue Jul 21, 2017
Add PEP8 error message description for every error
found by autopep8 during PEP8Bear analysis.
Utilizes pycodestyle (as autopep8).

Best case senario:

 - errors list and diffs list have the same size.

Worst case scenario:

 - errors list is sorter than the diffs list:
     The loop will utilize every error and then will print an empty
     line bellow the 'does not comply' message.

 - errors list is empty:
     The loop will only print the 'does not comply' message.

 - errors list is larger than diffs list:
     The loop will print every diff and the corresponding error.

Closes coala#1897
@bkhanale
Copy link
Member

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

@Makman2 Makman2 assigned bkhanale and unassigned JohnMoutafis May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants