Skip to content

Commit

Permalink
💄 Fixing linting for Adventist Valkyrie
Browse files Browse the repository at this point in the history
This commit fixes the linting issues on the Adventist Valkyrie project.
The files in this commit contain only whitespace changes or changing
Note comments to NOTE as suggested by Rubocop. There should not be any
changes to the functionality of the application.

Ref:
- #741
  • Loading branch information
sjproctor committed Aug 16, 2024
1 parent c8ad84c commit 54adf77
Show file tree
Hide file tree
Showing 77 changed files with 858 additions and 94 deletions.
2 changes: 1 addition & 1 deletion app/controllers/hyrax/conference_items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ConferenceItemsController < ApplicationController
# Use a Valkyrie aware form service to generate Valkyrie::ChangeSet style
# forms.
self.work_form_service = Hyrax::FormFactory.new

# Use this line if you want to use a custom presenter
self.show_presenter = Hyrax::ConferenceItemPresenter
end
Expand Down
20 changes: 10 additions & 10 deletions app/indexers/hyrax/file_set_indexer_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ def generate_solr_document

private

def pdf_text
text = IO.popen(['pdftotext', '-', '-'], 'r+b') do |pdftotext|
pdftotext.write(object.original_file.content)
pdftotext.close_write
pdftotext.read
end

text.tr("\n", ' ')
.squeeze(' ')
.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '') # remove non-UTF-8 characters
def pdf_text
text = IO.popen(['pdftotext', '-', '-'], 'r+b') do |pdftotext|
pdftotext.write(object.original_file.content)
pdftotext.close_write
pdftotext.read
end

text.tr("\n", ' ')
.squeeze(' ')
.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '') # remove non-UTF-8 characters
end
end
end

Expand Down
1 change: 0 additions & 1 deletion app/jobs/application_job_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ module ApplicationJobDecorator
end
end


def redirect_priority_jobs
return :ingest unless priority_tenants_array.include? tenant_name
PRIORITY_QUEUE_NAME
Expand Down
2 changes: 1 addition & 1 deletion app/models/bulkrax/oai_adventist_qdc_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def field_to(field)
super(field)
end

# Note: We're overriding the setting of the thumbnail_url as per prior implementations in
# NOTE: We're overriding the setting of the thumbnail_url as per prior implementations in
# Adventist's code-base.
def add_thumbnail_url
true
Expand Down
2 changes: 1 addition & 1 deletion app/models/bulkrax/oai_adventist_set_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def build_metadata
end
end

# Note: as of the time of writing this comment, the Bulkrax::OaiSetEntry does not handle
# NOTE: as of the time of writing this comment, the Bulkrax::OaiSetEntry does not handle
# metadata nor does it do anything with visibility, rights statements, or admin sets. This is
# added as an override that I'd love to see "removed"
add_visibility
Expand Down
2 changes: 1 addition & 1 deletion app/models/generic_work_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
derivative_service_plugins: [
IiifPrint::TextExtractionDerivativeService
]
))
))

# This must come after the properties because it finalizes the metadata
# schema (by adding accepts_nested_attributes)
Expand Down
2 changes: 1 addition & 1 deletion app/models/image_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
derivative_service_plugins: [
IiifPrint::TextExtractionDerivativeService
]
))
))

# This must come after the properties because it finalizes the metadata
# schema (by adding accepts_nested_attributes)
Expand Down
48 changes: 24 additions & 24 deletions app/parsers/bulkrax/adventist_csv_parser_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,35 @@ def missing_elements(record)

private

def extract_keys_from_record(record)
keys = record.reject { |_, v| v.blank? }
.keys
.compact
.uniq
.map(&:to_s)
.map(&:strip)
.map { |k| Bulkrax.normalize_string(k) }
keys_without_numbers(keys)
end
def extract_keys_from_record(record)
keys = record.reject { |_, v| v.blank? }
.keys
.compact
.uniq
.map(&:to_s)
.map(&:strip)
.map { |k| Bulkrax.normalize_string(k) }
keys_without_numbers(keys)
end

