Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyshields committed Jan 16, 2024
1 parent 4f78825 commit a3dab25
Show file tree
Hide file tree
Showing 39 changed files with 180 additions and 132 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,28 +98,28 @@ jobs:

# JRuby
- ruby: jruby-9.4
gemfile: gemfiles/rails_7.0.gemfile
gemfile: gemfiles/rails_7.1.gemfile
mongodb: '6.0'
topology: replica_set
- ruby: jruby-9.4
gemfile: gemfiles/rails_6.0.gemfile
gemfile: gemfiles/rails_6.1.gemfile
mongodb: '5.0'
topology: server

# Field-Level Encryption
# TODO: support LIBMONGOCRYPT via path
- ruby: ruby-3.2
gemfile: gemfiles/rails_7.0.gemfile
gemfile: gemfiles/rails_7.1.gemfile
mongodb: '6.0'
topology: sharded_cluster
fle: helper
- ruby: ruby-3.1
gemfile: gemfiles/rails_6.1.gemfile
gemfile: gemfiles/rails_7.0.gemfile
mongodb: '6.0'
topology: replica_set
fle: helper
- ruby: ruby-2.7
gemfile: gemfiles/rails_6.0.gemfile
gemfile: gemfiles/rails_6.1.gemfile
mongodb: '6.0'
topology: server
fle: helper
Expand Down
135 changes: 99 additions & 36 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
# This configuration was generated by
# `rubocop --auto-gen-config --exclude-limit 1000`
# on 2023-08-26 19:42:04 UTC using RuboCop version 1.49.0.
# on 2024-01-16 04:19:18 UTC using RuboCop version 1.60.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: EnforcedStyle, AllowedGems, Include.
# SupportedStyles: Gemfile, gems.rb, gemspec
# Include: **/*.gemspec, **/Gemfile, **/gems.rb
Gemspec/DevelopmentDependencies:
Exclude:
- 'mongoid.gemspec'

# Offense count: 4
Lint/SelfAssignment:
Exclude:
- 'spec/integration/associations/embeds_one_spec.rb'
- 'spec/integration/associations/has_one_spec.rb'
- 'spec/mongoid/association/embedded/embeds_one/proxy_spec.rb'

# Offense count: 108
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Expand All @@ -25,19 +40,19 @@ Metrics/BlockNesting:
# Offense count: 17
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 327
Max: 337

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

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

# Offense count: 21
# Offense count: 22
# Configuration parameters: CountComments, CountAsOne.
Metrics/ModuleLength:
Max: 330
Expand All @@ -53,13 +68,13 @@ Metrics/ParameterLists:
Metrics/PerceivedComplexity:
Max: 20

# Offense count: 3
# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
Naming/MemoizedInstanceVariableName:
Exclude:
- 'lib/mongoid/association/relatable.rb'
- 'lib/mongoid/document.rb'

# Offense count: 27
RSpec/AnyInstance:
Expand All @@ -80,7 +95,7 @@ RSpec/AnyInstance:
RSpec/BeforeAfterAll:
Enabled: false

# Offense count: 833
# Offense count: 832
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Expand Down Expand Up @@ -176,7 +191,6 @@ RSpec/ContextWording:
- 'spec/mongoid/errors/invalid_collection_spec.rb'
- 'spec/mongoid/errors/invalid_includes_spec.rb'
- 'spec/mongoid/extensions/date_class_mongoize_spec.rb'
- 'spec/mongoid/extensions/hash_spec.rb'
- 'spec/mongoid/extensions/range_spec.rb'
- 'spec/mongoid/fields/localized_spec.rb'
- 'spec/mongoid/fields_spec.rb'
Expand All @@ -203,7 +217,7 @@ RSpec/ContextWording:
- 'spec/support/immutable_ids.rb'
- 'spec/support/shared/time.rb'

# Offense count: 58
# Offense count: 60
# Configuration parameters: IgnoredMetadata.
RSpec/DescribeClass:
Exclude:
Expand Down Expand Up @@ -248,7 +262,7 @@ RSpec/DescribeClass:
- 'spec/mongoid/railties/console_sandbox_spec.rb'
- 'spec/mongoid/tasks/database_rake_spec.rb'

# Offense count: 126
# Offense count: 124
RSpec/ExpectInHook:
Exclude:
- 'spec/integration/associations/embedded_spec.rb'
Expand Down Expand Up @@ -291,7 +305,7 @@ RSpec/ExpectInHook:
- 'spec/mongoid/validatable/presence_spec.rb'
- 'spec/support/immutable_ids.rb'

# Offense count: 25
# Offense count: 24
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
# Include: **/*_spec*rb*, **/spec/**/*
RSpec/FilePath:
Expand All @@ -313,7 +327,6 @@ RSpec/FilePath:
- 'spec/mongoid/extensions/raw_value_spec.rb'
- 'spec/mongoid/extensions/stringified_symbol_spec.rb'
- 'spec/mongoid/loading_spec.rb'
- 'spec/mongoid/railties/bson_object_id_serializer_spec.rb'
- 'spec/mongoid/validatable/associated_spec.rb'
- 'spec/mongoid/validatable/format_spec.rb'
- 'spec/mongoid/validatable/length_spec.rb'
Expand All @@ -335,7 +348,7 @@ RSpec/IteratedExpectation:
- 'spec/mongoid/findable_spec.rb'
- 'spec/mongoid_spec.rb'

