Commit 361a68fe authored by Bob Van Landuyt's avatar Bob Van Landuyt 💬
Browse files

Merge branch '22-update-rubocop-to-0.93.1' into 'master'

Update RuboCop to 0.93.1

Closes #22

See merge request gitlab-org/labkit-ruby!65
parents 8c5bdc6e 0070f3c2
Loading
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -27,11 +27,9 @@ test:2.5:
  <<: *test_definition

static-analysis:
  # RuboCop 0.65.0 supports Ruby 2.6 at maximum
  image: ruby:2.6
  image: ruby:2.7
  before_script:
    - bundle install
    - echo '2.6.6' > .ruby-version
  script:
    - rake verify

+110 −4
Original line number Diff line number Diff line
inherit_from: .rubocop_todo.yml

AllCops:
  TargetRubyVersion: 2.4
  TargetRubyVersion: 2.7

require:
  - rubocop-rspec
@@ -36,6 +36,9 @@ Style/Lambda:
Layout/MultilineMethodCallIndentation:
  Enabled: No

Layout/LineLength:
  Enabled: false

Layout/SpaceInLambdaLiteral:
  Enabled: No

@@ -63,9 +66,6 @@ Metrics/CyclomaticComplexity:
  Enabled: true
  Max: 13

Metrics/LineLength:
  Enabled: false

Metrics/MethodLength:
  Enabled: false

@@ -176,3 +176,109 @@ RSpec/SubjectStub:

RSpec/VerifiedDoubles:
  Enabled: false

Layout/BeginEndAlignment: # (new in 0.91)
  Enabled: true
Layout/EmptyLinesAroundAttributeAccessor: # (new in 0.83)
  Enabled: true
Layout/SpaceAroundMethodCallOperator: # (new in 0.82)
  Enabled: true
Lint/BinaryOperatorWithIdenticalOperands: # (new in 0.89)
  Enabled: true
Lint/ConstantDefinitionInBlock: # (new in 0.91)
  Enabled: true
Lint/DeprecatedOpenSSLConstant: # (new in 0.84)
  Enabled: true
Lint/DuplicateElsifCondition: # (new in 0.88)
  Enabled: true
Lint/DuplicateRequire: # (new in 0.90)
  Enabled: true
Lint/DuplicateRescueException: # (new in 0.89)
  Enabled: true
Lint/EmptyConditionalBody: # (new in 0.89)
  Enabled: true
Lint/EmptyFile: # (new in 0.90)
  Enabled: true
Lint/FloatComparison: # (new in 0.89)
  Enabled: true
Lint/HashCompareByIdentity: # (new in 0.93)
  Enabled: true
Lint/IdentityComparison: # (new in 0.91)
  Enabled: true
Lint/MissingSuper: # (new in 0.89)
  Enabled: true
Lint/MixedRegexpCaptureTypes: # (new in 0.85)
  Enabled: true
Lint/OutOfRangeRegexpRef: # (new in 0.89)
  Enabled: true
Lint/RaiseException: # (new in 0.81)
  Enabled: true
Lint/RedundantSafeNavigation: # (new in 0.93)
  Enabled: true
Lint/SelfAssignment: # (new in 0.89)
  Enabled: true
Lint/StructNewOverride: # (new in 0.81)
  Enabled: true
Lint/TopLevelReturnWithArgument: # (new in 0.89)
  Enabled: true
Lint/TrailingCommaInAttributeDeclaration: # (new in 0.90)
  Enabled: true
Lint/UnreachableLoop: # (new in 0.89)
  Enabled: true
Lint/UselessMethodDefinition: # (new in 0.90)
  Enabled: true
Lint/UselessTimes: # (new in 0.91)
  Enabled: true
Style/AccessorGrouping: # (new in 0.87)
  Enabled: true
Style/BisectedAttrAccessor: # (new in 0.87)
  Enabled: true
Style/CaseLikeIf: # (new in 0.88)
  Enabled: true
Style/ClassEqualityComparison: # (new in 0.93)
  Enabled: true
