Run xpd fix to apply the fixes of Ruff, xpd and ty to Python files in one pass and then format the changed files with Ruff. The checkers always run in that order, so each sees the code the previous one fixed. Directories respect .gitignore, and the default path is the current directory.
Target files or folders Ruff fixes xpd fixes ty fixes Ruff format of changed files Report changed files and remaining issues
xpd fix [OPTIONS] [PATHS]...
Argument
What it does
<PATHS>...
Python files or directories. Directories respect .gitignore.
Option
Default
What it does
--unsafe-fixes
Include fixes that may change behavior.
--workspace
Apply xpd workspace codemods across local callers. Requires --unsafe-fixes.
--plan
Emit parameterized fix plans (JSON) for domain-judgment rules without editing files. Conflicts with --apply-plan.
--apply-plan <PATH>
Apply answered fix plans from a JSON file (- reads stdin) atomically via rollback journal. Conflicts with --plan.
--rule <NAME>
Select a rule or package when running --plan or --apply-plan. Repeatable.
--tools <TOOLS>
ruff,xpd,ty
Select checkers. They always run in Ruff, xpd, ty order. Repeatable. Values: ruff, xpd, ty.
--no-format
Skip Ruff formatting of files changed by a fix.
--check
Report any selected tool's issues with exit code 1, without writing fixes or formatting.
--fail-on <FAIL_ON>
error
Exit 1 after applying fixes if a remaining issue meets this severity. Values: error, warning, info, hint.
--format <FORMAT>
Output format. Default: text on a terminal, json otherwise. Values: text, json.
-j, --jobs <NUM>
Maximum worker threads.
--check reports what each selected checker would fix, without writing anything.
$ xpd fix samples/bad.py --tools xpd --check --format json
{"changed_files":0,"tools":[{"changed_files":0,"fixed":0,"remaining":5,"status":"completed","tool":"xpd"}]}
Flag
Behavior
--tools ruff,xpd,ty
Select the checkers. They always run in Ruff, xpd, ty order
--unsafe-fixes
Include fixes that may change behavior
--workspace
Apply xpd workspace codemods across local callers. Requires --unsafe-fixes
--no-format
Skip Ruff formatting of the files a fix changed
--check
Report any selected checker's issues with exit code 1, without writing fixes or formatting
--fail-on error
Exit 1 after applying fixes when a remaining issue meets this severity (error, warning, info or hint)
--format text
Output format. Text on a terminal and JSON otherwise
-j, --jobs
Maximum worker threads
A checker that is not installed is reported as skipped and does not fail the run.
Exit code
Meaning
0
Every selected checker ran, and no remaining issue meets --fail-on
1
A remaining issue meets --fail-on (default: error), --check found an issue, or a checker failed to run
2
Invalid arguments, such as --workspace without --unsafe-fixes