Skip to content

Instantly share code, notes, and snippets.

@cjcolvar
Created February 11, 2022 16:00
Show Gist options
  • Save cjcolvar/4185fa40bd88ac7ec2203d1a78c94bd2 to your computer and use it in GitHub Desktop.
Save cjcolvar/4185fa40bd88ac7ec2203d1a78c94bd2 to your computer and use it in GitHub Desktop.
Hyrax offenses on rubocop1 branch
Offenses:
Gemfile:15:3: C: [Correctable] Bundler/OrderedGems: Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem bixby should appear before simplecov.
gem 'bixby', github: 'samvera-labs/bixby', branch: 'rubocop1'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/actors/hyrax/actors/collections_membership_actor.rb:38:7: C: Metrics/AbcSize: Assignment Branch Condition size for assign_nested_attributes_for_collection is too high. [<8, 25, 11> 28.46/28]
def assign_nested_attributes_for_collection(env) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/actors/hyrax/actors/file_set_actor.rb:85:7: C: Metrics/AbcSize: Assignment Branch Condition size for attach_to_valkyrie_work is too high. [<5, 30, 4> 30.68/28]
def attach_to_valkyrie_work(work, file_set_params) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/actors/hyrax/actors/interpret_visibility_actor.rb:6:9: W: Lint/MissingSuper: Call super to initialize state of the parent class.
def initialize(attributes) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^
app/actors/hyrax/actors/ordered_members_actor.rb:9:7: W: Lint/MissingSuper: Call super to initialize state of the parent class.
def initialize(ordered_members, user) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/controllers/concerns/hyrax/collections_controller_behavior.rb:44:22: C: [Correctable] Style/RedundantBegin: Redundant begin block detected.
@presenter ||= begin
^^^^^
app/controllers/concerns/hyrax/embargoes_controller_behavior.rb:30:5: C: Metrics/CyclomaticComplexity: Cyclomatic complexity for update is too high. [8/7]
def update ...
^^^^^^^^^^
app/controllers/hyrax/dashboard/collections_controller.rb:377:24: C: [Correctable] Style/RedundantBegin: Redundant begin block detected.
@presenter ||= begin
^^^^^
app/controllers/hyrax/single_use_links_viewer_controller.rb:78:59: C: [Correctable] Rails/HttpStatus: Prefer :not_found over 404 to define HTTP status code.
render 'single_use_error', layout: "error", status: 404
^^^
app/forms/hyrax/forms/widgets/admin_set_visibility.rb:9:13: C: [Correctable] Style/CommentAnnotation: Annotation keywords like Note should be all upper case, followed by a colon, and a space, then a note describing the problem.
# Note: Visibility 'varies' = '' implies no constraints
^^^^^^
app/helpers/hyrax/hyrax_helper_behavior.rb:206:5: C: Metrics/PerceivedComplexity: Perceived complexity for link_to_profile is too high. [11/8]
def link_to_profile(args) ...
^^^^^^^^^^^^^^^^^^^^^^^^^
app/helpers/hyrax/trophy_helper.rb:4:5: C: Metrics/AbcSize: Assignment Branch Condition size for display_trophy_link is too high. [<12, 28, 6> 31.05/28]
def display_trophy_link(user, id, args = {}, &_block) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/jobs/import_url_job.rb:83:7: C: [Correctable] Style/RedundantBegin: Redundant begin block detected.
begin
^^^^^
app/models/concerns/hyrax/collection_behavior.rb:90:28: C: [Correctable] Layout/LeadingCommentSpace: Missing space after #.
def _to_partial_path #:nodoc:
^^^^^^^^
app/models/concerns/hyrax/work_behavior.rb:37:28: C: [Correctable] Layout/LeadingCommentSpace: Missing space after #.
def _to_partial_path #:nodoc:
^^^^^^^^
app/models/hyrax/file_set.rb:13:24: C: [Correctable] Style/RedundantBegin: Redundant begin block detected.
@_model_name ||= begin
^^^^^
app/models/hyrax/permission_template.rb:57:5: C: Rails/HasManyOrHasOneDependent: Specify a :dependent option.
has_one :active_workflow, -> { where(active: true) }, class_name: 'Sipity::Workflow', foreign_key: :permission_template_id
^^^^^^^
app/models/hyrax/statistic.rb:54:7: C: Metrics/CyclomaticComplexity: Cyclomatic complexity for resource_types is too high. [8/7]
def resource_types ...
^^^^^^^^^^^^^^^^^^
app/models/hyrax/statistic.rb:54:7: C: Metrics/PerceivedComplexity: Perceived complexity for resource_types is too high. [9/8]
def resource_types ...
^^^^^^^^^^^^^^^^^^
app/models/job_io_wrapper.rb:97:52: C: [Correctable] Style/CommentAnnotation: Annotation keywords like note should be all upper case, followed by a colon, and a space, then a note describing the problem.
eon ||= File.basename(path) if path.present? # note: uploader.filename is `nil` with uncached remote files (e.g. AWSFile)
^^^^^^
app/presenters/hyrax/file_usage.rb:7:5: W: Lint/MissingSuper: Call super to initialize state of the parent class.
def initialize(id) ...
^^^^^^^^^^^^^^^^^^
app/presenters/hyrax/member_presenter_factory.rb:50:25: C: [Correctable] Style/RedundantBegin: Redundant begin block detected.
@file_set_ids ||= begin
^^^^^
app/presenters/hyrax/work_usage.rb:10:5: W: Lint/MissingSuper: Call super to initialize state of the parent class.
def initialize(id) ...
^^^^^^^^^^^^^^^^^^
app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb:74:7: C: Metrics/CyclomaticComplexity: Cyclomatic complexity for exclude_if_paths_contain_collection is too high. [8/7]
def exclude_if_paths_contain_collection ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/hyrax/adapters/nesting_index_adapter.rb:63:13: C: [Correctable] Style/CommentAnnotation: Annotation keywords like note should be all upper case, followed by a colon, and a space, then a note describing the problem.
# note: we do not yield when the object has parents. Calling the nested indexer for the
^^^^^^
app/services/hyrax/adapters/nesting_index_adapter.rb:126:11: C: [Correctable] Performance/RedundantBlockCall: Use yield instead of block.call.
block.call(child_document) if full_reindex?(extent: extent) || child_document.pathnames.empty?
^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/hyrax/batch_create_failure_service.rb:5:5: W: Lint/MissingSuper: Call super to initialize state of the parent class.
def initialize(user, messages) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/hyrax/batch_create_success_service.rb:6:5: W: Lint/MissingSuper: Call super to initialize state of the parent class.
def initialize(user) ...
^^^^^^^^^^^^^^^^^^^^
app/services/hyrax/characterization/valkyrie_characterization_service.rb:94:7: C: [Correctable] Style/RedundantBegin: Redundant begin block detected.
begin
^^^^^
app/services/hyrax/collection_types/create_service.rb:161:9: W: Lint/MissingSuper: Call super to initialize state of the parent class.
def initialize(participants) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/hyrax/collections/collection_member_service.rb:86:13: C: [Correctable] Style/RedundantBegin: Redundant begin block detected.
begin
^^^^^
app/services/hyrax/listeners/member_cleanup_listener.rb:16:11: C: [Correctable] Style/RedundantBegin: Redundant begin block detected.
begin
^^^^^
app/services/hyrax/listeners/member_cleanup_listener.rb:36:11: C: [Correctable] Style/RedundantBegin: Redundant begin block detected.
begin
^^^^^
app/services/hyrax/manifest_builder_service.rb:58:5: C: Metrics/CyclomaticComplexity: Cyclomatic complexity for sanitized_manifest is too high. [9/7]
def sanitized_manifest(presenter:) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/hyrax/manifest_builder_service.rb:58:5: C: Metrics/PerceivedComplexity: Perceived complexity for sanitized_manifest is too high. [9/8]
def sanitized_manifest(presenter:) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/hyrax/permission_manager.rb:169:5: C: Metrics/CyclomaticComplexity: Cyclomatic complexity for update_users_for is too high. [10/7]
def update_users_for(mode:, users:) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/hyrax/permission_manager.rb:169:5: C: Metrics/PerceivedComplexity: Perceived complexity for update_users_for is too high. [10/8]
def update_users_for(mode:, users:) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/hyrax/solr_query_service.rb:14:5: W: Lint/MissingSuper: Call super to initialize state of the parent class.
def initialize(query: [], solr_service: Hyrax::SolrService) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/hyrax/workflow/workflow_importer.rb:131:11: C: [Correctable] Style/RedundantBegin: Redundant begin block detected.
begin
^^^^^
app/services/hyrax/workflow/workflow_schema.rb:23:11: C: [Correctable] Style/RedundantBegin: Redundant begin block detected.
begin
^^^^^
app/services/hyrax/works/migration_service.rb:27:58: C: Rails/SkipsModelValidations: Avoid using insert because it skips validations.
orm.value(predicate_from).each { |val| orm.graph.insert([orm.resource.subject_uri, predicate_to, val.to_s]) }
^^^^^^
app/strategies/hyrax/strategies/yaml_strategy.rb:37:9: C: [Correctable] Style/RedundantBegin: Redundant begin block detected.
begin
^^^^^
config/features.rb:3:3: C: [Correctable] Style/RedundantBegin: Redundant begin block detected.
begin
^^^^^
hyrax.gemspec:29:5: C: [Correctable] Style/CommentAnnotation: Annotation keywords like Note should be all upper case, followed by a colon, and a space, then a note describing the problem.
# Note: rails does not follow sem-ver conventions, it's
^^^^^^
lib/hyrax/form_fields.rb:28:5: W: Lint/MissingSuper: Call super to initialize state of the parent class.
def initialize(schema_name, definition_loader: SimpleSchemaLoader.new) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/hyrax/health_checks/solr_check.rb:6:7: W: Lint/MissingSuper: Call super to initialize state of the parent class.
def initialize(service: Hyrax::SolrService) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/hyrax/schema.rb:64:5: W: Lint/MissingSuper: Call super to initialize state of the parent class.
def initialize(schema_name, schema_loader: SimpleSchemaLoader.new) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/wings/attribute_transformer.rb:18:5: C: Metrics/PerceivedComplexity: Perceived complexity for run is too high. [9/8]
def self.run(obj) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/wings/attribute_transformer.rb:52:5: C: Metrics/AbcSize: Assignment Branch Condition size for run is too high. [<10, 29, 4> 30.94/28]
def run(obj) ...
^^^^^^^^^^^^
lib/wings/model_transformer.rb:173:5: C: Metrics/CyclomaticComplexity: Cyclomatic complexity for append_permissions is too high. [8/7]
def append_permissions(attrs) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/wings/services/custom_queries/find_file_metadata.rb:76:11: C: [Correctable] Style/RedundantBegin: Redundant begin block detected.
begin
^^^^^
lib/wings/valkyrie/query_service.rb:89:11: C: [Correctable] Style/RedundantBegin: Redundant begin block detected.
begin
^^^^^
lib/wings/valkyrie/query_service.rb:166:7: C: Metrics/CyclomaticComplexity: Cyclomatic complexity for find_inverse_references_by is too high. [8/7]
def find_inverse_references_by(resource: nil, id: nil, model: nil, property:) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/controllers/concerns/hyrax/works_controller_behavior_spec.rb:27:7: C: [Correctable] Style/CommentAnnotation: Annotation keywords like note should be all upper case, followed by a colon, and a space, then a note describing the problem.
# note: we can't run jobs that rely on routes (i.e. those that send notifications)
^^^^^^
spec/controllers/hyrax/dashboard/collection_members_controller_spec.rb:9:9: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let(:owned_work_1) { FactoryBot.create(:work, user: user) }
^^^^^^^^^^^^^
spec/controllers/hyrax/dashboard/collection_members_controller_spec.rb:10:9: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let(:owned_work_2) { FactoryBot.create(:work, user: user) }
^^^^^^^^^^^^^
spec/controllers/hyrax/dashboard/collection_members_controller_spec.rb:11:9: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let(:owned_work_3) { FactoryBot.create(:work, user: user) }
^^^^^^^^^^^^^
spec/factories/admin_sets_lw.rb:205:5: C: Metrics/AbcSize: Assignment Branch Condition size for solr_document_with_permissions is too high. [<7, 27, 3> 28.05/28]
def self.solr_document_with_permissions(adminset, evaluator, creator_only) ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/factories/collection_types.rb:97:5: C: Metrics/CyclomaticComplexity: Cyclomatic complexity for process_access is too high. [9/7]
def self.process_access(collection_type, evaluator) # rubocop:disable Metrics/MethodLength ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/factories/collection_types.rb:97:5: C: Metrics/PerceivedComplexity: Perceived complexity for process_access is too high. [9/8]
def self.process_access(collection_type, evaluator) # rubocop:disable Metrics/MethodLength ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/features/admin_spec.rb:4:7: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let(:admin_set_1) do
^^^^^^^^^^^^
spec/features/admin_spec.rb:9:7: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let(:admin_set_2) do
^^^^^^^^^^^^
spec/features/collection_multi_membership_spec.rb:5:7: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let(:single_membership_type_1) { create(:collection_type, :not_allow_multiple_membership, title: 'Single-membership 1') }
^^^^^^^^^^^^^^^^^^^^^^^^^
spec/features/collection_multi_membership_spec.rb:6:7: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let(:single_membership_type_2) { create(:collection_type, :not_allow_multiple_membership, title: 'Single-membership 2') }
^^^^^^^^^^^^^^^^^^^^^^^^^
spec/features/collection_multi_membership_spec.rb:7:7: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let(:multi_membership_type_1) { create(:collection_type, :allow_multiple_membership, title: 'Multi-membership 1') }
^^^^^^^^^^^^^^^^^^^^^^^^
spec/features/collection_multi_membership_spec.rb:8:7: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let(:multi_membership_type_2) { create(:collection_type, :allow_multiple_membership, title: 'Multi-membership 2') }
^^^^^^^^^^^^^^^^^^^^^^^^
spec/features/create_work_admin_spec.rb:4:7: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let(:admin_set_1) do
^^^^^^^^^^^^
spec/features/create_work_admin_spec.rb:10:7: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let(:admin_set_2) do
^^^^^^^^^^^^
spec/features/work_show_spec.rb:27:9: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let(:multi_membership_type_1) { FactoryBot.create(:collection_type, :allow_multiple_membership, title: 'Multi-membership 1') }
^^^^^^^^^^^^^^^^^^^^^^^^
spec/features/work_show_spec.rb:98:9: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let(:multi_membership_type_1) { create(:collection_type, :allow_multiple_membership, title: 'Multi-membership 1') }
^^^^^^^^^^^^^^^^^^^^^^^^
spec/helpers/hyrax/embargo_helper_spec.rb:16:11: C: [Correctable] Style/CommentAnnotation: Annotation keywords like Note should be all upper case, followed by a colon, and a space, then a note describing the problem.
# Note: This spec echoes "embargo_enforced? with a Hyrax::Work when an embargo is enforced on the resource"
^^^^^^
spec/helpers/hyrax/lease_helper_spec.rb:16:11: C: [Correctable] Style/CommentAnnotation: Annotation keywords like Note should be all upper case, followed by a colon, and a space, then a note describing the problem.
# Note: This spec echoes "lease_enforced? with a Hyrax::Work when a lease is enforced on the resource"
^^^^^^
spec/indexers/hyrax/valkyrie_work_indexer_spec.rb:39:11: C: [Correctable] Layout/EmptyLineBetweenDefs: Expected 1 empty line between class definitions; found 0.
class WorkIndexer < Hyrax::ValkyrieWorkIndexer
^^^^^^^^^^^^^^^^^
spec/models/hyrax/change_set_spec.rb:78:13: C: [Correctable] Style/CommentAnnotation: Annotation keywords like NOTE should be all upper case, followed by a colon, and a space, then a note describing the problem.
# NOTE isbn has validation presence: true
^^^^^
spec/models/hyrax/change_set_spec.rb:85:13: C: [Correctable] Style/CommentAnnotation: Annotation keywords like NOTE should be all upper case, followed by a colon, and a space, then a note describing the problem.
# NOTE isbn has validation presence: true
^^^^^
spec/services/hyrax/collection_types/create_service_spec.rb:119:11: C: [Correctable] Style/RedundantBegin: Redundant begin block detected.
begin
^^^^^
spec/services/hyrax/multiple_membership_checker_spec.rb:108:14: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let!(:collection_type_2) { create(:collection_type, title: 'Doc', allow_multiple_membership: false) }
^^^^^^^^^^^^^^^^^^
spec/services/hyrax/multiple_membership_checker_spec.rb:148:13: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let(:item_2) { create(:work, id: 'work-2', user: user) }
^^^^^^^
spec/services/hyrax/multiple_membership_checker_spec.rb:191:14: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let!(:collection_type_2) { create(:collection_type, title: 'Doc', allow_multiple_membership: false) }
^^^^^^^^^^^^^^^^^^
spec/services/hyrax/user_stat_importer_spec.rb:44:8: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let!(:bilbo_file_1) do
^^^^^^^^^^^^^
spec/services/hyrax/user_stat_importer_spec.rb:48:8: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let!(:bilbo_file_2) do
^^^^^^^^^^^^^
spec/services/hyrax/user_stat_importer_spec.rb:52:8: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let!(:frodo_file_1) do
^^^^^^^^^^^^^
spec/services/hyrax/user_stat_importer_spec.rb:57:8: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let!(:bilbo_work_1) do
^^^^^^^^^^^^^
spec/services/hyrax/user_stat_importer_spec.rb:61:8: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let!(:bilbo_work_2) do
^^^^^^^^^^^^^
spec/services/hyrax/user_stat_importer_spec.rb:65:8: C: Naming/VariableNumber: Use normalcase for symbol numbers.
let!(:frodo_work_1) do
^^^^^^^^^^^^^
spec/views/hyrax/my/facet.html.erb_spec.rb:3:3: C: [Correctable] Style/CommentAnnotation: Annotation keywords like Note should be all upper case, followed by a colon, and a space, then a note describing the problem.
# Note: this is a direct copy of the corresponding test in Blacklight
^^^^^^
1659 files inspected, 86 offenses detected, 32 offenses auto-correctable
[cjcolvar@trogglus-assistus hyrax]$ git diff
diff --git a/.rubocop.yml b/.rubocop.yml
index 75f33f3bf..f91fbd708 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -5,7 +5,7 @@ inherit_gem:
bixby: bixby_default.yml
AllCops:
- TargetRubyVersion: 2.4
+ TargetRubyVersion: 2.5
DisplayCopNames: true
Exclude:
- 'db/**/*'
diff --git a/.rubocop_fixme.yml b/.rubocop_fixme.yml
index 4ef63b9fb..969bafc1b 100644
--- a/.rubocop_fixme.yml
+++ b/.rubocop_fixme.yml
@@ -179,6 +179,6 @@ Rails/HasManyOrHasOneDependent:
- 'app/models/admin_set.rb'
# Offense count: 1
-Style/MethodMissingSuper:
+Lint/MissingSuper:
Exclude:
- 'app/models/concerns/hyrax/file_set/characterization.rb'
diff --git a/Gemfile b/Gemfile
index 341ed79b4..4eec96b90 100644
--- a/Gemfile
+++ b/Gemfile
@@ -12,6 +12,7 @@ group :development, :test do
gem 'pry-byebug' unless ENV['CI']
gem 'ruby-prof', require: false
gem "simplecov", require: false
+ gem 'bixby', github: 'samvera-labs/bixby', branch: 'rubocop1'
end
test_app_path = ENV['RAILS_ROOT'] ||
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment