Skip to content

Commit

Permalink
🧹 Favor Layout/LineLength over Metrics/LineLength
Browse files Browse the repository at this point in the history
Rubocop seams to prefer the Layout namespace for LineLength.
  • Loading branch information
jeremyf committed Dec 21, 2023
1 parent b7bc2f2 commit 681401a
Show file tree
Hide file tree
Showing 20 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# rubocop:disable Metrics/LineLength
# rubocop:disable Layout/LineLength
source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
Expand Down Expand Up @@ -106,4 +106,4 @@ gem 'webmock', group: %i[test]
# and place overrides, themes and deployment code.
gem 'hyku_knapsack', github: 'samvera-labs/hyku_knapsack', branch: 'upstream_main'

# rubocop:enable Metrics/LineLength
# rubocop:enable Layout/LineLength
4 changes: 2 additions & 2 deletions app/models/featured_collection_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ class FeaturedCollectionList
# @param [ActionController::Parameters] a collection of nested perameters
def featured_collections_attributes=(attributes_collection)
attributes_collection = attributes_collection.to_h if attributes_collection.respond_to?(:permitted?)
# rubocop:disable Metrics/LineLength
# rubocop:disable Layout/LineLength
attributes_collection = attributes_collection.sort_by { |i, _| i.to_i }.map { |_, attributes| attributes } if attributes_collection.is_a? Hash
attributes_collection.each do |attributes|
raise "Missing id" if attributes['id'].blank?
existing_record = FeaturedCollection.find(attributes['id'])
existing_record.update(attributes.except('id'))
end
# rubocop:enable Metrics/LineLength
# rubocop:enable Layout/LineLength
end

def featured_collections
Expand Down
4 changes: 2 additions & 2 deletions lib/tasks/tenantize_task.rake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# rubocop:disable Metrics/LineLength
# rubocop:disable Layout/LineLength
namespace :tenantize do
desc 'Run given task on all or selected tenants'
task :task, [:task_name] => :environment do |_cmd, args|
Expand All @@ -17,4 +17,4 @@ namespace :tenantize do
end
end
end
# rubocop:enable Metrics/LineLength
# rubocop:enable Layout/LineLength
2 changes: 1 addition & 1 deletion spec/factories/collections.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
evaluator.user,
access)

attributes = evaluator.with_permission_template.merge(attributes) if evaluator.with_permission_template.respond_to?(:merge) # rubocop:disable Metrics/LineLength
attributes = evaluator.with_permission_template.merge(attributes) if evaluator.with_permission_template.respond_to?(:merge) # rubocop:disable Layout/LineLength

create(:permission_template, attributes) unless Hyrax::PermissionTemplate.find_by(source_id: collection.id)
collection.permission_template.reset_access_controls_for(collection:)
Expand Down
4 changes: 2 additions & 2 deletions spec/features/admin_set_form_participants_tab_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@
.find(:xpath, '//td[@data-agent="admin"]')
.find(:xpath, '..')['innerHTML']
expect(manager_row_html).to include('<td data-agent="admin">Repository Administrators</td>')
# rubocop:disable Metrics/LineLength
# rubocop:disable Layout/LineLength
expect(manager_row_html).to include('<input class="btn btn-sm btn-danger disabled" disabled="disabled" title="The repository administrators group cannot be removed" type="submit" value="Remove">')
# rubocop:enable Metrics/LineLength
# rubocop:enable Layout/LineLength
end

it 'shows an enabled remove button next to Repository Administrator group as a Depositor' do
Expand Down
4 changes: 2 additions & 2 deletions spec/features/appearance_theme_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
visit '/admin/appearance'
click_link('Themes')
select('Gallery view', from: 'Search Results Page Theme')
# rubocop:disable Metrics/LineLength
# rubocop:disable Layout/LineLength
expect(page).to have_content('This will select a default view for the search results page. Users can select their preferred views on the search results page that will override this selection')
# rubocop:enable Metrics/LineLength
# rubocop:enable Layout/LineLength
find('body').click
click_on('Save')
site = Site.last
Expand Down
2 changes: 1 addition & 1 deletion spec/features/collection_editor_role_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'rails_helper'

