From e2f52ac087cf018ccba1d23bcbdb898ccc299d3f Mon Sep 17 00:00:00 2001 From: Munawar Shah <93397215+mwrshah@users.noreply.github.com> Date: Wed, 12 Aug 2026 23:51:19 +0500 Subject: [PATCH] docs(README): install straight from PyPI - Add PyPI version, Python versions, and MIT license badges. - Add Installation section: uvx for hooks/CI, uv tool install for a persistent PATH binary, pipx/pip as fallbacks. - Switch the Lefthook example from 'uv run' to 'uvx codedecorum .' so it needs no dependency entry in the target repo (any language). --- README.md | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6943446..82ab397 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # 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. @@ -7,11 +11,12 @@ Pygments provides broad lexical tokens, while Tree-sitter grammars downloaded an ## 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 @@ -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: @@ -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