2

I'm unable to exclude a directory from being autoformatted with yapf.

Tested usages:

yapf --in-place --recursive --parallel --exclude 'somedir' --exclude '*_pb2.py' .
yapf --in-place --recursive --parallel --exclude 'somedir/*' --exclude '*_pb2.py' .
yapf --in-place --recursive --parallel --exclude 'somedir/**' --exclude '*_pb2.py' .

It seems to take file patterns well but not folder patterns.

  • yapf version: 0.21.0
  • OS: Ubuntu 14.04 LTS
  • python version: 2.7 (in a virtualenv)
tarabyte
  • 17,837
  • 15
  • 76
  • 117

1 Answers1

5

Did you try yapf --in-place --recursive --parallel --exclude 'somedir/**/*.py' --exclude '**/*_pb2.py' .?

yapf uses fnmatch.fnmatch(path, exclude_pattern) under the hood.

Arthur Rio
  • 400
  • 4
  • 8