Skip to content

Commit

Permalink
Merge pull request #4853 from sul-dlss/update-rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
mjgiarlo authored Apr 11, 2024
2 parents 7a78ba7 + 1c3280d commit 31c81e3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 34 deletions.
62 changes: 34 additions & 28 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,51 +8,51 @@ require:
AllCops:
TargetRubyVersion: 3.2
Exclude:
- 'bin/console'
- 'bin/rails'
- 'bin/rake'
- 'docs/**/*'
- 'db/migrate/**'
- 'db/schema.rb'
- 'log/**/*'
- 'results/**/*'
- 'tmp/**/*'
- 'vendor/**/*'
- "bin/console"
- "bin/rails"
- "bin/rake"
- "docs/**/*"
- "db/migrate/**"
- "db/schema.rb"
- "log/**/*"
- "results/**/*"
- "tmp/**/*"
- "vendor/**/*"
SuggestExtensions: false

Rails:
Enabled: true

Layout/LineLength:
Exclude:
- 'spec/services/cocina/mapping/descriptive/h2_datacite/subject_h2_datacite_spec.rb'
- "spec/services/cocina/mapping/descriptive/h2_datacite/subject_h2_datacite_spec.rb"

Lint/UnusedMethodArgument:
AllowUnusedKeywordArguments: true

Metrics/BlockLength:
Exclude:
- 'spec/**/*'
- 'config/routes.rb'
- 'config/initializers/dor_config.rb'
- 'lib/tasks/missing_druids.rake'
- "spec/**/*"
- "config/routes.rb"
- "config/initializers/dor_config.rb"
- "lib/tasks/missing_druids.rake"

Metrics/ClassLength:
Exclude:
- 'app/services/cocina/to_datacite/event.rb'
- 'app/services/cocina/to_xml/content_metadata_generator.rb'
- "app/services/cocina/to_datacite/event.rb"
- "app/services/cocina/to_xml/content_metadata_generator.rb"

Performance/CollectionLiteralInLoop:
Enabled: true
Exclude:
- 'app/services/symphony_reader.rb'
- "app/services/symphony_reader.rb"

Rails/DynamicFindBy:
Enabled: true
Exclude:
- 'app/services/cocina_object_store.rb'
- 'app/controllers/objects_controller.rb'
- 'spec/services/cocina_object_store_spec.rb'
- "app/services/cocina_object_store.rb"
- "app/controllers/objects_controller.rb"
- "spec/services/cocina_object_store_spec.rb"

Rails/EagerEvaluationLogMessage: # (new in 2.11)
Enabled: false
Expand All @@ -63,12 +63,12 @@ Rails/EnvironmentVariableAccess: # (new in 2.10)

Rails/Output:
Exclude:
- 'app/reports/**/*'
- "app/reports/**/*"

RSpec/DescribeClass:
Exclude:
- 'spec/requests/**/*'
- 'spec/services/cocina/mapping/**/*'
- "spec/requests/**/*"
- "spec/services/cocina/mapping/**/*"

RSpec/ExampleLength:
Max: 8
Expand All @@ -82,20 +82,20 @@ RSpec/MultipleMemoizedHelpers:

RSpec/ExpectActual:
Exclude:
- 'spec/routing/**'
- "spec/routing/**"

RSpec/NestedGroups:
Max: 5

RSpec/SubjectStub:
Exclude:
- 'spec/services/catalog/update_marc856_record_service_spec.rb'
- "spec/services/catalog/update_marc856_record_service_spec.rb"

Style/RedundantStringEscape:
Enabled: true
Exclude:
# Does not play well with raw SQL.
- 'app/reports/**'
- "app/reports/**"

Style/WordArray:
MinSize: 3
Expand Down Expand Up @@ -725,4 +725,10 @@ RSpec/RemoveConst: # new in 2.26
RSpec/RepeatedSubjectCall: # new in 2.27
Enabled: true
Rails/EnvLocal: # new in 2.22
Enabled: true
Enabled: true
Style/MapIntoArray: # new in 1.63
Enabled: true
RSpec/EmptyOutput: # new in 2.29
Enabled: true
RSpec/UndescriptiveLiteralsDescription: # new in 2.29
Enabled: true
9 changes: 3 additions & 6 deletions lib/tasks/missing_druids.rake
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ namespace :missing_druids do
desc 'Find unindexed druids'
task unindexed_objects: :environment do
models = [AdminPolicy, Collection, Dro]
druids_from_db = []
druids_from_solr = []

results = SolrService.query('id:*', fl: 'id', rows: 10_000_000, wt: 'csv')
results.each { |r| druids_from_solr << r['id'] }
druids_from_solr = results.pluck('id')

models.each do |model|
druids_from_db << model.pluck(:external_identifier)
druids_from_db = models.map do |model|
model.pluck(:external_identifier)
end

missing_druids = druids_from_db.flatten.sort - druids_from_solr.sort
Expand Down

0 comments on commit 31c81e3

Please sign in to comment.