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

Create diff for a specific pep8 issue #227

Open
AbdealiLoKo opened this issue Dec 8, 2015 · 2 comments · May be fixed by #452
Open

Create diff for a specific pep8 issue #227

AbdealiLoKo opened this issue Dec 8, 2015 · 2 comments · May be fixed by #452

Comments

@AbdealiLoKo
Copy link

I'm trying to use autopep8 to automate a few things. This is my workflow:

  • I want to run pep8 on a code base and list all the results.
  • Then I want the user to specify specific issues he wants fixed
  • Then autopep8 should only fix these issues.

I notice with --select I can choose which errors autopep8 fixes, how do I specify a specific issue (I guess this is characterized by line, column, issue code) to fix ?

Could you help me on how to do this ?

Example:
I have a file with the line print( sys.path, ( 2)) This raises

test.py:1:7: E201 whitespace after '('
test.py:1:19: E201 whitespace after '('

So, I run autopep8 test.py --select=E201 --range 1 1 --diff but this fixes both errors.

@myint
Copy link
Collaborator

myint commented Dec 8, 2015

I suppose that might work. I have no idea if all of autopep8's fixers respect columns though. There may or may not be fixers that fix the whole line.

By the way, I'm not sure how the title of this issue "Show error along with creating diff" relates to the contents of the issue.

@AbdealiLoKo AbdealiLoKo changed the title Show error along with creating diff Create diff for a specific pep8 issue Dec 8, 2015
@jayvdb
Copy link

jayvdb commented May 5, 2018

Note that in 7383706 --range was given new name --line-range to be more correct. I guess --range is implicitly deprecated.

CLiu13 added a commit to CLiu13/autopep8 that referenced this issue Nov 4, 2018
This adds the ability to specify a column range
on which to perform fixes. Although multiline
column range fixing is supported, it is not
recommended, since changing columns may result in
differing numbers of columns among lines - which
would make it impossible to automatically adjust
the column range after performing changes.

Closes hhatto#227
@CLiu13 CLiu13 linked a pull request Nov 4, 2018 that will close this issue
CLiu13 added a commit to CLiu13/autopep8 that referenced this issue Nov 4, 2018
This adds the ability to specify a column range
on which to perform fixes. Although multiline
column range fixing is supported, it is not
recommended, since changing columns may result in
differing numbers of columns among lines - which
would make it impossible to automatically adjust
the column range after performing changes.

Closes hhatto#227
CLiu13 added a commit to CLiu13/autopep8 that referenced this issue Nov 4, 2018
This adds the ability to specify a column range
on which to perform fixes. Although multiline
column range fixing is supported, it is not
recommended, since changing columns may result in
differing numbers of columns among lines - which
would make it impossible to automatically adjust
the column range after performing changes.

Closes hhatto#227
CLiu13 added a commit to CLiu13/autopep8 that referenced this issue Nov 5, 2018
This adds the ability to specify a column range
on which to perform fixes. Although multiline
column range fixing is supported, it is not
recommended, since changing columns may result in
differing numbers of columns among lines - which
would make it impossible to automatically adjust
the column range after performing changes.

Closes hhatto#227
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants