Skip to main content

Another custom linter layer

Project description

Motivation

When you have a big old code base with thousands of lines, you can not just include a linter and enable 100% checks.

You cannot just take and (Boromir meme)

Instead, you just enable 1% of the checks, which is very sad for a decent developer.

There is a better solution for this ! Welcome custolint - custom linter.

Idea

  1. Detect affected files.

  2. Run the tool with all available feature enables only on changed affected files or parse log/result of the linter tool.

  3. Match changed code with the linters output, and consider only the match lines as failed lint criteria.

  4. Fail or Report the build.

Install

From pip

$ make install
pip install custolint
Collecting custolint
  Downloading custolint-...-py3-none-any.whl (8.4 kB)
Collecting bash...
Installing collected packages: ...
Successfully installed ... custolint-...

From repo

git clone https://github.com/a-da/custolint.git

# prod
pip install .

# dev
pip install -e .[dev]

How to run:

cd "${YOUR_CODE}/"

# when MAIN_BRANCH is develop
python custolint mypy

# typechecking with mypy implemented, set main branch, default is master
# TODO: autodetect main branch
MAIN_BRANCH=JIRA-14407-care2-merge python custolint mypy

# code smell checking with pylint
custolint pylint

# code smell checking with flake8
custolint flake8

# 100% coverage checking for new commits implemented
coverage run --branch -m pytest
custolint coverage .coverage

Config filter

# TODO: not implemented yet
custolint \
    --contributor=Josh,Andrei,Joanna \
    --skip-contributor=Ben \
        mypy

Halt on N messages

# TODO: not implemented yet
custolint --halt-on-N-messages=5 mypy

How to contribute:

For developers and contributors see the instruction here docs/for_developers.rst.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

custolint-0.0.2-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file custolint-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: custolint-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for custolint-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b643b5055d07a8a38aabc14a84431471b69cde2bd112ab5c6d190a98e7d10711
MD5 5b861570ce7d005628acbfdb369cb684
BLAKE2b-256 4f9d2f45e11bce8bc6ee44cd05f0835786513fff3dc2f3aa18555397bd381a9c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page