meganemura/ruby-dmm

View on GitHub
.rubocop.yml

Summary

Maintainability
Test Coverage
inherit_from: .rubocop_todo.yml


# The following cops are added between 0.40.0 and 0.51.0.
# The configurations are default.
# If you want to use a cop by default, remove a configuration for the cop from here.
# If you want to disable a cop, change `Enabled` to false.

Bundler/DuplicatedGem:
  Description: Checks for duplicate gem entries in Gemfile.
  Enabled: true
  Include:
  - "**/Gemfile"
  - "**/gems.rb"

# Supports --auto-correct
Bundler/InsecureProtocolSource:
  Description: The source `:gemcutter`, `:rubygems` and `:rubyforge` are deprecated
    because HTTP requests are insecure. Please change your source to 'https://rubygems.org'
    if possible, or 'http://rubygems.org' if not.
  Enabled: true
  Include:
  - "**/Gemfile"
  - "**/gems.rb"

# Supports --auto-correct
Bundler/OrderedGems:
  Description: Gems within groups in the Gemfile should be alphabetically sorted.
  Enabled: true
  Include:
  - "**/Gemfile"
  - "**/gems.rb"
  TreatCommentsAsGroupSeparators: true

# Supports --auto-correct
Gemspec/OrderedDependencies:
  Description: Dependencies in the gemspec should be alphabetically sorted.
  Enabled: true
  Include:
  - "**/*.gemspec"
  TreatCommentsAsGroupSeparators: true

# Supports --auto-correct
Layout/EmptyLineAfterMagicComment:
  Description: Add an empty line after magic comments to separate them from code.
  StyleGuide: "#separate-magic-comments-from-code"
  Enabled: true

# Supports --auto-correct
Layout/EmptyLinesAroundBeginBody:
  Description: Keeps track of empty lines around begin-end bodies.
  StyleGuide: "#empty-lines-around-bodies"
  Enabled: true

# Supports --auto-correct
Layout/EmptyLinesAroundExceptionHandlingKeywords:
  Description: Keeps track of empty lines around exception handling keywords.
  StyleGuide: "#empty-lines-around-bodies"
  Enabled: true

# Supports --auto-correct
Layout/IndentHeredoc:
  Description: This cops checks the indentation of the here document bodies.
  StyleGuide: "#squiggly-heredocs"
  Enabled: true
  EnforcedStyle: auto_detection
  SupportedStyles:
  - auto_detection
  - squiggly
  - active_support
  - powerpack
  - unindent

# Supports --auto-correct
Layout/SpaceInLambdaLiteral:
  Description: Checks for spaces in lambda literals.
  Enabled: true
  EnforcedStyle: require_no_space
  SupportedStyles:
  - require_no_space
  - require_space

# Supports --auto-correct
Layout/SpaceInsideArrayPercentLiteral:
  Description: No unnecessary additional spaces between elements in %i/%w literals.
  Enabled: true

# Supports --auto-correct
Layout/SpaceInsidePercentLiteralDelimiters:
  Description: No unnecessary spaces inside delimiters of %i/%w/%x literals.
  Enabled: true

Lint/AmbiguousBlockAssociation:
  Description: Checks for ambiguous block association with method when param passed
    without parentheses.
  StyleGuide: "#syntax"
  Enabled: true

Lint/BooleanSymbol:
  Description: Check for `:true` and `:false` symbols.
  Enabled: true

Lint/DuplicateCaseCondition:
  Description: Do not repeat values in case conditionals.
  Enabled: true

Lint/EmptyExpression:
  Description: Checks for empty expressions.
  Enabled: true

Lint/EmptyWhen:
  Description: Checks for `when` branches with empty bodies.
  Enabled: true

# Supports --auto-correct
Lint/InheritException:
  Description: Avoid inheriting from the `Exception` class.
  Enabled: true
  EnforcedStyle: runtime_error
  SupportedStyles:
  - runtime_error
  - standard_error

