explaingit

jangia/jg-lint

6RustAudience · developerComplexity · 3/5ActiveLicenseSetup · easy

TLDR

A Python linter with a Rust core that scans source files for style and structural issues, with two built-in rules and a Python plugin API for custom rules.

Mindmap

mindmap
  root((jg-lint))
    Inputs
      Python files
      pyproject toml config
      Custom Python rules
    Outputs
      Violation list
      Exit code 1 on failure
    Use Cases
      CI lint gate
      Custom team rules
      Test file checks
    Tech Stack
      Rust
      Python
      Maturin

Things people build with this

USE CASE 1

Lint a Python codebase from CI with a fast Rust-backed scanner

USE CASE 2

Write a custom rule in Python and load it via the rules_path config

USE CASE 3

Forbid if statements inside pytest test_ functions with rule JG002

USE CASE 4

Block in-function imports by enabling JG001 in pyproject.toml

Tech stack

RustPythonMaturin

Getting it running

Difficulty · easy Time to first run · 5min

Needs Python 3.14 or newer; a dev install also needs Rust and Maturin.

MIT lets you use, modify, and redistribute the code commercially as long as you keep the copyright notice.

In plain English

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.

Copy-paste prompts

Prompt 1
Give me a 5-minute install guide for jg-lint via uv and a minimal pyproject.toml that enables JG001 and JG002
Prompt 2
Show me how to write a custom jg-lint rule by subclassing Rule, returning Violation objects, and exposing get_rules
Prompt 3
Explain how jg-lint config selects and ignores rule codes with patterns like JG* in pyproject.toml
Prompt 4
Walk me through building jg-lint from source with Maturin and a Rust toolchain
Prompt 5
How do I silence a jg-lint violation on one line with # noqa and which rules honor it
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.