darglint icon indicating copy to clipboard operation
darglint copied to clipboard

QST Ignore directory

Open MarcoGorelli opened this issue 5 years ago • 2 comments

I tried making a config file as follows:

[darglint]
docstring_style=numpy
ignore_regex=venv

and then to run

darglint .

, but it still catches errors in files from venv. How can I exclude venv from the config file?

Am happy to submit a PR to address this if it's indeed a bug


EDIT

I've found it pretty easy to just use pre-commit's own settings to ignore files/directories when running darglint, so I'm now just using that directly

MarcoGorelli avatar Jul 22 '20 07:07 MarcoGorelli

Ignoring directories isn't a feature of darglint, yet. It should be, though!

If you'd like to add it as a feature, it should be simple. You would add the check here, where directories are expanded. An option (filename_regex or ignore_filename_regex, or both) would also have to be added to the arguments (like this) and to the config (like this).

terrencepreilly avatar Jul 25 '20 14:07 terrencepreilly

Alternatively, you could use find to invoke darglint, like

find . -type d \( -path ./.env -o -path ./.tox \) -prune -false -o -name "*.py" | xargs darglint

But I can never remember the syntax for find, so having this as an option sounds better.

terrencepreilly avatar Jul 25 '20 14:07 terrencepreilly