def collect_keys_from_mapping(keys_from_record)
keys = []
importerexporter.mapping.stringify_keys.each do |k, v|
Array.wrap(v['from']).each do |vf|
vf_str = Bulkrax.normalize_string(vf.to_s.strip)
keys << k.to_s.strip if keys_from_record.include?(vf_str)
end
def collect_keys_from_mapping(keys_from_record)
keys = []
importerexporter.mapping.stringify_keys.each do |k, v|
Array.wrap(v['from']).each do |vf|
vf_str = Bulkrax.normalize_string(vf.to_s.strip)
keys << k.to_s.strip if keys_from_record.include?(vf_str)
end
keys.uniq.map(&:to_s).map(&:strip).map { |k| Bulkrax.normalize_string(k) }
end
keys.uniq.map(&:to_s).map(&:strip).map { |k| Bulkrax.normalize_string(k) }
end

def normalize_elements(elements)
elements.map(&:to_s).map(&:strip).map { |k| Bulkrax.normalize_string(k) }
end
def normalize_elements(elements)
elements.map(&:to_s).map(&:strip).map { |k| Bulkrax.normalize_string(k) }
end

def identify_missing_elements(required_elements, keys)
required_elements - keys
end
def identify_missing_elements(required_elements, keys)
required_elements - keys
end
end
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# OVERRIDE IiifPrint v3.0.1 to check has_model instead of hydra_model.
# OVERRIDE IiifPrint v3.0.1 to check has_model instead of hydra_model.
# Hyrax.config.curation_concerns does not include "Resource"

module Adl
Expand Down
7 changes: 4 additions & 3 deletions app/presenters/hyku/work_show_presenter_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ def pdf_extension?
def viewer?
iiif_viewer? || video_embed_viewer? || pdf_viewer?
end

private

def model_klass
model_name.instance_variable_get(:@klass)
end
def model_klass
model_name.instance_variable_get(:@klass)
end
end
end

Expand Down
16 changes: 8 additions & 8 deletions app/renderers/publication_status_renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ class PublicationStatusRenderer < Hyrax::Renderers::AttributeRenderer

private

def li_value(value)
link_to(ERB::Util.h(publication_status_label(value)), search_path(value))
end
def li_value(value)
link_to(ERB::Util.h(publication_status_label(value)), search_path(value))
end

def search_path(value)
Rails.application.routes.url_helpers.search_catalog_path(
'f([publication_status_sim[]])': ERB::Util.h(value), locale: I18n.locale
)
end
def search_path(value)
Rails.application.routes.url_helpers.search_catalog_path(
'f([publication_status_sim[]])': ERB::Util.h(value), locale: I18n.locale
)
end
end
4 changes: 2 additions & 2 deletions app/services/wings/custom_queries/find_by_slug.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ class FindBySlug
def self.queries
[:find_by_slug]
end

def initialize(query_service:)
@query_service = query_service
end

attr_reader :query_service
delegate :resource_factory, to: :query_service

Expand Down
4 changes: 2 additions & 2 deletions app/uploaders/hyrax/uploaded_file_uploader_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ def filename
end

def original_file_name
model.filename
model.filename
end
end
end

Hyrax::UploadedFileUploader.prepend(Hyrax::UploadedFileUploaderDecorator)
Hyrax::UploadedFileUploader.prepend(Hyrax::UploadedFileUploaderDecorator)
5 changes: 2 additions & 3 deletions bundler.d/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
# or `ensure_gem` to make sure a gem is there w/o worrying about if it is an
# override or not

# Note: these injected gems are very sticky... it appears that you must rebuild
# your docker container and rebundle to get rid of an injected gem.
# NOTE: these injected gems are very sticky... it appears that you must rebuild
# your docker container and rebundle to get rid of an injected gem.

ensure_gem 'derivative-rodeo', '~> 0.5', '>= 0.5.3'

15 changes: 15 additions & 0 deletions db/migrate/20240815211201_create_version_committers.hyrax.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class CreateVersionCommitters < ActiveRecord::Migration[6.1]
def self.up
create_table :version_committers do |t|
t.string :obj_id
t.string :datastream_id
t.string :version_id
t.string :committer_login
t.timestamps null: false
end
end

def self.down
drop_table :version_committers
end
end
19 changes: 19 additions & 0 deletions db/migrate/20240815211202_create_checksum_audit_logs.hyrax.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class CreateChecksumAuditLogs < ActiveRecord::Migration[6.1]
def self.up
create_table :checksum_audit_logs do |t|
t.string :file_set_id
t.string :file_id
t.string :version
t.integer :pass
t.string :expected_result
t.string :actual_result
t.timestamps null: false
end
add_index :checksum_audit_logs, [:file_set_id, :file_id], name: 'by_file_set_id_and_file_id', order: { created_at: 'DESC' }
end