Style/CombinableLoops: # (new in 0.90)
  Enabled: true
Style/ExplicitBlockArgument: # (new in 0.89)
  Enabled: true
Style/ExponentialNotation: # (new in 0.82)
  Enabled: true
Style/GlobalStdStream: # (new in 0.89)
  Enabled: true
Style/HashAsLastArrayItem: # (new in 0.88)
  Enabled: true
Style/HashEachMethods: # (new in 0.80)
  Enabled: true
Style/HashLikeCase: # (new in 0.88)
  Enabled: true
Style/HashTransformKeys: # (new in 0.80)
  Enabled: true
Style/HashTransformValues: # (new in 0.80)
  Enabled: true
Style/KeywordParametersOrder: # (new in 0.90)
  Enabled: true
Style/OptionalBooleanParameter: # (new in 0.89)
  Enabled: true
Style/RedundantAssignment: # (new in 0.87)
  Enabled: true
Style/RedundantFetchBlock: # (new in 0.86)
  Enabled: true
Style/RedundantFileExtensionInRequire: # (new in 0.88)
  Enabled: true
Style/RedundantRegexpCharacterClass: # (new in 0.85)
  Enabled: true
Style/RedundantRegexpEscape: # (new in 0.85)
  Enabled: true
Style/RedundantSelfAssignment: # (new in 0.90)
  Enabled: true
Style/SingleArgumentDig: # (new in 0.89)
  Enabled: true
Style/SlicingWithRange: # (new in 0.83)
  Enabled: true
Style/SoleNestedConditional: # (new in 0.89)
  Enabled: true
Style/StringConcatenation: # (new in 0.89)
  Enabled: true

RSpec/StubbedMock: # (new in 1.44)
  Enabled: true
+127 −39
Original line number Diff line number Diff line
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2021-04-13 00:00:00 +0000 using RuboCop version 0.65.0.
# on 2021-04-14 00:00:00 UTC using RuboCop version 0.93.1.
# 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
@@ -8,30 +8,53 @@

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
# Include: **/*.gemspec
Gemspec/OrderedDependencies:
  Exclude:
    - 'gitlab-labkit.gemspec'

# Offense count: 1
# Configuration parameters: Include.
# Include: **/*.gemspec
Gemspec/RequiredRubyVersion:
  Exclude:
    - 'gitlab-labkit.gemspec'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
# SupportedHashRocketStyles: key, separator, table
# SupportedColonStyles: key, separator, table
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
Layout/AlignHash:
Layout/HashAlignment:
  Exclude:
    - 'spec/labkit/context_spec.rb'

# Offense count: 1
Lint/BinaryOperatorWithIdenticalOperands:
  Exclude:
    - 'spec/labkit/tracing/redis/redis_interceptor_helper_spec.rb'

# Offense count: 4
Lint/HandleExceptions:
Lint/ConstantDefinitionInBlock:
  Exclude:
    - 'spec/labkit/excon_publisher_spec.rb'
    - 'spec/labkit/httpclient_publisher_spec.rb'
    - 'spec/labkit/net_http_publisher_spec.rb'
    - 'spec/labkit/middleware/sidekiq/client_spec.rb'
    - 'spec/labkit/middleware/sidekiq/context/client_spec.rb'
    - 'spec/labkit/middleware/sidekiq/context/server_spec.rb'
    - 'spec/labkit/middleware/sidekiq/server_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
Lint/UnneededCopDisableDirective:
# Configuration parameters: AllowedMethods.
# AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal?
Lint/RedundantSafeNavigation:
  Exclude:
    - 'spec/labkit/tracing/rails/action_view_spec.rb'
    - 'lib/labkit/tracing.rb'

# Offense count: 8
# Cop supports --auto-correct.
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
Lint/UnusedMethodArgument:
  Exclude:
    - 'lib/labkit/logging/grpc/server_interceptor.rb'
@@ -41,12 +64,12 @@ Lint/UnusedMethodArgument:
    - 'lib/labkit/tracing/rails/active_support/cache_read_instrumenter.rb'
    - 'lib/labkit/tracing/rails/active_support/cache_write_instrumenter.rb'

