simplecov-ruby/simplecov

View on GitHub
.rubocop.yml

Summary

Maintainability
Test Coverage
AllCops:
  Exclude:
    - "spec/fixtures/iso-8859.rb"
    - "spec/fixtures/utf-8.rb"
    - "spec/fixtures/utf-8-magic.rb"
    - "spec/fixtures/euc-jp.rb"
    - "spec/fixtures/empty_euc-jp.rb"
    - "spec/fixtures/euc-jp-shebang.rb"
    - "test_projects/**/*"
    - "tmp/**/*"
    - "vendor/bundle/**/*"
    - "vendor/bundle/**/.*"
  TargetRubyVersion: 2.7
  NewCops: enable
  # we might wanna adopt rspec and rake but it's a bit annoying for now
  SuggestExtensions: false

Bundler/OrderedGems:
  Description: Gems should be alphabetically sorted within groups.
  Enabled: false

Layout/AccessModifierIndentation:
  Description: Modifiers should be indented as deep as method definitions,
    or as deep as the class/module keyword, depending on configuration.
  EnforcedStyle: outdent

Layout/EmptyLinesAroundAttributeAccessor:
  Description: Keep blank lines around attribute accessors.
  Enabled: true

# Open for revision would like table style but the impact
# would probably be huge
Layout/HashAlignment:
  Enabled: false

Layout/HeredocIndentation:
  Description: Checks the indentation of the here document bodies.
  Enabled: false

Layout/LineLength:
  Description: Checks the length of lines in the source code.
  AllowURI: true
  Enabled: false

Layout/SpaceAroundMethodCallOperator:
  Description: Checks method call operators to not have spaces around them.
  Enabled: true

Layout/SpaceBeforeBrackets:
  Enabled: true

Layout/SpaceInsideHashLiteralBraces:
  Description: Use spaces inside hash literal braces - or don't.
  StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#spaces-operators
  EnforcedStyle: no_space

Lint/AmbiguousAssignment:
  Enabled: true

Lint/AmbiguousRegexpLiteral:
  Description: Checks for ambiguous regexp literals in the first argument of a method invocation without parentheses.
  Exclude:
    - "features/**/*_steps.rb"
    - "spec/**/*_steps.rb"
    - "tmp/**/*_steps.rb"

Lint/BinaryOperatorWithIdenticalOperands:
  Enabled: true

Lint/ConstantDefinitionInBlock:
  Exclude:
    - "spec/**/*_spec.rb"

Lint/DeprecatedConstants:
  Enabled: true

Lint/DeprecatedOpenSSLConstant:
  Description: Don't use algorithm constants for `OpenSSL::Cipher` and `OpenSSL::Digest`.
  Enabled: true

Lint/DuplicateBranch:
  Enabled: true

Lint/DuplicateElsifCondition:
  Enabled: true

Lint/DuplicateRegexpCharacterClassElement:
  Enabled: true

Lint/DuplicateRescueException:
  Enabled: true

Lint/EmptyBlock:
  Enabled: true

Lint/EmptyClass:
  Enabled: true

Lint/EmptyConditionalBody:
  Enabled: true

Lint/FloatComparison:
  Enabled: true

Lint/LambdaWithoutLiteralBlock:
  Enabled: true

Lint/MissingSuper:
  Enabled: true

Lint/MixedRegexpCaptureTypes:
  Description: Do not mix named captures and numbered captures in a Regexp literal.
  Enabled: true

Lint/NoReturnInBeginEndBlocks:
  Enabled: true

Lint/NumberedParameterAssignment:
  Enabled: true

Lint/OrAssignmentToConstant:
  Enabled: true

Lint/OutOfRangeRegexpRef:
  Enabled: true

Lint/RaiseException:
  Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
  Enabled: true

Lint/RedundantDirGlobSort:
  Enabled: true

Lint/SelfAssignment:
  Enabled: true

Lint/StructNewOverride:
  Description: Disallow overriding the `Struct` built-in methods via `Struct.new`.
  Enabled: true

Lint/SymbolConversion:
  Enabled: true

Lint/ToEnumArguments:
  Enabled: true

Lint/TopLevelReturnWithArgument:
  Enabled: true

Lint/TripleQuotes:
  Enabled: true

Lint/UnexpectedBlockArity:
  Enabled: true

Lint/UnmodifiedReduceAccumulator:
  Enabled: true

Lint/UnreachableLoop:
  Enabled: true

Metrics/AbcSize:
  Description: Checks that the ABC size of methods is not higher than the configured maximum.
  Max: 25 # TODO: Lower to 15

Metrics/BlockLength:
  Description: Checks if the length of a block exceeds some maximum value.
  Exclude:
    - "spec/**/*.rb"

