Lint a Python codebase from CI with a fast Rust-backed scanner
Write a custom rule in Python and load it via the rules_path config
Forbid if statements inside pytest test_ functions with rule JG002
Block in-function imports by enabling JG001 in pyproject.toml
Needs Python 3.14 or newer; a dev install also needs Rust and Maturin.
jg-lint is a linter for Python code. A linter is a tool that scans source files and reports stylistic or structural issues. The README describes jg-lint as an extensible Python linter with a Rust core, meaning the scanning engine is written in Rust for speed but the user works with it from Python and writes custom rules in Python. Installation needs Python 3.14 or newer and is available through uv, pip, or Poetry. A development install builds from source using Maturin and a Rust toolchain. Once installed, the user runs jg-lint check followed by one or more files or directories, and a --config flag points at the folder containing pyproject.toml. The tool ships with two built in rules. JG001 says imports must be at the module top level. JG002 says if statements are not allowed inside functions whose names start with test_. Built in rules are opt in, so they only run when the user explicitly lists them in a select setting in pyproject.toml. Output prints a line per violation in the form file:line:col: code message, and the exit code is 1 if any violations are found. Configuration lives in pyproject.toml under [tool.jg-lint]. The user can list which rule codes to enable with select, which to skip globally with ignore, which paths to exclude, where custom rules live with rules_path, and per file overrides under [tool.jg-lint.per-file-ignores]. Rule codes are matched with simple patterns: matches everything, JG matches any code starting with JG, and exact codes match exactly. Plugin rules loaded from rules_path are enabled by default, while built in rules are not. Writing a custom rule means creating a Python module inside the configured rules folder, subclassing Rule from the jg_linter package, setting a code and message, implementing a check method that returns a list of Violation objects, and exposing a get_rules function. Optional flags on a rule include test_only, which restricts it to test files, and allow_noqa, which lets it be silenced on a single line with a # noqa comment. By default # noqa is not honored, which the README frames as a way to keep suppression intentional. Contributors are asked to run cargo fmt, cargo clippy, cargo audit, and ruff check before opening a pull request. The license is MIT.
Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.