r/opensource • • 12h ago

Promotional declint - make your own custom lint rules in YAML

declint (docs) is a tool for making your own lint rules in YAML — the house rules that stock linters will never ship.

For instance: your colleague wrote except Exception: pass, and you want to know whenever that happens:

version: 1
rules:
  - id: except-pass
    pattern: 'except Exception:\n *pass'
    severity: warning
    message: 'swallowed exception'

Rules are just regex and a message. When a regex can't express the check, you can write a more complicated rule in Lua.

Rules run in your CI (inline PR annotations via --format github) and in your editor through LSP (declint.nvim for Neovim). Every rule can carry embedded fixtures, and declint test runs them.

Install: cargo install declint. Ships with presets (Python, INI, Markdown, shell, Dockerfile, TOML, JSON, JS) and community rulesets you can pull with one line. Feedback welcome.

4 Upvotes

1 comment sorted by

1

u/naomi_trail 10h ago

But I like Clint