# This is the default configuration file. Enabling and disabling is configured # in separate files. This file adds all other parameters apart from Enabled. inherit_from: - config/rubocop_enabled.yml - config/rubocop_disabled.yml # Common configuration. AllCops: # Include gemspec and Rakefile Include: - '**/*.gemspec' - '**/*.podspec' - '**/*.jbuilder' - '**/*.rake' - '**/*.opal' - '**/Gemfile' - '**/Rakefile' - '**/Capfile' - '**/Guardfile' - '**/Podfile' - '**/Thorfile' - '**/Vagrantfile' - '**/Berksfile' - '**/Cheffile' - '**/Vagabondfile' Exclude: - 'test/**/*' - 'vendor/**/*' # Cop names are not displayed in offense messages by default. Change behavior # by overriding DisplayCopNames, or by giving the -D/--display-cop-names # option. DisplayCopNames: true # Style guide URLs are not displayed in offense messages by default. Change # behavior by overriding DisplayStyleGuide, or by giving the # -S/--display-style-guide option. DisplayStyleGuide: false # Additional cops that do not reference a style guide rule may be enabled by # default. Change behavior by overriding StyleGuideCopsOnly, or by giving # the --only-guide-cops option. StyleGuideCopsOnly: false Style/EmptyLinesAroundBlockBody: EnforcedStyle: no_empty_lines Style/EmptyLinesAroundClassBody: EnforcedStyle: empty_lines Style/EmptyLinesAroundModuleBody: EnforcedStyle: empty_lines # Built-in global variables are allowed by default. Style/GlobalVars: AllowedVariables: [$LIB_DIR] # `MinBodyLength` defines the number of lines of the a body of an if / unless # needs to have to trigger this cop Style/GuardClause: MinBodyLength: 1 Style/IfUnlessModifier: MaxLineLength: 80 Style/IndentationWidth: Width: 2 # Checks the indentation of the first key in a hash literal. Style/IndentHash: # The value `special_inside_parentheses` means that hash literals with braces # that have their opening brace on the same line as a surrounding opening # round parenthesis, shall have their first key indented relative to the # first position inside the parenthesis. # The value `consistent` means that the indentation of the first key shall # always be relative to the first position of the line where the opening # brace is. EnforcedStyle: special_inside_parentheses SupportedStyles: - special_inside_parentheses - consistent Style/ModuleFunction: Enabled: false Style/Next: # With `always` all conditions at the end of an iteration needs to be # replaced by next - with `skip_modifier_ifs` the modifier if like this one # are ignored: [1, 2].each { |a| return 'yes' if a == 1 } EnforcedStyle: skip_modifier_ifs # `MinBodyLength` defines the number of lines of the a body of an if / unless # needs to have to trigger this cop MinBodyLength: 3 SupportedStyles: - skip_modifier_ifs - always Style/SpaceAroundEqualsInParameterDefault: EnforcedStyle: space Style/SpaceBeforeBlockBraces: EnforcedStyle: space Style/SpaceInsideBlockBraces: EnforcedStyle: space Style/SpaceInsideHashLiteralBraces: EnforcedStyle: space Style/TrailingBlankLines: EnforcedStyle: final_newline Style/TrailingCommaInLiteral: EnforcedStyleForMultiline: comma ##################### Metrics ################################## Metrics/AbcSize: # The ABC size is a calculated magnitude, so this number can be a Fixnum or # a Float. Max: 20 Metrics/BlockNesting: Max: 3 Metrics/ClassLength: CountComments: false # count full line comments? Max: 100 # Avoid complex methods. Metrics/CyclomaticComplexity: Max: 10 Metrics/LineLength: Max: 80 # To make it possible to copy or click on URIs in the code, we allow lines # contaning a URI to be longer than Max. AllowURI: true URISchemes: - http - https Metrics/MethodLength: CountComments: false # count full line comments? Max: 70 Metrics/ParameterLists: Max: 5 CountKeywordArgs: true Metrics/PerceivedComplexity: Max: 12 ##################### Lint ################################## # Allow safe assignment in conditions. Lint/AssignmentInCondition: AllowSafeAssignment: true # Align ends correctly. Lint/EndAlignment: # The value `keyword` means that `end` should be aligned with the matching # keyword (if, while, etc.). # The value `variable` means that in assignments, `end` should be aligned # with the start of the variable on the left hand side of `=`. In all other # situations, `end` should still be aligned with the keyword. AlignWith: keyword SupportedStyles: - keyword - variable Lint/DefEndAlignment: # The value `def` means that `end` should be aligned with the def keyword. # The value `start_of_line` means that `end` should be aligned with method # calls like `private`, `public`, etc, if present in front of the `def` # keyword on the same line. AlignWith: start_of_line SupportedStyles: - start_of_line - def