Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 27 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
# Codedecorum

[![PyPI](https://img.shields.io/pypi/v/codedecorum)](https://pypi.org/project/codedecorum/)
[![Python](https://img.shields.io/pypi/pyversions/codedecorum)](https://pypi.org/project/codedecorum/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow)](LICENSE)

Codedecorum is a configurable, extensible, cross-language command-line linter that keeps AI-generated code on the rails. Repositories choose their rules; violations fail the check with location breadcrumbs and a configurable message.

Pygments provides broad lexical tokens, while Tree-sitter grammars downloaded and cached on demand provide lazy concrete syntax trees for semantic rules. A language's first semantic check for each language-pack version requires network access; later runs reuse its cached grammar. Download or loading failures stop linting rather than silently disabling semantic rules.

## Table of Contents

1. [Bundled rules](#bundled-rules)
2. [Configure Lefthook](#configure-lefthook)
3. [Configuration](#configuration)
4. [Suppressions](#suppressions)
5. [How to write a plugin](#how-to-write-a-plugin)
6. [License](#license)
2. [Installation](#installation)
3. [Configure Lefthook](#configure-lefthook)
4. [Configuration](#configuration)
5. [Suppressions](#suppressions)
6. [How to write a plugin](#how-to-write-a-plugin)
7. [License](#license)

## Bundled rules

Expand All @@ -22,6 +27,22 @@ Pygments provides broad lexical tokens, while Tree-sitter grammars downloaded an
5. `CD005` flags every test file included by the active scope.
6. `CD006` rejects changed files matching configured root-relative, case-sensitive path patterns unless that rule-path pair has a current temporary unlock. Option: `paths` (array of non-empty glob patterns, default `[]`).

## Installation

Run Codedecorum with [uv](https://docs.astral.sh/uv/):

```bash
uvx codedecorum .
```

To keep it on your `PATH`, install it as a tool:

```bash
uv tool install codedecorum
```

`pipx install codedecorum` and `pip install codedecorum` also work.

## Configure Lefthook

Lefthook invokes Codedecorum across the repository before each commit:
Expand All @@ -30,7 +51,7 @@ Lefthook invokes Codedecorum across the repository before each commit:
pre-commit:
commands:
codedecorum:
run: uv run codedecorum .
run: uvx codedecorum .
```

## Configuration
Expand Down
Loading