Skip to content

Instantly share code, notes, and snippets.

@isuke
Last active November 10, 2022 07:05
Show Gist options
  • Save isuke/0d22a2b1e7f6225b7dc0 to your computer and use it in GitHub Desktop.
Save isuke/0d22a2b1e7f6225b7dc0 to your computer and use it in GitHub Desktop.
# ver: 0.9.6
# rubocop: v1.38.0
inherit_from:
- .rubocop_rails.yml
- .rubocop_rspec.yml
- .rubocop_todo.yml
AllCops:
TargetRubyVersion: 3.1
DisplayCopNames: true
NewCops: enable
#
# Metrics
#
Metrics/MethodLength:
Max: 20
Metrics/AbcSize:
Enabled: false
Metrics/BlockLength:
Enabled: false
#
# Style
#
Style/StringLiterals:
ConsistentQuotesInMultiline: true
Style/AsciiComments:
Enabled: false
Style/Documentation:
Enabled: false
Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: comma
Style/ClassAndModuleChildren:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: true
Style/MethodDefParentheses:
EnforcedStyle: require_no_parentheses
Style/BarePercentLiterals:
EnforcedStyle: percent_q
Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: consistent_comma
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: consistent_comma
Style/MultilineBlockChain:
Enabled: false
#
# Layout
#
Layout/LineLength:
Max: 160
Layout/HashAlignment:
EnforcedHashRocketStyle: table
EnforcedColonStyle: table
EnforcedLastArgumentHashStyle: always_inspect
Layout/AccessModifierIndentation:
EnforcedStyle: outdent
Layout/ParameterAlignment:
EnforcedStyle: with_first_parameter
Layout/CaseIndentation:
EnforcedStyle: end
IndentOneStep: true
IndentationWidth: 2
Layout/EmptyLinesAroundBlockBody:
EnforcedStyle: no_empty_lines
Layout/EmptyLinesAroundClassBody:
EnforcedStyle: no_empty_lines
Layout/EmptyLinesAroundModuleBody:
EnforcedStyle: no_empty_lines
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
Layout/ExtraSpacing:
AllowForAlignment: true
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
# for the following case.
# validates :project, presence: true
# validates :title , presence: true
# validates :status , presence: true
Layout/SpaceBeforeComma:
Enabled: false
# for the following case.
# expect(json['title']).to eq 'implement hoge'
# expect(json['status']).to eq 'todo'
# expect(json['priority']).to eq 1
# expect(json['point']).to eq 1
Layout/SpaceBeforeFirstArg:
Enabled: false
# for the following case.
# db = ENV['db'] || 'apollo'
# user = ENV['user'] || 'postgres'
# password = ENV['password'] || ''
Layout/SpaceAroundOperators:
Enabled: false
Layout/LineContinuationLeadingSpace:
Enabled: true
Layout/LineContinuationSpacing:
Enabled: true
Layout/LineEndStringConcatenationIndentation:
Enabled: true
Layout/SpaceBeforeBrackets:
Enabled: true
Lint/AmbiguousAssignment:
Enabled: true
Lint/AmbiguousOperatorPrecedence:
Enabled: true
Lint/AmbiguousRange:
Enabled: true
Lint/ConstantOverwrittenInRescue:
Enabled: true
Lint/DeprecatedConstants:
Enabled: true
Lint/DuplicateBranch:
Enabled: true
Lint/DuplicateMagicComment:
Enabled: true
Lint/DuplicateRegexpCharacterClassElement:
Enabled: true
Lint/EmptyBlock:
Enabled: true
Lint/EmptyClass:
Enabled: true
Lint/EmptyInPattern:
Enabled: true
Lint/IncompatibleIoSelectWithFiberScheduler:
Enabled: true
Lint/LambdaWithoutLiteralBlock:
Enabled: true
Lint/NoReturnInBeginEndBlocks:
Enabled: true
Lint/NonAtomicFileOperation:
Enabled: true
Lint/NumberedParameterAssignment:
Enabled: true
Lint/OrAssignmentToConstant:
Enabled: true
Lint/RedundantDirGlobSort:
Enabled: true
Lint/RefinementImportMethods:
Enabled: true
Lint/RequireRangeParentheses:
Enabled: true
Lint/RequireRelativeSelfPath:
Enabled: true
Lint/SymbolConversion:
Enabled: true
Lint/ToEnumArguments:
Enabled: true
Lint/TripleQuotes:
Enabled: true
Lint/UnexpectedBlockArity:
Enabled: true
Lint/UnmodifiedReduceAccumulator:
Enabled: true
Lint/UselessRuby2Keywords:
Enabled: true
#
# Naming
#
Naming/HeredocDelimiterNaming:
Enabled: false
Naming/MethodParameterName:
AllowedNames:
- io
- id
- to
- by
- on
- in
- at
- ex
Naming/BlockForwarding:
Enabled: true
#
# Gemspec
#
Gemspec/DeprecatedAttributeAssignment:
Enabled: true
Gemspec/RequireMFA:
Enabled: true
#
# Security
#
Security/CompoundHash:
Enabled: true
Security/IoMethods:
Enabled: true
Style/ArgumentsForwarding:
Enabled: true
Style/CollectionCompact:
Enabled: true
Style/DocumentDynamicEvalDefinition:
Enabled: true
Style/EmptyHeredoc:
Enabled: true
Style/EndlessMethod:
Enabled: true
Style/EnvHome:
Enabled: true
Style/FetchEnvVar:
Enabled: true
Style/FileRead:
Enabled: true
Style/FileWrite:
Enabled: true
Style/HashConversion:
Enabled: true
Style/HashExcept:
Enabled: true
Style/IfWithBooleanLiteralBranches:
Enabled: true
Style/InPatternThen:
Enabled: true
Style/MagicCommentFormat:
Enabled: true
Style/MapCompactWithConditionalBlock:
Enabled: true
Style/MapToHash:
Enabled: true
Style/MultilineInPatternThen:
Enabled: true
Style/NegatedIfElseCondition:
Enabled: true
Style/NestedFileDirname:
Enabled: true
Style/NilLambda:
Enabled: true
Style/NumberedParameters:
Enabled: true
Style/NumberedParametersLimit:
Enabled: true
Style/ObjectThen:
Enabled: true
Style/OpenStructUse:
Enabled: true
Style/OperatorMethodCall:
Enabled: true
Style/QuotedSymbols:
Enabled: true
Style/RedundantArgument:
Enabled: true
Style/RedundantEach:
Enabled: true
Style/RedundantInitialize:
Enabled: true
Style/RedundantSelfAssignmentBranch:
Enabled: true
Style/RedundantStringEscape:
Enabled: true
Style/SelectByRegexp:
Enabled: true
Style/StringChars:
Enabled: true
Style/SwapValues:
Enabled: true
AllCops:
Exclude:
- 'Rakefile'
- 'db/migrations/*'
- 'bin/**/*'
- 'vendor/**/*'
- 'node_modules/**/*'
AllCops:
Exclude:
- 'Rakefile'
- 'db/schema.rb'
- 'config/routes.rb'
- 'config/routes/*'
- 'db/migrate/*'
- 'bin/**/*'
- 'vendor/**/*'
- 'node_modules/**/*'
require: rubocop-rspec
RSpec/AlignLeftLetBrace:
Enabled: true
RSpec/AlignRightLetBrace:
Enabled: false
RSpec/AnyInstance:
Enabled: true
RSpec/AroundBlock:
Enabled: true
RSpec/BeEql:
Enabled: true
RSpec/BeforeAfterAll:
Enabled: false
RSpec/ContextWording:
Enabled: true
RSpec/DescribeMethod:
Enabled: true
RSpec/DescribeSymbol:
Enabled: true
RSpec/DescribedClass:
EnforcedStyle: described_class
RSpec/EmptyExampleGroup:
Enabled: true
RSpec/EmptyLineAfterFinalLet:
Enabled: true
RSpec/EmptyLineAfterSubject:
Enabled: true
RSpec/ExampleLength:
Enabled: false
RSpec/ExampleWithoutDescription:
Enabled: true
RSpec/ExampleWording:
Enabled: true
RSpec/ExpectActual:
Enabled: true
RSpec/ExpectChange:
EnforcedStyle: method_call
RSpec/ExpectInHook:
Enabled: true
RSpec/ExpectOutput:
Enabled: true
RSpec/FilePath:
Enabled: true
RSpec/Focus:
Enabled: true
RSpec/HookArgument:
EnforcedStyle: implicit
RSpec/InstanceSpy:
Enabled: true
RSpec/InstanceVariable:
Enabled: true
RSpec/ItBehavesLike:
EnforcedStyle: it_behaves_like
RSpec/IteratedExpectation:
Enabled: false
RSpec/LeadingSubject:
Enabled: true
RSpec/LetBeforeExamples:
Enabled: true
RSpec/LetSetup:
Enabled: false
RSpec/MessageChain:
Enabled: false
RSpec/MessageExpectation:
EnforcedStyle: expect
RSpec/MessageSpies:
EnforcedStyle: receive
RSpec/MultipleDescribes:
Enabled: true
RSpec/MultipleExpectations:
Max: 10
Exclude:
- 'spec/requests/**/*_spec.rb'
- 'spec/features/**/*_spec.rb'
- 'spec/system/**/*_spec.rb'
RSpec/MultipleSubjects:
Enabled: true
RSpec/NamedSubject:
Enabled: false
# RSpec/NestedGroups:
# Enabled: TODO
RSpec/NotToNot:
Enabled: true
RSpec/OverwritingSetup:
Enabled: true
RSpec/RepeatedDescription:
Enabled: true
RSpec/RepeatedExample:
Enabled: true
RSpec/ReturnFromStub:
Enabled: true
RSpec/ScatteredLet:
Enabled: true
RSpec/ScatteredSetup:
Enabled: false
RSpec/SharedContext:
Enabled: true
RSpec/SingleArgumentMessageChain:
Enabled: false
RSpec/SubjectStub:
Enabled: true
RSpec/VerifiedDoubles:
Enabled: true
RSpec/VoidExpect:
Enabled: true
RSpec/BeEq:
Enabled: true
RSpec/BeNil:
Enabled: true
RSpec/ChangeByZero:
Enabled: true
RSpec/ClassCheck:
Enabled: true
RSpec/ExcessiveDocstringSpacing:
Enabled: true
RSpec/IdenticalEqualityAssertion:
Enabled: true
RSpec/NoExpectationExample:
Enabled: true
RSpec/SortMetadata:
Enabled: true
RSpec/SubjectDeclaration:
Enabled: true
RSpec/VerifiedDoubleReference:
Enabled: true
RSpec/Capybara/NegationMatcher:
Enabled: true
RSpec/Capybara/SpecificActions:
Enabled: true
RSpec/Capybara/SpecificFinders:
Enabled: true
RSpec/Capybara/SpecificMatcher:
Enabled: true
RSpec/FactoryBot/ConsistentParenthesesStyle:
Enabled: true
RSpec/FactoryBot/SyntaxMethods:
Enabled: true
RSpec/Rails/AvoidSetupHook:
Enabled: true
RSpec/Rails/HaveHttpStatus:
Enabled: true
RSpec/Rails/InferredSpecType:
Enabled: true
RSpec/ImplicitSubject:
EnforcedStyle: require_implicit
AllCops:
Exclude:
- 'vendor/**/*'
- 'node_modules/**/*'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment