A code metric tool for rails projects.




Ruby Versions

Supported Languages


Official Documentation


YAML Configuration


  • input:

    Patterns to include in execution and reports.

    Note: Inspecode runs rails_best_practices for each Rails application and the input patterns are used for detecting Rails applications containing input files. Therefore, the files excluded by the patterns are processed if they are contained in applications that also contain input files, and you may even see logs related to the excluded files in the job console. However, Inspecode eventually ignores any issues detected on the excluded files when generating job reports.

    If you need to let rails_best_practices ignore particular files, consider specifying -x, --exclude or -o, --only under options: instead.

  • ignore:

    Patterns to exclude from execution and reports.

    Note: Just like input:, the ignore patterns may not be applied completely when running rails_best_practices.

  • auto-fix:


  • config-file:

    Alias of --config option.

  • machine:

    • cpu:

      Amount of CPU. The default machine has 0.25 CPU with 960 MiB RAM.

  • options:

    Below is the list of options that are supported:

        --vendor                     include vendor files
        --spec                       include spec files
        --test                       include test files
        --features                   include features files
    -x, --exclude PATTERNS           Don't analyze files matching a pattern
                                     (comma-separated regexp list)
    -o, --only PATTERNS              Analyze files only matching a pattern
                                     (comma-separated regexp list)
    -c, --config CONFIG_PATH         configuration file location (defaults to config/rails_best_practices.yml)
  • thresholds:

    • num-issues:

      No tool specific severity levels are available.

  • incremental:


    Note: The incremental analysis cannot be supported for rails_best_practices. This is because rails_best_practices checks files with considering dependencies between them and the results on unchanged files can be affected by changed files.

  • experimental:

    No tool specific experimental options are available.

YAML Examples

  • With default options:

        rails_best_practices: default
  • With custom machine:

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

          options: [--spec, --test]

Rails Application Detection

Inspecode tries to detect Rails applications in your repository and runs rails_best_practices at the root of each Rails application if detected. Otherwise if no Rails applications are detected in your repository, Inspecode runs rails_best_practices at the root of your repository.

Note: Inspecode assumes a Rails application has the following layout:

<rails app>/
|-- app/
|-- config/
|-- public/
|-- Rakefile
|-X *.gemspec (should not be a gem)
|-- ... (other files and directories)

Configuration File Detection

If no configuration files are specified via config-file or options field, Inspecode first lets rails_best_practices to find configuration files in your repository. See https://github.com/flyerhzm/rails_best_practices/tree/v1.18.0#other-command-line-options about how rails_best_practices looks for configuration files.

In addition, if rails_best_practices cannot find any configuration files, Inspecode also walks the file tree in lexical order in your repository to find a configuration file named rails_best_practices.yml and specifies the file first found to rails_best_practices 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: ""

results matching ""

    No results matching ""