Skip to content

Getting started

npm i -D @sudsylint/sudsy

Run it with npx sudsy.

To try it first without installing anything: npx @sudsylint/sudsy check src/ or uvx sudsy check src/.

The examples use two small files in src/:

src/a.py
import sys
import os
x = os.getcwd()
if x == None:
print( "hi", sys.argv )
src/b.js
function add(a, b) {
debugger;
return a+b
}
Terminal window
sudsy check src/
src/a.py:1:1: error[format]: the file is not formatted; run `sudsy format`
src/a.py:4:4: warning[none-comparison]: compare to None with `is` or `is not`, not `==` or `!=`
src/b.js:1:1: error[format]: the file is not formatted; run `sudsy format`
src/b.js:2:5: warning[no-debugger]: a call that stops in a debugger was left in the code
2 file(s) checked, 2 error(s), 2 warning(s)

A line reads file:line:column: level[rule]: message. An error[format] means the file is not formatted; a warning is a likely bug. check changes no files and exits 1 while there is an error.

sudsy format rewrites the files in the project’s style and changes nothing else. sudsy fix applies the safe fixes of the rules first, then formats. Findings whose fix could change behavior are reported and left alone.

Terminal window
sudsy format src/
2 file(s) checked, 2 reformatted, 0 unchanged
src/a.py
import sys
import os
x = os.getcwd()
if x == None:
print("hi", sys.argv)
src/b.js
function add(a, b) {
debugger;
return a + b;
}

The two warnings stay, because removing a debugger or rewriting == None is not a safe fix. With the files above, sudsy fix src/ therefore writes the same result and prints the remaining warnings.

Without a config file Sudsy formats with its defaults and lint reports likely bugs only, never style. In a terminal sudsy init asks which languages to set up, which style each should follow, and whether to migrate the configs of other tools it finds; Enter takes every default, and Esc writes nothing. Without a terminal it writes a starter file:

Terminal window
sudsy init
sudsy.yaml
extends: [] # e.g. preset:python/ruff

To keep the style of a tool you use today, extend its preset. For Python code formatted and linted with ruff:

Terminal window
sudsy init --preset python/ruff
sudsy.yaml
extends:
- preset:python/ruff

A rule is set to off, warn or error in the short form, and can sit beside the preset:

extends:
- preset:python/ruff
lint:
rules:
no-debugger: error

See all rules, the presets and the format options.

The VS Code extension gives diagnostics, quick fixes, fix all and formatting. Install sudsy.sudsy from the VS Code Marketplace, or from Open VSX for Cursor, Windsurf and VSCodium:

Terminal window
code --install-extension sudsy.sudsy

The .vsix for your platform from the GitHub releases is the fallback.

Turn on format on save per language in .vscode/settings.json:

{
"[python]": { "editor.defaultFormatter": "sudsy.sudsy" },
"[javascript]": { "editor.defaultFormatter": "sudsy.sudsy" },
"editor.formatOnSave": true,
"editor.codeActionsOnSave": { "source.fixAll.sudsy": "explicit" }
}

sudsy lsp is a language server over stdio, so any editor with an LSP client can use it. See editors and CI.

sudsy check runs the format check and the linter together and exits 1 on an unformatted file or a rule error. With --format github the findings appear as annotations on the pull request.

.github/workflows/sudsy.yml
name: sudsy
on: [push, pull_request]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 22 }
- run: npx @sudsylint/sudsy check --format github
  • Command line: every command and the JSON output
  • Rules: search and filter every rule
  • Languages: what each language supports and how it compares
  • Compared tools: rule by rule against ESLint, ruff, hadolint and the others