0

I try to use command autopep8 the such way

autopep8 --in-place --exclude='*.js,*.jade,*.styl'
autopep8 --in-place --exclude='*.styl'
autopep8 --in-place --exclude=*.js,*.jade,*.styl
autopep8 --in-place --exclude=*.styl

all these methods do not work for me, the ignore does not apply. Where am I wrong? How can I ignore files by mask when formatting?

autopep8 version is 1.2.1

fedorshishi
  • 1,467
  • 1
  • 18
  • 34

1 Answers1

2

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 you've 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="*" *

Update: I've opened an issue on their repo for this.

https://github.com/hhatto/autopep8/issues/246

Taylor D. Edmiston
  • 12,088
  • 6
  • 56
  • 76
  • There is no "star inclusion", the `*` is interpreted by the shell already to all files that match. If you want to pass a star to autopep8, put it into quotes as well. – quazgar May 12 '21 at 10:35