Lint/InterpolationCheck:
  Description: Raise warning for interpolation in single q strs
  Enabled: true

# Supports --auto-correct
Lint/MultipleCompare:
  Description: Use `&&` operator to compare multiple value.
  Enabled: true

# Supports --auto-correct
Lint/PercentStringArray:
  Description: Checks for unwanted commas and quotes in %w/%W literals.
  Enabled: true

# Supports --auto-correct
Lint/PercentSymbolArray:
  Description: Checks for unwanted commas and colons in %i/%I literals.
  Enabled: true

# Supports --auto-correct
Lint/RedundantWithIndex:
  Description: Checks for redundant `with_index`.
  Enabled: true

# Supports --auto-correct
Lint/RedundantWithObject:
  Description: Checks for redundant `with_object`.
  Enabled: true

Lint/RegexpAsCondition:
  Description: Do not use regexp literal as a condition. The regexp literal matches
    `$_` implicitly.
  Enabled: true

# Supports --auto-correct
Lint/RescueType:
  Description: Avoid rescuing from non constants that could result in a `TypeError`.
  Enabled: true

Lint/RescueWithoutErrorClass:
  Description: Avoid rescuing without specifying an error class.
  StyleGuide: "#no-blind-rescues"
  Enabled: true

Lint/ReturnInVoidContext:
  Description: Checks for return in void context.
  Enabled: true

# Supports --auto-correct
Lint/SafeNavigationChain:
  Description: Do not chain ordinary method call after safe navigation operator.
  Enabled: true
  Whitelist:
  - present?
  - blank?
  - presence
  - try

# Supports --auto-correct
Lint/ScriptPermission:
  Description: Grant script file execute permission.
  Enabled: true

Lint/ShadowedException:
  Description: Avoid rescuing a higher level exception before a lower level exception.
  Enabled: true

# Supports --auto-correct
Lint/UnifiedInteger:
  Description: Use Integer instead of Fixnum or Bignum
  Enabled: true

# Supports --auto-correct
Lint/UnneededRequireStatement:
  Description: Checks for unnecessary `require` statement.
  Enabled: true

Lint/UriEscapeUnescape:
  Description: "`URI.escape` method is obsolete and should not be used. Instead, use
    `CGI.escape`, `URI.encode_www_form` or `URI.encode_www_form_component` depending
    on your specific use case. Also `URI.unescape` method is obsolete and should not
    be used. Instead, use `CGI.unescape`, `URI.decode_www_form` or `URI.decode_www_form_component`
    depending on your specific use case."
  Enabled: true

# Supports --auto-correct
Lint/UriRegexp:
  Description: Use `URI::DEFAULT_PARSER.make_regexp` instead of `URI.regexp`.
  Enabled: true

Metrics/BlockLength:
  Description: Avoid long blocks with many lines.
  Enabled: true
  CountComments: false
  Max: 25
  ExcludedMethods: []

Naming/HeredocDelimiterCase:
  Description: Use configured case for heredoc delimiters.
  StyleGuide: "#heredoc-delimiters"
  Enabled: true
  EnforcedStyle: uppercase
  SupportedStyles:
  - lowercase
  - uppercase

Naming/HeredocDelimiterNaming:
  Description: Use descriptive heredoc delimiters.
  StyleGuide: "#heredoc-delimiters"
  Enabled: true
  Blacklist:
  - END
  - !ruby/regexp /EO[A-Z]{1}/

Naming/VariableNumber:
  Description: Use the configured style when numbering variables.
  Enabled: true
  EnforcedStyle: normalcase
  SupportedStyles:
  - snake_case
  - normalcase
  - non_integer

Performance/Caller:
  Description: Use `caller(n..n)` instead of `caller`.
  Enabled: true

