Skip to content

Add support for autopep8 aggressive option from config file #807

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

Merged
merged 3 commits into from
May 28, 2020

Conversation

andrewzigerelli
Copy link
Contributor

This is so the user can specify aggressive option in pycodestyle config file.
e.g. in ~/.config/pycodestyle

[pycodestyle]
aggressive = 2

This seems to work. E.g.
No aggressive option leave this code as is:

if x == None:

With above pycodestyle and pull request, it makes this change:

if x is None:

Anyone who reads this: higher aggressive options than 0 should be used with care, as x is None does not always mean the same as x == None.

@palantirtech
Copy link
Member

Thanks for your interest in palantir/python-language-server, @andrewzigerelli! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

@goanpeca
Copy link
Contributor

Thanks for working on this @andrewzigerelli

Could you add a small test for this ?

Using the x == None example should be enough in the test

@ccordoba12
Copy link
Contributor

@andrewzigerelli, please also sign the CLA agreement so we can merge your PR (we can't do it without it).

@andrewzigerelli
Copy link
Contributor Author

Does the current ci test pycodestlye config files? I'm not familiar with ci tests

@goanpeca
Copy link
Contributor

Does the current ci test pycodestlye config files?
Yes

I'm not familiar with ci tests

Take a look at this file https://github.com/palantir/python-language-server/blob/develop/test/plugins/test_pycodestyle_lint.py

@andrewzigerelli
Copy link
Contributor Author

@goanpeca
I wrote a small test and do

pytest test/plugins/test_pycodestyle_lint.py -s >2 log.out

This reads from my ~/.config/pycodestyle and is fine, but I don't see how this will pass ci validation.
Do I have to install circleci locally to see setup.cfg be preferred?

Further, test_pycodestyle_lint.py doesn't even seem to test the options defined in setup.cfg, unless I'm in the wrong file. I don't see any code which tests max-line-length = 120, or the ignore options..

@goanpeca
Copy link
Contributor

Actually I think is fine to leave without a test for now :-)

@ccordoba12 ccordoba12 changed the title add support for autopep8 aggressive option from config file Add support for autopep8 aggressive option from config file May 28, 2020
@ccordoba12 ccordoba12 added this to the 0.33.1 milestone May 28, 2020
@ccordoba12 ccordoba12 merged commit 9b5cb21 into palantir:develop May 28, 2020
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 this pull request may close these issues.

4 participants