Skip to content

Commit

Permalink
Update the ruby version for rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Apr 24, 2019
1 parent 18a60e9 commit 50815d8
Show file tree
Hide file tree
Showing 64 changed files with 164 additions and 35 deletions.
4 changes: 2 additions & 2 deletions .rubocop.yml
Expand Up @@ -3,7 +3,7 @@ inherit_from: .rubocop_todo.yml
require: rubocop-rspec

AllCops:
TargetRubyVersion: 2.2
TargetRubyVersion: 2.5
Exclude:
- db/migrate/**
- db/schema.rb
Expand Down Expand Up @@ -40,7 +40,7 @@ Metrics/LineLength:

Metrics/BlockLength:
Enabled: false

RSpec/ExpectActual:
Exclude:
- 'spec/routing/**'
11 changes: 10 additions & 1 deletion .rubocop_todo.yml
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2019-04-11 13:57:00 -0500 using RuboCop version 0.65.0.
# on 2019-04-23 12:17:23 -0500 using RuboCop version 0.65.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
Expand Down Expand Up @@ -307,6 +307,15 @@ Style/IfUnlessModifier:
Style/NumericLiterals:
MinDigits: 11

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
# SupportedStyles: predicate, comparison
Style/NumericPredicate:
Exclude:
- 'spec/**/*'
- 'app/models/dor/update_marc_record_service.rb'

# Offense count: 13
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters.
Expand Down
2 changes: 2 additions & 0 deletions Capfile
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Load DSL and Setup Up Stages
require 'capistrano/setup'

Expand Down
2 changes: 2 additions & 0 deletions Gemfile
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gem 'rails', '~> 5.2.0'
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative 'config/application'

Rails.application.load_tasks
2 changes: 2 additions & 0 deletions app/controllers/application_controller.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ApplicationController < ActionController::API
include ActionController::HttpAuthentication::Basic::ControllerMethods
include ActionController::MimeResponds
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/content_controller.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# API to retrieve file listings and file content from the DOR workspace
class ContentController < ApplicationController
rescue_from ActionController::MissingFile do
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/marcxml_controller.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class MarcxmlController < ApplicationController #:nodoc:
before_action :set_marcxml_resource

Expand Down
2 changes: 2 additions & 0 deletions app/controllers/objects_controller.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class ObjectsController < ApplicationController
before_action :load_item, except: [:create]

Expand Down
2 changes: 2 additions & 0 deletions app/controllers/sdr_controller.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class SdrController < ApplicationController
def cm_inv_diff
unless %w(all shelve preserve publish).include?(params[:subset].to_s)
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/versions_controller.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class VersionsController < ApplicationController
before_action :load_item

Expand Down
2 changes: 2 additions & 0 deletions app/controllers/workflows_controller.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

class WorkflowsController < ApplicationController
def initial
render content_type: 'application/xml', body: Dor::WorkflowObject.initial_workflow(params[:wf_name])
Expand Down
2 changes: 2 additions & 0 deletions app/models/dor/goobi.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Dor
# This class passes data to the Goobi server using a custom XML message that was developed by Intranda
class Goobi < ServiceItem
Expand Down
2 changes: 2 additions & 0 deletions app/models/dor/goobi_tag.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Dor
# This represents a tag from Argo that we want to pass to Goobi.
# So the tag from Argo:
Expand Down
2 changes: 2 additions & 0 deletions app/models/dor/registration_response.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Dor
class RegistrationResponse
attr_reader :params
Expand Down
6 changes: 4 additions & 2 deletions app/models/dor/service_item.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Dor
class ServiceItem
# @return [String] value with SIRSI/Symphony numeric catkey in it for specified object, or nil if none exists
Expand Down Expand Up @@ -41,7 +43,7 @@ def previous_ckeys
def object_type
@object_type ||= begin
node = @druid_obj.datastreams['identityMetadata'].ng_xml.at_xpath('//identityMetadata/objectType')
node.content unless node.nil?
node&.content
end
end

Expand All @@ -51,7 +53,7 @@ def object_type
def barcode
@barcode ||= begin
node = @druid_obj.datastreams['identityMetadata'].ng_xml.at_xpath("//identityMetadata/otherId[@name='barcode']")
node.content unless node.nil?
node&.content
end
end

Expand Down
18 changes: 10 additions & 8 deletions app/models/dor/update_marc_record_service.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'open3'

module Dor
Expand Down Expand Up @@ -69,11 +71,11 @@ def run_write_script(command)

def new_856_record(ckey)
new856 = "#{get_identifier(ckey)}#{get_856_cons} #{get_1st_indicator}#{get_2nd_indicator}#{get_z_field}#{get_u_field}#{get_x1_sdrpurl_marker}#{object_type.prepend('|x')}"
new856 << "|xbarcode:#{barcode}" unless barcode.nil?
new856 << "|xfile:#{thumb}" unless thumb.nil?
new856 << get_x2_collection_info unless get_x2_collection_info.nil?
new856 << get_x2_constituent_info unless get_x2_constituent_info.nil?
new856 << get_x2_part_info unless get_x2_part_info.nil?
new856 += "|xbarcode:#{barcode}" unless barcode.nil?
new856 += "|xfile:#{thumb}" unless thumb.nil?
new856 += get_x2_collection_info unless get_x2_collection_info.nil?
new856 += get_x2_constituent_info unless get_x2_constituent_info.nil?
new856 += get_x2_part_info unless get_x2_part_info.nil?
new856
end

Expand Down Expand Up @@ -125,7 +127,7 @@ def get_x2_collection_info

unless collections.empty?
collections.each do |coll|
coll_info << "|xcollection:#{coll.id.sub('druid:', '')}:#{Dor::ServiceItem.get_ckey(coll)}:#{coll.label}"
coll_info += "|xcollection:#{coll.id.sub('druid:', '')}:#{Dor::ServiceItem.get_ckey(coll)}:#{coll.label}"
end
end