# Supports --auto-correct
Performance/CompareWithBlock:
  Description: Use `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.
  Enabled: true

# Supports --auto-correct
Performance/DoubleStartEndWith:
  Description: Use `str.{start,end}_with?(x, ..., y, ...)` instead of `str.{start,end}_with?(x,
    ...) || str.{start,end}_with?(y, ...)`.
  Enabled: true
  IncludeActiveSupportAliases: false

# Supports --auto-correct
Performance/RegexpMatch:
  Description: Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`,
    `Regexp#===`, or `=~` when `MatchData` is not used.
  Enabled: true

Performance/UnfreezeString:
  Description: Use unary plus to get an unfrozen string literal.
  Enabled: true

# Supports --auto-correct
Performance/UriDefaultParser:
  Description: Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.
  Enabled: true

# Supports --auto-correct
Rails/ActiveSupportAliases:
  Description: 'Avoid ActiveSupport aliases of standard ruby methods: `String#starts_with?`,
    `String#ends_with?`, `Array#append`, `Array#prepend`.'
  Enabled: false

# Supports --auto-correct
Rails/ApplicationJob:
  Description: Check that jobs subclass ApplicationJob.
  Enabled: false

# Supports --auto-correct
Rails/ApplicationRecord:
  Description: Check that models subclass ApplicationRecord.
  Enabled: false

# Supports --auto-correct
Rails/Blank:
  Description: Enforce using `blank?` and `present?`.
  Enabled: false
  NilOrEmpty: true
  NotPresent: true
  UnlessPresent: true

# Supports --auto-correct
Rails/DelegateAllowBlank:
  Description: Do not use allow_blank as an option to delegate.
  Enabled: false

# Supports --auto-correct
Rails/DynamicFindBy:
  Description: Use `find_by` instead of dynamic `find_by_*`.
  StyleGuide: https://github.com/bbatsov/rails-style-guide#find_by
  Enabled: false
  Whitelist:
  - find_by_sql

Rails/EnumUniqueness:
  Description: Avoid duplicate integers in hash-syntax `enum` declaration.
  Enabled: false
  Include:
  - app/models/**/*.rb

Rails/Exit:
  Description: Favor `fail`, `break`, `return`, etc. over `exit` in application or library
    code outside of Rake files to avoid exits during unit testing or running in production.
  Enabled: false
  Include:
  - app/**/*.rb
  - config/**/*.rb
  - lib/**/*.rb
  Exclude:
  - "/private/var/folders/65/bmfgj4lx7852pgszfg48cvf80000gn/T/d20171204-5486-1t77paf/lib/**/*.rake"

Rails/FilePath:
  Description: Use `Rails.root.join` for file path joining.
  Enabled: false

Rails/HasManyOrHasOneDependent:
  Description: Define the dependent option to the has_many and has_one associations.
  StyleGuide: https://github.com/bbatsov/rails-style-guide#has_many-has_one-dependent-option
  Enabled: false
  Include:
  - app/models/**/*.rb

# Supports --auto-correct
Rails/HttpPositionalArguments:
  Description: Use keyword arguments instead of positional arguments in http method
    calls.
  Enabled: false
  Include:
  - spec/**/*
  - test/**/*

