id = "rubocop" name = "RuboCop" homepage = "https://rubocop.org" description = "RuboCop is a Ruby static code analyzer (a.k.a. linter) and code formatter." icon = "SimpleIcons:rubocop" executables = ["rubocop"] [dotfiles] # https://docs.rubocop.org/rubocop/latest/configuration.html — RuboCop starts # in the inspected file's directory and walks up to the root; when nothing is # found in the project it falls back to the user's global locations, # "~/.rubocop.yml" and "$XDG_CONFIG_HOME/rubocop/config.yml (expands to # ~/.config/rubocop/config.yml if $XDG_CONFIG_HOME is not set)". Both are # listed: "if both files exist, the dotfile will be selected", so a machine may # carry either. The XDG one is written as [configHome] so that the variable, # not its default, decides. The per-project .rubocop.yml belongs to the # repository, not here. paths = [ "~/.rubocop.yml", "[configHome]/rubocop/config.yml", ] # https://docs.rubocop.org/rubocop/latest/usage/caching.html — results are # cached in "$XDG_CACHE_HOME/$UID/rubocop_cache" or, when XDG_CACHE_HOME is # unset, "$HOME/.cache/rubocop_cache/". Regenerated on the next run. # # That is `[xdgCache]`, the XDG cache directory on macOS as well as Linux — # lib/rubocop/cache_config.rb reads $XDG_CACHE_HOME and otherwise joins # File.realpath(Dir.home) with ".cache", with no Library/Caches branch — so # the variable decides instead of its default. The two spellings are both # listed because the variable branch inserts a segment the default one does # not: the same file comments "Include user ID in the path to make sure the # user has write access" and joins Process.uid before "rubocop_cache". exclude = [ "[xdgCache]/rubocop_cache/", "[xdgCache]/*/rubocop_cache/", ] # Cop configuration only. RuboCop authenticates to nothing. secret = [] # Read once per `rubocop` run; the file is never written back. side_effect = false # No machine_lines: the global config holds enabled cops, style choices and # Metrics limits, which are exactly the preferences a user wants to follow them # between machines. `inherit_from` can name an absolute path, but in practice # it names a gem or a URL, and guessing would be worse than leaving it out. [commands] format = 1 label = "Inspect Ruby code" description = "Inspect files with RuboCop, optionally autocorrecting." quality = "ai-draft" base = "fig:rubocop" parser = { end_of_options = "--", interleave = "permute", long_equals = true, short_attached = true, short_bundles = true } [[commands.source]] id = "fig" kind = "completion" url = "https://github.com/withfig/autocomplete/blob/master/src/rubocop.ts" license = "MIT" [[commands.field]] id = "files" label = "Files or directories" type = "path" position = 0 multiple = true path = { kind = "any", role = "input" } sources = ["fig"] [[commands.field]] id = "autocorrect" label = "Autocorrect (safe)" type = "boolean" option = ["--autocorrect", "-a"] effect = "overwrite" sources = ["fig"] [[commands.field]] id = "autocorrect_all" label = "Autocorrect (safe and unsafe)" type = "boolean" option = ["--autocorrect-all", "-A"] effect = "overwrite" sources = ["fig"] [[commands.field]] id = "lint" label = "Lint cops only" type = "boolean" option = ["--lint", "-l"] sources = ["fig"] [[commands.field]] id = "only" label = "Only these cops" type = "string" option = ["--only"] multiple = true sources = ["fig"] [[commands.field]] id = "except" label = "Exclude these cops" type = "string" option = ["--except"] multiple = true sources = ["fig"] [[commands.field]] id = "format" label = "Output formatter" type = "string" option = ["--format", "-f"] sources = ["fig"] [[commands.field]] id = "config" label = "Config file" type = "path" option = ["--config", "-c"] path = { kind = "file", role = "input" } sources = ["fig"] [[commands.field]] id = "fail_level" label = "Fail level" type = "string" option = ["--fail-level"] suggestions = [{ value = "A", label = "A" }, { value = "I", label = "I" }, { value = "R", label = "R" }, { value = "C", label = "C" }, { value = "W", label = "W" }, { value = "E", label = "E" }, { value = "F", label = "F" }] sources = ["fig"] [[commands.field]] id = "fail_fast" label = "Fail fast" type = "boolean" option = ["--fail-fast", "-F"] sources = ["fig"] [[commands.field]] id = "list_target_files" label = "List target files only" type = "boolean" option = ["--list-target-files", "-L"] sources = ["fig"] [[commands.field]] id = "force_exclusion" label = "Force configured exclusions" type = "boolean" option = ["--force-exclusion"] sources = ["fig"] [[commands.task]] id = "inspect" label = "Inspect" fields = ["files", "only", "except", "format", "config", "fail_level"] [[commands.task]] id = "fix_safe" label = "Autocorrect safely" fields = ["files", "autocorrect"] required = ["autocorrect"] set = { autocorrect = [true] } [[commands.task]] id = "list" label = "List files RuboCop would inspect" fields = ["files", "list_target_files"] required = ["list_target_files"] set = { list_target_files = [true] } [[commands.group]] id = "basic" label = "Basic" fields = ["files", "autocorrect", "autocorrect_all", "lint", "only", "except"] [[commands.group]] id = "advanced" label = "Advanced" fields = ["format", "config", "fail_level", "fail_fast", "list_target_files", "force_exclusion"]