jason-kane/PyYapf

File exclusion

ivan-krukov opened this issue · 5 comments

Is there an easy way to ignore particular file types?

Specifically, I would like to ignore .pyx files used in cython.

Plain yapf has the -e flag, and the .yapfignore options, which don't seem to work here (via "yapf_command": "/usr/local/bin/yapf -e *.pyx" or a project-root .yapfignore respectively).

Just to clarify - cython is not always valid python, and yapf will most likely crash if given it as input. The regular .yapfignore methods work fine if invoking yapf from the command line. However, since sublime highlights cython sources as python, PyYapf will try to parse them, generating some unpleasantness:

Screen Shot 2019-06-07 at 12 17 42 PM

I would like to know if there is a simple way to ignore a file entirely before being passed to PyYapf.

Thank you!

I suspect the yapf_command exclusion doesn't work because we aren't executing through a shell and the wildcard isn't expanded. I'm not sure why .yapfignore isn't working for you. I'll see what I can do.

fix is in #48 which adds a config:

  "onsave_ignore_fn_glob": ["*.pyx", ]

For files that should not trigger an automatic yapf when saved. I'll cut a new release in a day or two once this has some edits under its belt.

I cleaned up some of the code to be more pep8 compliant, mostly docstring stuff.

This is simply fantastic! Thank you!

Released as v0.15.0, will probably reach sublime package control in the next 24 hours.