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/sudsyRun it with npx sudsy.
pip install sudsyOr run it without installing: uvx sudsy.
brew install bingsubandit/sudsy/sudsyscoop bucket add sudsy https://github.com/bingsubandit/scoop-sudsy; scoop install sudsyDownload the archive for your platform (Linux, macOS or Windows, x64 or arm64) from the GitHub releases and put sudsy on your PATH.
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.
$ 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)
$ sudsy fix
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: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
2 file(s) changed
3 file(s) checked, 2 error(s), 3 warning(s)
$ sudsy format
3 file(s) checked, 2 reformatted, 1 unchanged
$ git diff
@@ -4,5 +4,5 @@ import os
def greet(name):
unused = 1
if name == None:
- return 'hello'
- return "hi, "+name
+ return "hello"
+ return "hi, " + name
@@ -1,6 +1,6 @@
-function total(items){
- debugger
- var sum = 0
- for (const i of items) sum += i.price
- return sum
+function total(items) {
+ debugger;
+ var sum = 0;
+ for (const i of items) sum += i.price;
+ return sum;
}
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.
- npx prettier --check . && npx eslint . && ruff format --check && ruff check \
- && shfmt -d . && buf format -d && terraform fmt -check && markdownlint '**/*.md' \
- && yamllint . && hadolint Dockerfile
+ sudsy checkextends:
- preset:python/ruff
- preset:js/eslint-recommended
lint:
rules:
no-debugger: error27 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.
- HTMLReadyFormatLint
- FormatLint
- CSS / SCSS / LessReadyFormatLint
- JSON / JSONCReadyFormatLint
- MarkdownReadyFormatLint
- PythonReadyFormatLint
- YAMLReadyFormatLint
- ShellReadyFormatLint
- DockerfileReadyFormatno reference toolLint
- SQLReadyFormatLint
- JavaReadyFormatLint
- GitHub ActionsReadyFormatno reference toolLint
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× fasterSudsy0.026 sPrettier1.40 s
- HTML · lint25× fasterSudsy0.090 shtml-validate2.27 s
- JavaScript / TypeScript · format23× fasterSudsy0.21 sPrettier4.87 s
- JavaScript / TypeScript · lint16× fasterSudsy0.27 sESLint4.30 s
- CSS / SCSS / Less · format39× fasterSudsy0.14 sPrettier5.61 s
- CSS / SCSS / Less · lint7.5× fasterSudsy0.27 sstylelint2.04 s
- JSON / JSONC · format26× fasterSudsy0.009 sPrettier0.23 s
- JSON / JSONC · lint1.4× fasterSudsy0.87 seslint-plugin-jsonc1.18 s
- Markdown · lint7.5× fasterSudsy0.096 smarkdownlint0.72 s
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.
Presets858 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 rulesSafe 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 workYour own rules
Write a rule as a YAML pattern with a fix, or as a sandboxed Wasm plugin.
Pattern rulesIn your editor
A language server and a VS Code extension: diagnostics, quick fixes, fix all and format on save.
Editor setupIn your CI
CI setupsudsy checkexits 1 on an unformatted file or a rule error. Output as GitHub annotations or SARIF.
Try it on your repo
Read-only: sudsy check reports and changes no files, and needs no config.
npm i -D @sudsylint/sudsyRun it with npx sudsy.
pip install sudsyOr run it without installing: uvx sudsy.
brew install bingsubandit/sudsy/sudsyscoop bucket add sudsy https://github.com/bingsubandit/scoop-sudsy; scoop install sudsyDownload the archive for your platform (Linux, macOS or Windows, x64 or arm64) from the GitHub releases and put sudsy on your PATH.
Early release (v0.0.x): config may change in minor versions before 1.0.