Skip to content

Commit

Permalink
Run bundle exec rubocop -a
Browse files Browse the repository at this point in the history
Exclude some files in rubocop.yml
  • Loading branch information
christinach committed Sep 13, 2024
1 parent 3d755bb commit 7ed2b57
Show file tree
Hide file tree
Showing 13 changed files with 6 additions and 30 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,17 @@ RSpec/DescribeClass:
- 'spec/features/**/*'
- 'spec/views/**/*'
- 'spec/requests/**/*'
- 'spec/system**/*'
- 'spec/lib/**/*'

RSpec/ExampleLength:
Enabled: false

RSpec/VerifiedDoubles:
Exclude:
- 'spec/helpers/catalog_helper_spec.rb'
- 'spec/components/**/*'
- 'spec/processors/**/*'

Layout/IndentationConsistency:
EnforcedStyle: indented_internal_methods
Expand Down
2 changes: 0 additions & 2 deletions app/models/requests/illiad.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def illiad_query_parameters(referrer:, referent:, metadata:, note:)
qp.to_query
end

# rubocop:disable Metrics/MethodLength
def map_metdata(referrer:, referent:, metadata:)
qp = {}
METADATA_MAPPING.each { |metadata_key, illiad_key| qp[illiad_key] = metadata[metadata_key.to_s] }
Expand All @@ -62,7 +61,6 @@ def map_metdata(referrer:, referent:, metadata:)
qp['CitedIn'] = catalog_url(referent)
qp
end
# rubocop:enable Metrics/MethodLength

# Grab a source label out of `sid` or `rfr_id`, add on our suffix.
def sid_for_illiad(referrer)
Expand Down
6 changes: 2 additions & 4 deletions app/models/requests/illiad_patron.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ def illiad_staff_status
end
end

# rubocop:disable Metrics/MethodLength
def illiad_staff_title_status
if title.include?("Visiting Research")
def illiad_staff_title_status(ldap_title:)
if ldap_title.include?("Visiting Research")
"GS - Visiting Research Scholar"
elsif title.include?("Senior Research Scholar")
"F - Senior Research Scholar"
Expand All @@ -108,6 +107,5 @@ def illiad_staff_title_status
"GS - University Staff"
end
end
# rubocop:enable Metrics/MethodLength
end
end
2 changes: 0 additions & 2 deletions app/models/requests/router.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def calculate_services

private

# rubocop:disable Metrics/MethodLength
def calculate_alma_or_scsb_services
return [] unless auth_user?
if requestable.charged?
Expand All @@ -74,7 +73,6 @@ def calculate_alma_or_scsb_services
].select(&:eligible?).map(&:to_s)
end
end
# rubocop:enable Metrics/MethodLength

def calculate_unavailable_services
ill_eligibility = ServiceEligibility::ILL.new(requestable:, user:, any_loanable:)
Expand Down
2 changes: 0 additions & 2 deletions app/models/requests/selected_items_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def validate(record)

private

# rubocop:disable Metrics/MethodLength
def validate_selected(record, selected)
return unless selected['selected'] == 'true'
case selected["type"]
Expand All @@ -35,7 +34,6 @@ def validate_selected(record, selected)
record.errors.add(:items, { selected['mfhd'] => { 'text' => 'Please choose a Request Method for your selected item.', 'type' => 'pick_up' } })
end
end
# rubocop:enable Metrics/MethodLength

def validate_ill_on_shelf(record, selected, pick_up_phrase: 'your selected item', action_phrase: 'Requested')
return unless validate_item_id(record:, selected:, action_phrase:)
Expand Down
2 changes: 0 additions & 2 deletions app/models/requests/submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ def edd?(item)

private

# rubocop:disable Metrics/MethodLength
def service_by_type(type)
case type
when 'on_shelf', 'marquand_in_library', 'annex', 'annex_in_library'
Expand Down Expand Up @@ -139,7 +138,6 @@ def categorize_by_delivery_and_location(item)
end
item
end
# rubocop:enable Metrics/MethodLength

def in_library?(item)
# return false if item["type"] == "digitize_fill_in"
Expand Down
1 change: 0 additions & 1 deletion app/services/bibdata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class ResourceNotFoundError < StandardError; end
class ForbiddenError < StandardError; end

class << self
# rubocop:disable Metrics/MethodLength
# ignore rubocop warnings; complexity and length step from error checking.
def get_patron(user)
return unless user.uid
Expand Down
2 changes: 0 additions & 2 deletions spec/features/requests/form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

# rubocop:disable Metrics/BlockLength
describe 'request form', vcr: { cassette_name: 'form_features', record: :none }, type: :feature, requests: true do
# rubocop:disable RSpec/MultipleExpectations
let(:mms_id) { '9994933183506421?mfhd=22558528920006421' }
let(:thesis_id) { 'dsp01rr1720547' }
let(:in_process_id) { '99117665883506421?mfhd=22707341710006421' }
Expand Down Expand Up @@ -1544,6 +1543,5 @@
expect(confirm_email.subject).to eq("In Process Request")
end
end
# rubocop:enable RSpec/MultipleExpectations
end
# rubocop:enable Metrics/BlockLength
2 changes: 0 additions & 2 deletions spec/models/requests/illiad_transaction_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
expect(transaction).to be_blank
end

