require: - rubocop-performance AllCops: DisabledByDefault: true Lint/AmbiguousOperator: Description: >- Checks for ambiguous operators in the first argument of a method invocation without parentheses. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args' Enabled: true Lint/AmbiguousRegexpLiteral: Description: >- Checks for ambiguous regexp literals in the first argument of a method invocation without parenthesis. Enabled: true Layout/IndentationWidth: Enabled: true Lint/Syntax: Enabled: true Lint/AssignmentInCondition: Description: "Don't use assignment in conditions." StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition' Enabled: true Layout/BlockAlignment: Description: 'Align block ends correctly.' Enabled: true Lint/CircularArgumentReference: Description: "Don't refer to the keyword argument in the default value." Enabled: true Layout/ConditionPosition: Description: >- Checks for condition placed in a confusing position relative to the keyword. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition' Enabled: true Lint/Debugger: Description: 'Check for debugger calls.' Enabled: true Layout/DefEndAlignment: Description: 'Align ends corresponding to defs correctly.' Enabled: true Lint/DeprecatedClassMethods: Description: 'Check for deprecated class method calls.' Enabled: true Lint/DuplicateMethods: Description: 'Check for duplicate methods calls.' Enabled: true Lint/EachWithObjectArgument: Description: 'Check for immutable argument given to each_with_object.' Enabled: true Lint/ElseLayout: Description: 'Check for odd code arrangement in an else block.' Enabled: true Lint/EmptyEnsure: Description: 'Checks for empty ensure block.' Enabled: true Lint/EmptyInterpolation: Description: 'Checks for empty string interpolation.' Enabled: true Layout/EndAlignment: Description: 'Align ends correctly.' Enabled: true Lint/EnsureReturn: Description: 'Do not use return in an ensure block.' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-return-ensure' Enabled: true Security/Eval: Description: 'The use of eval represents a serious security risk.' Enabled: true Lint/FormatParameterMismatch: Description: 'The number of parameters to format/sprint must match the fields.' Enabled: true Lint/SuppressedException: Description: "Don't suppress exception." StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions' Enabled: true Lint/LiteralAsCondition: Description: 'Checks of literals used in conditions.' Enabled: true Lint/LiteralInInterpolation: Description: 'Checks for literals used in interpolation.' Enabled: true Lint/Loop: Description: >- Use Kernel#loop with break rather than begin/end/until or begin/end/while for post-loop tests. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break' Enabled: true Lint/NestedMethodDefinition: Description: 'Do not use nested method definitions.' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods' Enabled: true Lint/NonLocalExitFromIterator: Description: 'Do not use return in iterator to cause non-local exit.' Enabled: true Lint/ParenthesesAsGroupedExpression: Description: >- Checks for method calls with a space before the opening parenthesis. StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces' Enabled: true Lint/RequireParentheses: Description: >- Use parentheses in the method call to avoid confusion about precedence. Enabled: true Lint/RescueException: Description: 'Avoid rescuing the Exception class.' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-blind-rescues' Enabled: true Lint/ShadowingOuterLocalVariable: Description: >- Do not use the same name as outer local variable for block arguments or block local variables. Enabled: true Lint/RedundantStringCoercion: Description: 'Checks for Object#to_s usage in string interpolation.' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-to-s' Enabled: true Lint/UnderscorePrefixedVariableName: Description: 'Do not use prefix `_` for a variable that is used.' Enabled: true Lint/RedundantCopDisableDirective: Description: >- Checks for rubocop:disable comments that can be removed. Note: this cop is not disabled when disabling all cops. It must be explicitly disabled. Enabled: true Lint/UnusedBlockArgument: Description: 'Checks for unused block arguments.' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars' Enabled: true Lint/UnusedMethodArgument: Description: 'Checks for unused method arguments.' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars' Enabled: true Lint/UnreachableCode: Description: 'Unreachable code.' Enabled: true Lint/UselessAccessModifier: Description: 'Checks for useless access modifiers.' Enabled: true Lint/UselessAssignment: Description: 'Checks for useless assignment to a local variable.' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars' Enabled: true Lint/BinaryOperatorWithIdenticalOperands: Description: 'Checks for comparison of something with itself.' Enabled: true Lint/UselessElseWithoutRescue: Description: 'Checks for useless `else` in `begin..end` without `rescue`.' Enabled: true Lint/UselessSetterCall: Description: 'Checks for useless setter call to a local variable.' Enabled: true Lint/Void: Description: 'Possible use of operator/literal/variable in void context.' Enabled: true ###################### Metrics #################################### Metrics/BlockNesting: Description: 'Avoid excessive block nesting' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count' Enabled: true Max: 4 Metrics/ClassLength: Description: 'Avoid classes longer than 260 lines of code.' Enabled: true Max: 260 Exclude: - lib/pact_broker/test/*.rb Metrics/CyclomaticComplexity: Description: >- A complexity metric that is strongly correlated to the number of test cases needed to validate a method. Enabled: true Exclude: - ./lib/pact_broker/ui/app.rb Metrics/MethodLength: Description: 'Avoid methods longer than 30 lines of code.' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods' Enabled: true Max: 30 Exclude: - ./lib/pact_broker/ui/app.rb Metrics/ModuleLength: Description: 'Avoid modules longer than 250 lines of code.' Enabled: true Max: 250 Exclude: - spec/**/*.rb - lib/pact_broker/api/pact_broker_urls.rb Metrics/ParameterLists: Description: 'Avoid parameter lists longer than three or four parameters.' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params' Enabled: true Exclude: - lib/pact_broker/test/*.rb ##################### Performance ############################# Performance/Count: Description: >- Use `count` instead of `select...size`, `reject...size`, `select...count`, `reject...count`, `select...length`, and `reject...length`. Enabled: true Performance/Detect: Description: >- Use `detect` instead of `select.first`, `find_all.first`, `select.last`, and `find_all.last`. Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code' Enabled: true Performance/FlatMap: Description: >- Use `Enumerable#flat_map` instead of `Enumerable#map...Array#flatten(1)` or `Enumberable#collect..Array#flatten(1)` Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code' Enabled: true EnabledForFlattenWithoutParams: false # If enabled, this cop will warn about usages of # `flatten` being called without any parameters. # This can be dangerous since `flat_map` will only flatten 1 level, and # `flatten` without any parameters can flatten multiple levels. Performance/ReverseEach: Description: 'Use `reverse_each` instead of `reverse.each`.' Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code' Enabled: true Style/Sample: Description: >- Use `sample` instead of `shuffle.first`, `shuffle.last`, and `shuffle[Fixnum]`. Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code' Enabled: true Style/StringLiterals: Description: Checks if uses of quotes match the configured preference. Enabled: true EnforcedStyle: double_quotes Performance/Size: Description: >- Use `size` instead of `count` for counting the number of elements in `Array` and `Hash`. Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code' Enabled: true Performance/StringReplacement: Description: >- Use `tr` instead of `gsub` when you are replacing the same number of characters. Use `delete` instead of `gsub` when you are deleting characters. Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code' Enabled: true Layout/SpaceBeforeFirstArg: Description: >- Checks that exactly one space is used between a method name and the first argument for method calls without parentheses. Enabled: true