Closed bbelderbos closed 11 months ago
Hi @bbelderbos
Thanks for this suggestion 🙂
I've looked at how other tools solve the exclusion feature:
--exclude
option that's a regular expression for files and directories (can also be set in pyproject.toml
)exclude
setting in pyproject.toml
for file and directory globsexclude
setting in pyproject.toml
that's a regular expression for files and directoriesAs it's not common to exclude function names and to keep things familiar for most users, I'm proposing to add an --exclude
option for excluding files/directories with a regular expression, and to also support loading this setting from a pyprojec.toml
file.
What do you think?
Thanks for your research on this @robvanderleek, that sounds like a great way to design this. Not urgent for me right now but I think it will be useful feature. It's a bit like globally ignoring E501 with flake because you might not agree with this long line violation, likewise there might be functions you just don't want to include in this analysis, long init.py constructors come to mind.
/cib
Hi @bbelderbos
It took some time; for now, I've added an --exclude
command-line option.
Together with the functionality to exclude functions using a # nocl
comment, I think this will handle most situations for current users.
Thanks for submitting both issues!
Nice, this will be useful, thanks!
Similar to https://github.com/getcodelimit/codelimit/issues/20 but that is more for linting, with this issue I suggest a config variable to specify one or more patterns to be ignored, for example
main.py
or__init__.py
(we've seen long constructors in FastAPI for example).Not sure if this should work with function names and/or module names. Probably best to ignore minimally so I suggest the former.
Bare bones env variable handling =
os.environ
but usually we use an.env
locally in Python. If you go that route I suggest adding the python-dotenv or python-decouple package / dependency, see: https://pybit.es/articles/how-to-handle-environment-variables-in-python/