# rubocop:disable RSpec/MultipleExpectations
it "posts a transaction and also sends an email when the patron is not cleared" do
stub_request(:post, transaction_url)
.with(body: hash_including("Username" => "abc234", "TransactionStatus" => "Awaiting Article Express Processing", "RequestType" => "Article", "ProcessType" => "Borrowing", "WantedBy" => "Yes, until the semester's", "PhotoArticleAuthor" => "That One", "PhotoItemAuthor" => "Davis, Paul K.", "PhotoJournalTitle" => "100 decisive battles : from ancient times to the present", "PhotoItemPublisher" => "Santa Barbara, Calif: ABC-CLIO", "ISSN" => "9781576070758", "CallNumber" => "HF1131 .B485", "PhotoJournalInclusivePages" => "-", "CitedIn" => "https://catalog.princeton.edu/catalog/9935102073506421", "PhotoJournalVolume" => "",
Expand All @@ -105,7 +104,6 @@
expect(transaction["Username"]).to eq('abc123')
expect(transaction["TransactionNumber"]).to eq(1_093_806)
end
# rubocop:enable RSpec/MultipleExpectations
end

context "loan metadata mapper" do
Expand Down
2 changes: 0 additions & 2 deletions spec/models/requests/patron_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true
require 'rails_helper'

# rubocop:disable RSpec/MultipleExpectations
describe Requests::Patron, requests: true do
subject(:patron) do
described_class.new(user:, patron_hash: patron_values)
Expand Down Expand Up @@ -207,4 +206,3 @@
end
end
end
# rubocop:enable RSpec/MultipleExpectations
6 changes: 0 additions & 6 deletions spec/models/requests/requestable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@
let(:no_circ_item_type) { requestable.item['item_type'] }
let(:no_circ_pick_up_location_code) { requestable.item['pickup_location_code'] }

# rubocop:disable RSpec/MultipleExpectations
describe 'getters' do
it 'gets values' do
expect(requestable.item_data?).to be true
Expand All @@ -154,8 +153,6 @@
end
end
end
# rubocop:enable RSpec/MultipleExpectations

context 'A circulating item' do
let(:request) { FactoryBot.build(:mfhd_with_no_circ_and_circ_item, patron:) }
let(:requestable) { request.requestable[0] }
Expand Down Expand Up @@ -579,7 +576,6 @@
let(:request) { FactoryBot.build(:request_no_items, patron:) }
let(:requestable) { request.requestable.first } # assume only one requestable

# rubocop:disable RSpec/MultipleExpectations
describe 'requestable with no items ' do
it 'does not have item data' do
expect(requestable.item_data?).to be false
Expand All @@ -589,8 +585,6 @@
expect(requestable.cron_value).to eq ""
end
end
# rubocop:enable RSpec/MultipleExpectations

describe '#location_label' do
it 'has a location label' do
expect(requestable.location_label).to eq('Forrestal Annex - Princeton Collection')
Expand Down
3 changes: 0 additions & 3 deletions spec/models/requests/submission_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,6 @@
.to_return(status: 200, body: responses[:found], headers: {})
end

# rubocop:disable RSpec/MultipleExpectations
it 'items contacts illiad' do
stub_delivery_locations
clancy_url = stub_clancy_post(barcode: "32101072349515")
Expand All @@ -953,8 +952,6 @@
expect(a_request(:post, transaction_note_url)).to have_been_made
expect(a_request(:post, clancy_url)).to have_been_made
end
# rubocop:enable RSpec/MultipleExpectations

it "returns illiad errors" do
stub_request(:post, transaction_url)
.with(body: hash_including("Username" => "foo", "TransactionStatus" => "Awaiting Article Express Processing", "RequestType" => "Article", "ProcessType" => "Borrowing", "NotWantedAfter" => (DateTime.current + 6.months).strftime("%m/%d/%Y"), "WantedBy" => "Yes, until the semester's", "PhotoItemAuthor" => "Johns, Catherine",
Expand Down
2 changes: 0 additions & 2 deletions spec/models/requests/submissions/recap_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true
require 'rails_helper'

# rubocop:disable RSpec/MultipleExpectations
describe Requests::Submissions::Recap, requests: true do
context 'ReCAP Request' do
let(:valid_patron) { { "netid" => "foo", "university_id" => "99999999", "active_email" => 'foo1@princeton.edu', barcode: '111222333' }.with_indifferent_access }
Expand Down Expand Up @@ -295,4 +294,3 @@
end
end
end
# rubocop:enable RSpec/MultipleExpectations

0 comments on commit 7ed2b57

Please sign in to comment.