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

Precedence of excluding vs. including files #246

Open
tedmiston opened this issue Jun 10, 2016 · 3 comments
Open

Precedence of excluding vs. including files #246

tedmiston opened this issue Jun 10, 2016 · 3 comments

Comments

@tedmiston
Copy link

In trying to help answer someone's question on Stack Overflow, I came across what may be a bug, or perhaps just something that's unclear to me.

The full details are here on SO, but I've copied below for your convenience.

Also here are the details requested in the contributor guidelines:

$ autopep8 --version
autopep8 1.2.4

$ pep8 --version
1.7.0

$ python --version
Python 2.7.11

$ uname -a
Darwin <my machine name> 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64

To create this setup, I simply ran mktmpenv followed by pip install autopep8.

This style to avoid specific files works for me (using either single or double quotes):

autopep8 --diff --recursive --exclude="*.styl" .

This also works:

autopep8 --diff --exclude="*.styl" *.py

However this does not exclude .styl files:

autopep8 --diff --exclude="*.styl" *

In my opinion, it appears [OP has] identified a bug in autopep8.

However, perhaps it's not a bug, but rather an opinionated decision that star inclusion should take precedence over star exclusion.

In other words, is running this command intended to process (a) all files, or (b) no files?

autopep8 --diff --exclude="*" *
@myint
Copy link
Collaborator

myint commented Jun 11, 2016

I think I originally meant for --exclude to be used with --recursive only. But I see how this might be unintuitive. In any case, pep8/pycodestyle does things the way you and the Stack Overflow question expects. So I think it would make sense to fix this. At the very least, this would make our tools match in behavior.

Thanks

@tedmiston
Copy link
Author

Thanks so much for the clarification. Admittedly an edge case, but I appreciate taking the time to address it. Thank you!

@fpuga
Copy link

fpuga commented Jul 14, 2017

I fall into this case also. Just for the record, to launch the tool only against .py files I execute the tool two times in this way:

autopep8 --diff --recursive **/*.py
autopep8 --diff --recursive *.py

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

No branches or pull requests

3 participants