chore: reduce lint warning noises on commit
What does this merge request do and why?
We explicitly run linting on modified files on every commit, ignoring
the global exclusion in the pyproject.yml file. According to the official doc,
Note that this flag only affects recursive directory tree discovery, that is, when mypy is discovering files within a directory tree or submodules of a package to check. If you pass a file or module explicitly it will still be checked. For instance, mypy --exclude '/setup.py$' but_still_check/setup.py.
This forces developers to make linting fixes as part of the main changes and creates a lot of noises.
This MR removes the changed files being passed to mypy command. The downsize of this approach is that the lint command scan all files in the project and hence slower.
❯ time make lint-code LINT_WORKING_DIR=ai_gateway/abuse_detection/container.py
Installing lint dependencies...
Installing dependencies from lock file
No dependencies to install or update
Installing the current project: ai_gateway (0.1.0)
Running flake8...
Running black check...
All done! ✨ 🍰 ✨
1 file would be left unchanged.
Running isort check...
Running pylint check...
Running mypy check...
Success: no issues found in 1 source file
________________________________________________________
Executed in 5.43 secs fish external
usr time 3.20 secs 0.35 millis 3.20 secs
sys time 0.92 secs 1.67 millis 0.92 secs
❯ time make lint-code
Installing lint dependencies...
Installing dependencies from lock file
No dependencies to install or update
Installing the current project: ai_gateway (0.1.0)
Running flake8...
Running black check...
All done! ✨ 🍰 ✨
290 files would be left unchanged.
Running isort check...
Running pylint check...
Running mypy check...
Success: no issues found in 122 source files
________________________________________________________
Executed in 17.75 secs fish external
usr time 96.84 secs 0.34 millis 96.84 secs
sys time 7.85 secs 2.15 millis 7.85 secs
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
Merge request checklist
-
Tests added for new functionality. If not, please raise an issue to follow up. -
Documentation added/updated, if needed.