Skip to main content

lintkit is a framework for building linters/code checking rules

  • Multiple formats: Python-first, but supports YAML, JSON and TOML
  • Comprehensive: noqa comments, file skips and standardized pretty output
  • Quick: Create and run custom rules in a few lines of code
  • Flexible: Rules over file(s), their subelements and more (see Files tutorial)
  • Minimal: Gentle learning curve - <1000 lines of code, tutorials, API reference

🚀 Quick start 📚 Documentation 🤝 Contribute 👍 Adopters 📜 Legal

Quick start

[!TIP] Check out more examples (here) to get a better feel of lintkit.

Below are ~20 lines of code implementing custom linter with two rules and running it on three files:

import lintkit

# Set the name of the linter
lintkit.settings.name = "NOUTILS"


class _NoUtils(lintkit.check.Regex, lintkit.loader.Python, lintkit.rule.Node):
    def regex(self):
        # Regex to match util(s) variations in function/class name
        return r"_?[Uu]til(s|ities)?"

    def values(self):
        # Yield class or function names from a Python file
        data = self.getitem("nodes_map")
        for node in data[self.ast_class()]:
            yield lintkit.Value.from_python(node.name, node)

    def message(self, _):
        return f"{self.ast_class()} name contains util(s) word"


# Concrete rules and their codes
# Disabling linter using noqas supported out of the box!
class ClassNoUtils(_NoUtils, code=0):  # noqa: NOUTILS0
    # ast type we want to focus on in this rule
    def ast_class(self):
        return ast.ClassDef


class FunctionNoUtils(_NoUtils, code=1):  # noqa: NOUTILS0
    def ast_class(self):
        return ast.FunctionDef


lintkit.run(["linter.py", "file1.py", "file2.py"])

# Example output
# /path/file1.py:23:17 NOUTILS0: ClassDef name contains util(s) word
# /path/file2.py:73:21 NOUTILS1: FunctionDef name contains util(s) word

Installation

[!TIP] You can use your favorite package manager like uv, hatch or pdm instead of pip.

> pip install lintkit

[!NOTE] lintkit provides extras (rich, toml, yaml and all containing everything) to provide additional functionality.

# To create rules utilizing YAML
> pip install lintkit[rich, yaml]

Learn

Check out the following links to learn more about lintkit:

Contribute

We welcome your contributions! Start here:

Legal

  • This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
  • This project is copyrighted by open-nudge - the appropriate copyright notice is included in each file.

Download files

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

Source Distribution

lintkit-3.0.0.tar.gz (44.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lintkit-3.0.0-py3-none-any.whl (47.6 kB view details)

Uploaded Python 3

File details

Details for the file lintkit-3.0.0.tar.gz.

File metadata

  • Download URL: lintkit-3.0.0.tar.gz
  • Upload date:
  • Size: 44.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lintkit-3.0.0.tar.gz
Algorithm Hash digest
SHA256 2cc85d56788ac372cc461a734962d9a54c6b98a31f45afd6ade37880e5c34c3f
MD5 51d4bb19a906e0c2f9d91459e8df31f7
BLAKE2b-256 f75afa51a6046cb03db4f2ef754f85fc225555675f634bde6ee6a93c26c5bbd9

See more details on using hashes here.

Provenance

The following attestation bundles were made for lintkit-3.0.0.tar.gz:

Publisher: release.yml on open-nudge/lintkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lintkit-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: lintkit-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 47.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lintkit-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20ef0a250e5df5cdf256d3286f287fb23534dd513aa2f4db67a5a74601319231
MD5 6c7a0525b57fded9be2685760598d6f4
BLAKE2b-256 976c66092b043047af68d31d226ce67a7d1e1ffdb1bf7222ec4893579c0b95ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for lintkit-3.0.0-py3-none-any.whl:

Publisher: release.yml on open-nudge/lintkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

3.0.0 This release

2 files

1.2.1

2 files

1.1.1

2 files

1.0.1

2 files

1.0.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page