Skip to content

Commit

Permalink
Merge pull request #817 from sul-dlss/ruby3
Browse files Browse the repository at this point in the history
upgrade to ruby3
  • Loading branch information
aaron-collier committed Jan 7, 2022
2 parents 0c0118f + 76d328f commit 4bc9e76
Show file tree
Hide file tree
Showing 25 changed files with 341 additions and 73 deletions.
182 changes: 179 additions & 3 deletions .rubocop.yml
@@ -1,7 +1,12 @@
require:
- rubocop-rails
- rubocop-rspec

inherit_from: .rubocop_todo.yml
require: rubocop-rspec

AllCops:
TargetRubyVersion: 3.0
SuggestExtensions: false
DisplayCopNames: true
Include:
- './Rakefile'
Expand All @@ -24,7 +29,7 @@ Layout/SpaceBeforeBlockBraces:
- 'spec/**/*_spec.rb'

Metrics/BlockLength:
ExcludedMethods:
IgnoredMethods:
- SimpleForm.setup
- FactoryBot.define
- factory
Expand All @@ -33,7 +38,7 @@ Metrics/BlockLength:
- it

# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:
Layout/LineLength:
Max: 200
Exclude:
- 'config/initializers/**/*.rb' # generated files
Expand Down Expand Up @@ -72,3 +77,174 @@ Style/RegexpLiteral:

Style/SymbolArray:
MinSize: 4

Gemspec/DateAssignment: # new in 1.10
Enabled: true
Gemspec/RequireMFA: # new in 1.23
Enabled: true
Layout/LineEndStringConcatenationIndentation: # new in 1.18
Enabled: true
Layout/SpaceBeforeBrackets: # new in 1.7
Enabled: true
Lint/AmbiguousAssignment: # new in 1.7
Enabled: true
Lint/AmbiguousOperatorPrecedence: # new in 1.21
Enabled: true
Lint/AmbiguousRange: # new in 1.19
Enabled: true
Lint/DeprecatedConstants: # new in 1.8
Enabled: true
Lint/DuplicateBranch: # new in 1.3
Enabled: true
Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
Enabled: true
Lint/EmptyBlock: # new in 1.1
Enabled: true
Lint/EmptyClass: # new in 1.3
Enabled: true
Lint/EmptyInPattern: # new in 1.16
Enabled: true
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
Enabled: true
Lint/LambdaWithoutLiteralBlock: # new in 1.8
Enabled: true
Lint/NoReturnInBeginEndBlocks: # new in 1.2
Enabled: true
Lint/NumberedParameterAssignment: # new in 1.9
Enabled: true
Lint/OrAssignmentToConstant: # new in 1.9
Enabled: true
Lint/RedundantDirGlobSort: # new in 1.8
Enabled: true
Lint/RequireRelativeSelfPath: # new in 1.22
Enabled: true
Lint/SymbolConversion: # new in 1.9
Enabled: true
Lint/ToEnumArguments: # new in 1.1
Enabled: true
Lint/TripleQuotes: # new in 1.9
Enabled: true
Lint/UnexpectedBlockArity: # new in 1.5
Enabled: true
Lint/UnmodifiedReduceAccumulator: # new in 1.1
Enabled: true
Lint/UselessRuby2Keywords: # new in 1.23
Enabled: true
Naming/BlockForwarding: # new in 1.24
Enabled: true
Security/IoMethods: # new in 1.22
Enabled: true
Style/ArgumentsForwarding: # new in 1.1
Enabled: true
Style/CollectionCompact: # new in 1.2
Enabled: true
Style/DocumentDynamicEvalDefinition: # new in 1.1
Enabled: true
Style/EndlessMethod: # new in 1.8
Enabled: true
Style/FileRead: # new in 1.24
Enabled: true
Style/FileWrite: # new in 1.24
Enabled: true
Style/HashConversion: # new in 1.10
Enabled: true
Style/HashExcept: # new in 1.7
Enabled: true
Style/IfWithBooleanLiteralBranches: # new in 1.9
Enabled: true
Style/InPatternThen: # new in 1.16
Enabled: true
Style/MapToHash: # new in 1.24
Enabled: true
Style/MultilineInPatternThen: # new in 1.16
Enabled: true
Style/NegatedIfElseCondition: # new in 1.2
Enabled: true
Style/NilLambda: # new in 1.3
Enabled: true
Style/NumberedParameters: # new in 1.22
Enabled: true
Style/NumberedParametersLimit: # new in 1.22
Enabled: true
Style/OpenStructUse: # new in 1.23
Enabled: true
Style/QuotedSymbols: # new in 1.16
Enabled: true
Style/RedundantArgument: # new in 1.4
Enabled: true
Style/RedundantSelfAssignmentBranch: # new in 1.19
Enabled: true
Style/SelectByRegexp: # new in 1.22
Enabled: true
Style/StringChars: # new in 1.12
Enabled: true
Style/SwapValues: # new in 1.1
Enabled: true