# Offense count: 230
# Offense count: 231
RSpec/LeakyConstantDeclaration:
Exclude:
- 'spec/integration/active_job_spec.rb'
Expand Down Expand Up @@ -394,7 +407,7 @@ RSpec/LeakyConstantDeclaration:
- 'spec/mongoid/validatable/numericality_spec.rb'
- 'spec/mongoid/validatable/uniqueness_spec.rb'

# Offense count: 499
# Offense count: 501
RSpec/LetSetup:
Exclude:
- 'spec/integration/matcher_examples_spec.rb'
Expand Down Expand Up @@ -468,8 +481,8 @@ RSpec/LetSetup:
- 'spec/mongoid/touchable_spec.rb'
- 'spec/mongoid/validatable/uniqueness_spec.rb'

# Offense count: 298
# Configuration parameters: EnforcedStyle.
# Offense count: 308
# Configuration parameters: .
# SupportedStyles: have_received, receive
RSpec/MessageSpies:
EnforcedStyle: receive
Expand All @@ -481,7 +494,7 @@ RSpec/MultipleDescribes:
- 'spec/mongoid/association/embedded/dirty_spec.rb'
- 'spec/mongoid/tasks/database_rake_spec.rb'

# Offense count: 233
# Offense count: 244
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Expand All @@ -498,12 +511,12 @@ RSpec/NamedSubject:
- 'spec/mongoid/extensions/raw_value_spec.rb'
- 'spec/mongoid/matcher/expression_spec.rb'

# Offense count: 5025
# Offense count: 5074
# Configuration parameters: AllowedGroups.
RSpec/NestedGroups:
Max: 13

# Offense count: 37
# Offense count: 31
# Configuration parameters: AllowedPatterns.
# AllowedPatterns: ^expect_, ^assert_
RSpec/NoExpectationExample:
Expand All @@ -516,7 +529,6 @@ RSpec/NoExpectationExample:
- 'spec/mongoid/association/referenced/has_and_belongs_to_many/proxy_spec.rb'
- 'spec/mongoid/attributes_spec.rb'
- 'spec/mongoid/collection_configurable_spec.rb'
- 'spec/mongoid/criteria/queryable/storable_spec.rb'
- 'spec/mongoid/document_spec.rb'
- 'spec/mongoid/errors/mongoid_error_spec.rb'
- 'spec/mongoid/persistence_context_spec.rb'
Expand Down Expand Up @@ -638,7 +650,7 @@ RSpec/ScatteredSetup:
- 'spec/mongoid/copyable_spec.rb'
- 'spec/mongoid/persistable/deletable_spec.rb'

# Offense count: 14
# Offense count: 12
RSpec/StubbedMock:
Exclude:
- 'spec/mongoid/clients_spec.rb'
Expand All @@ -648,15 +660,15 @@ RSpec/StubbedMock:
- 'spec/mongoid/tasks/encryption_spec.rb'
- 'spec/mongoid/validatable/associated_spec.rb'

# Offense count: 21
# Offense count: 26
RSpec/SubjectDeclaration:
Exclude:
- 'spec/integration/associations/embedded_dirty_spec.rb'
- 'spec/mongoid/clients/transactions_spec.rb'
- 'spec/mongoid/collection_configurable_spec.rb'
- 'spec/mongoid/contextual/mongo/documents_loader_spec.rb'

# Offense count: 28
# Offense count: 27
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
RSpec/VerifiedDoubles:
Exclude:
Expand All @@ -670,7 +682,6 @@ RSpec/VerifiedDoubles:
- 'spec/mongoid/contextual/mongo/documents_loader_spec.rb'
- 'spec/mongoid/errors/validations_spec.rb'
- 'spec/mongoid/persistence_context_spec.rb'
- 'spec/mongoid/tasks/database_rake_spec.rb'
- 'spec/mongoid/tasks/database_spec.rb'
- 'spec/mongoid/threaded_spec.rb'
- 'spec/mongoid/validatable/associated_spec.rb'
Expand All @@ -688,7 +699,7 @@ Rails/Date:
- 'spec/mongoid/persistable/maxable_spec.rb'
- 'spec/mongoid/persistable/minable_spec.rb'

# Offense count: 21
# Offense count: 20
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforceForPrefixed.
Rails/Delegate:
Expand All @@ -700,7 +711,6 @@ Rails/Delegate:
- 'lib/mongoid/clients/options.rb'
- 'lib/mongoid/contextual/memory.rb'
- 'lib/mongoid/contextual/none.rb'
- 'lib/mongoid/criteria.rb'
- 'lib/mongoid/document.rb'
- 'lib/mongoid/extensions/nil_class.rb'
- 'lib/mongoid/extensions/symbol.rb'
Expand All @@ -727,7 +737,7 @@ Rails/I18nLocaleAssignment:
- 'spec/mongoid/validatable/uniqueness_spec.rb'
- 'spec/support/macros.rb'