Rails/NotNullColumn:
  Description: Do not add a NOT NULL column without a default value
  Enabled: false
  Include:
  - db/migrate/*.rb

Rails/OutputSafety:
  Description: The use of `html_safe` or `raw` may be a security risk.
  Enabled: false

# Supports --auto-correct
Rails/Present:
  Description: Enforce using `blank?` and `present?`.
  Enabled: false
  NotNilAndNotEmpty: true
  NotBlank: true
  UnlessBlank: true

# Supports --auto-correct
Rails/RelativeDateConstant:
  Description: Do not assign relative date to constants.
  Enabled: false

# Supports --auto-correct
Rails/RequestReferer:
  Description: Use consistent syntax for request.referer.
  Enabled: false
  EnforcedStyle: referer
  SupportedStyles:
  - referer
  - referrer

Rails/ReversibleMigration:
  Description: Checks whether the change method of the migration file is reversible.
  StyleGuide: https://github.com/bbatsov/rails-style-guide#reversible-migration
  Reference: http://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html
  Enabled: false
  Include:
  - db/migrate/*.rb

# Supports --auto-correct
Rails/SafeNavigation:
  Description: Use Ruby's safe navigation operator (`&.`) instead of `try!`
  Enabled: false
  ConvertTry: false

# Supports --auto-correct
Rails/SaveBang:
  Description: Identifies possible cases where Active Record save! or related should
    be used.
  StyleGuide: https://github.com/bbatsov/rails-style-guide#save-bang
  Enabled: false

Rails/SkipsModelValidations:
  Description: Use methods that skips model validations with caution. See reference
    for more information.
  Reference: http://guides.rubyonrails.org/active_record_validations.html#skipping-validations
  Enabled: false
  Blacklist:
  - decrement!
  - decrement_counter
  - increment!
  - increment_counter
  - toggle!
  - touch
  - update_all
  - update_attribute
  - update_column
  - update_columns
  - update_counters

Rails/UnknownEnv:
  Description: Use correct environment name.
  Enabled: false
  Environments:
  - development
  - test
  - production

# Supports --auto-correct
Security/JSONLoad:
  Description: Prefer usage of `JSON.parse` over `JSON.load` due to potential security
    issues. See reference for more information.
  Reference: http://ruby-doc.org/stdlib-2.3.0/libdoc/json/rdoc/JSON.html#method-i-load
  Enabled: true
  AutoCorrect: false

Security/MarshalLoad:
  Description: Avoid using of `Marshal.load` or `Marshal.restore` due to potential security
    issues. See reference for more information.
  Reference: http://ruby-doc.org/core-2.3.3/Marshal.html#module-Marshal-label-Security+considerations
  Enabled: true

# Supports --auto-correct
Security/YAMLLoad:
  Description: Prefer usage of `YAML.safe_load` over `YAML.load` due to potential security
    issues. See reference for more information.
  Reference: https://ruby-doc.org/stdlib-2.3.3/libdoc/yaml/rdoc/YAML.html#module-YAML-label-Security
  Enabled: true

Style/CommentedKeyword:
  Description: Do not place comments on the same line as certain keywords.
  Enabled: true

Style/DateTime:
  Description: Use Date or Time over DateTime.
  StyleGuide: "#date--time"
  Enabled: true

# Supports --auto-correct
Style/Dir:
  Description: Use the `__dir__` method to retrieve the canonicalized absolute path
    to the current file.
  Enabled: true

Style/DocumentationMethod:
  Description: Public methods.
  Enabled: false
  Exclude:
  - "/private/var/folders/65/bmfgj4lx7852pgszfg48cvf80000gn/T/d20171204-5486-1t77paf/spec/**/*"
  - "/private/var/folders/65/bmfgj4lx7852pgszfg48cvf80000gn/T/d20171204-5486-1t77paf/test/**/*"
  RequireForNonPublicMethods: false

# Supports --auto-correct
Style/EachForSimpleLoop:
  Description: Use `Integer#times` for a simple loop which iterates a fixed number of
    times.
  Enabled: true

# Supports --auto-correct
Style/EmptyMethod:
  Description: Checks the formatting of empty method definitions.
  StyleGuide: "#no-single-line-methods"
  Enabled: true
  EnforcedStyle: compact
  SupportedStyles:
  - compact
  - expanded

Style/FormatStringToken:
  Description: Use a consistent style for format string tokens.
  Enabled: true
  EnforcedStyle: annotated
  SupportedStyles:
  - annotated
  - template

Style/ImplicitRuntimeError:
  Description: Use `raise` or `fail` with an explicit exception class and message, rather
    than just a message.
  Enabled: false

# Supports --auto-correct
Style/InverseMethods:
  Description: Use the inverse method instead of `!.method` if an inverse method is
    defined.
  Enabled: true
  InverseMethods:
    :any?: :none?
    :even?: :odd?
    :==: :!=
    :=~: :!~
    :<: :>=
    :>: :<=
  InverseBlocks:
    :select: :reject
    :select!: :reject!

