gdtidy

CLI Reference

Every gdtidy command and flag.

gdtidy fmt [--check | --diff] [--format text|json] [PATHS]...
gdtidy lint [--fix] [--format text|json|sarif] [PATHS]...
gdtidy rules [--format text|json]
gdtidy migrate [--stdout] [--force] [FILES]...

PATHS default to the current folder. In gdtidy fmt, - reads standard input and writes standard output.

gdtidy fmt

FlagDescription
--checkChange nothing; list the files that would change
--diffChange nothing; print the changes as a unified diff
--format <FORMAT>text (default) or json

See Formatting.

gdtidy lint

FlagDescription
--fixRepair the problems that can be repaired safely, then report the rest
--format <FORMAT>text (default), json, or sarif (SARIF 2.1.0, for GitHub code scanning)

See Linting.

gdtidy rules

Lists every rule with whether it is on by default. --format json adds each rule's concern and options.

gdtidy migrate

FlagDescription
--stdoutPrint the configuration instead of writing it
--forceReplace an existing gdtidy.toml; without it, only the sections it does not have yet are added. In a gdsuite.toml, existing sections are never replaced

FILES default to gdlintrc and gdformatrc in the current folder, with or without a leading dot. See Moving from gdtoolkit.

Exit codes

CodeMeaning
0No problems
1Problems found, or files that would change
2The check could not run, or some files could not be checked