Skip to content
Snippets Groups Projects
.rubocop.yml 27.3 KiB
Newer Older
  • Learn to ignore specific revisions
  • 
    # TODO: Enable RedundantMatch Cop.
    # Use `=~` instead of `String#match` or `Regexp#match` in a context where the
    # returned `MatchData` is not needed.
    Performance/RedundantMatch:
      Enabled: false
    
    # TODO: Enable RedundantMerge Cop.
    # Use `Hash#[]=`, rather than `Hash#merge!` with a single key-value pair.
    Performance/RedundantMerge:
      # Max number of key-value pairs to consider an offense
      MaxKeyValuePairs: 2
      Enabled: false
    
    # Use `sort` instead of `sort_by { |x| x }`.
    Performance/RedundantSortBy:
    
    
    # Use `start_with?` instead of a regex match anchored to the beginning of a
    # string.
    Performance/StartWith:
    
    # Use `tr` instead of `gsub` when you are replacing the same number of
    # characters. Use `delete` instead of `gsub` when you are deleting
    # characters.
    Performance/StringReplacement:
    
      Enabled: true
    
    
    # Checks for `.times.map` calls.
    Performance/TimesMap:
    
    ##################### Rails ##################################
    
    
    # Enables Rails cops.
    Rails:
      Enabled: true
    
    # Enforces consistent use of action filter methods.
    
      Enabled: true
    
      EnforcedStyle: action
    
    # Checks the correct usage of date aware methods, such as `Date.today`,
    # `Date.current`, etc.
    
    Rails/Date:
      Enabled: false
    
    
    # Prefer delegate method for delegations.
    Rails/Delegate:
    
    # Prefer `find_by` over `where.first`.
    Rails/FindBy:
    
    
    # Prefer `all.find_each` over `all.find`.
    Rails/FindEach:
    
    # Prefer has_many :through to has_and_belongs_to_many.
    
      Enabled: true
    
    # Checks for calls to puts, print, etc.
    
    # Checks for incorrect grammar when using methods like `3.day.ago`.
    Rails/PluralizationGrammar:
    
    
    # Checks for `read_attribute(:attr)` and `write_attribute(:attr, val)`.
    
    # Checks the arguments of ActiveRecord scopes.
    
    # Checks the correct usage of time zone aware methods.
    # http://danilenko.org/2012/7/6/rails_timezones
    
    Rails/TimeZone:
      Enabled: false
    
    
    # Use validates :attribute, hash of validations.
    
    Rails/UniqBeforePluck:
      Enabled: false
    
    
    Robert Speicher's avatar
    Robert Speicher committed
    ##################### RSpec ##################################
    
    
    # Check that instances are not being stubbed globally.
    
    Robert Speicher's avatar
    Robert Speicher committed
    RSpec/AnyInstance:
      Enabled: false
    
    
    # Check that the first argument to the top level describe is the tested class or
    # module.
    
    Robert Speicher's avatar
    Robert Speicher committed
    RSpec/DescribeClass:
      Enabled: false
    
    
    # Use `described_class` for tested class / module.
    
    Robert Speicher's avatar
    Robert Speicher committed
    RSpec/DescribeMethod:
      Enabled: false
    
    
    # Checks that the second argument to top level describe is the tested method
    # name.
    
    Robert Speicher's avatar
    Robert Speicher committed
    RSpec/DescribedClass:
      Enabled: false
    
    
    # Checks for long example.
    
    Robert Speicher's avatar
    Robert Speicher committed
    RSpec/ExampleLength:
      Enabled: false
      Max: 5
    
    
    # Do not use should when describing your tests.
    
    Robert Speicher's avatar
    Robert Speicher committed
    RSpec/ExampleWording:
      Enabled: false
      CustomTransform:
        be: is
        have: has
        not: does not
      IgnoredWords: []
    
    
    # Checks the file and folder naming of the spec file.
    
    Robert Speicher's avatar
    Robert Speicher committed
    RSpec/FilePath:
      Enabled: false
      CustomTransform:
        RuboCop: rubocop
        RSpec: rspec
    
    
    # Checks if there are focused specs.
    
    Robert Speicher's avatar
    Robert Speicher committed
    RSpec/Focus:
      Enabled: true
    
    
    # Checks for the usage of instance variables.
    
    Robert Speicher's avatar
    Robert Speicher committed
    RSpec/InstanceVariable:
      Enabled: false
    
    
    # Checks for multiple top-level describes.
    
    Robert Speicher's avatar
    Robert Speicher committed
    RSpec/MultipleDescribes:
      Enabled: false
    
    
    # Enforces the usage of the same method on all negative message expectations.
    
    Robert Speicher's avatar
    Robert Speicher committed
    RSpec/NotToNot:
      EnforcedStyle: not_to
    
    # Prefer using verifying doubles over normal doubles.
    
    Robert Speicher's avatar
    Robert Speicher committed
    RSpec/VerifiedDoubles:
      Enabled: false