Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest ]
ruby: [ '3.1' ]
ruby: [ '3.3' ]
runs-on: ${{ matrix.os }}

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gem-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
ruby-version: '3.3'
bundler-cache: true

- name: Publish to RubyGems
Expand Down
188 changes: 186 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ Style/SingleLineBlockParams:
Style/SafeNavigation:
Enabled: false

# disable newer cops that require some cleanup
Gemspec/DevelopmentDependencies: # new in 1.44
Enabled: false

Gemspec/DeprecatedAttributeAssignment: # (new in 1.10)
Enabled: false

############################################################
# Enable newer cops

Expand Down Expand Up @@ -187,8 +194,6 @@ Lint/TripleQuotes: # (new in 1.9)
Enabled: true
Style/IfWithBooleanLiteralBranches: # (new in 1.9)
Enabled: true
Gemspec/DateAssignment: # (new in 1.10)
Enabled: true
Style/HashConversion: # (new in 1.10)
Enabled: true
Style/StringChars: # (new in 1.12)
Expand Down Expand Up @@ -239,3 +244,182 @@ Style/MapToHash: # new in 1.24
Enabled: true
Style/NestedFileDirname: # new in 1.26
Enabled: true

# newer cops

Gemspec/AddRuntimeDependency: # new in 1.65
Enabled: true
Gemspec/AttributeAssignment: # new in 1.77
Enabled: true
Layout/EmptyLinesAfterModuleInclusion: # new in 1.79
Enabled: true
Layout/LineContinuationLeadingSpace: # new in 1.31
Enabled: true
Layout/LineContinuationSpacing: # new in 1.31
Enabled: true
Lint/ArrayLiteralInRegexp: # new in 1.71
Enabled: true
Lint/ConstantOverwrittenInRescue: # new in 1.31
Enabled: true
Lint/ConstantReassignment: # new in 1.70
Enabled: true
Lint/CopDirectiveSyntax: # new in 1.72
Enabled: true
Lint/DuplicateMagicComment: # new in 1.37
Enabled: true
Lint/DuplicateMatchPattern: # new in 1.50
Enabled: true
Lint/DuplicateSetElement: # new in 1.67
Enabled: true
Lint/HashNewWithKeywordArgumentsAsDefault: # new in 1.69
Enabled: true
Lint/ItWithoutArgumentsInBlock: # new in 1.59
Enabled: true
Lint/LiteralAssignmentInCondition: # new in 1.58
Enabled: true
Lint/MixedCaseRange: # new in 1.53
Enabled: true
Lint/NonAtomicFileOperation: # new in 1.31
Enabled: true
Lint/NumericOperationWithConstantResult: # new in 1.69
Enabled: true
Lint/RedundantRegexpQuantifiers: # new in 1.53
Enabled: true
Lint/RedundantTypeConversion: # new in 1.72
Enabled: true
Lint/RefinementImportMethods: # new in 1.27
Enabled: true
Lint/RequireRangeParentheses: # new in 1.32
Enabled: true
Lint/SharedMutableDefault: # new in 1.70
Enabled: true
Lint/SuppressedExceptionInNumberConversion: # new in 1.72
Enabled: true
Lint/UnescapedBracketInRegexp: # new in 1.68
Enabled: true
Lint/UselessConstantScoping: # new in 1.72
Enabled: true
Lint/UselessDefaultValueArgument: # new in 1.76
Enabled: true
Lint/UselessDefined: # new in 1.69
Enabled: true
Lint/UselessNumericOperation: # new in 1.66
Enabled: true
Lint/UselessOr: # new in 1.76
Enabled: true
Lint/UselessRescue: # new in 1.43
Enabled: true
Metrics/CollectionLiteralLength: # new in 1.47
Enabled: true
Naming/PredicateMethod: # new in 1.76
Enabled: true
Security/CompoundHash: # new in 1.28
Enabled: true
Style/AmbiguousEndlessMethodDefinition: # new in 1.68
Enabled: true
Style/ArrayIntersect: # new in 1.40
Enabled: true
Style/ArrayIntersectWithSingleElement: # new in 1.81
Enabled: true
Style/BitwisePredicate: # new in 1.68
Enabled: true
Style/CollectionQuerying: # new in 1.77
Enabled: true
Style/CombinableDefined: # new in 1.68
Enabled: true
Style/ComparableBetween: # new in 1.74
Enabled: true
Style/ComparableClamp: # new in 1.44
Enabled: true
Style/ConcatArrayLiterals: # new in 1.41
Enabled: true
Style/DataInheritance: # new in 1.49
Enabled: true
Style/DigChain: # new in 1.69
Enabled: true
Style/DirEmpty: # new in 1.48
Enabled: true
Style/EmptyHeredoc: # new in 1.32
Enabled: true
Style/EmptyStringInsideInterpolation: # new in 1.76
Enabled: true
Style/EnvHome: # new in 1.29
Enabled: true
Style/ExactRegexpMatch: # new in 1.51
Enabled: true
Style/FetchEnvVar: # new in 1.28
Enabled: true
Style/FileEmpty: # new in 1.48
Enabled: true
Style/FileNull: # new in 1.69
Enabled: true
Style/FileTouch: # new in 1.69
Enabled: true
Style/HashFetchChain: # new in 1.75
Enabled: true
Style/HashSlice: # new in 1.71
Enabled: true
Style/ItAssignment: # new in 1.70
Enabled: true
Style/ItBlockParameter: # new in 1.75
Enabled: true
Style/KeywordArgumentsMerging: # new in 1.68
Enabled: true
Style/MagicCommentFormat: # new in 1.35
Enabled: true
Style/MapCompactWithConditionalBlock: # new in 1.30
Enabled: true
Style/MapIntoArray: # new in 1.63
Enabled: true
Style/MapToSet: # new in 1.42
Enabled: true
Style/MinMaxComparison: # new in 1.42
Enabled: true
Style/ObjectThen: # new in 1.28
Enabled: true
Style/OperatorMethodCall: # new in 1.37
Enabled: true
Style/RedundantArrayConstructor: # new in 1.52
Enabled: true
Style/RedundantArrayFlatten: # new in 1.76
Enabled: true
Style/RedundantConstantBase: # new in 1.40
Enabled: true
Style/RedundantCurrentDirectoryInPath: # new in 1.53
Enabled: true
Style/RedundantDoubleSplatHashBraces: # new in 1.41
Enabled: true
Style/RedundantEach: # new in 1.38
Enabled: true
Style/RedundantFilterChain: # new in 1.52
Enabled: true
Style/RedundantFormat: # new in 1.72
Enabled: true
Style/RedundantHeredocDelimiterQuotes: # new in 1.45
Enabled: true
Style/RedundantInitialize: # new in 1.27
Enabled: true
Style/RedundantInterpolationUnfreeze: # new in 1.66
Enabled: true
Style/RedundantLineContinuation: # new in 1.49
Enabled: true
Style/RedundantRegexpArgument: # new in 1.53
Enabled: true
Style/RedundantRegexpConstructor: # new in 1.52
Enabled: true
Style/RedundantStringEscape: # new in 1.37
Enabled: true
Style/ReturnNilInPredicateMethodDefinition: # new in 1.53
Enabled: true
Style/SafeNavigationChainLength: # new in 1.68
Enabled: true
Style/SendWithLiteralMethodName: # new in 1.64
Enabled: true
Style/SingleLineDoEndBlock: # new in 1.57
Enabled: true
Style/SuperArguments: # new in 1.64
Enabled: true
Style/SuperWithArgsParentheses: # new in 1.58
Enabled: true
Style/YAMLFileRead: # new in 1.53
Enabled: true
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# =============================================================================
# Target: base

