Skip to content

Commit

Permalink
Show --no-X variants in CLI help
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Sep 19, 2023
1 parent 40f6456 commit 95bbde8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 23 deletions.
13 changes: 12 additions & 1 deletion crates/ruff_cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,21 @@ pub struct CheckCommand {
/// List of files or directories to check.
pub files: Vec<PathBuf>,
/// Attempt to automatically fix lint violations.
/// Use `--no-fix` to disable.
#[arg(long, overrides_with("no_fix"))]
fix: bool,
#[clap(long, overrides_with("fix"), hide = true)]
no_fix: bool,
/// Show violations with source code.
/// Use `--no-show-source` to disable.
#[arg(long, overrides_with("no_show_source"))]
show_source: bool,
#[clap(long, overrides_with("show_source"), hide = true)]
no_show_source: bool,
/// Show an enumeration of all autofixed lint violations.
#[arg(long, overrides_with("no_show_fixes"))]
/// Use `--no-show-fixes` to disable.
// Show a custom `--show-fixes / --no-show-fixes` flag.
#[arg(long, overrides_with("no_show_fixes"), help_heading = "Miscellaneous")]
show_fixes: bool,
#[clap(long, overrides_with("show_fixes"), hide = true)]
no_show_fixes: bool,
Expand All @@ -98,6 +102,7 @@ pub struct CheckCommand {
#[arg(short, long)]
pub watch: bool,
/// Fix any fixable lint violations, but don't report on leftover violations. Implies `--fix`.
/// Use `--no-fix-only` to disable.
#[arg(long, overrides_with("no_fix_only"))]
fix_only: bool,
#[clap(long, overrides_with("fix_only"), hide = true)]
Expand All @@ -115,6 +120,7 @@ pub struct CheckCommand {
#[arg(long, value_enum)]
pub target_version: Option<PythonVersion>,
/// Enable preview mode; checks will include unstable rules and fixes.
/// Use `--no-preview` to disable.
#[arg(long, overrides_with("no_preview"))]
preview: bool,
#[clap(long, overrides_with("preview"), hide = true)]
Expand Down Expand Up @@ -226,6 +232,7 @@ pub struct CheckCommand {
)]
pub extend_unfixable: Option<Vec<RuleSelector>>,
/// Respect file exclusions via `.gitignore` and other standard ignore files.
/// Use `--no-respect-gitignore` to disable.
#[arg(
long,
overrides_with("no_respect_gitignore"),
Expand All @@ -235,6 +242,7 @@ pub struct CheckCommand {
#[clap(long, overrides_with("respect_gitignore"), hide = true)]
no_respect_gitignore: bool,
/// Enforce exclusions, even for paths passed to Ruff directly on the command-line.
/// Use `--no-force-exclude` to disable.
#[arg(
long,
overrides_with("no_force_exclude"),
Expand Down Expand Up @@ -341,6 +349,7 @@ pub struct FormatCommand {
#[arg(long, conflicts_with = "isolated")]
pub config: Option<PathBuf>,
/// Respect file exclusions via `.gitignore` and other standard ignore files.
/// Use `--no-respect-gitignore` to disable.
#[arg(
long,
overrides_with("no_respect_gitignore"),
Expand All @@ -350,6 +359,7 @@ pub struct FormatCommand {
#[clap(long, overrides_with("respect_gitignore"), hide = true)]
no_respect_gitignore: bool,
/// Enforce exclusions, even for paths passed to Ruff directly on the command-line.
/// Use `--no-force-exclude` to disable.
#[arg(
long,
overrides_with("no_force_exclude"),
Expand All @@ -369,6 +379,7 @@ pub struct FormatCommand {
pub stdin_filename: Option<PathBuf>,

/// Enable preview mode; checks will include unstable rules and fixes.
/// Use `--no-preview` to disable.
#[arg(long, overrides_with("no_preview"), hide = true)]
preview: bool,
#[clap(long, overrides_with("preview"), hide = true)]
Expand Down
44 changes: 22 additions & 22 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,15 @@ Arguments:
Options:
--fix
Attempt to automatically fix lint violations
Attempt to automatically fix lint violations. Use `--no-fix` to disable
--show-source
Show violations with source code
--show-fixes
Show an enumeration of all autofixed lint violations
Show violations with source code. Use `--no-show-source` to disable
--diff
Avoid writing any fixed files back; instead, output a diff for each changed file to stdout. Implies `--fix-only`
-w, --watch
Run in watch mode by re-running whenever files change
--fix-only
Fix any fixable lint violations, but don't report on leftover violations. Implies `--fix`
Fix any fixable lint violations, but don't report on leftover violations. Implies `--fix`. Use `--no-fix-only` to disable
--ignore-noqa
Ignore any `# noqa` comments
--format <FORMAT>
Expand All @@ -213,7 +211,7 @@ Options:
--target-version <TARGET_VERSION>
The minimum Python version that should be supported [possible values: py37, py38, py39, py310, py311, py312]
--preview
Enable preview mode; checks will include unstable rules and fixes
Enable preview mode; checks will include unstable rules and fixes. Use `--no-preview` to disable
--config <CONFIG>
Path to the `pyproject.toml` or `ruff.toml` file to use for configuration
--statistics
Expand All @@ -227,6 +225,22 @@ Options:
-h, --help
Print help
Miscellaneous:
--show-fixes
Show an enumeration of all autofixed lint violations. Use `--no-show-fixes` to disable
-n, --no-cache
Disable cache reads
--isolated
Ignore all configuration files
--cache-dir <CACHE_DIR>
Path to the cache directory [env: RUFF_CACHE_DIR=]
--stdin-filename <STDIN_FILENAME>
The name of the file when passing it through stdin
-e, --exit-zero
Exit with status code "0", even upon detecting lint violations
--exit-non-zero-on-fix
Exit with a non-zero status code if any files were modified via autofix, even if no lint violations remain
Rule selection:
--select <RULE_CODE>
Comma-separated list of rule codes to enable (or ALL, to enable all rules)
Expand All @@ -248,22 +262,8 @@ Rule selection:
File selection:
--exclude <FILE_PATTERN> List of paths, used to omit files and/or directories from analysis
--extend-exclude <FILE_PATTERN> Like --exclude, but adds additional files and directories on top of those already excluded
--respect-gitignore Respect file exclusions via `.gitignore` and other standard ignore files
--force-exclude Enforce exclusions, even for paths passed to Ruff directly on the command-line
Miscellaneous:
-n, --no-cache
Disable cache reads
--isolated
Ignore all configuration files
--cache-dir <CACHE_DIR>
Path to the cache directory [env: RUFF_CACHE_DIR=]
--stdin-filename <STDIN_FILENAME>
The name of the file when passing it through stdin
-e, --exit-zero
Exit with status code "0", even upon detecting lint violations
--exit-non-zero-on-fix
Exit with a non-zero status code if any files were modified via autofix, even if no lint violations remain
--respect-gitignore Respect file exclusions via `.gitignore` and other standard ignore files. Use `--no-respect-gitignore` to disable
--force-exclude Enforce exclusions, even for paths passed to Ruff directly on the command-line. Use `--no-force-exclude` to disable
Log levels:
-v, --verbose Enable verbose logging
Expand Down

0 comments on commit 95bbde8

Please sign in to comment.