# Offense count: 3
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
# AllowedNames: io, id, to, by, on, in, at, ip, db
Naming/UncommunicativeMethodParamName:
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: PreferredName.
Naming/RescuedExceptionsVariableName:
  Exclude:
    - 'spec/support/grpc_service/test_service_impl.rb'
    - 'lib/labkit/logging/grpc/server_interceptor.rb'

# Offense count: 6
# Cop supports --auto-correct.
@@ -72,39 +95,69 @@ RSpec/DescribedClass:
    - 'spec/labkit/tracing_spec.rb'

# Offense count: 2
# Configuration parameters: CustomTransform, IgnoreMethods.
# Configuration parameters: CustomTransform, IgnoreMethods, SpecSuffixOnly.
RSpec/FilePath:
  Exclude:
    - 'spec/labkit/httpclient_publisher_spec.rb'
    - 'spec/logging/sanitizer_spec.rb'

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: single_line_only, single_statement_only, disallow
RSpec/ImplicitSubject:
  Exclude:
    - 'spec/labkit/correlation/correlation_id_spec.rb'

# Offense count: 4
RSpec/LeakyConstantDeclaration:
  Exclude:
    - 'spec/labkit/middleware/sidekiq/client_spec.rb'
    - 'spec/labkit/middleware/sidekiq/context/client_spec.rb'
    - 'spec/labkit/middleware/sidekiq/context/server_spec.rb'
    - 'spec/labkit/middleware/sidekiq/server_spec.rb'

# Offense count: 2
# Cop supports --auto-correct.
RSpec/LetBeforeExamples:
  Exclude:
    - 'spec/labkit/tracing_spec.rb'

# Offense count: 18
# Configuration parameters: AllowSubject.
RSpec/MultipleMemoizedHelpers:
  Max: 7

# Offense count: 15
# Cop supports --auto-correct.
RSpec/ScatteredLet:
  Exclude:
    - 'spec/labkit/excon_publisher_spec.rb'
    - 'spec/labkit/httpclient_publisher_spec.rb'
    - 'spec/labkit/net_http_publisher_spec.rb'

# Offense count: 20
RSpec/StubbedMock:
  Exclude:
    - 'spec/labkit/middleware/rack_spec.rb'
    - 'spec/labkit/middleware/sidekiq/client_spec.rb'
    - 'spec/labkit/middleware/sidekiq/server_spec.rb'
    - 'spec/labkit/middleware/sidekiq/tracing/client_spec.rb'
    - 'spec/labkit/middleware/sidekiq/tracing/server_spec.rb'
    - 'spec/labkit/tracing/factory_spec.rb'
    - 'spec/labkit/tracing_spec.rb'

# Offense count: 1
# Configuration parameters: AllowedChars.
Style/AsciiComments:
  Exclude:
    - 'spec/support/grpc_service/test_service_impl.rb'

# Offense count: 5
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: braces, no_braces, context_dependent
Style/BracesAroundHashParameters:
Style/CaseLikeIf:
  Exclude:
    - 'spec/labkit/net_http_publisher_spec.rb'
    - 'spec/labkit/tracing/rails/action_view_spec.rb'
    - 'lib/labkit/excon_publisher.rb'

# Offense count: 1
# Cop supports --auto-correct.
@@ -125,10 +178,24 @@ Style/Documentation:
    - 'lib/labkit/tracing/rails/active_record.rb'
    - 'lib/labkit/tracing/rails/active_support.rb'

# Offense count: 23
# Cop supports --auto-correct.
Style/ExplicitBlockArgument:
  Exclude:
    - 'lib/labkit/correlation/grpc/server_interceptor.rb'
    - 'lib/labkit/logging/grpc/server_interceptor.rb'
    - 'lib/labkit/middleware/sidekiq/client.rb'
    - 'lib/labkit/middleware/sidekiq/context/server.rb'
    - 'lib/labkit/middleware/sidekiq/server.rb'
    - 'lib/labkit/middleware/sidekiq/tracing/server.rb'
    - 'lib/labkit/tracing/grpc/client_interceptor.rb'
    - 'lib/labkit/tracing/grpc/server_interceptor.rb'
    - 'lib/labkit/tracing/redis/redis_interceptor_helper.rb'

