Skip to main content

Extensible Python linter written in Rust

Project description

jg-lint

jg-lint

Extensible Python linter with a Rust core.

Installation

Requires Python 3.14+.

uv add jg-lint

or with pip:

pip install jg-lint

or with Poetry:

poetry add jg-lint

Development install

To build from source, you need Maturin and a Rust toolchain:

git clone https://github.com/giacosoft/jg-lint.git
cd jg-lint
uv sync
uv run maturin develop

Usage

jg-lint check <paths...>

Lint one or more files or directories:

jg-lint check src/
jg-lint check src/ lib/ main.py
jg-lint check --config path/to/project src/

The --config flag points to the directory containing pyproject.toml (defaults to .).

Output looks like:

src/app.py:12:1: MY001 TODO comments should be tracked as issues
src/app.py:45:1: MY001 TODO comments should be tracked as issues

Found 2 violation(s)

Exit code is 1 if any violations are found, 0 otherwise.

Inline suppression

Suppress specific rules on a line with # noqa:

x = something()  # noqa: MY001
y = another()  # noqa: MY001, MY002

Configuration

All configuration lives in pyproject.toml under [tool.jg-lint]:

[tool.jg-lint]
select = ["MY"]              # only run rules matching these prefixes (empty = all)
ignore = ["MY002"]           # skip these rules globally
exclude = [".venv/**", "build/**"]
plugins = ["my_rules"]       # Python modules containing custom rules

[tool.jg-lint.per-file-ignores]
"tests/**" = ["MY001"]       # skip MY001 in test files

Writing custom rules

1. Create a rule module

# my_rules.py (or my_rules/__init__.py)
from jg_linter import Rule, Violation


class NoTodoComments(Rule):
    code = "MY001"
    message = "TODO comments should be tracked as issues"

    def check(self, file_path: str, content: str) -> list[Violation]:
        violations = []
        for i, line in enumerate(content.splitlines(), 1):
            if "# TODO" in line:
                violations.append(
                    Violation(file_path, i, 1, self.code, self.message)
                )
        return violations


def get_rules() -> list[Rule]:
    return [NoTodoComments()]

Each rule needs:

  • code -- unique identifier (e.g. MY001)
  • message -- human-readable description
  • check(file_path, content) -- returns a list of Violation objects

Set test_only = True on a rule to run it only against test files (files named test_*.py, *_test.py, or inside a tests/ directory).

2. Register the plugin

Add the module to pyproject.toml:

[tool.jg-lint]
plugins = ["my_rules"]

Make sure the module is importable (installed or on PYTHONPATH).

3. Run

jg-lint check src/
src/app.py:3:1: MY001 TODO comments should be tracked as issues
src/utils.py:17:1: MY001 TODO comments should be tracked as issues

Found 2 violation(s)

Project details


Download files

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

Source Distribution

jg_lint-0.1.1.tar.gz (19.5 kB view details)

Uploaded Source

Built Distributions

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

jg_lint-0.1.1-cp315-cp315-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.15manylinux: glibc 2.17+ x86-64

jg_lint-0.1.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ ARM64

jg_lint-0.1.1-cp314-cp314-win_amd64.whl (924.5 kB view details)

Uploaded CPython 3.14Windows x86-64

jg_lint-0.1.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

jg_lint-0.1.1-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ ARM64

jg_lint-0.1.1-cp314-cp314-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

jg_lint-0.1.1-cp314-cp314-macosx_10_12_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

File details

Details for the file jg_lint-0.1.1.tar.gz.

File metadata

  • Download URL: jg_lint-0.1.1.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for jg_lint-0.1.1.tar.gz
Algorithm Hash digest
SHA256 db993a8847959061a1f4d5a5314be6d2d7e46d3afa5a4e6e1075b4ff03389bb3
MD5 e533ebde785fd7488f6b7fe58558fdcc
BLAKE2b-256 28d4e5e5f51e865178368bd548e5f903a31d03ac97f39b8437ba04593815109e