Metrics/BlockNesting:
  Description: Avoid excessive block nesting.
  StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#three-is-the-number-thou-shalt-count
  Max: 2

Metrics/ClassLength:
  Max: 300

Metrics/MethodLength:
  Description: Checks if the length of a method exceeds some maximum value.
  CountComments: false
  Max: 12 # TODO: Lower to 10

Metrics/ModuleLength:
  Description: Avoid modules longer than 100 lines of code.
  Max: 300
  Exclude:
    - "lib/simplecov.rb"

Metrics/ParameterLists:
  Description: Avoid parameter lists longer than three or four parameters.
  StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#too-many-params
  Max: 4
  CountKeywordArgs: true

Naming/FileName:
  Description: makes sure that Ruby source files have snake_case names.
  Exclude:
    - "spec/fixtures/utf-8.rb"

Style/AccessorGrouping:
  Enabled: true

Style/ArgumentsForwarding:
  Enabled: true

Style/ArrayCoercion:
  Enabled: true

Style/BisectedAttrAccessor:
  Enabled: true

Style/CaseLikeIf:
  Enabled: true

Style/CollectionCompact:
  Enabled: true

Style/CollectionMethods:
  Description: Enforces the use of consistent method names from the Enumerable module.
  PreferredMethods:
    map: "collect"
    reduce: "inject"
    find: "detect"
    find_all: "select"

Style/Documentation:
  Description: Checks for missing top-level documentation of classes and modules.
  Enabled: false

Style/DoubleNegation:
  Description: Checks for uses of double negation (!!).
  StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#no-bang-bang
  Enabled: false

Style/DocumentDynamicEvalDefinition:
  Enabled: true

Style/EndlessMethod:
  Enabled: true

Style/ExplicitBlockArgument:
  # capturing as a proc has a performance hit, so is a case by case choice
  Enabled: false

Style/ExponentialNotation:
  Description: When using exponential notation, favor a mantissa between 1 (inclusive) and 10 (exclusive).
  Enabled: true

Style/FrozenStringLiteralComment:
  Description:
    Add the frozen_string_literal comment to the top of files to help transition
    from Ruby 2.3.0 to Ruby 3.0.
  Enabled: true
  EnforcedStyle: always
  Exclude:
    - "spec/fixtures/**/*"

Style/GlobalStdStream:
  Enabled: true

Style/GuardClause:
  Description: Use a guard clause instead of wrapping the code inside a conditional expression.
  Enabled: false

Style/HashAsLastArrayItem:
  Enabled: true

Style/HashEachMethods:
  Description: Use Hash#each_key and Hash#each_value.
  Enabled: true

Style/HashExcept:
  Enabled: true

Style/HashLikeCase:
  Enabled: true

Style/HashTransformKeys:
  Description: Prefer `transform_keys` over `each_with_object` and `map`.
  Enabled: true

Style/HashTransformValues:
  Description: Prefer `transform_values` over `each_with_object` and `map`.
  Enabled: true

Style/HashSyntax:
  Description: Checks hash literal syntax.
  EnforcedStyle: ruby19

Style/IfWithBooleanLiteralBranches:
  Enabled: true

Style/NegatedIfElseCondition:
  Enabled: true

Style/NilLambda:
  Enabled: true

Style/OptionalBooleanParameter:
  Enabled: true

Style/RedundantArgument:
  Enabled: true

Style/RedundantAssignment:
  Enabled: true

Style/RedundantFetchBlock:
  Enabled: true

Style/RedundantFileExtensionInRequire:
  Enabled: true

Style/RedundantRegexpCharacterClass:
  Description: Checks for unnecessary single-element Regexp character classes.
  Enabled: true

Style/RedundantRegexpEscape:
  Description: Checks for redundant escapes in Regexps.
  Enabled: true

Style/RegexpLiteral:
  Description: Use / or %r around regular expressions.
  StyleGuide: https://github.com/rubocop-hq/ruby-style-guide#percent-r
  Enabled: false

Style/SingleArgumentDig:
  Enabled: true

Style/SlicingWithRange:
  Description: Checks array slicing is done with endless ranges when suitable.
  Enabled: true

Style/SpecialGlobalVars:
  Description: Looks for uses of Perl-style global variables.
  Exclude:
    - "spec/deleted_source_spec.rb"
    - "spec/return_codes_spec.rb"
    - "lib/simplecov/defaults.rb"

Style/StringConcatenation:
  Enabled: true

Style/StringLiterals:
  Description: Allow double-quoted strings without interpolation.
  EnforcedStyle: double_quotes

Style/SwapValues:
  Enabled: true

Style/TrailingCommaInArrayLiteral:
  EnforcedStyleForMultiline: no_comma

Style/TrailingCommaInHashLiteral:
  EnforcedStyleForMultiline: no_comma