# Supports --auto-correct
Style/MethodCallWithArgsParentheses:
  Description: Use parentheses for method calls with arguments.
  StyleGuide: "#method-invocation-parens"
  Enabled: false
  IgnoreMacros: true
  IgnoredMethods: []

Style/MethodMissing:
  Description: Avoid using `method_missing`.
  StyleGuide: "#no-method-missing"
  Enabled: true

# Supports --auto-correct
Style/MinMax:
  Description: Use `Enumerable#minmax` instead of `Enumerable#min` and `Enumerable#max`
    in conjunction.'
  Enabled: true

# Supports --auto-correct
Style/MixinGrouping:
  Description: Checks for grouping of mixins in `class` and `module` bodies.
  StyleGuide: "#mixin-grouping"
  Enabled: true
  EnforcedStyle: separated
  SupportedStyles:
  - separated
  - grouped

Style/MixinUsage:
  Description: Checks that `include`, `extend` and `prepend` exists at the top level.
  Enabled: true

# Supports --auto-correct
Style/MultilineIfModifier:
  Description: Only use if/unless modifiers on single line statements.
  StyleGuide: "#no-multiline-if-modifiers"
  Enabled: true

# Supports --auto-correct
Style/MultilineMemoization:
  Description: Wrap multiline memoizations in a `begin` and `end` block.
  Enabled: true
  EnforcedStyle: keyword
  SupportedStyles:
  - keyword
  - braces

Style/MultipleComparison:
  Description: Avoid comparing a variable with multiple items in a conditional, use
    Array#include? instead.
  Enabled: true

# Supports --auto-correct
Style/NumericLiteralPrefix:
  Description: Use smallcase prefixes for numeric literals.
  StyleGuide: "#numeric-literal-prefixes"
  Enabled: true
  EnforcedOctalStyle: zero_with_o
  SupportedOctalStyles:
  - zero_with_o
  - zero_only

# Supports --auto-correct
Style/NumericPredicate:
  Description: Checks for the use of predicate- or comparison methods for numeric comparisons.
  StyleGuide: "#predicate-methods"
  AutoCorrect: false
  Enabled: true
  EnforcedStyle: predicate
  SupportedStyles:
  - predicate
  - comparison
  Exclude:
  - "/private/var/folders/65/bmfgj4lx7852pgszfg48cvf80000gn/T/d20171204-5486-1t77paf/spec/**/*"

# Supports --auto-correct
Style/OrAssignment:
  Description: Recommend usage of double pipe equals (||=) where applicable.
  StyleGuide: "#double-pipe-for-uninit"
  Enabled: true

# Supports --auto-correct
Style/RedundantConditional:
  Description: Don't return true/false from a conditional.
  Enabled: true

# Supports --auto-correct
Style/ReturnNil:
  Description: Use return instead of return nil.
  Enabled: false
  EnforcedStyle: return
  SupportedStyles:
  - return
  - return_nil

# Supports --auto-correct
Style/SafeNavigation:
  Description: This cop transforms usages of a method call safeguarded by a check for
    the existance of the object to safe navigation (`&.`).
  Enabled: true
  ConvertCodeThatCanStartToReturnNil: false

# Supports --auto-correct
Style/StderrPuts:
  Description: Use `warn` instead of `$stderr.puts`.
  StyleGuide: "#warn"
  Enabled: true

# Supports --auto-correct
Style/TernaryParentheses:
  Description: Checks for use of parentheses around ternary conditions.
  Enabled: true
  EnforcedStyle: require_no_parentheses
  SupportedStyles:
  - require_parentheses
  - require_no_parentheses
  - require_parentheses_when_complex
  AllowSafeAssignment: true

# Supports --auto-correct
Style/YodaCondition:
  Description: Do not use literals as the first operand of a comparison.
  Reference: https://en.wikipedia.org/wiki/Yoda_conditions
  Enabled: true
  EnforcedStyle: all_comparison_operators
  SupportedStyles:
  - all_comparison_operators
  - equality_operators_only