Skip to content

Commit

Permalink
Get rid of unused methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Aug 9, 2024
1 parent 86b8f3c commit f3b6636
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 78 deletions.
40 changes: 10 additions & 30 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`
# on 2024-07-29 18:35:06 UTC using RuboCop version 1.65.0.
# on 2024-08-09 14:49:32 UTC using RuboCop version 1.65.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
Expand All @@ -12,11 +12,6 @@ Lint/DuplicateBranch:
Exclude:
- 'app/models/purl_version.rb'

# Offense count: 1
Lint/UriEscapeUnescape:
Exclude:
- 'lib/purl/util.rb'

# Offense count: 2
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
# AllowedMethods: refine
Expand All @@ -26,17 +21,17 @@ Metrics/BlockLength:
# Offense count: 3
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 197
Max: 192

# Offense count: 3
# Offense count: 2
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/CyclomaticComplexity:
Max: 9

# Offense count: 3
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/PerceivedComplexity:
Max: 11
Max: 10

# Offense count: 13
# Configuration parameters: ForbiddenDelimiters.
Expand All @@ -62,7 +57,7 @@ RSpec/ContextWording:
- 'spec/integration/purl_spec.rb'
- 'spec/views/purl/_find_it.html.erb_spec.rb'

# Offense count: 50
# Offense count: 52
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 45
Expand Down Expand Up @@ -90,11 +85,11 @@ RSpec/LeadingSubject:
- 'spec/model/content_metadata_spec.rb'
- 'spec/model/iiif_presentation_manifest_spec.rb'

# Offense count: 73
# Offense count: 77
RSpec/MultipleExpectations:
Max: 19

# Offense count: 43
# Offense count: 41
# Configuration parameters: AllowSubject.
RSpec/MultipleMemoizedHelpers:
Max: 8
Expand Down Expand Up @@ -147,13 +142,6 @@ Rails/Presence:
Exclude:
- 'app/mailers/feedback_mailer.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: NotNilAndNotEmpty, NotBlank, UnlessBlank.
Rails/Present:
Exclude:
- 'lib/purl/util.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
Expand All @@ -162,45 +150,37 @@ Style/FormatString:
Exclude:
- 'app/helpers/application_helper.rb'

# Offense count: 52
# Offense count: 51
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Enabled: false

# Offense count: 7
# Offense count: 6
# This cop supports safe autocorrection (--autocorrect).
Style/IfUnlessModifier:
Exclude:
- 'app/models/iiif3_presentation_manifest.rb'
- 'app/models/iiif_presentation_manifest.rb'
- 'lib/purl/util.rb'

# Offense count: 1
Style/OpenStructUse:
Exclude:
- 'spec/model/purl_version_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantAssignment:
Exclude:
- 'lib/purl/util.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantBegin:
Exclude:
- 'app/models/iiif_presentation_manifest.rb'

# Offense count: 4
# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Mode.
Style/StringConcatenation:
Exclude:
- 'app/controllers/purl_controller.rb'
- 'lib/purl/util.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Expand Down
7 changes: 6 additions & 1 deletion app/services/resource_xml_deserializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def self.extract_resources(resource_node, druid)
Float::INFINITY
end

resource_node.xpath('file|externalFile|resource').select { |node| Purl::Util.file_ready? node }.map do |node|
resource_node.xpath('file|externalFile|resource').select { |node| file_ready? node }.map do |node|
case node.name
when 'file'
Resource.from_file_metadata(node, resource_attributes)
Expand All @@ -30,6 +30,11 @@ def self.extract_resources(resource_node, druid)
end
end

# check if file is ready (deliver = yes or publish = yes)
def self.file_ready?(file)
file && (file['deliver'] != 'no' || file['publish'] != 'no')
end

class Resource
##
# Extract attributes from `<file>...</file>` in content metadata
Expand Down
1 change: 0 additions & 1 deletion config/initializers/utils.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
require 'dor/util'
require 'purl/util'
46 changes: 0 additions & 46 deletions lib/purl/util.rb

This file was deleted.

0 comments on commit f3b6636

Please sign in to comment.