mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
This groups related cops in rubocop configuration file together and arranges them in an alphabetical order Close #1385
157 lines
3.5 KiB
YAML
157 lines
3.5 KiB
YAML
# Inherit style from another configuration
|
|
inherit_from: .rubocop_todo.yml
|
|
|
|
# Apply rule to all cops
|
|
AllCops:
|
|
Include:
|
|
- '**/Rakefile'
|
|
- '**/config.ru'
|
|
Exclude:
|
|
- 'db/schema.rb'
|
|
- 'vendor/bundle/**/*'
|
|
- 'bundle/**/*'
|
|
- 'config/**/*'
|
|
- 'bin/*'
|
|
|
|
#################### Style ###############################
|
|
|
|
# Align the elements of a hash literal if they span more than one line
|
|
Style/AlignHash:
|
|
Enabled: true
|
|
|
|
# Align the parameters of a method call if they span more than one line
|
|
Style/AlignParameters:
|
|
Enabled: true
|
|
|
|
# Use && instead of and, use || instead of or
|
|
Style/AndOr:
|
|
Enabled: true
|
|
|
|
# Avoid redundunt curly braces when it is obvious that hash is used
|
|
Style/BracesAroundHashParameters:
|
|
Enabled: true
|
|
|
|
# Avoid the use of the case equality operator `===`
|
|
Style/CaseEquality:
|
|
Enabled: true
|
|
|
|
# Use nested module/class definitions instead of compact style
|
|
Style/ClassAndModuleChildren:
|
|
Enabled: true
|
|
|
|
# Checks for uses of double negation (!!) to convert something to a boolean value.
|
|
Style/DoubleNegation:
|
|
Enabled: true
|
|
|
|
# Use one empty line between method definitions
|
|
Style/EmptyLineBetweenDefs:
|
|
Enabled: true
|
|
|
|
# There should be only one empty line in designated place
|
|
Style/EmptyLines:
|
|
Enabled: true
|
|
|
|
# Keep a blank line before and after private.
|
|
Style/EmptyLinesAroundAccessModifier:
|
|
Enabled: true
|
|
|
|
# Use hash literal {} instead of Hash.new
|
|
Style/EmptyLiteral:
|
|
Enabled: true
|
|
|
|
# Prefer `each` over `for i`
|
|
Style/For:
|
|
Enabled: true
|
|
|
|
# Checks that operators have space around them, except for ** which should not have surrounding space.
|
|
Style/SpaceAroundOperators:
|
|
Enabled: true
|
|
|
|
# Use the new Ruby 1.9 hash syntax
|
|
Style/HashSyntax:
|
|
Enabled: true
|
|
EnforcedStyle: ruby19
|
|
|
|
# Do not compare with nil. Use .nil? instead
|
|
Style/NilComparison:
|
|
Enabled: true
|
|
|
|
# Use single quotes unless there's string interpolation
|
|
Style/StringLiterals:
|
|
Enabled: true
|
|
|
|
# Avoid trailing blank lines
|
|
Style/TrailingBlankLines:
|
|
Enabled: true
|
|
|
|
# Avoid trailing whitespace
|
|
Style/TrailingWhitespace:
|
|
Enabled: true
|
|
|
|
#################### Metrics ###############################
|
|
|
|
# Avoid deep blocks nesting
|
|
Metrics/BlockNesting:
|
|
Max: 4
|
|
|
|
# Avoid writing classes that are more than 300 lines
|
|
Metrics/ClassLength:
|
|
Max: 300
|
|
Exclude:
|
|
- 'app/models/conference.rb'
|
|
|
|
#################### Lint ###############################
|
|
|
|
# Wrap your assignment in condition if you mean it, otherwise it is most likely equality check
|
|
Lint/AssignmentInCondition:
|
|
Enabled: true
|
|
|
|
# Align blocks of code properly
|
|
Lint/BlockAlignment:
|
|
Enabled: true
|
|
|
|
# Things deprecated in current ruby API
|
|
Lint/DeprecatedClassMethods:
|
|
Enabled: true
|
|
|
|
# Do not use literal in conditions. We have it enabled for now
|
|
Lint/LiteralInCondition:
|
|
Enabled: false
|
|
|
|
# Prefer `Kernel#loop -> break` over `begin -> while`
|
|
Lint/Loop:
|
|
Enabled: true
|
|
|
|
# Do not put space before arguments when they are in parentheses
|
|
Lint/ParenthesesAsGroupedExpression:
|
|
Enabled: true
|
|
|
|
# Do not rescue Exceptions class itself
|
|
Lint/RescueException:
|
|
Enabled: true
|
|
|
|
# Do not shadow local variables in blocks, choose other name
|
|
Lint/ShadowingOuterLocalVariable:
|
|
Enabled: true
|
|
|
|
# Use _ or variable_name to explicitly mark variable as unused
|
|
Lint/UnusedBlockArgument:
|
|
Enabled: true
|
|
|
|
# Use _ or _argument_name to explicitly mark argument as unused
|
|
Lint/UnusedMethodArgument:
|
|
Enabled: true
|
|
|
|
# Avoid useless assignment
|
|
Lint/UselessAssignment:
|
|
Enabled: true
|
|
|
|
# Do not use variables in void context
|
|
Lint/Void:
|
|
Enabled: true
|
|
|
|
#################### Rails ###############################
|
|
|
|
# Enforce Rails specific style
|
|
Rails:
|
|
Enabled: true
|