2017-03-24 20:13:02 +01:00
|
|
|
# Inherit style from another configuration
|
2014-07-21 13:09:37 +02:00
|
|
|
inherit_from: .rubocop_todo.yml
|
|
|
|
|
|
2017-03-24 20:13:02 +01:00
|
|
|
# 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:
|
2014-07-21 14:49:05 +02:00
|
|
|
Enabled: true
|
2014-07-21 13:09:37 +02:00
|
|
|
|
2017-03-24 20:13:02 +01:00
|
|
|
# Align the parameters of a method call if they span more than one line
|
|
|
|
|
Style/AlignParameters:
|
2014-07-21 13:09:37 +02:00
|
|
|
Enabled: true
|
|
|
|
|
|
2017-03-24 20:13:02 +01:00
|
|
|
# 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
|
|
|
|
|
|
2017-04-06 23:19:58 -04:00
|
|
|
# Checks the . position in multi-line method calls.
|
|
|
|
|
Style/DotPosition:
|
|
|
|
|
Enabled: true
|
|
|
|
|
|
2017-03-24 20:13:02 +01:00
|
|
|
# Checks for uses of double negation (!!) to convert something to a boolean value.
|
|
|
|
|
Style/DoubleNegation:
|
2014-07-21 13:09:37 +02:00
|
|
|
Enabled: true
|
|
|
|
|
|
2014-07-21 14:27:32 +02:00
|
|
|
# Use one empty line between method definitions
|
2014-07-21 13:09:37 +02:00
|
|
|
Style/EmptyLineBetweenDefs:
|
|
|
|
|
Enabled: true
|
|
|
|
|
|
2014-07-21 14:27:32 +02:00
|
|
|
# There should be only one empty line in designated place
|
2014-07-21 13:09:37 +02:00
|
|
|
Style/EmptyLines:
|
2014-07-21 14:27:32 +02:00
|
|
|
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
|
|
|
|
|
|
2017-03-24 20:13:02 +01:00
|
|
|
# Use the new Ruby 1.9 hash syntax
|
|
|
|
|
Style/HashSyntax:
|
|
|
|
|
Enabled: true
|
|
|
|
|
EnforcedStyle: ruby19
|
|
|
|
|
|
2017-03-28 22:20:27 -04:00
|
|
|
# Checks for uses of if with negated condition. Use unless instead
|
|
|
|
|
Style/NegatedIf:
|
|
|
|
|
Enabled: true
|
|
|
|
|
|
2017-03-24 20:13:02 +01:00
|
|
|
# Do not compare with nil. Use .nil? instead
|
|
|
|
|
Style/NilComparison:
|
|
|
|
|
Enabled: true
|
|
|
|
|
|
2017-03-28 13:27:52 +05:30
|
|
|
# Checks for redundant uses of self.
|
|
|
|
|
Style/RedundantSelf:
|
|
|
|
|
Enabled: true
|
|
|
|
|
|
2017-03-28 22:20:27 -04:00
|
|
|
# Checks that operators have space around them, except for ** which should not have surrounding space.
|
|
|
|
|
Style/SpaceAroundOperators:
|
|
|
|
|
Enabled: true
|
|
|
|
|
|
2017-03-24 20:13:02 +01:00
|
|
|
# Use single quotes unless there's string interpolation
|
|
|
|
|
Style/StringLiterals:
|
|
|
|
|
Enabled: true
|
|
|
|
|
|
2017-04-04 11:48:52 -06:00
|
|
|
# This cop checks for tabs where spaces should be used.
|
|
|
|
|
Style/Tab:
|
|
|
|
|
Enabled: true
|
|
|
|
|
|
2017-03-24 20:13:02 +01:00
|
|
|
# Avoid trailing blank lines
|
|
|
|
|
Style/TrailingBlankLines:
|
|
|
|
|
Enabled: true
|
|
|
|
|
|
|
|
|
|
# Avoid trailing whitespace
|
|
|
|
|
Style/TrailingWhitespace:
|
|
|
|
|
Enabled: true
|
|
|
|
|
|
2017-04-07 23:58:43 -04:00
|
|
|
# This cop checks for numeric comparisons that can be replaced by a predicate method.
|
2017-03-28 14:42:21 +05:30
|
|
|
Style/ZeroLengthPredicate:
|
|
|
|
|
Enabled: true
|
|
|
|
|
|
2017-03-24 20:13:02 +01:00
|
|
|
#################### 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 ###############################
|
|
|
|
|
|
2014-07-21 14:27:32 +02:00
|
|
|
# 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
|
|
|
|
|
|
2017-03-24 20:13:02 +01:00
|
|
|
# Things deprecated in current ruby API
|
|
|
|
|
Lint/DeprecatedClassMethods:
|
|
|
|
|
Enabled: true
|
|
|
|
|
|
2014-07-21 14:27:32 +02:00
|
|
|
# Do not use literal in conditions. We have it enabled for now
|
|
|
|
|
Lint/LiteralInCondition:
|
2014-07-21 13:09:37 +02:00
|
|
|
Enabled: false
|
|
|
|
|
|
2014-07-21 14:27:32 +02:00
|
|
|
# Prefer `Kernel#loop -> break` over `begin -> while`
|
|
|
|
|
Lint/Loop:
|
|
|
|
|
Enabled: true
|
|
|
|
|
|
2017-03-24 20:13:02 +01:00
|
|
|
# Do not put space before arguments when they are in parentheses
|
2014-07-21 14:27:32 +02:00
|
|
|
Lint/ParenthesesAsGroupedExpression:
|
|
|
|
|
Enabled: true
|
|
|
|
|
|
2014-07-21 14:37:26 +02:00
|
|
|
# Do not rescue Exceptions class itself
|
2014-07-21 14:27:32 +02:00
|
|
|
Lint/RescueException:
|
|
|
|
|
Enabled: true
|
|
|
|
|
|
2017-03-24 20:13:02 +01:00
|
|
|
# Do not shadow local variables in blocks, choose other name
|
2014-07-21 14:27:32 +02:00
|
|
|
Lint/ShadowingOuterLocalVariable:
|
2014-07-21 14:37:26 +02:00
|
|
|
Enabled: true
|
2014-07-21 13:09:37 +02:00
|
|
|
|
2017-03-24 20:13:02 +01:00
|
|
|
# Use _ or variable_name to explicitly mark variable as unused
|
2014-07-21 14:27:32 +02:00
|
|
|
Lint/UnusedBlockArgument:
|
2014-07-21 14:37:26 +02:00
|
|
|
Enabled: true
|
2014-07-21 13:09:37 +02:00
|
|
|
|
2017-03-24 20:13:02 +01:00
|
|
|
# Use _ or _argument_name to explicitly mark argument as unused
|
2014-07-21 14:27:32 +02:00
|
|
|
Lint/UnusedMethodArgument:
|
2014-07-21 14:37:26 +02:00
|
|
|
Enabled: true
|
2014-07-21 14:27:32 +02:00
|
|
|
|
2017-03-24 20:13:02 +01:00
|
|
|
# Avoid useless assignment
|
2014-07-21 14:27:32 +02:00
|
|
|
Lint/UselessAssignment:
|
2014-07-21 14:37:26 +02:00
|
|
|
Enabled: true
|
2014-07-21 13:09:37 +02:00
|
|
|
|
2014-07-21 14:49:05 +02:00
|
|
|
# Do not use variables in void context
|
2014-07-21 14:27:32 +02:00
|
|
|
Lint/Void:
|
2014-07-21 14:45:17 +02:00
|
|
|
Enabled: true
|
2014-07-21 14:27:32 +02:00
|
|
|
|
2017-04-05 17:33:14 +01:00
|
|
|
# Do not use duplicated keys in hash literals.
|
|
|
|
|
Lint/DuplicatedKey:
|
|
|
|
|
Enabled: true
|
|
|
|
|
|
2017-03-24 20:13:02 +01:00
|
|
|
#################### Rails ###############################
|
2014-08-18 21:26:45 +03:00
|
|
|
|
2017-03-28 21:47:17 +02:00
|
|
|
# Enforce Rails specific style
|
2017-03-24 20:13:02 +01:00
|
|
|
Rails:
|
2017-03-20 19:12:40 +05:30
|
|
|
Enabled: true
|
2017-03-28 21:47:17 +02:00
|
|
|
|
|
|
|
|
# Avoid use of old-style attribute validation
|
|
|
|
|
Rails/Validation:
|
|
|
|
|
Enabled: true
|
2017-04-07 23:58:43 -04:00
|
|
|
|
|
|
|
|
#################### Performance ###############################
|
|
|
|
|
|
|
|
|
|
# Identifies places where gsub can be replaced by tr or delete.
|
|
|
|
|
Performance/StringReplacement:
|
|
|
|
|
Enabled: true
|