RSpec/ExcessiveDocstringSpacing: # new in 2.5
Enabled: true
RSpec/IdenticalEqualityAssertion: # new in 2.4
Enabled: true
RSpec/SubjectDeclaration: # new in 2.5
Enabled: true
RSpec/FactoryBot/SyntaxMethods: # new in 2.7
Enabled: true
RSpec/Rails/AvoidSetupHook: # new in 2.4
Enabled: true

Rails/ActiveRecordCallbacksOrder: # new in 2.7
Enabled: true
Rails/AddColumnIndex: # new in 2.11
Enabled: true
Rails/AfterCommitOverride: # new in 2.8
Enabled: true
Rails/AttributeDefaultBlockValue: # new in 2.9
Enabled: true
Rails/CompactBlank: # new in 2.13
Enabled: true
Rails/DurationArithmetic: # new in 2.13
Enabled: true
Rails/EagerEvaluationLogMessage: # new in 2.11
Enabled: true
Rails/ExpandedDateRange: # new in 2.11
Enabled: true
Rails/FindById: # new in 2.7
Enabled: true
Rails/I18nLocaleAssignment: # new in 2.11
Enabled: true
Rails/Inquiry: # new in 2.7
Enabled: true
Rails/MailerName: # new in 2.7
Enabled: true
Rails/MatchRoute: # new in 2.7
Enabled: true
Rails/NegateInclude: # new in 2.7
Enabled: true
Rails/Pluck: # new in 2.7
Enabled: true
Rails/PluckInWhere: # new in 2.7
Enabled: true
Rails/RedundantPresenceValidationOnBelongsTo: # new in 2.13
Enabled: true
Rails/RedundantTravelBack: # new in 2.12
Enabled: true
Rails/RenderInline: # new in 2.7
Enabled: true
Rails/RenderPlainText: # new in 2.7
Enabled: true
Rails/RootJoinChain: # new in 2.13
Enabled: true
Rails/ShortI18n: # new in 2.7
Enabled: true
Rails/SquishedSQLHeredocs: # new in 2.8
Enabled: true
Rails/TimeZoneAssignment: # new in 2.10
Enabled: true
Rails/UnusedIgnoredColumns: # new in 2.11
Enabled: true
Rails/WhereEquals: # new in 2.9
Enabled: true
Rails/WhereExists: # new in 2.7
Enabled: true
Rails/WhereNot: # new in 2.8
Enabled: true
99 changes: 88 additions & 11 deletions .rubocop_todo.yml
@@ -1,32 +1,46 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2021-04-08 13:27:43 -0700 using RuboCop version 0.76.0.
# on 2022-01-07 22:11:15 UTC using RuboCop version 1.24.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
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
Lint/MissingSuper:
Exclude:
- 'config/initializers/okcomputer.rb'

# Offense count: 1
# Cop supports --auto-correct.
Lint/RedundantDirGlobSort:
Exclude:
- 'app/lib/pre_assembly/batch.rb'

# Offense count: 10
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 68
Max: 79

# Offense count: 2
# Configuration parameters: CountComments.
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 157

# Offense count: 4
# Offense count: 3
# Configuration parameters: IgnoredMethods.
Metrics/CyclomaticComplexity:
Max: 16
Max: 17