RSpec.describe 'actions permitted by the collection_editor role', type: :feature, js: true, clean: true, ci: 'skip' do # rubocop:disable Metrics/LineLength
RSpec.describe 'actions permitted by the collection_editor role', type: :feature, js: true, clean: true, ci: 'skip' do # rubocop:disable Layout/LineLength
let!(:role) { FactoryBot.create(:role, :collection_editor) }
let!(:collection) { FactoryBot.create(:private_collection_lw, with_permission_template: true) }
let(:user) { FactoryBot.create(:user) }
Expand Down
2 changes: 1 addition & 1 deletion spec/features/collection_manager_role_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'rails_helper'

RSpec.describe 'actions permitted by the collection_manager role', type: :feature, js: true, clean: true, ci: 'skip' do # rubocop:disable Metrics/LineLength
RSpec.describe 'actions permitted by the collection_manager role', type: :feature, js: true, clean: true, ci: 'skip' do # rubocop:disable Layout/LineLength
let!(:role) { FactoryBot.create(:role, :collection_manager) }
let!(:collection) { FactoryBot.create(:private_collection_lw, with_permission_template: true) }
let(:user) { FactoryBot.create(:user) }
Expand Down
2 changes: 1 addition & 1 deletion spec/features/collection_reader_role_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'rails_helper'

RSpec.describe 'actions permitted by the collection_reader role', type: :feature, js: true, clean: true, ci: 'skip' do # rubocop:disable Metrics/LineLength
RSpec.describe 'actions permitted by the collection_reader role', type: :feature, js: true, clean: true, ci: 'skip' do # rubocop:disable Layout/LineLength
let!(:role) { FactoryBot.create(:role, :collection_reader) }
let!(:collection) { FactoryBot.create(:private_collection_lw, with_permission_template: true) }
let(:user) { FactoryBot.create(:user) }
Expand Down
4 changes: 2 additions & 2 deletions spec/features/create_generic_work_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
select('In Copyright', from: 'Rights statement')

page.choose('generic_work_visibility_open')
# rubocop:disable Metrics/LineLength
# rubocop:disable Layout/LineLength
expect(page).to have_content('Please note, making something visible to the world (i.e. marking this as Public) may be viewed as publishing which could impact your ability to')
# rubocop:enable Metrics/LineLength
# rubocop:enable Layout/LineLength
find('#agreement').click

click_on('Save')
Expand Down
4 changes: 2 additions & 2 deletions spec/features/create_image_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
select('In Copyright', from: 'Rights statement')

page.choose('image_visibility_open')
# rubocop:disable Metrics/LineLength
# rubocop:disable Layout/LineLength
expect(page).to have_content('Please note, making something visible to the world (i.e. marking this as Public) may be viewed as publishing which could impact your ability to')
# rubocop:enable Metrics/LineLength
# rubocop:enable Layout/LineLength
find('#agreement').click

click_on('Save')
Expand Down
2 changes: 1 addition & 1 deletion spec/features/institutional_repository_theme_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'rails_helper'

RSpec.describe 'Admin can select institutional repository theme', type: :feature, js: true, clean: true do # rubocop:disable Metrics/LineLength
RSpec.describe 'Admin can select institutional repository theme', type: :feature, js: true, clean: true do # rubocop:disable Layout/LineLength
let(:account) { FactoryBot.create(:account) }
let(:admin) { FactoryBot.create(:admin, email: '[email protected]', display_name: 'Adam Admin') }
let(:user) { create :user }
Expand Down
4 changes: 2 additions & 2 deletions spec/features/work_editor_role_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@
select('In Copyright', from: 'Rights statement')

page.choose('generic_work_visibility_open')
# rubocop:disable Metrics/LineLength
# rubocop:disable Layout/LineLength
expect(page).to have_content('Please note, making something visible to the world (i.e. marking this as Public) may be viewed as publishing which could impact your ability to')
# rubocop:enable Metrics/LineLength
# rubocop:enable Layout/LineLength
find('#agreement').click

