Skip to main content

Rails Best Practices

caution

We have deprecated the support of Rails Best Practices because of the lack of active development of the tool. As alternatives, please consider using RuboCop Rails, HAML-Lint, Slim-Lint, etc. We will drop the support on September 30, 2021.

Supported VersionLanguageWebsite
1.19.1+ (default: 1.21.0)Rubyhttps://rails-bestpractices.com

Rails Best Practices (abbr. RBP) is a code metric tool to check the quality of Rails code.

Getting Started#

To start using Rails Best Practices, enable it in your repository settings.

Configuration#

Here is an example configuration via sider.yml:

linter:  rails_best_practices:    dependencies:      - slim    config: .rails_best_practices.yml    vendor: false    spec: true    test: true    features: true    exclude: db/migrate,vendor    only: app,config
NameTypeDefault
root_dirstring-
dependenciesstring[], map[]-
configstring-
vendorbooleantrue
specbooleanfalse
testbooleanfalse
featuresbooleanfalse
excludestring-
onlystring-

config#

This option allows you to specify a configuration file path you want.

If the option is omitted and the config/rails_best_practices.yml file (RBP's default) in your repository does not exist, Sider uses the default configuration.

vendor#

This option allows you to include vendor/ directory or not.

spec#

This option allows you to include spec/ directory or not.

test#

This option allows you to include test/ directory or not.

features#

This option allows you to include features/ directory or not.

exclude#

This option allows you to exclude files or directories from the analysis. The value should be a comma-separated list.

only#

This option allows you to limit only to files or directories you want. The value should be a comma-separated list.

Analyzing View Templates#

Rails Best Practices supports some template engines. When Sider finds the following gems in your Gemfile.lock, it installs them automatically for backward compatibility:

Note that these gems are not be installed when the dependencies option is specified.