# Offense count: 8
# Configuration parameters: CountComments, ExcludedMethods.
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
Metrics/MethodLength:
Max: 45

# Offense count: 2
# Configuration parameters: IgnoredMethods.
Metrics/PerceivedComplexity:
Max: 16
Max: 17

# Offense count: 6
RSpec/AnyInstance:
Expand All @@ -36,23 +50,86 @@ RSpec/AnyInstance:
# Offense count: 1
RSpec/BeforeAfterAll:
Exclude:
- 'spec/spec_helper.rb'
- 'spec/rails_helper.rb'
- 'spec/support/**/*.rb'
- 'spec/lib/pre_assembly/digital_object_spec.rb'

# Offense count: 1
RSpec/IdenticalEqualityAssertion:
Exclude:
- 'spec/models/batch_context_spec.rb'

# Offense count: 55
# Configuration parameters: AllowSubject.
RSpec/MultipleMemoizedHelpers:
Max: 12

# Offense count: 6
RSpec/StubbedMock:
Exclude:
- 'spec/models/job_run_spec.rb'
- 'spec/services/discovery_report_spec.rb'

# Offense count: 44
RSpec/SubjectStub:
Exclude:
- 'spec/lib/pre_assembly/digital_object_spec.rb'
- 'spec/models/batch_context_spec.rb'
- 'spec/services/discovery_report_spec.rb'

# Offense count: 1
# Configuration parameters: EnforcedStyle, AllowToTime.
# SupportedStyles: strict, flexible
Rails/Date:
Exclude:
- 'spec/services/discovery_report_spec.rb'

# Offense count: 6
# Configuration parameters: EnforcedStyle.
# SupportedStyles: slashes, arguments
Rails/FilePath:
Exclude:
- 'app/lib/pre_assembly/logging.rb'
- 'config/initializers/load_config.rb'
- 'config/initializers/resque.rb'
- 'spec/lib/csv_importer_spec.rb'
- 'spec/rails_helper.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: Include.
# Include: **/Rakefile, **/*.rake
Rails/RakeEnvironment:
Exclude:
- 'lib/tasks/resque.rake'

# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: strict, flexible
Rails/TimeZone:
Exclude:
- 'app/lib/pre_assembly/batch.rb'
- 'app/services/discovery_report.rb'
- 'spec/lib/pre_assembly/batch_spec.rb'

# Offense count: 1
Style/ClassVars:
Exclude:
- 'app/lib/pre_assembly/logging.rb'

# Offense count: 24
# Offense count: 22
# Configuration parameters: AllowedConstants.
Style/Documentation:
Enabled: false

# Offense count: 6
# Cop supports --auto-correct.
Style/KeywordParametersOrder:
Exclude:
- 'app/lib/pre_assembly/digital_object.rb'

# Offense count: 1
# Configuration parameters: AllowedMethods.
# AllowedMethods: respond_to_missing?
Style/OptionalBooleanParameter:
Exclude:
- 'app/lib/pre_assembly/digital_object.rb'
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -18,5 +18,5 @@ before_install:
- nvm install 12.18

rvm:
- 2.6.3
- 2.7.1
- 3.0.3
5 changes: 3 additions & 2 deletions Gemfile
Expand Up @@ -24,7 +24,7 @@ gem 'uglifier' # compressor for JavaScript assets

# Stanford gems
gem 'assembly-image', '~> 1.7'
gem 'assembly-objectfile', '~> 1.10', '>= 1.10.2' # webarchive-seed and reading order is supported in 1.10.2 and better
gem 'assembly-objectfile', '~> 1.10', '>= 1.10.3' # webarchive-seed and reading order is supported in 1.10.2 and better
gem 'dor-services-client', '~> 7.0'
gem 'dor-workflow-client'
gem 'druid-tools'
Expand Down Expand Up @@ -53,7 +53,8 @@ end

group :development, :test do
gem 'pry-byebug'
gem 'rubocop', '~> 0.76.0'
gem 'rubocop'
gem 'rubocop-rails'
gem 'rubocop-rspec'
# gem 'ruby-prof'
gem 'sqlite3'
Expand Down

0 comments on commit 4bc9e76

Please sign in to comment.