Implementation
final List<Option> checkOptions = [
Option(
name: '--fix',
description: 'Apply fixes to resolve lint violations'
),
Option(
name: '--unsafe-fixes',
description: 'Include fixes that may not retain the original intent of the code'
),
Option(
name: '--show-fixes',
description: 'Show an enumeration of all fixed lint violations'
),
Option(
name: '--diff',
description: 'Avoid writing any fixed files back; instead, output a diff for each changed file to stdout, and exit 0 if there are no diffs. Implies `--fix-only`'
),
Option(
name: ['-w', '--watch'],
description: 'Run in watch mode by re-running whenever files change'
),
Option(
name: '--fix-only',
description: 'Apply fixes to resolve lint violations, but don\'t report on, or exit non-zero for, leftover violations. Implies `--fix`'
),
Option(
name: '--ignore-noqa',
description: 'Ignore any `# noqa` comments'
),
Option(
name: '--output-format',
description: 'Output serialization format for violations. The default serialization format is \'full\'',
args: [
Arg(
name: 'output_format',
isOptional: true,
suggestions: [
FigSuggestion(name: 'concise'),
FigSuggestion(name: 'full'),
FigSuggestion(name: 'json'),
FigSuggestion(name: 'json-lines'),
FigSuggestion(name: 'junit'),
FigSuggestion(name: 'grouped'),
FigSuggestion(name: 'github'),
FigSuggestion(name: 'gitlab'),
FigSuggestion(name: 'pylint'),
FigSuggestion(name: 'rdjson'),
FigSuggestion(name: 'azure'),
FigSuggestion(name: 'sarif')
]
)
]
),
Option(
name: ['-o', '--output-file'],
description: 'Specify file to write the linter output to (default: stdout)',
args: [
Arg(
name: 'output_file',
isOptional: true,
template: 'filepaths'
)
]
),
Option(
name: '--target-version',
description: 'The minimum Python version that should be supported',
args: [
Arg(
name: 'target_version',
isOptional: true,
suggestions: [
FigSuggestion(name: 'py37'),
FigSuggestion(name: 'py38'),
FigSuggestion(name: 'py39'),
FigSuggestion(name: 'py310'),
FigSuggestion(name: 'py311'),
FigSuggestion(name: 'py312'),
FigSuggestion(name: 'py313')
]
)
]
),
Option(
name: '--preview',
description: 'Enable preview mode; checks will include unstable rules and fixes'
),
Option(
name: '--extension',
description: 'List of mappings from file extension to language (one of `python`, `ipynb`, `pyi`). For example, to treat `.ipy` files as IPython notebooks, use `--extension ipy:ipynb`',
args: [
Arg(
name: 'extension',
isOptional: true
)
]
),
Option(
name: '--statistics',
description: 'Show counts for every rule with at least one violation'
),
Option(
name: '--add-noqa',
description: 'Enable automatic additions of `noqa` directives to failing lines'
),
Option(
name: '--show-files',
description: 'See the files Ruff will be run against with the current settings'
),
Option(
name: '--show-settings',
description: 'See the settings Ruff will use to lint a given Python file'
),
Option(
name: ['-h', '--help'],
description: 'Print help'
),
Option(
name: '--select',
description: 'Comma-separated list of rule codes to enable (or ALL, to enable all rules)',
args: [
Arg(
name: 'select',
isOptional: true
)
]
),
Option(
name: '--ignore',
description: 'Comma-separated list of rule codes to disable',
args: [
Arg(
name: 'ignore',
isOptional: true
)
]
),
Option(
name: '--extend-select',
description: 'Like --select, but adds additional rule codes on top of the selected ones',
args: [
Arg(
name: 'extend_select',
isOptional: true
)
]
),
Option(
name: '--per-file-ignores',
description: 'List of mappings from file pattern to code to exclude',
args: [
Arg(
name: 'per_file_ignores',
isOptional: true
)
]
),
Option(
name: '--extend-per-file-ignores',
description: 'Like `--per-file-ignores`, but adds additional ignores on top of those already specified',
args: [
Arg(
name: 'extend_per_file_ignores',
isOptional: true
)
]
),
Option(
name: '--fixable',
description: 'List of rule codes to treat as eligible for fix. Only applicable when fix itself is enabled (e.g., via `--fix`)',
args: [
Arg(
name: 'fixable',
isOptional: true
)
]
),
Option(
name: '--unfixable',
description: 'List of rule codes to treat as ineligible for fix. Only applicable when fix itself is enabled (e.g., via `--fix`)',
args: [
Arg(
name: 'unfixable',
isOptional: true
)
]
),
Option(
name: '--extend-fixable',
description: 'Like --fixable, but adds additional rule codes on top of those already specified',
args: [
Arg(
name: 'extend_fixable',
isOptional: true
)
]
),
Option(
name: '--exclude',
description: 'List of paths, used to omit files and/or directories from analysis',
args: [
Arg(
name: 'exclude',
isOptional: true
)
]
),
Option(
name: '--extend-exclude',
description: 'Like --exclude, but adds additional files and directories on top of those already excluded',
args: [
Arg(
name: 'extend_exclude',
isOptional: true
)
]
),
Option(
name: '--respect-gitignore',
description: 'Respect file exclusions via `.gitignore` and other standard ignore files'
),
Option(
name: '--force-exclude',
description: 'Enforce exclusions, even for paths passed to Ruff directly on the command-line'
),
Option(
name: ['-n', '--no-cache'],
description: 'Disable cache reads'
),
Option(
name: '--cache-dir',
description: 'Path to the cache directory',
args: [
Arg(
name: 'cache_dir',
isOptional: true,
template: 'filepaths'
)
]
),
Option(
name: '--stdin-filename',
description: 'The name of the file when passing it through stdin',
args: [
Arg(
name: 'stdin_filename',
isOptional: true,
template: 'filepaths'
)
]
),
Option(
name: ['-e', '--exit-zero'],
description: 'Exit with status code "0", even upon detecting lint violations'
),
Option(
name: '--exit-non-zero-on-fix',
description: 'Exit with a non-zero status code if any files were modified via fix, even if no lint violations remain'
)
];