Skip to content

Commit

Permalink
More Rubocop fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyshields committed May 6, 2024
1 parent bd77b0e commit 14ecb58
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 91 deletions.
9 changes: 6 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ Layout/EmptyLinesAroundClassBody:
Layout/EmptyLinesAroundModuleBody:
Enabled: false

Style/IfUnlessModifier:
Enabled: false

Performance/CollectionLiteralInLoop:
Exclude:
- 'spec/mongoid/association/embedded/embeds_many/proxy_spec.rb'
Expand All @@ -153,6 +150,9 @@ Performance/CollectionLiteralInLoop:
- 'spec/mongoid/criteria/queryable/selectable_spec.rb'
- 'spec/mongoid/criteria/queryable/selector_spec.rb'

Style/IfUnlessModifier:
Enabled: false

# --------------------------------------------------
# These cops are intentionally disabled due to incompatibility.

Expand Down Expand Up @@ -215,6 +215,9 @@ Naming/PredicateName:
- has_attribute?
- has_attribute_before_type_cast?

RSpec/IndexedLet:
Enabled: false

RSpec/NotToNot:
EnforcedStyle: to_not

Expand Down
138 changes: 50 additions & 88 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config --exclude-limit 1000`
# on 2024-01-16 04:19:18 UTC using RuboCop version 1.60.0.
# on 2024-05-06 13:32:48 UTC using RuboCop version 1.63.4.
# 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
Expand All @@ -21,7 +21,7 @@ Lint/SelfAssignment:
- 'spec/integration/associations/has_one_spec.rb'
- 'spec/mongoid/association/embedded/embeds_one/proxy_spec.rb'

# Offense count: 108
# Offense count: 110
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 154
Expand All @@ -37,22 +37,22 @@ Metrics/BlockLength:
Metrics/BlockNesting:
Max: 6

# Offense count: 17
# Offense count: 18
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 337

# Offense count: 51
# Offense count: 52
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/CyclomaticComplexity:
Max: 33

# Offense count: 184
# Offense count: 185
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 87

# Offense count: 22
# Offense count: 21
# Configuration parameters: CountComments, CountAsOne.
Metrics/ModuleLength:
Max: 330
Expand All @@ -63,7 +63,7 @@ Metrics/ParameterLists:
MaxOptionalParameters: 4
Max: 6

# Offense count: 40
# Offense count: 41
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/PerceivedComplexity:
Max: 20
Expand Down Expand Up @@ -262,7 +262,7 @@ RSpec/DescribeClass:
- 'spec/mongoid/railties/console_sandbox_spec.rb'
- 'spec/mongoid/tasks/database_rake_spec.rb'

# Offense count: 124
# Offense count: 120
RSpec/ExpectInHook:
Exclude:
- 'spec/integration/associations/embedded_spec.rb'
Expand Down Expand Up @@ -301,77 +301,17 @@ RSpec/ExpectInHook:
- 'spec/mongoid/serializable_spec.rb'
- 'spec/mongoid/tasks/database_rake_spec.rb'
- 'spec/mongoid/tasks/encryption_spec.rb'
- 'spec/mongoid/validatable/associated_spec.rb'
- 'spec/mongoid/validatable/presence_spec.rb'
- 'spec/support/immutable_ids.rb'

# Offense count: 24
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
RSpec/SpecFilePathFormat:
Exclude:
- 'spec/integration/atomic/modifiers_spec.rb'
- 'spec/integration/bson_regexp_raw_spec.rb'
- 'spec/integration/document_spec.rb'
- 'spec/mongoid/association/auto_save_spec.rb'
- 'spec/mongoid/association/counter_cache_spec.rb'
- 'spec/mongoid/association/eager_spec.rb'
- 'spec/mongoid/clients/transactions_spec.rb'
- 'spec/mongoid/criteria/queryable/extensions/boolean_spec.rb'
- 'spec/mongoid/criteria/queryable/extensions/numeric_spec.rb'
- 'spec/mongoid/criteria/queryable/extensions/regexp_raw_spec.rb'
- 'spec/mongoid/criteria/queryable/extensions/time_with_zone_spec.rb'
- 'spec/mongoid/criteria/queryable/queryable_spec.rb'
- 'spec/mongoid/extensions/binary_spec.rb'
- 'spec/mongoid/extensions/boolean_spec.rb'
- 'spec/mongoid/extensions/raw_value_spec.rb'
- 'spec/mongoid/extensions/stringified_symbol_spec.rb'
- 'spec/mongoid/loading_spec.rb'
- 'spec/mongoid/validatable/associated_spec.rb'
- 'spec/mongoid/validatable/format_spec.rb'
- 'spec/mongoid/validatable/length_spec.rb'
- 'spec/mongoid/validatable/numericality_spec.rb'
- 'spec/mongoid/validatable/presence_spec.rb'
- 'spec/mongoid/validatable/uniqueness_spec.rb'
- 'spec/mongoid/version_spec.rb'

# Offense count: 24
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
RSpec/SpecFilePathSuffix:
Exclude:
- 'spec/integration/atomic/modifiers_spec.rb'
- 'spec/integration/bson_regexp_raw_spec.rb'
- 'spec/integration/document_spec.rb'
- 'spec/mongoid/association/auto_save_spec.rb'
- 'spec/mongoid/association/counter_cache_spec.rb'
- 'spec/mongoid/association/eager_spec.rb'
- 'spec/mongoid/clients/transactions_spec.rb'
- 'spec/mongoid/criteria/queryable/extensions/boolean_spec.rb'
- 'spec/mongoid/criteria/queryable/extensions/numeric_spec.rb'
- 'spec/mongoid/criteria/queryable/extensions/regexp_raw_spec.rb'
- 'spec/mongoid/criteria/queryable/extensions/time_with_zone_spec.rb'
- 'spec/mongoid/criteria/queryable/queryable_spec.rb'
- 'spec/mongoid/extensions/binary_spec.rb'
- 'spec/mongoid/extensions/boolean_spec.rb'
- 'spec/mongoid/extensions/raw_value_spec.rb'
- 'spec/mongoid/extensions/stringified_symbol_spec.rb'
- 'spec/mongoid/loading_spec.rb'
- 'spec/mongoid/validatable/associated_spec.rb'
- 'spec/mongoid/validatable/format_spec.rb'
- 'spec/mongoid/validatable/length_spec.rb'
- 'spec/mongoid/validatable/numericality_spec.rb'
- 'spec/mongoid/validatable/presence_spec.rb'
- 'spec/mongoid/validatable/uniqueness_spec.rb'
- 'spec/mongoid/version_spec.rb'

# Offense count: 18
# Offense count: 21
RSpec/IteratedExpectation:
Exclude:
- 'spec/mongoid/association/referenced/belongs_to/eager_spec.rb'
- 'spec/mongoid/association/referenced/has_many/eager_spec.rb'
- 'spec/mongoid/association/referenced/has_many/enumerable_spec.rb'
- 'spec/mongoid/association/referenced/has_one/eager_spec.rb'
- 'spec/mongoid/clients_spec.rb'
- 'spec/mongoid/contextual/memory_spec.rb'
- 'spec/mongoid/contextual/mongo_spec.rb'
- 'spec/mongoid/criteria_spec.rb'
Expand Down Expand Up @@ -511,7 +451,7 @@ RSpec/LetSetup:
- 'spec/mongoid/touchable_spec.rb'
- 'spec/mongoid/validatable/uniqueness_spec.rb'

# Offense count: 308
# Offense count: 306
# Configuration parameters: .
# SupportedStyles: have_received, receive
RSpec/MessageSpies:
Expand Down Expand Up @@ -546,7 +486,7 @@ RSpec/NamedSubject:
RSpec/NestedGroups:
Max: 13

# Offense count: 31
# Offense count: 32
# Configuration parameters: AllowedPatterns.
# AllowedPatterns: ^expect_, ^assert_
RSpec/NoExpectationExample:
Expand All @@ -561,6 +501,7 @@ RSpec/NoExpectationExample:
- 'spec/mongoid/collection_configurable_spec.rb'
- 'spec/mongoid/document_spec.rb'
- 'spec/mongoid/errors/mongoid_error_spec.rb'
- 'spec/mongoid/inspectable_spec.rb'
- 'spec/mongoid/persistence_context_spec.rb'
- 'spec/mongoid/scopable_spec.rb'
- 'spec/mongoid/tasks/database_rake_spec.rb'
Expand All @@ -573,16 +514,9 @@ RSpec/OverwritingSetup:
- 'spec/mongoid/interceptable_spec.rb'
- 'spec/mongoid/serializable_spec.rb'

# Offense count: 17
# Offense count: 3
RSpec/PendingWithoutReason:
Exclude:
- 'spec/mongoid/association/embedded/embedded_in_spec.rb'
- 'spec/mongoid/association/embedded/embeds_many_spec.rb'
- 'spec/mongoid/association/embedded/embeds_one_spec.rb'
- 'spec/mongoid/association/referenced/belongs_to_spec.rb'
- 'spec/mongoid/association/referenced/has_and_belongs_to_many_spec.rb'
- 'spec/mongoid/association/referenced/has_many_spec.rb'
- 'spec/mongoid/association/referenced/has_one_spec.rb'
- 'spec/mongoid/criteria/queryable/aggregable_spec.rb'
- 'spec/mongoid/serializable_spec.rb'

Expand Down Expand Up @@ -669,6 +603,7 @@ RSpec/ScatteredLet:
- 'spec/mongoid/scopable_spec.rb'

# Offense count: 67
# This cop supports safe autocorrection (--autocorrect).
RSpec/ScatteredSetup:
Exclude:
- 'spec/integration/stringified_symbol_field_spec.rb'
Expand All @@ -680,15 +615,44 @@ RSpec/ScatteredSetup:
- 'spec/mongoid/copyable_spec.rb'
- 'spec/mongoid/persistable/deletable_spec.rb'

# Offense count: 12
# Offense count: 24
# Configuration parameters: Include, CustomTransform, IgnoreMethods, IgnoreMetadata.
# Include: **/*_spec.rb
RSpec/SpecFilePathFormat:
Exclude:
- 'spec/integration/atomic/modifiers_spec.rb'
- 'spec/integration/bson_regexp_raw_spec.rb'
- 'spec/integration/document_spec.rb'
- 'spec/mongoid/association/auto_save_spec.rb'
- 'spec/mongoid/association/counter_cache_spec.rb'
- 'spec/mongoid/association/eager_spec.rb'
- 'spec/mongoid/clients/transactions_spec.rb'
- 'spec/mongoid/criteria/queryable/extensions/boolean_spec.rb'
- 'spec/mongoid/criteria/queryable/extensions/numeric_spec.rb'
- 'spec/mongoid/criteria/queryable/extensions/regexp_raw_spec.rb'
- 'spec/mongoid/criteria/queryable/extensions/time_with_zone_spec.rb'
- 'spec/mongoid/criteria/queryable/queryable_spec.rb'
- 'spec/mongoid/extensions/binary_spec.rb'
- 'spec/mongoid/extensions/boolean_spec.rb'
- 'spec/mongoid/extensions/raw_value_spec.rb'
- 'spec/mongoid/extensions/stringified_symbol_spec.rb'
- 'spec/mongoid/loading_spec.rb'
- 'spec/mongoid/validatable/associated_spec.rb'
- 'spec/mongoid/validatable/format_spec.rb'
- 'spec/mongoid/validatable/length_spec.rb'
- 'spec/mongoid/validatable/numericality_spec.rb'
- 'spec/mongoid/validatable/presence_spec.rb'
- 'spec/mongoid/validatable/uniqueness_spec.rb'
- 'spec/mongoid/version_spec.rb'

# Offense count: 8
RSpec/StubbedMock:
Exclude:
- 'spec/mongoid/clients_spec.rb'
- 'spec/mongoid/errors/mongoid_error_spec.rb'
- 'spec/mongoid/persistence_context_spec.rb'
- 'spec/mongoid/tasks/database_spec.rb'
- 'spec/mongoid/tasks/encryption_spec.rb'
- 'spec/mongoid/validatable/associated_spec.rb'

# Offense count: 26
RSpec/SubjectDeclaration:
Expand All @@ -698,7 +662,7 @@ RSpec/SubjectDeclaration:
- 'spec/mongoid/collection_configurable_spec.rb'
- 'spec/mongoid/contextual/mongo/documents_loader_spec.rb'

# Offense count: 27
# Offense count: 23
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
RSpec/VerifiedDoubles:
Exclude:
Expand All @@ -714,10 +678,10 @@ RSpec/VerifiedDoubles:
- 'spec/mongoid/persistence_context_spec.rb'
- 'spec/mongoid/tasks/database_spec.rb'
- 'spec/mongoid/threaded_spec.rb'
- 'spec/mongoid/validatable/associated_spec.rb'
- 'spec/rails/mongoid_spec.rb'

# Offense count: 11
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle, AllowToTime.
# SupportedStyles: strict, flexible
Rails/Date:
Expand Down Expand Up @@ -795,7 +759,7 @@ Rails/SkipsModelValidations:
- 'spec/mongoid/touchable_spec.rb'
- 'spec/support/models/server.rb'

# Offense count: 151
# Offense count: 134
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: strict, flexible
Expand All @@ -805,7 +769,6 @@ Rails/TimeZone:
- 'lib/mongoid/extensions/date.rb'
- 'lib/mongoid/extensions/string.rb'
- 'lib/mongoid/extensions/time.rb'
- 'lib/mongoid/timestamps/updated.rb'
- 'spec/integration/criteria/date_field_spec.rb'
- 'spec/integration/criteria/raw_value_spec.rb'
- 'spec/integration/persistence/range_field_spec.rb'
Expand Down Expand Up @@ -834,15 +797,14 @@ Rails/TimeZone:
- 'spec/mongoid/touchable_spec.rb'
- 'spec/support/models/post.rb'

# Offense count: 4
# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowOnlyRestArgument, UseAnonymousForwarding, RedundantRestArgumentNames, RedundantKeywordRestArgumentNames, RedundantBlockArgumentNames.
# RedundantRestArgumentNames: args, arguments
# RedundantKeywordRestArgumentNames: kwargs, options, opts
# RedundantBlockArgumentNames: blk, block, proc
Style/ArgumentsForwarding:
Exclude:
- 'lib/mongoid/association/referenced/has_many/enumerable.rb'
- 'lib/mongoid/association/referenced/has_many/proxy.rb'

# Offense count: 5
Expand Down

0 comments on commit 14ecb58

Please sign in to comment.