Skip to content

Instantly share code, notes, and snippets.

@matsubo
Last active February 15, 2023 07:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matsubo/ec5b6cbf0a7207075e2b081f394863e6 to your computer and use it in GitHub Desktop.
Save matsubo/ec5b6cbf0a7207075e2b081f394863e6 to your computer and use it in GitHub Desktop.
My rubocop setting template.
gem 'rubocop', require: false
gem 'rubocop-performance', require: false
gem 'rubocop-rails', require: false
gem 'rubocop-rspec', require: false
# inherit_from: .rubocop_todo.yml
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2017-11-25 11:44:56 +0000 using RuboCop version 0.51.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 15
# Cop supports --auto-correct.
# Configuration parameters: Include, TreatCommentsAsGroupSeparators.
# Include: **/Gemfile, **/gems.rb
require:
- rubocop-rails
- rubocop-performance
- rubocop-rspec
AllCops:
TargetRubyVersion: 3.1
Exclude:
- 'vendor/**/*'
- 'db/**/*'
- 'lib/tasks/**/*'
- "db/schema.rb"
- 'bin/*'
- 'test/*'
- 'node_modules/**/*'
- 'config/initializers/**/*'
- 'public/**/*'
- 'storage/**/*'
- 'log/**/*'
- 'tmp/**/*'
- 'terraform/**/*'
- 'openapi/**/*'
NewCops: enable
# sider's rubocop stops during this file
Rails/HttpStatus:
Exclude:
- 'app/controllers/application_controller.rb'
Rails/SkipsModelValidations:
AllowedMethods:
- 'touch'
- 'upsert_all'
Layout/LineLength:
Max: 200
Exclude:
- 'spec/**/*'
- 'config/**/*'
Layout/ParameterAlignment:
Enabled: false
Layout/EmptyLineBetweenDefs:
Enabled: false
Layout/EmptyLines:
Enabled: false
Layout/EmptyLinesAroundAccessModifier:
Enabled: false
Layout/EmptyLinesAroundBlockBody:
Enabled: false
Layout/EmptyLinesAroundClassBody:
Enabled: false
Layout/EmptyLinesAroundMethodBody:
Enabled: false
Layout/ExtraSpacing:
Enabled: false
Layout/IndentationConsistency:
Enabled: false
Layout/SpaceBeforeBlockBraces:
Enabled: false
Layout/SpaceInsideHashLiteralBraces:
Enabled: false
Layout/EmptyLinesAroundAttributeAccessor:
Enabled: true
Layout/SpaceAroundMethodCallOperator:
Enabled: true
Lint/DeprecatedOpenSSLConstant:
Enabled: true
Lint/DuplicateElsifCondition:
Enabled: true
Lint/MixedRegexpCaptureTypes:
Enabled: true
Lint/RaiseException:
Enabled: true
Lint/StructNewOverride:
Enabled: true
Style/AsciiComments:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Style/Documentation:
Enabled: false
Style/EmptyMethod:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false
Style/GuardClause:
Enabled: false
# Configuration parameters: Whitelist.
# Whitelist: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with
Style/NumericPredicate:
Enabled: false
# Readability is more important
Style/RedundantReturn:
Enabled: false
Style/NumericLiterals:
Enabled: false
Style/AccessorGrouping:
Enabled: false
Style/ArrayCoercion:
Enabled: true
Style/BisectedAttrAccessor:
Enabled: true
Style/CaseLikeIf:
Enabled: true
Style/ExponentialNotation:
Enabled: true
Style/HashAsLastArrayItem:
Enabled: false
Style/HashEachMethods:
Enabled: true
Style/HashLikeCase:
Enabled: true
Style/HashTransformKeys:
Enabled: true
Style/HashTransformValues:
Enabled: true
Style/RedundantAssignment:
Enabled: true
Style/RedundantFetchBlock:
Enabled: true
Style/RedundantFileExtensionInRequire:
Enabled: true
Style/RedundantRegexpCharacterClass:
Enabled: true
Style/RedundantRegexpEscape:
Enabled: true
Style/SlicingWithRange:
Enabled: true
Style/TrailingCommaInHashLiteral:
Enabled: false
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: all_comparison_operators, equality_operators_only
Style/YodaCondition:
# Readability is more important
Enabled: false
Style/FormatStringToken:
EnforcedStyle: template
Performance/TimesMap:
Exclude:
- 'spec/**/*'
Metrics/BlockLength:
Exclude:
- 'spec/**/*'
- 'config/**/*'
- 'app/views/api/v1/**/*'
- 'app/models/order_product.rb' # aasm
Metrics/AbcSize:
Enabled: false
Metrics/MethodLength:
Enabled: false
Style/SymbolArray:
Enabled: false
Style/RescueModifier:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/ParameterLists:
Enabled: false
RSpec/NestedGroups:
Enabled: false
Capybara/CurrentPathExpectation:
Enabled: false
RSpec/MultipleMemoizedHelpers:
Enabled: false
RSpec/ExampleLength:
Enabled: false
RSpec/ContextWording:
Enabled: false
RSpec/MultipleExpectations:
Enabled: false
RSpec/LetSetup:
Enabled: false
RSpec/Capybara/FeatureMethods:
Enabled: false
RSpec/ChangeByZero:
Enabled: false
Naming/VariableNumber:
Enabled: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment