-
Notifications
You must be signed in to change notification settings - Fork 223
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
autopep8 #551
Comments
@AbdealiJK , hhatto/autopep8#227 gives me an idea that might be a good basis for a GSoC size project. We can already tell Therefore, we could let pycodestyle do the error detection, with the usual 'coala ignore' processing and the PycodestyleBear settings, and then pass only the resulting filtered errors to autopep8 to generate fixes only for. The fixes could then be applied by the bear and pycodestyle re-run on the file to verify that the fixes satisfied the pycodestyle rule, and bad fixes rejected. This might be done by chaining PycodestyleBear and PEP8Bear together, would involve serious enhancements to coala core, or PycodestyleBear could be enhanced to also use autopep8 to get fixes. Even if the former approach is designed well, it still may not be a very re-usable as it would depend on two bears having the same codes for a problem. That does occur in other languages, but probably not very frequently. (I know the markdown style tools have a set of similar codes used across different programs written in Python and Node). Invoking autopep8 in PycodestyleBear would still likely 'require' some improvements to coala core, to create fixes for error reports, but they would be less complicated. Then the autopep8 part of the project would be to add the ability to specify column numbers with |
Adding a few things: We can safely assume that autopep8 won't expand to Pycodestyle-like error reporting capabilities anytime soon. There already was an attempt to use Pycodestyle and autopep8 together but this approach tries to run Pycodestyle alongside autopep8 and assumes that errors detected by Pycodestyle will be in the same order as autopep8 and equal to the set of errors detected by the latter. Pycodestyle (the library) is solely focused on detecting PEP8 violations and not fixing them. We might want to leave that behaviour as is in its bear. Instead, creating a new bear might be a better way to implement this. |
This shouldn't be required with the following workflow:
I don't see why implementing |
This is because one single line could've multiple same types of errors. Through Example: If the file contains: print( sys.path, ( 2)) Then the error would be: test.py:1:7: E201 whitespace after '('
print( sys.path, ( 2))
^
test.py:1:19: E201 whitespace after '('
print( sys.path, ( 2)) By running autopep8 with |
Yes, but PycodestyleBear and PEP8Bear generate only one result for a set of line-error pairs:
So we wouldn't really be using column-range anywhere in the bears |
The improvement would be for the autopep8 rather than for the bears. An attempt was already made by a GCI student hhatto/autopep8#452. |
Hm yeah, looks like column range is indeed needed here. It's only the PEP8Bear that patches multiple problems in a line at once, PycodestyleBear reports them one by one. Related: coala/coala-bears#2882 |
Please what's the status for this project |
@jayvdb will you mentor this project this year? I would like to work on this |
This issue is reserved under the GSoC project Improve Generic Bear Quality. |
Lots of opportunity to add fixes.
The text was updated successfully, but these errors were encountered: