Hi all, I wanted to share a script that I wrote recently to get flake8 to pass on a large codebase by marking all lines with violations as `# noqa: XXXX` and can be run like
``` flake8 $(git ls-files **/*.py) | noqaer.py - [--dry-run] ``` https://gist.github.com/AlexRiina/d8dfd39d2c6c4b121c8776070a2272dc My problem was that the codebase had lots of issues like unused and undefined variables that pyflakes was rightfully flagging but in too many files for me alone to fix. Because some files were in violation, I couldn't easily incorporate flake8 into our CI. Excluding entire files with any errors would mean most changes would be unvalidated until someone ran `flake8 --isolated` and fixed all of the violations, which didn't seem likely without organizing a major company initiative. Since I would not be able to audit all of the changes, I decided against automatic fixers like autoflake which has the potential to introduce errors as it resolves * imports or mask extra calculations as it resolves unused variables. My third optional was dropping a `# noqa: XXXX` on each line in violation and this script will do that all at once. I didn't quite nail errors on multi-line backslash-continued statements, but I was able to clean those up manually. Hope you find this useful _______________________________________________ code-quality mailing list -- code-quality@python.org To unsubscribe send an email to code-quality-le...@python.org https://mail.python.org/mailman3/lists/code-quality.python.org/