Expand Down Expand Up @@ -156,8 +158,8 @@ def get_x2_part_info
part_sort = @druid_obj.datastreams['descMetadata'].ng_xml.xpath('//*[@type="date/sequential designation"]').first

str = ''
str << "|xlabel:#{part_label}" unless part_label.empty?
str << "|xsort:#{part_sort.text}" if part_sort
str += "|xlabel:#{part_label}" unless part_label.empty?
str += "|xsort:#{part_sort.text}" if part_sort

str
end
Expand Down
2 changes: 2 additions & 0 deletions app/models/marcxml_resource.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# MARC resource model for retrieving and transforming MARC records
class MarcxmlResource
def self.find_by(catkey: nil, barcode: nil)
Expand Down
2 changes: 2 additions & 0 deletions app/models/symphony_reader.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Reader from symphony's JSON API to a MARC record
class SymphonyReader
attr_reader :catkey
Expand Down
2 changes: 2 additions & 0 deletions app/services/sdr_client.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# A client for talking to sdr-services-app
class SdrClient
def self.create
Expand Down
2 changes: 2 additions & 0 deletions app/services/workspace_service.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Creates workspaces. This replaces https://github.com/sul-dlss/dor-services/blob/master/lib/dor/models/concerns/assembleable.rb
class WorkspaceService
# @param [Dor::Item] work the work to create the workspace for
Expand Down
2 changes: 2 additions & 0 deletions bin/console
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

ENV['RACK_ENV'] = ARGV.first unless ARGV.first.nil?
require File.expand_path(File.dirname(__FILE__) + '/../config/boot')
require 'irb'
Expand Down
2 changes: 2 additions & 0 deletions bin/rails
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
Expand Down
2 changes: 2 additions & 0 deletions bin/rake
@@ -1,4 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
Expand Down
2 changes: 2 additions & 0 deletions config.ru
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# This file is used by Rack-based servers to start the application.

require_relative 'config/environment'
Expand Down
2 changes: 2 additions & 0 deletions config/application.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative 'boot'

require "rails"
Expand Down
2 changes: 2 additions & 0 deletions config/boot.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

require 'bundler/setup' # Set up gems listed in the Gemfile.
2 changes: 2 additions & 0 deletions config/deploy.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

set :application, 'dor_services'
set :repo_url, 'https://github.com/sul-dlss/dor-services-app.git'

Expand Down
2 changes: 2 additions & 0 deletions config/deploy/prod.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

server 'dor-services-prod.stanford.edu', user: 'dor_services', roles: %w(web app)

Capistrano::OneTimeKey.generate_one_time_key!
2 changes: 2 additions & 0 deletions config/deploy/stage.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

server 'dor-services-stage.stanford.edu', user: 'dor_services', roles: %w(web app)

Capistrano::OneTimeKey.generate_one_time_key!
2 changes: 2 additions & 0 deletions config/environment.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Load the Rails application.
require_relative 'application'

Expand Down
2 changes: 2 additions & 0 deletions config/environments/development.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

Expand Down
2 changes: 2 additions & 0 deletions config/environments/production.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

Expand Down
2 changes: 2 additions & 0 deletions config/environments/test.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

Expand Down
2 changes: 2 additions & 0 deletions config/initializers/dor_config.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Dor.configure do
ssl do
cert_file Settings.SSL.CERT_FILE
Expand Down
2 changes: 2 additions & 0 deletions config/initializers/mime_types.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Add new mime types for use in respond_to blocks:
Expand Down
2 changes: 2 additions & 0 deletions config/initializers/okcomputer.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'okcomputer'

# /status for 'upness', e.g. for load balancer
Expand Down
2 changes: 2 additions & 0 deletions config/initializers/ssl.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# By default Ruby 2.5 tries to use SSLv23.
# This sometimes causes this error:
# OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A
Expand Down
2 changes: 2 additions & 0 deletions config/initializers/wrap_parameters.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# This file contains settings for ActionController::ParamsWrapper which
Expand Down
2 changes: 2 additions & 0 deletions config/puma.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers a minimum and maximum.
# Any libraries that use thread pools should be configured to match
Expand Down
2 changes: 2 additions & 0 deletions config/routes.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html

Expand Down
2 changes: 2 additions & 0 deletions config/spring.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

%w(
.ruby-version
.rbenv-vars
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/rspec.rake
@@ -1,3 +1,5 @@
# frozen_string_literal: true

begin
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
Expand Down
2 changes: 2 additions & 0 deletions spec/controllers/content_controller_spec.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe ContentController do
Expand Down
2 changes: 2 additions & 0 deletions spec/controllers/marcxml_controller_spec.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe MarcxmlController do
Expand Down
2 changes: 2 additions & 0 deletions spec/controllers/objects_controller_spec.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe ObjectsController do
Expand Down
2 changes: 2 additions & 0 deletions spec/controllers/sdr_controller_spec.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe SdrController do
Expand Down
2 changes: 2 additions & 0 deletions spec/controllers/versions_controller_spec.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe VersionsController do
Expand Down
2 changes: 2 additions & 0 deletions spec/controllers/workflows_controller_spec.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe WorkflowsController do
Expand Down
2 changes: 2 additions & 0 deletions spec/dor/goobi_spec.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Dor::Goobi do
Expand Down
2 changes: 2 additions & 0 deletions spec/dor/goobi_tag_spec.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Dor::GoobiTag do
Expand Down
2 changes: 2 additions & 0 deletions spec/dor/registration_response_spec.rb
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Dor::RegistrationResponse do
Expand Down

0 comments on commit 50815d8

Please sign in to comment.