# Offense count: 129
# Offense count: 133
# Configuration parameters: ForbiddenMethods, AllowedMethods.
# ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all
Rails/SkipsModelValidations:
Expand Down Expand Up @@ -755,23 +765,17 @@ Rails/SkipsModelValidations:
- 'spec/mongoid/touchable_spec.rb'
- 'spec/support/models/server.rb'

# Offense count: 159
# Offense count: 151
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: strict, flexible
Rails/TimeZone:
Exclude:
- 'lib/mongoid/criteria/queryable/extensions/date.rb'
- 'lib/mongoid/criteria/queryable/extensions/string.rb'
- 'lib/mongoid/extensions/array.rb'
- 'lib/mongoid/extensions/date.rb'
- 'lib/mongoid/extensions/float.rb'
- 'lib/mongoid/extensions/integer.rb'
- 'lib/mongoid/extensions/string.rb'
- 'lib/mongoid/extensions/time.rb'
- 'lib/mongoid/timestamps/created.rb'
- 'lib/mongoid/timestamps/updated.rb'
- 'lib/mongoid/touchable.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 @@ -800,6 +804,17 @@ Rails/TimeZone:
- 'spec/mongoid/touchable_spec.rb'
- 'spec/support/models/post.rb'

# Offense count: 4
# 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
Style/MultilineBlockChain:
Exclude:
Expand Down Expand Up @@ -834,7 +849,55 @@ Style/OptionalBooleanParameter:
- 'spec/support/models/address.rb'
- 'spec/support/models/name.rb'

# Offense count: 240
# Offense count: 38
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantCurrentDirectoryInPath:
Exclude:
- 'Gemfile'
- 'gemfiles/bson_master.gemfile'
- 'gemfiles/bson_min.gemfile'
- 'gemfiles/driver_master.gemfile'
- 'gemfiles/driver_min.gemfile'
- 'gemfiles/driver_stable.gemfile'
- 'gemfiles/rails_6.1.gemfile'
- 'gemfiles/rails_7.0.gemfile'
- 'gemfiles/rails_7.1.gemfile'
- 'gemfiles/rails_master.gemfile'
- 'spec/integration/associations/foreign_key_spec.rb'
- 'spec/integration/associations/reverse_population_spec.rb'
- 'spec/integration/callbacks_spec.rb'
- 'spec/mongoid/association/auto_save_spec.rb'
- 'spec/mongoid/association/embedded/embedded_in_spec.rb'
- 'spec/mongoid/association/embedded/embeds_many_query_spec.rb'
- 'spec/mongoid/association/embedded/embeds_one_query_spec.rb'
- 'spec/mongoid/association/embedded/embeds_one_spec.rb'
- 'spec/mongoid/association/referenced/belongs_to_query_spec.rb'
- 'spec/mongoid/association/referenced/belongs_to_spec.rb'
- 'spec/mongoid/association/referenced/has_and_belongs_to_many_query_spec.rb'
- 'spec/mongoid/association/referenced/has_and_belongs_to_many_spec.rb'
- 'spec/mongoid/association/referenced/has_many_query_spec.rb'
- 'spec/mongoid/association/referenced/has_many_spec.rb'
- 'spec/mongoid/association/referenced/has_one_query_spec.rb'
- 'spec/mongoid/association/referenced/has_one_spec.rb'
- 'spec/mongoid/attributes/nested_spec.rb'
- 'spec/mongoid/attributes_spec.rb'
- 'spec/mongoid/clients/transactions_spec.rb'
- 'spec/mongoid/copyable_spec.rb'
- 'spec/mongoid/criteria/includable_spec.rb'
- 'spec/mongoid/criteria/queryable/selectable_spec.rb'
- 'spec/mongoid/criteria/queryable/selectable_where_spec.rb'
- 'spec/mongoid/interceptable_spec.rb'
- 'spec/mongoid/shardable_spec.rb'
- 'spec/mongoid/timestamps_spec.rb'
- 'spec/mongoid/touchable_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantParentheses:
Exclude:
- 'lib/mongoid/association/referenced/has_many/enumerable.rb'

# Offense count: 251
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/crud.txt
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ Mongoid models are reverted. For example:
person.name # => 'Jake'
raise 'An exception'
end
rescue Exception
rescue StandardError
person.name # => 'Tom'
end

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/standard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def standard_dependencies
end

group :development, :test do
gem 'rubocop', '~> 1.49.0'
gem 'rubocop', '~> 1.60.0'
gem 'rubocop-performance', '~> 1.16.0'
gem 'rubocop-rails', '~> 2.17.4'
gem 'rubocop-rake', '~> 0.6.0'
Expand Down
Loading

0 comments on commit a3dab25

Please sign in to comment.