RuboCop is a Ruby static code analyzer.




Ruby Versions

Supported Languages


Official Documentation

YAML Configuration


  • input:

    Patterns to include in execution and reports.

  • ignore:

    Patterns to exclude from execution and reports.

  • auto-fix:


    Specifying true implies --auto-correct option.

  • config-file:

    Alias of --config option.

  • machine:

    • cpu:

      Amount of CPU. The default machine has 0.75 CPU with 2880 MiB RAM.

  • options:

    Below is the list of options that are supported:

        --except [COP1,COP2,...]     Disable the given cop(s).
        --only [COP1,COP2,...]       Run only the given cop(s).
        --only-guide-cops            Run only cops for rules that link to a
                                     style guide.
    -c, --config FILE                Specify configuration file.
        --force-exclusion            Force excluding files specified in the
                                     configuration `Exclude` even if they are
                                     explicitly passed as arguments.
        --force-default-config       Use default configuration even if configuration
                                     files are present in the directory tree.
    -r, --require FILE               Require Ruby file.
    -F, --fail-fast                  Inspect files in order of modification
                                     time and stop after the first file
                                     containing offenses.
    -D, --[no-]display-cop-names     Display cop names in offense messages.
                                     Default is true.
    -E, --extra-details              Display extra details in offense messages.
    -S, --display-style-guide        Display style guide URLs in offense messages.
        --ignore-disable-comments    Run cops even when they are disabled locally
                                     with a comment.
        --safe                       Run only safe cops.
    -l, --lint                       Run only lint cops.
  • thresholds:

    • num-issues:

      In addition to general severity levels, the following tool specific severity levels can be specified:

      • fatal (equivalent to general severity level critical)
      • refactor (equivalent to general severity level info)
      • convention (equivalent to general severity level info)
  • experimental:

    • incremental:


      Note: The incremental analysis is disabled if any kinds of configuration files are changed. The files recognized as configuration files are as follows:

      • Configuration files:
        • Files specified in config-file field
        • Files specified to -c, --config options
        • If none of the above configuration files are found and --force-default-config option is not specified:
          • **/.rubocop.yml, **/rubocop.yml

      Note: The incremental analysis is disabled if external dependencies are required. See Resolving Dependencies about how the dependencies are resolved.

YAML Examples

  • With default options:

      rubocop: default
  • With enabling auto-fixing and default options:

      rubocop: auto-fix
  • With custom machine:

          cpu: 1.5 # 1.5 CPU, 5760 MiB RAM
  • With custom options:

        options: [--rails, --only-guide-cops, --display-cop-names, --extra-details]
  • With a configuration file:

        config-file: rails/.rubocop.yaml

    The above configuration is equivalent to:

          --config: rails/.rubocop.yaml

Configuration File Detection

If no configuration files are specified via config-file or options field, Inspecode first lets RuboCop to find configuration files in your repository. See about how RuboCop looks for configuration files.

In addition, if RuboCop cannot find any configuration files, Inspecode also walks the file tree in lexical order in your repository to find a configuration file, named .rubocop.yml or rubocop.yml, and specifies the file first found to RuboCop automatically via --config option.

Note: Inspecode ignores specific configuration files while searching. See Configuration > Tool Configuration > Field: config-file for detail.

If the configuration file detected by Inspecode is not the one you want to use or you do not want to use any configuration files, you can disable Inspecode from detecting configuration files by explicitly setting an empty string to config-file field like below:

    config-file: ""

Resolving Dependencies

By default, no RuboCop extensions are installed. But Inspecode searches your repository for Gemfile files and runs bundle install at each directory where Gemfile exists so that you can use any RuboCop extensions.

results matching ""

    No results matching ""