id = "ruff" name = "Ruff" homepage = "https://docs.astral.sh/ruff/" description = "An extremely fast Python linter and code formatter, written in Rust." icon = "SimpleIcons:ruff" executables = ["ruff"] [dotfiles] # https://docs.astral.sh/ruff/configuration/ — "If a user-specific # configuration file exists at ${config_dir}/ruff/pyproject.toml, that file # will be used instead of the default configuration, with ${config_dir} being # determined via etcetera's base strategy". find_user_settings_toml() in # crates/ruff_workspace/src/pyproject.rs calls choose_base_strategy(), joins # "ruff", and tries .ruff.toml, then ruff.toml, then pyproject.toml. etcetera's # base strategy is XDG on Linux *and* macOS (~/.config) and the Windows # known-folder strategy on Windows (%APPDATA%) — that is [configHome]. The # per-project pyproject.toml belongs to the repository, not here. paths = [ "[configHome]/ruff/.ruff.toml", "[configHome]/ruff/ruff.toml", "[configHome]/ruff/pyproject.toml", ] # Ruff's cache is .ruff_cache beside the code it checked, not in the home # directory, so there is nothing here to carve out. exclude = [] # Lint and format settings only. Ruff authenticates to nothing. secret = [] # Read once per `ruff check`/`ruff format` run; never written back. side_effect = false # No machine_lines: the user-level config holds line-length, target-version and # the enabled rule set, which are exactly the preferences a user wants on every # machine. [commands] format = 1 label = "Ruff" description = "Lint and format Python code. Global options (--config, --isolated) are not included." quality = "ai-draft" base = "fig:ruff" parser = { end_of_options = "--", interleave = "permute", long_equals = true, short_attached = true, short_bundles = false } [[commands.source]] id = "fig" kind = "completion" url = "https://github.com/withfig/autocomplete/blob/master/src/ruff.ts" license = "MIT" [[commands.subcommand]] path = ["check"] label = "Lint" description = "Run the Ruff linter on files or directories." [[commands.subcommand.source]] id = "fig" kind = "completion" url = "https://github.com/withfig/autocomplete/blob/master/src/ruff.ts" license = "MIT" [[commands.subcommand.field]] id = "paths" label = "Files or directories" type = "path" position = 0 multiple = true path = { kind = "any", role = "input" } sources = ["fig"] [[commands.subcommand.field]] id = "fix" label = "Apply fixes" type = "boolean" option = ["--fix"] effect = "overwrite" sources = ["fig"] [[commands.subcommand.field]] id = "unsafe_fixes" label = "Include unsafe fixes" type = "boolean" option = ["--unsafe-fixes"] effect = "overwrite" sources = ["fig"] [[commands.subcommand.field]] id = "diff" label = "Show diff, write nothing" type = "boolean" option = ["--diff"] sources = ["fig"] [[commands.subcommand.field]] id = "select" label = "Enable rules" type = "string" option = ["--select"] description = "Comma-separated rule codes, or ALL." sources = ["fig"] [[commands.subcommand.field]] id = "ignore" label = "Disable rules" type = "string" option = ["--ignore"] description = "Comma-separated rule codes." sources = ["fig"] [[commands.subcommand.field]] id = "output_format" label = "Output format" type = "string" option = ["--output-format"] suggestions = [{ value = "concise", label = "concise" }, { value = "full", label = "full" }, { value = "json", label = "json" }, { value = "json-lines", label = "json-lines" }, { value = "junit", label = "junit" }, { value = "grouped", label = "grouped" }, { value = "github", label = "github" }, { value = "gitlab", label = "gitlab" }, { value = "pylint", label = "pylint" }, { value = "rdjson", label = "rdjson" }, { value = "azure", label = "azure" }, { value = "sarif", label = "sarif" }] sources = ["fig"] [[commands.subcommand.field]] id = "target_version" label = "Target Python version" type = "string" option = ["--target-version"] suggestions = [{ value = "py37", label = "py37" }, { value = "py38", label = "py38" }, { value = "py39", label = "py39" }, { value = "py310", label = "py310" }, { value = "py311", label = "py311" }, { value = "py312", label = "py312" }, { value = "py313", label = "py313" }] sources = ["fig"] [[commands.subcommand.field]] id = "statistics" label = "Show statistics" type = "boolean" option = ["--statistics"] sources = ["fig"] [[commands.subcommand.field]] id = "watch" label = "Watch for changes" type = "boolean" option = ["--watch", "-w"] sources = ["fig"] [[commands.subcommand.field]] id = "exclude" label = "Exclude paths" type = "string" option = ["--exclude"] sources = ["fig"] [[commands.subcommand.field]] id = "exit_zero" label = "Always exit 0" type = "boolean" option = ["--exit-zero", "-e"] sources = ["fig"] [[commands.subcommand.task]] id = "lint" label = "Lint" fields = ["paths", "select", "ignore", "output_format"] [[commands.subcommand.task]] id = "fix" label = "Lint and fix" fields = ["paths", "fix"] required = ["fix"] set = { fix = [true] } [[commands.subcommand.task]] id = "preview" label = "Preview fixes as diff" fields = ["paths", "diff"] required = ["diff"] set = { diff = [true] } [[commands.subcommand.group]] id = "basic" label = "Basic" fields = ["paths", "fix", "unsafe_fixes", "diff", "select", "ignore"] [[commands.subcommand.group]] id = "advanced" label = "Advanced" fields = ["output_format", "target_version", "statistics", "watch", "exclude", "exit_zero"] [[commands.subcommand]] path = ["format"] label = "Format" description = "Run the Ruff formatter on files or directories." [[commands.subcommand.source]] id = "fig" kind = "completion" url = "https://github.com/withfig/autocomplete/blob/master/src/ruff.ts" license = "MIT" [[commands.subcommand.field]] id = "paths" label = "Files or directories" type = "path" position = 0 multiple = true path = { kind = "any", role = "input" } effect = "overwrite" sources = ["fig"] [[commands.subcommand.field]] id = "check" label = "Check only" type = "boolean" option = ["--check"] sources = ["fig"] [[commands.subcommand.field]] id = "diff" label = "Show diff, write nothing" type = "boolean" option = ["--diff"] sources = ["fig"] [[commands.subcommand.field]] id = "line_length" label = "Line length" type = "integer" option = ["--line-length"] sources = ["fig"] [[commands.subcommand.field]] id = "target_version" label = "Target Python version" type = "string" option = ["--target-version"] suggestions = [{ value = "py37", label = "py37" }, { value = "py38", label = "py38" }, { value = "py39", label = "py39" }, { value = "py310", label = "py310" }, { value = "py311", label = "py311" }, { value = "py312", label = "py312" }, { value = "py313", label = "py313" }] sources = ["fig"] [[commands.subcommand.field]] id = "exclude" label = "Exclude paths" type = "string" option = ["--exclude"] sources = ["fig"] [[commands.subcommand.task]] id = "format" label = "Format" fields = ["paths"] [[commands.subcommand.task]] id = "check" label = "Check formatting" fields = ["paths", "check"] required = ["check"] set = { check = [true] } [[commands.subcommand.group]] id = "basic" label = "Basic" fields = ["paths", "check", "diff", "line_length"] [[commands.subcommand.group]] id = "advanced" label = "Advanced" fields = ["target_version", "exclude"]