osem-fcy/.rubocop.yml

196 lines
4.4 KiB
YAML
Raw Normal View History

# Inherit style from another configuration
2014-07-21 13:09:37 +02:00
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:
2014-07-21 14:49:05 +02:00
Enabled: true
2014-07-21 13:09:37 +02: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
# 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
# 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
# Use the new Ruby 1.9 hash syntax
Style/HashSyntax:
Enabled: true
EnforcedStyle: ruby19
# Checks for uses of if with negated condition. Use unless instead
Style/NegatedIf:
Enabled: true
# Do not compare with nil. Use .nil? instead
Style/NilComparison:
Enabled: true
# Checks for redundant uses of self.
Style/RedundantSelf:
Enabled: true
# Checks that operators have space around them, except for ** which should not have surrounding space.
Style/SpaceAroundOperators:
Enabled: true
# Use single quotes unless there's string interpolation
Style/StringLiterals:
Enabled: true
# This cop checks for tabs where spaces should be used.
Style/Tab:
Enabled: true
# Avoid trailing blank lines
Style/TrailingBlankLines:
Enabled: true
# Avoid trailing whitespace
Style/TrailingWhitespace:
Enabled: true
# This cop checks for numeric comparisons that can be replaced by a predicate method.
Style/ZeroLengthPredicate:
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'
Metrics/BlockLength:
Exclude:
- 'spec/models/conference_spec.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
# 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
# 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
# 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
# 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
# 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
# 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
# Do not use duplicated keys in hash literals.
Lint/DuplicatedKey:
Enabled: true
#################### Rails ###############################
2014-08-18 21:26:45 +03:00
# Enforce Rails specific style
Rails:
Enabled: true
# Avoid use of old-style attribute validation
Rails/Validation:
Enabled: true
#################### Performance ###############################
# Identifies places where gsub can be replaced by tr or delete.
Performance/StringReplacement:
Enabled: true