expect { click_on('Save') }
Expand Down
2 changes: 1 addition & 1 deletion spec/features/work_search_institution_visibility_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

RSpec.describe 'Users trying to search for an Institution Work', type: :feature, clean: true, js: true do # rubocop:disable Metrics/LineLength
RSpec.describe 'Users trying to search for an Institution Work', type: :feature, clean: true, js: true do # rubocop:disable Layout/LineLength
let(:fake_solr_document) do
{
'has_model_ssim': ['GenericWork'],
Expand Down
2 changes: 1 addition & 1 deletion spec/features/work_show_institution_visibility_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

RSpec.describe "Users trying to access an Institution Work's show page", type: :feature, clean: true, js: true do # rubocop:disable Metrics/LineLength
RSpec.describe "Users trying to access an Institution Work's show page", type: :feature, clean: true, js: true do # rubocop:disable Layout/LineLength
let(:fake_solr_document) do
{
'has_model_ssim': ['GenericWork'],
Expand Down
2 changes: 1 addition & 1 deletion spec/features/work_show_open_visibility_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

RSpec.describe "Users trying to access a Public Work's show page", type: :feature, clean: true, js: true do # rubocop:disable Metrics/LineLength
RSpec.describe "Users trying to access a Public Work's show page", type: :feature, clean: true, js: true do # rubocop:disable Layout/LineLength
let(:fake_solr_document) do
{
'has_model_ssim': ['GenericWork'],
Expand Down
2 changes: 1 addition & 1 deletion spec/features/work_show_private_visibility_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

RSpec.describe "Users trying to access a Private Work's show page", type: :feature, clean: true, js: true do # rubocop:disable Metrics/LineLength
RSpec.describe "Users trying to access a Private Work's show page", type: :feature, clean: true, js: true do # rubocop:disable Layout/LineLength
let(:fake_solr_document) do
{
'has_model_ssim': ['GenericWork'],
Expand Down
4 changes: 2 additions & 2 deletions spec/models/uploaded_file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Much of this testing is the complex configurable stuff underneath UploadedFile
# and simulating the AWS configuration that would be in production.

# rubocop:disable Metrics/LineLength
# rubocop:disable Layout/LineLength
RSpec.describe 'Hyrax::UploadedFile' do # rubocop:disable RSpec/DescribeClass
let(:file) { File.open(fixture_path + '/images/world.png') }
let(:upload) { Hyrax::UploadedFile.create(file:) }
Expand Down Expand Up @@ -110,4 +110,4 @@
end
end
end
# rubocop:enable Metrics/LineLength
# rubocop:enable Layout/LineLength
2 changes: 1 addition & 1 deletion spec/requests/work_show_institution_visibility_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

RSpec.describe "Users trying to access an Institution Work's show page", type: :request, clean: true, multitenant: true do # rubocop:disable Metrics/LineLength
RSpec.describe "Users trying to access an Institution Work's show page", type: :request, clean: true, multitenant: true do # rubocop:disable Layout/LineLength
let(:account) { create(:account) }
let(:work) { create(:work, visibility: 'authenticated') }
let(:tenant_user_attributes) { attributes_for(:user) }
Expand Down
4 changes: 2 additions & 2 deletions spec/routing/featured_collections_route_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
RSpec.describe "file routes", type: :routing do
routes { Rails.application.routes }

# rubocop:disable Metrics/LineLength
# rubocop:disable Layout/LineLength
it 'creates a featured_collection' do
expect(post: '/collections/7/featured_collection').to route_to(controller: 'hyrax/featured_collections', action: 'create', id: '7')
end
Expand All @@ -15,5 +15,5 @@
expect(featured_collection_lists_path).to eq '/featured_collections'
expect(post: '/featured_collections').to route_to(controller: 'hyrax/featured_collection_lists', action: 'create')
end
# rubocop:enable Metrics/LineLength
# rubocop:enable Layout/LineLength
end

0 comments on commit 681401a

Please sign in to comment.