Rubokop and style / Indentation. Compatible with rails.

I am using rubocop for the rails 5 project, and I added to my .rubocop.ymlthis:

Rails:
  Enabled: true

I noticed, however, that rule ( Style/IndentationConsistency) fails, and I had to explicitly add it as follows:

Style/IndentationConsistency:
  EnforcedStyle: rails

Is this normal, or am I doing something wrong?

+4
source share
2 answers

This seems to be normal. Not everyone uses this style in Rails projects. This is just the style used by the Rails code base itself. Therefore, if you need to indent the rails code base, you must explicitly specify both of the above.

0
source

Rails: Enabled: true, Rails, (Rails Action Filter, FindEach, FindBy).

, Rails, . (https://github.com/bbatsov/rubocop/blob/master/config/default.yml)

  Rails/ActionFilter:
      EnforcedStyle: action
      SupportedStyles:
          - action
          - filter
      Include:
          - app/controllers/**/*.rb

  Rails/Date:
      # The value `strict` disallows usage of `Date.today`, `Date.current`,
      # `Date#to_time` etc.
      # The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
      # (but not `Date.today`) which are overridden by ActiveSupport to handle current
      # time zone.
      EnforcedStyle: flexible
      SupportedStyles:
          - strict
          - flexible

  Rails/Exit:
      Include:
          - app/**/*.rb
          - config/**/*.rb
          - lib/**/*.rb
      Exclude:
          - lib/**/*.rake

  Rails/FindBy:
      Include:
          - app/models/**/*.rb

  Rails/FindEach:
      Include:
          - app/models/**/*.rb

  Rails/HasAndBelongsToMany:
      Include:
          - app/models/**/*.rb
0

Source: https://habr.com/ru/post/1652147/


All Articles