Skip to content

Commit

Permalink
Add Style enforcer (via Rubocop)
Browse files Browse the repository at this point in the history
It will fail the build, but as it is currently,
most of the cops are 'todos'. Great for new contributors.. :)
  • Loading branch information
bf4 committed Sep 4, 2015
1 parent 6784866 commit 09c97de
Show file tree
Hide file tree
Showing 12 changed files with 430 additions and 10 deletions.
49 changes: 49 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
inherit_from: .rubocop_todo.yml

AllCops:
Exclude:
- config/initializers/forbidden_yaml.rb
- !ruby/regexp /(vendor|bundle|bin|db)\/.*/
RunRailsCops: true
DisplayCopNames: true
DisplayStyleGuide: true

Lint/NestedMethodDefinition:
Enabled: false
Exclude:
- test/action_controller/serialization_test.rb

Style/StringLiterals:
EnforcedStyle: single_quotes

Metrics/AbcSize:
Max: 35 # TODO: Lower to 15

Metrics/ClassLength:
Max: 261 # TODO: Lower to 100
Exclude:
- test/**/*.rb

Metrics/CyclomaticComplexity:
Max: 7 # TODO: Lower to 6

Metrics/LineLength:
Max: 251 # TODO: Lower to 80

Metrics/MethodLength:
Max: 106 # TODO: Lower to 10

Metrics/PerceivedComplexity:
Max: 9 # TODO: Lower to 7

Style/AlignParameters:
EnforcedStyle: with_fixed_indentation

Style/ClassAndModuleChildren:
EnforcedStyle: compact

Style/Documentation:
Enabled: false

Style/MultilineOperationIndentation:
EnforcedStyle: indented
347 changes: 347 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,347 @@
# This configuration was generated by `rubocop --auto-gen-config`
# on 2015-08-30 23:03:50 -0500 using RuboCop version 0.31.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# Configuration parameters: AllowSafeAssignment.
Lint/AssignmentInCondition:
Enabled: false

# Offense count: 1
Lint/EmptyEnsure:
Enabled: false

# Offense count: 1
Lint/HandleExceptions:
Enabled: false

# Offense count: 2
# Cop supports --auto-correct.
Lint/UnusedBlockArgument:
Enabled: false

# Offense count: 9
# Cop supports --auto-correct.
Lint/UnusedMethodArgument:
Enabled: false

# Offense count: 1
Lint/UselessAccessModifier:
Enabled: false

# Offense count: 3
Lint/UselessAssignment:
Enabled: false

# Offense count: 1
# Configuration parameters: EnforcedStyle, SupportedStyles.
Rails/Date:
Enabled: false

# Offense count: 8
# Configuration parameters: EnforcedStyle, SupportedStyles.
Rails/TimeZone:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/AccessModifierIndentation:
Enabled: false

# Offense count: 16
# Cop supports --auto-correct.
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
Style/AlignHash:
Enabled: false

# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/AlignParameters:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/AndOr:
Enabled: false

# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
Style/BlockDelimiters:
Enabled: false

# Offense count: 46
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/BracesAroundHashParameters:
Enabled: false

# Offense count: 167
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassAndModuleChildren:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/CommentIndentation:
Enabled: false

# Offense count: 1
Style/DoubleNegation:
Enabled: false

# Offense count: 1
Style/EachWithObject:
Enabled: false

# Offense count: 4
# Cop supports --auto-correct.
Style/EmptyLines:
Enabled: false

# Offense count: 3
# Cop supports --auto-correct.
Style/EmptyLinesAroundAccessModifier:
Enabled: false

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/EmptyLinesAroundBlockBody:
Enabled: false

# Offense count: 16
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/EmptyLinesAroundClassBody:
Enabled: false

# Offense count: 9
# Cop supports --auto-correct.
Style/EmptyLinesAroundMethodBody:
Enabled: false

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/EmptyLinesAroundModuleBody:
Enabled: false

# Offense count: 3
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Enabled: false

# Offense count: 12
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
Style/HashSyntax:
Enabled: false

# Offense count: 9
# Cop supports --auto-correct.
Style/IndentArray:
Enabled: false

# Offense count: 8
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/IndentHash:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/IndentationConsistency:
Enabled: false

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: Width.
Style/IndentationWidth:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/Lambda:
Enabled: false

# Offense count: 2
# Cop supports --auto-correct.
Style/MethodCallParentheses:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/MethodDefParentheses:
Enabled: false

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/MultilineOperationIndentation:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/NegatedIf:
Enabled: false

# Offense count: 1
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
Style/Next:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/NumericLiterals:
MinDigits: 7

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters.
Style/PercentLiteralDelimiters:
Enabled: false

# Offense count: 2
# Cop supports --auto-correct.
Style/PerlBackrefs:
Enabled: false

# Offense count: 6
# Configuration parameters: NamePrefix, NamePrefixBlacklist.
Style/PredicateName:
Enabled: false

# Offense count: 7
# Cop supports --auto-correct.
Style/RedundantSelf:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AllowAsExpressionSeparator.
Style/Semicolon:
Enabled: false

# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/SignalException:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AllowIfMethodIsEmpty.
Style/SingleLineMethods:
Enabled: false

# Offense count: 26
# Cop supports --auto-correct.
Style/SpaceAfterColon:
Enabled: false

# Offense count: 7
# Cop supports --auto-correct.
Style/SpaceAfterComma:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/SpaceAfterNot:
Enabled: false

# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/SpaceAroundEqualsInParameterDefault:
Enabled: false

# Offense count: 39
# Cop supports --auto-correct.
# Configuration parameters: MultiSpaceAllowedForOperators.
Style/SpaceAroundOperators:
Enabled: false

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/SpaceBeforeBlockBraces:
Enabled: false

# Offense count: 8
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
Style/SpaceInsideBlockBraces:
Enabled: false

# Offense count: 20
# Cop supports --auto-correct.
Style/SpaceInsideBrackets:
Enabled: false

# Offense count: 179
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
Style/SpaceInsideHashLiteralBraces:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/SpaceInsideParens:
Enabled: false

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/StringLiteralsInInterpolation:
Enabled: false

# Offense count: 1
Style/StructInheritance:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: IgnoredMethods.
Style/SymbolProc:
Enabled: false

# Offense count: 9
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/TrailingBlankLines:
Enabled: false

# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
Style/TrailingComma:
Enabled: false

# Offense count: 2
# Cop supports --auto-correct.
Style/TrailingWhitespace:
Enabled: false

# Offense count: 1
Style/UnlessElse:
Enabled: false

# Offense count: 2
# Cop supports --auto-correct.
Style/UnneededPercentQ:
Enabled: false

# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: WordRegex.
Style/WordArray:
MinSize: 2
Loading

0 comments on commit 09c97de

Please sign in to comment.