def self.down
remove_index(:checksum_audit_logs, name: 'by_file_set_id_and_file_id')
drop_table :checksum_audit_logs
end
end
12 changes: 12 additions & 0 deletions db/migrate/20240815211203_create_single_use_links.hyrax.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class CreateSingleUseLinks < ActiveRecord::Migration[6.1]
def change
create_table :single_use_links do |t|
t.string :downloadKey
t.string :path
t.string :itemId
t.datetime :expires

t.timestamps null: false
end
end
end
13 changes: 13 additions & 0 deletions db/migrate/20240815211204_add_social_to_users.hyrax.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class AddSocialToUsers < ActiveRecord::Migration[6.1]
def self.up
add_column :users, :facebook_handle, :string
add_column :users, :twitter_handle, :string
add_column :users, :googleplus_handle, :string
end

def self.down
remove_column :users, :facebook_handle, :string
remove_column :users, :twitter_handle, :string
remove_column :users, :googleplus_handle, :string
end
end
27 changes: 27 additions & 0 deletions db/migrate/20240815211205_add_ldap_attrs_to_user.hyrax.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class AddLdapAttrsToUser < ActiveRecord::Migration[6.1]
def self.up
add_column :users, :display_name, :string
add_column :users, :address, :string
add_column :users, :admin_area, :string
add_column :users, :department, :string
add_column :users, :title, :string
add_column :users, :office, :string
add_column :users, :chat_id, :string
add_column :users, :website, :string
add_column :users, :affiliation, :string
add_column :users, :telephone, :string
end

def self.down
remove_column :users, :display_name
remove_column :users, :address
remove_column :users, :admin_area
remove_column :users, :department
remove_column :users, :title
remove_column :users, :office
remove_column :users, :chat_id
remove_column :users, :website
remove_column :users, :affiliation
remove_column :users, :telephone
end
end
15 changes: 15 additions & 0 deletions db/migrate/20240815211206_add_avatars_to_users.hyrax.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class AddAvatarsToUsers < ActiveRecord::Migration[6.1]
def self.up
add_column :users, "avatar_file_name", :string
add_column :users, "avatar_content_type", :string
add_column :users, "avatar_file_size", :integer
add_column :users, "avatar_updated_at", :datetime
end

def self.down
remove_column :users, "avatar_file_name"
remove_column :users, "avatar_content_type"
remove_column :users, "avatar_file_size"
remove_column :users, "avatar_updated_at"
end
end
10 changes: 10 additions & 0 deletions db/migrate/20240815211207_create_trophies.hyrax.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateTrophies < ActiveRecord::Migration[6.1]
def change
create_table :trophies do |t|
t.integer :user_id
t.string :generic_file_id

t.timestamps null: false
end
end
end
5 changes: 5 additions & 0 deletions db/migrate/20240815211208_add_linkedin_to_users.hyrax.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddLinkedinToUsers < ActiveRecord::Migration[6.1]
def change
add_column :users, :linkedin_handle, :string
end
end
8 changes: 8 additions & 0 deletions db/migrate/20240815211209_create_tinymce_assets.hyrax.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class CreateTinymceAssets < ActiveRecord::Migration[6.1]
def change
create_table :tinymce_assets do |t|
t.string :file
t.timestamps null: false
end
end
end
10 changes: 10 additions & 0 deletions db/migrate/20240815211210_create_content_blocks.hyrax.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateContentBlocks < ActiveRecord::Migration[6.1]
def change
create_table :content_blocks do |t|
t.string :name
t.text :value
t.timestamps null: false
end
add_index :content_blocks, :name, unique: true
end
end
12 changes: 12 additions & 0 deletions db/migrate/20240815211211_create_featured_works.hyrax.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class CreateFeaturedWorks < ActiveRecord::Migration[6.1]
def change
create_table :featured_works do |t|
t.integer :order, default: 5
t.string :work_id

t.timestamps null: false
end
add_index :featured_works, :work_id
add_index :featured_works, :order
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddExternalKeyToContentBlocks < ActiveRecord::Migration[6.1]
def change
add_column :content_blocks, :external_key, :string
remove_index :content_blocks, :name
end
end
10 changes: 10 additions & 0 deletions db/migrate/20240815211213_create_proxy_deposit_rights.hyrax.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CreateProxyDepositRights < ActiveRecord::Migration[6.1]
def change
create_table :proxy_deposit_rights do |t|
t.references :grantor
t.references :grantee
t.timestamps null: false
end

end
end
Loading

0 comments on commit 54adf77

Please sign in to comment.