Exclude violations based on function names
AVHopp opened this issue · comments
In one my projects, we would like to exclude certain errors based on function names without having to manually exclude them.
More precisely, we have functions that are used for validation purposes and all start with _validate
, and for which our docstrings do not follow the "standard format", raising errors with pydocstyle which we use as a plugin for flake8. Since our project is quite large, we have a lot of these validation functions, and having to manually prevent flake8 from raising specific errors would be very tedious, time consuming and cumbersome.
Ideally, having the possibility to use an option per-function-ignores
similar to per-file-ignores
would be really great. I'd imagine that you could then use something similar to --per-function-ignores="project/*/_validation*:E000"
to ignore the (dummy) error E000 in all functions that start with _validation
in all files that are part of project
.
I had a look at the documentation and the already existing issues and did not find anything that could be used to achieve this with the existing options. Also, I think that this feature would be a great addition to the capabilities of flake8, and I think a lot of people would greatly appreciate it.
I'd recommend putting your special functions in particular filenames and then using per-file-ignores. or using noqa
your use case is far too narrow and would require some very complicated bits to support so I'm declining it
if your functions are all decorated by a specific decorator you may be able to use pydocstyle's ignore-decorators (might but be the exact name I forget) option