Package: custolint
Your current code-validation pipeline rules may be changed more easily usingcustolint.Source Code:https://github.com/a-da/custolint.Custolint add new layer on top of:PyLintFlake8MyPyPython CoverageMotivationYou cannot just add a linter and activate 100% inspections when you have a large,
ancient codebase with thousands of lines.Instead, you only make 1% of the checks available, which is really frustrating for a decent developer.You could enable those 100% checks just for your changes with “custolint”.IdeaGiven we have a project alike this one, where we:had added a functioncustolint/generics.py:filer_output.had modified the functioncustolint/git.py:_blame$tree...|--src||--custolint...|||--generics.py<<<<1|||--git.py<<<<2|||--mypy.py|||--pylint.py||`--typing.py|--tests|`--test_custolint.py...When:Detect affected fileswithgit diffandgit blamecustolint/git.pycustolint/generics.pyRun the lintertool (pylint, flake8, mypy, coverage …) with all available feature enables
(the configuration have to be placed intoconfig.d/folder)
only on changed affected files or parse log/result of the linter tool.Match changed codewith the linters output, and consider only the match lines as failed lint criteria.
It has to detect thatcustolint/generics.py:filer_outputneed unitest for coverage
andcustolint/git.py:_blameintroduce a mypy typing issue.Then:Fail or Reportthe build.$coveragerun--rcfile=config.d/.coveragerc-mpytest&&\custolintcoverageconfig.d/.coveragercINFO:custolint.git:Executegitdiffcommand'git diff origin/main -U0 --diff-filter=ACMRTUXB'INFO:custolint.git:Gitdiffdetected16filedaffectedINFO:custolint.coverage:executecoveragecommand:'coverage report --data-file=.coverage --show-missing'src/custolint/git.py:66not.committed.yet2022-08-31$custolintmypyINFO:custolint.mypy:MYPYCOMPAREWITH'main'branchINFO:custolint.git:Executegitdiffcommand'git diff origin/main -U0 --diff-filter=ACMRTUXB'INFO:custolint.git:Gitdiffdetected16filedaffectedINFO:custolint.mypy:executecommand'mypy --config-file=config.d/mypy.ini @/tmp/f/59..000gq/T/tmp...'tests/test_custolint.py31Modulehasnoattribute"bash"[attr-defined]not.committed.yet2022-08-31tests/test_custolint.py125Functionismissingareturntypeannotation[no-untyped-def]not.committed.yet2022-08-31tests/test_custolint.py140Functionismissingareturntypeannotation[no-untyped-def]not.committed.yet2022-08-31InstallSeeInstall dev versionHow to run:cd "${YOUR_CODE}/"

# check typing
custolint mypy

# code smell checking with pylint
custolint pylint

# code smell checking with flake8
custolint flake8

# 100% coverage checking for new commits
coverage run --rcfile=config.d/.coveragerc -m pytest
custolint coverage config.d/.coverageCustolintNo Legal Copyright (c) 2022 is own by creator Danciuc Andrei.
All rights can can not reserved.Using the MIT licencehttp://opensource.org/licenses/MITPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.