# Offense count: 8
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: when_needed, always, never
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
  Exclude:
    - 'spec/labkit/tracing/rails/active_record/sql_instrumenter_spec.rb'
@@ -140,6 +207,12 @@ Style/FrozenStringLiteralComment:
    - 'spec/support/grpc_service/test_pb.rb'
    - 'tools/update-changelog.rb'

# Offense count: 2
# Cop supports --auto-correct.
Style/GlobalStdStream:
  Exclude:
    - 'lib/labkit/tracing/jaeger_factory.rb'

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
@@ -154,16 +227,6 @@ Style/IfUnlessModifier:
  Exclude:
    - 'tools/update-changelog.rb'

# Offense count: 35
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: line_count_dependent, lambda, literal
Style/Lambda:
  Exclude:
    - 'spec/labkit/excon_publisher_spec.rb'
    - 'spec/labkit/httpclient_publisher_spec.rb'
    - 'spec/labkit/net_http_publisher_spec.rb'

# Offense count: 16
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters.
@@ -171,6 +234,31 @@ Style/PercentLiteralDelimiters:
  Exclude:
    - 'spec/labkit/tracing/redis/redis_interceptor_helper_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
Style/RedundantAssignment:
  Exclude:
    - 'lib/labkit/logging/sanitizer.rb'

# Offense count: 2
# Cop supports --auto-correct.
Style/RedundantBegin:
  Exclude:
    - 'Rakefile'
    - 'spec/labkit/net_http_publisher_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
Style/RedundantPercentQ:
  Exclude:
    - 'spec/logging/sanitizer_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
Style/RedundantRegexpEscape:
  Exclude:
    - 'lib/labkit/logging/sanitizer.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
@@ -179,6 +267,12 @@ Style/RescueStandardError:
  Exclude:
    - 'lib/labkit/excon_publisher.rb'

# Offense count: 1
# Cop supports --auto-correct.
Style/StringConcatenation:
  Exclude:
    - 'lib/labkit/tracing/redis/redis_interceptor_helper.rb'

# Offense count: 28
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline.
@@ -189,12 +283,6 @@ Style/TrailingCommaInArrayLiteral:
    - 'spec/labkit/httpclient_publisher_spec.rb'
    - 'spec/labkit/net_http_publisher_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
Style/UnneededPercentQ:
  Exclude:
    - 'spec/logging/sanitizer_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: WordRegex.
+2 −2
Original line number Diff line number Diff line
@@ -39,8 +39,8 @@ Gem::Specification.new do |spec|
  spec.add_development_dependency "rest-client", "~> 2.1.0"
  spec.add_development_dependency "rspec", "~> 3.8.0"
  spec.add_development_dependency "rspec-parameterized", "~> 0.4"
  spec.add_development_dependency "rubocop", "~> 0.65.0"
  spec.add_development_dependency "rubocop-rspec", "~> 1.22.1"
  spec.add_development_dependency "rubocop", "~> 0.93.1"
  spec.add_development_dependency "rubocop-rspec", "~> 1.44.1"
  spec.add_development_dependency "rufo", "0.9.0"
  spec.add_development_dependency "sidekiq", "~> 5.2.7"
end
+0 −2
Original line number Diff line number Diff line
# frozen_string_literal: true

# rubocop:disable RSpec/MultipleMemoizedHelpers
describe Labkit::Tracing::Rails::ActionView do
  let(:render_template_payload) do
    # https://guides.rubyonrails.org/active_support_instrumentation.html#render-template-action-view
@@ -82,4 +81,3 @@ describe Labkit::Tracing::Rails::ActionView do
    end
  end
end
# rubocop:enable RSpec/MultipleMemoizedHelpers