FROM ruby:3.0.2-alpine AS base
FROM ruby:3.3-alpine AS base

RUN apk --no-cache --update upgrade && \
apk --no-cache add \
Expand All @@ -12,6 +12,7 @@ RUN apk --no-cache --update upgrade && \
openssl \
tzdata \
xz-libs \
yaml-dev \
&& rm -rf /var/cache/apk/*

WORKDIR /opt/app
Expand All @@ -29,6 +30,9 @@ RUN apk --update --no-cache add \
git \
&& rm -rf /var/cache/apk/*

# The base image ships an older bundler, but we want something more recent
RUN gem install bundler -v 2.5.22

# Copy codebase to WORKDIR. Unlike application projects, for a gem project
# we need to do this before running `bundle install`, in order for the gem
# we're building to be able to "install" itself.
Expand Down
10 changes: 5 additions & 5 deletions av_core.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ Gem::Specification.new do |spec|

spec.add_dependency 'berkeley_library-logging', '~> 0.2'
spec.add_dependency 'berkeley_library-marc', '~> 0.2', '>= 0.2.1'
spec.add_dependency 'berkeley_library-util', '~> 0.1', '>= 0.1.1'
spec.add_dependency 'berkeley_library-util', '~> 0.2'
spec.add_dependency 'ruby-marc-spec', '~> 0.1', '>= 0.1.3'
spec.add_dependency 'typesafe_enum', '~> 0.3'

spec.add_development_dependency 'brakeman', '~> 4.9'
spec.add_development_dependency 'bundle-audit', '~> 0.1'
spec.add_development_dependency 'ci_reporter_rspec', '~> 1.0'
spec.add_development_dependency 'colorize', '~> 0.8'
spec.add_development_dependency 'colorize', '~> 1.0'
spec.add_development_dependency 'dotenv', '~> 2.7'
spec.add_development_dependency 'irb', '~> 1.2' # workaroundfor https://github.com/bundler/bundler/issues/6929
spec.add_development_dependency 'listen', '>= 3.0.5', '< 3.2'
spec.add_development_dependency 'rake', '~> 13.0'
spec.add_development_dependency 'rspec-support', '~> 3.9'
spec.add_development_dependency 'rubocop', '1.26.0'
spec.add_development_dependency 'rubocop-rake', '~> 0.6.0'
spec.add_development_dependency 'rubocop-rspec', '~> 2.4.0'
spec.add_development_dependency 'rubocop', '1.81.7'
spec.add_development_dependency 'rubocop-rake', '~> 0.7.1'
spec.add_development_dependency 'rubocop-rspec', '~> 3.7.0'
spec.add_development_dependency 'simplecov', '~> 0.21'
spec.add_development_dependency 'simplecov-rcov', '~> 0.2'
spec.add_development_dependency 'webmock', '~> 3.8'
Expand Down
2 changes: 1 addition & 1 deletion lib/berkeley_library/av/metadata/field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def same_metadata?(other)
raise ArgumentError, "Not a #{class_name(self)}: #{other}" unless other.is_a?(Field)

%i[tag query subfields_separator subfield_order].all? do |attr|
(other.respond_to?(attr) && send(attr) == other.send(attr))
other.respond_to?(attr) && send(attr) == other.send(attr)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/berkeley_library/av/metadata/fields.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def to_field(json_field)
label: json_field['labels']['en'],
tag:,
spec: marc_spec,
subfields_separator: (params['subfields_separator'] || ' '),
subfields_separator: params['subfields_separator'] || ' ',
subfield_order: params['subfield_order'].to_s.split(',')
)
end
Expand Down
9 changes: 6 additions & 3 deletions lib/berkeley_library/av/metadata/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def name

def catalog_link_text
return LINK_TEXT_ALMA if self == ALMA
return LINK_TEXT_TIND if self == TIND

LINK_TEXT_TIND if self == TIND
Comment on lines 36 to +38
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if these should be converted to case..when..else..end at some point, just in a hand wavy future update. Would be more maintainable and and make the else nil more explicit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good - this, i believe, was a rubocop autocorrection.

end

def display_uri_for(metadata)
Expand All @@ -46,7 +47,8 @@ def display_uri_for(metadata)

def find_bib_number(metadata)
return alma_bib_number(metadata.marc_record) if self == Source::ALMA
return tind_bib_number(metadata.marc_record) if self == Source::TIND

tind_bib_number(metadata.marc_record) if self == Source::TIND
end

private
Expand All @@ -58,7 +60,8 @@ def canonical_record_id_for(metadata)

def canonical_record_id_accessor
return :alma_id if self == ALMA
return :tind_id if self == TIND

:tind_id if self == TIND
end

def tind_bib_number(marc_record)
Expand Down
4 changes: 2 additions & 2 deletions lib/berkeley_library/av/track.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def to_s
end

def inspect
"\#<#{self.class.name} #{self}>"
"#<#{self.class.name} #{self}>"
end

# @return [Array<MARC::Subfield>]
Expand Down Expand Up @@ -90,7 +90,7 @@ def group_values(subfields)
end

def group_subfields(subfields)
single_track = subfields.lazy.select { |sf| sf.code.to_sym == SUBFIELD_CODE_PATH }.one?
single_track = subfields.lazy.one? { |sf| sf.code.to_sym == SUBFIELD_CODE_PATH }
return [group_together(subfields)] if single_track

group_on_paths(subfields)
Expand Down
10 changes: 5 additions & 5 deletions spec/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
inherit_from: ../.rubocop.yml

require:
plugins:
- rubocop-rspec

Layout/LineLength:
Expand Down Expand Up @@ -65,7 +65,10 @@ RSpec/ExpectInHook:
Enabled: false

# your naming scheme is not in possession of all the facts
RSpec/FilePath:
RSpec/SpecFilePathFormat:
Enabled: false

RSpec/SpecFilePathSuffix:
Enabled: false

# explicit >>> implicit
Expand Down Expand Up @@ -111,6 +114,3 @@ RSpec/VerifiedDoubles:

RSpec/IdenticalEqualityAssertion: # new in 2.4
Enabled: true

RSpec/Rails/AvoidSetupHook: # new in 2.4
Enabled: true
Loading