Skip to content

Sudsy

Formatter and linter, one binary

A true polyglot formatter and linter for every repo.

Fully featured polyglot formatter and linter for 20+ languages. Extremely configurable, plugin-extendable.

npm i -D @sudsylint/sudsy

Run it with npx sudsy.

Ready for 27 languages, early support for 2 more.

Real output

What the command line printed on a small repository: a Python file and a JavaScript file, with thesudsy.yaml shown below. check reports and changes nothing, fix applies the safe fixes and formats, format rewrites the files.

Every command and the JSON output

$ sudsy check
a.py:1:1: error[format]: the file is not formatted; run `sudsy format`
a.py:1:8: warning[unused-import]: `os` imported but unused
a.py:5:5: warning[unused-variable]: local variable `unused` is assigned to but never used
a.py:6:8: warning[none-comparison]: compare to None with `is` or `is not`, not `==` or `!=`
b.js:1:1: error[format]: the file is not formatted; run `sudsy format`
b.js:1:10: error[unused-variable]: 'total' is defined but never used.
b.js:2:3: error[no-debugger]: a call that stops in a debugger was left in the code
3 file(s) checked, 4 error(s), 3 warning(s)

One tool in place of many

A typical repo runs one tool per language. Each tool has its own install, config file, version pins, editor plugin and CI step. Sudsy is one of each.

The CI step
- npx prettier --check . && npx eslint . && ruff format --check && ruff check \
-   && shfmt -d . && buf format -d && terraform fmt -check && markdownlint '**/*.md' \
-   && yamllint . && hadolint Dockerfile
+ sudsy check
The config
extends:
  - preset:python/ruff
  - preset:js/eslint-recommended
lint:
  rules:
    no-debugger: error

27 languages ready, 2 in progress

Each bar is measured on real-world code against the reference tool's default rule set (an exception is named on the tile and on the language page). The tick marks 85%, where a language counts as ready.

All 29 languages with every reference tool · How languages are measured · Compared tools, rule by rule

Speed

Sudsy is faster than the primary linter on 81% of measured languages. Best of five wall-clock runs of the same task over the same files, a new process each time; a shorter bar is faster.

  • HTML · format54× faster
    Sudsy0.026 sPrettier1.40 s
  • HTML · lint25× faster
    Sudsy0.090 shtml-validate2.27 s
  • JavaScript / TypeScript · format23× faster
    Sudsy0.21 sPrettier4.87 s
  • JavaScript / TypeScript · lint16× faster
    Sudsy0.27 sESLint4.30 s
  • CSS / SCSS / Less · format39× faster
    Sudsy0.14 sPrettier5.61 s
  • CSS / SCSS / Less · lint7.5× faster
    Sudsy0.27 sstylelint2.04 s
  • JSON / JSONC · format26× faster
    Sudsy0.009 sPrettier0.23 s
  • JSON / JSONC · lint1.4× faster
    Sudsy0.87 seslint-plugin-jsonc1.18 s
  • Markdown · lint7.5× faster
    Sudsy0.096 smarkdownlint0.72 s

Every language with time and memory · Method

Why Sudsy

  • Keep your style

    53 presets set the rules and style of common tools. A preset is plain config, every style choice is a named option, and the language page shows how closely each one matches its tool.

    Presets
  • 858 rules with their own pages

    Every rule has a page with a description and, where they exist, an example, its options and the rules of other tools it replaces.

    Search the rules
  • Safe fixes

    48 rules carry a fix marked safe: by the rule's design it does not change what the code does. Formatting is checked separately, in our tests and corpus runs, by comparing the syntax tree before and after.

    How fixes work
  • Your own rules

    Write a rule as a YAML pattern with a fix, or as a sandboxed Wasm plugin.

    Pattern rules
  • In your editor

    A language server and a VS Code extension: diagnostics, quick fixes, fix all and format on save.

    Editor setup
  • In your CI

    sudsy check exits 1 on an unformatted file or a rule error. Output as GitHub annotations or SARIF.

    CI setup

Try it on your repo

Read-only: sudsy check reports and changes no files, and needs no config.

npm i -D @sudsylint/sudsy

Run it with npx sudsy.

Early release (v0.0.x): config may change in minor versions before 1.0.