See more details on using hashes here.

Provenance

The following attestation bundles were made for jg_lint-0.1.1.tar.gz:

Publisher: release.yml on jangia/jg-lint

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

File details

Details for the file jg_lint-0.1.1-cp315-cp315-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for jg_lint-0.1.1-cp315-cp315-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e9803a8ec9c332de9689e7f3508e25d63a5d9e0469c728086b0b2855eff69b35
MD5 152bab02c8e5674fe2ddec8ad4a16bc6
BLAKE2b-256 41086b6dc5fc5dc871ebcc4128a414e88f42898a77c3d8f3bfbb86e79cf6fef6

See more details on using hashes here.

Provenance

The following attestation bundles were made for jg_lint-0.1.1-cp315-cp315-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on jangia/jg-lint

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

File details

Details for the file jg_lint-0.1.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for jg_lint-0.1.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 63622a42cfa5955e62b12b15ef6329ac53d1c48443bfe5a78d0c48be786eed6b
MD5 e62b539b26e37895c07234c4c8ef1fc7
BLAKE2b-256 74195b6b59a98652b2ab86fd7d5be381851ecd8f1cb29df36d51fb0deb848c3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for jg_lint-0.1.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on jangia/jg-lint

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

File details

Details for the file jg_lint-0.1.1-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: jg_lint-0.1.1-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 924.5 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for jg_lint-0.1.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 883d8d382e4b421dd52f3f820ccbf7cd93f67b4a9acfc4713267cd3ce104a4b9
MD5 0db77ce56c2f39a9b502c64e6109e55d
BLAKE2b-256 847b71c59cd6d16d17c4a2f0b9fc1f9d3964677ede99c30b66607aaafd4eac87

See more details on using hashes here.

Provenance

The following attestation bundles were made for jg_lint-0.1.1-cp314-cp314-win_amd64.whl:

Publisher: release.yml on jangia/jg-lint

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

File details

Details for the file jg_lint-0.1.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for jg_lint-0.1.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bc5b81c89abcdc273c1bb051da2cd5e9861159e16e0c0da7f0c21965d25f8204
MD5 4105d5b0f5c04543658ecc035b5605fc
BLAKE2b-256 4f37cae905833f0243d836b775f436653a893098b2260c95071fb740ed4f4488

See more details on using hashes here.

Provenance

The following attestation bundles were made for jg_lint-0.1.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on jangia/jg-lint

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

File details

Details for the file jg_lint-0.1.1-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for jg_lint-0.1.1-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 80239388661faf187e1264fab6a97b401622e452e79d98654551428d73c4cef9
MD5 978599c4f9b67fd73d895dcbacefdab0
BLAKE2b-256 bfb22e778d1f68271cae37e7cbc3f85213585a3c4e7517d22a01a76857e761a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for jg_lint-0.1.1-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on jangia/jg-lint

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

File details

Details for the file jg_lint-0.1.1-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for jg_lint-0.1.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e04c30e6eadb98735a271c3422706b60fc2732baba9a3f00afaaea359e7e8e5d
MD5 8d27ebdb768b50afc4f804eeb0e20bc5
BLAKE2b-256 c0000f28c1914ce4d61cf07b251fc24db5045ce4e5e387e0bd633a4104497673

See more details on using hashes here.

Provenance

The following attestation bundles were made for jg_lint-0.1.1-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: release.yml on jangia/jg-lint

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

File details

Details for the file jg_lint-0.1.1-cp314-cp314-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for jg_lint-0.1.1-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7c62276aa261d380ce61ed8614885b8ea4d7f3ca483fdf6f996ec44dda521411
MD5 b25aa00f8ff77e6bc40b75155022df81
BLAKE2b-256 47902ea380d7fdfe6251467a7196a16cc93ee6c57213fec5b488b580504815d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for jg_lint-0.1.1-cp314-cp314-macosx_10_12_x86_64.whl:

Publisher: release.yml on jangia/jg-lint

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

Supported by

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