Skip to content

Commit

Permalink
Merge pull request #2283 from samvera/update-rubocop
Browse files Browse the repository at this point in the history
🧹 updates rubocop and adds rubocop-factory_bot
  • Loading branch information
Shana Moore authored Aug 15, 2024
2 parents 1cc5b17 + d2957c9 commit b44da37
Show file tree
Hide file tree
Showing 25 changed files with 123 additions and 244 deletions.
8 changes: 7 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,24 @@ inherit_from:
inherit_gem:
bixby: bixby_default.yml

Layout/IndentationWidth:
Width: 2

AllCops:
NewCops: disable
TargetRubyVersion: 3.2.2
DisplayCopNames: true
SuggestExtensions: false
Exclude:
- 'gems/**/*'
- 'db/**/*'
- 'script/**/*'
- 'spec/test_app_templates/**/*'
- 'vendor/**/*'
- 'lib/hyrax/specs/**/*'
- 'bin/graph'
- 'bin/import_from_purl'
- 'spec/features/**/*'

Lint/ImplicitStringConcatenation:
Exclude:
Expand All @@ -27,7 +33,7 @@ Rails/Output:
- 'lib/generators/**/*'

Metrics/BlockLength:
IgnoredMethods: ['included']
AllowedMethods: ['included']
Exclude:
- 'hyrax.gemspec'
- 'app/models/concerns/hyrax/content_block_behavior.rb'
Expand Down
227 changes: 37 additions & 190 deletions .rubocop_fixme.yml
Original file line number Diff line number Diff line change
@@ -1,201 +1,48 @@
Security/MarshalLoad:
Exclude:
- 'app/models/concerns/hyrax/user.rb'

Metrics/ClassLength:
Exclude:
- 'app/controllers/hyrax/dashboard/collections_controller.rb'
- 'app/controllers/hyrax/admin/admin_sets_controller.rb'
- 'app/controllers/hyrax/batch_edits_controller.rb'
- 'app/controllers/hyrax/downloads_controller.rb'
- 'app/controllers/hyrax/file_sets_controller.rb'
- 'app/forms/hyrax/forms/permission_template_form.rb'
- 'app/presenters/hyrax/work_show_presenter.rb'
- 'app/presenters/hyrax/collection_presenter.rb'
- 'app/services/hyrax/user_stat_importer.rb'
- 'lib/generators/hyrax/templates/catalog_controller.rb'
- 'lib/generators/hyrax/install_generator.rb'
- 'lib/hyrax/configuration.rb'

Metrics/ParameterLists:
Exclude:
- 'app/jobs/batch_create_job.rb'

Metrics/ModuleLength:
Exclude:
- 'app/controllers/concerns/hyrax/works_controller_behavior.rb'
- 'app/helpers/hyrax/hyrax_helper_behavior.rb'
- 'app/models/concerns/hyrax/ability.rb'
- 'app/services/hyrax/workflow/permission_query.rb'
- 'spec/services/hyrax/workflow/permission_query_spec.rb'
# TODO: extract CollectionAccessControls or something, so we don't have to skip this check?
- 'app/models/concerns/hyrax/collection_behavior.rb'

RSpec/NamedSubject:
# This configuration was generated by
# `rubocop --auto-gen-config --exclude-limit 0`
# on 2024-08-15 14:53:42 UTC using RuboCop version 1.61.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
# versions of RuboCop, may require this file to be generated again.

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
Layout/ExtraSpacing:
Enabled: false

RSpec/ExampleLength:
Max: 9
Exclude:
- 'spec/actors/hyrax/actors/file_set_actor_spec.rb'
- 'spec/actors/hyrax/actors/generic_work_actor_spec.rb'
- 'spec/controllers/hyrax/api/items_controller_spec.rb'
- 'spec/controllers/hyrax/batch_edits_controller_spec.rb'
- 'spec/controllers/hyrax/batch_uploads_controller_spec.rb'
- 'spec/controllers/hyrax/file_sets_controller_spec.rb'
- 'spec/controllers/hyrax/generic_works_controller_spec.rb'
- 'spec/controllers/hyrax/my/highlights_controller_spec.rb'
- 'spec/controllers/hyrax/transfers_controller_spec.rb'
- 'spec/forms/hyrax/forms/collection_form_spec.rb'
- 'spec/forms/hyrax/forms/batch_edit_form_spec.rb'
- 'spec/forms/hyrax/forms/batch_upload_form_spec.rb'
- 'spec/forms/hyrax/forms/file_set_edit_form_spec.rb'
- 'spec/features/**/*'
- 'spec/helpers/hyrax/charts_helper_spec.rb'
- 'spec/helpers/dashboard_helper_spec.rb'
- 'spec/helpers/hyrax_helper_spec.rb'
- 'spec/indexers/hyrax/file_set_indexer_spec.rb'
- 'spec/javascripts/jasmine_spec.rb'
- 'spec/jobs/file_set_attached_event_job_spec.rb'
- 'spec/jobs/batch_create_job_spec.rb'
- 'spec/jobs/create_work_job_spec.rb'
- 'spec/jobs/content_update_event_job_spec.rb'
- 'spec/jobs/content_restored_version_event_job_spec.rb'
- 'spec/jobs/content_new_version_event_job_spec.rb'
- 'spec/jobs/content_depositor_change_event_job_spec.rb'
- 'spec/jobs/change_depositor_event_job_spec.rb'
- 'spec/jobs/content_deposit_event_job_spec.rb'
- 'spec/jobs/content_delete_event_job_spec.rb'
- 'spec/jobs/ingest_file_job_spec.rb'
- 'spec/lib/hyrax/arkivo/actor_spec.rb'
- 'spec/lib/hyrax/resource_sync/capability_list_writer_spec.rb'
- 'spec/models/checksum_audit_log_spec.rb'
- 'spec/models/featured_work_spec.rb'
- 'spec/models/file_set_spec.rb'
- 'spec/models/generic_work_spec.rb'
- 'spec/presenters/hyrax/inspect_work_presenter_spec.rb'
- 'spec/services/hyrax/actor_factory_spec.rb'
- 'spec/services/hyrax/admin_set_create_service_spec.rb'
- 'spec/services/hyrax/default_middleware_stack_spec.rb'
- 'spec/services/hyrax/graph_exporter_spec.rb'
- 'spec/services/hyrax/user_stat_importer_spec.rb'
- 'spec/services/hyrax/workflow/activate_object_spec.rb'
- 'spec/services/hyrax/workflow/deactivate_object_spec.rb'
- 'spec/services/hyrax/workflow/permission_generator_spec.rb'
- 'spec/services/hyrax/workflow/permission_query_spec.rb'
- 'spec/services/hyrax/workflow/state_machine_generator_spec.rb'
- 'spec/services/hyrax/workflow/workflow_importer_spec.rb'
- 'spec/views/**/*'
- 'spec/wings/valkyrie/persister_spec.rb'

RSpec/VerifiedDoubles:
# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowForAlignment.
Layout/SpaceBeforeFirstArg:
Enabled: false

RSpec/SubjectStub:
Exclude:
- 'spec/actors/hyrax/actors/generic_work_actor_spec.rb'
- 'spec/controllers/hyrax/file_sets_controller_spec.rb'
- 'spec/models/file_set_spec.rb'
- 'spec/models/hyrax/work_behavior_spec.rb'
- 'spec/search_builders/hyrax/file_set_search_builder_spec.rb'
- 'spec/models/hyrax/operation_spec.rb'
- 'spec/controllers/hyrax/accepts_batches_controller_spec.rb'
- 'spec/indexers/hyrax/repository_reindexer_spec.rb'
- 'spec/lib/hyrax/analytics_spec.rb'
- 'spec/models/job_io_wrapper_spec.rb'
- 'spec/search_builders/hyrax/abstract_type_relation_spec.rb'
- 'spec/services/hyrax/database_migrator_spec.rb'

RSpec/AnyInstance:
Exclude:
- 'spec/actors/hyrax/actors/generic_work_actor_spec.rb'
- 'spec/controllers/hyrax/api/items_controller_spec.rb'
- 'spec/controllers/hyrax/api/zotero_controller_spec.rb'
- 'spec/controllers/hyrax/batch_edits_controller_spec.rb'
- 'spec/controllers/hyrax/stats_controller_spec.rb'
- 'spec/controllers/hyrax/users_controller_spec.rb'
- 'spec/hyrax/transactions/steps/delete_access_control_spec.rb'
- 'spec/hyrax/transactions/steps/save_access_control_spec.rb'
- 'spec/jobs/content_restored_version_event_job_spec.rb'
- 'spec/jobs/file_set_attached_event_job_spec.rb'
- 'spec/jobs/hyrax/grant_edit_to_members_job_spec.rb'
- 'spec/jobs/hyrax/grant_read_to_members_job_spec.rb'
- 'spec/jobs/hyrax/revoke_edit_from_members_job_spec.rb'
- 'spec/lib/hyrax/arkivo/create_subscription_job_spec.rb'
- 'spec/presenters/hyrax/file_usage_spec.rb'
- 'spec/presenters/hyrax/work_usage_spec.rb'
- 'spec/services/hyrax/repository_fixity_check_service_spec.rb'
- 'spec/services/hyrax/workflow/permission_generator_spec.rb'
- 'spec/services/hyrax/workflow/sipity_actions_generator_spec.rb'
- 'spec/services/hyrax/workflow/state_machine_generator_spec.rb'
- 'spec/services/hyrax/workflow/workflow_permissions_generator_spec.rb'
- 'spec/controllers/hyrax/homepage_controller_spec.rb'
- 'spec/controllers/hyrax/my/collections_controller_spec.rb'
- 'spec/controllers/hyrax/my/works_controller_spec.rb'
- 'spec/presenters/hyrax/admin/repository_object_presenter_spec.rb'

# Offense count: 51
RSpec/ExpectInHook:
# Offense count: 1
# Configuration parameters: AllowedParentClasses.
Lint/MissingSuper:
Enabled: false

# Offense count: 27
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: and_return, block
RSpec/ReturnFromStub:
Exclude:
- 'spec/controllers/hyrax/api/items_controller_spec.rb'
- 'spec/controllers/hyrax/file_sets_controller_spec.rb'
- 'spec/lib/hyrax/arkivo/create_subscription_job_spec.rb'
- 'spec/models/file_set_spec.rb'
- 'spec/presenters/hyrax/admin_set_options_presenter_spec.rb'
- 'spec/routing/api_route_spec.rb'
- 'spec/views/_user_util_links.html.erb_spec.rb'
- 'spec/views/hyrax/base/_attributes.html.erb_spec.rb'
- 'spec/views/hyrax/base/_form.html.erb_spec.rb'
- 'spec/views/hyrax/base/file_manager.html.erb_spec.rb'
- 'spec/views/hyrax/dashboard/profiles/edit.html.erb_spec.rb'
- 'spec/views/hyrax/users/_user_info.html.erb_spec.rb'
# Offense count: 8
# Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Enabled: false

# Offense count: 26
RSpec/RepeatedDescription:
Exclude:
- 'spec/models/sipity/agent_spec.rb'
- 'spec/models/sipity/comment_spec.rb'
- 'spec/models/sipity/entity_spec.rb'
- 'spec/models/sipity/entity_specific_responsibility_spec.rb'
- 'spec/models/sipity/role_spec.rb'
- 'spec/models/sipity/workflow_action_spec.rb'
- 'spec/models/sipity/workflow_responsibility_spec.rb'
- 'spec/models/sipity/workflow_role_spec.rb'
- 'spec/models/sipity/workflow_state_action_permission_spec.rb'
- 'spec/models/sipity/workflow_state_action_spec.rb'
- 'spec/models/sipity/workflow_state_spec.rb'
# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
# SupportedShorthandSyntax: always, never, either, consistent
Style/HashSyntax:
Enabled: false

# Offense count: 2
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/HasManyOrHasOneDependent:
Exclude:
- 'app/models/admin_set.rb'
- 'app/models/hyrax/permission_template.rb'
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantParentheses:
Enabled: false

# Offense count: 1
Rails/SkipsModelValidations:
Exclude:
- 'app/services/hyrax/works/migration_service.rb'

# Offense count: 12
Lint/MissingSuper:
Exclude:
- 'app/actors/hyrax/actors/interpret_visibility_actor.rb'
- 'app/actors/hyrax/actors/ordered_members_actor.rb'
- 'app/models/concerns/hyrax/file_set/characterization.rb'
- 'app/presenters/hyrax/file_usage.rb'
- 'app/presenters/hyrax/work_usage.rb'
- 'app/services/hyrax/batch_create_failure_service.rb'
- 'app/services/hyrax/batch_create_success_service.rb'
- 'app/services/hyrax/collection_types/create_service.rb'
- 'app/services/hyrax/solr_query_service.rb'
- 'lib/hyrax/form_fields.rb'
- 'lib/hyrax/health_checks/solr_check.rb'
- 'lib/hyrax/schema.rb'
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowMultipleReturnValues.
Style/RedundantReturn:
Enabled: false
9 changes: 2 additions & 7 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
# This configuration was generated by
# `rubocop --auto-gen-config --no-auto-gen-timestamp`
# using RuboCop version 1.28.2.
# `rubocop --auto-gen-config`
# on 2024-08-15 14:54:14 UTC using RuboCop version 1.61.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
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
Metrics/MethodLength:
Max: 21
9 changes: 6 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ gem 'rails', '~> 6.0', github: 'rails/rails', branch: '6-1-stable', ref: 'd16199
gem 'active_elastic_job', github: 'active-elastic-job/active-elastic-job', ref: 'ec51c5d9dedc4a1b47f2db41f26d5fceb251e979', group: %i[aws]
gem 'active-fedora', '~> 14.0'
gem 'activerecord-nulldb-adapter'
gem 'activesupport', '>= 4.2.0', group: %i[development test]
gem 'addressable', '2.8.1' # remove once https://github.com/postrank-labs/postrank-uri/issues/49 is fixed
gem 'apartment', github: 'scientist-softserv/apartment', branch: 'development'
gem 'aws-sdk-sqs', group: %i[aws]
gem 'bixby', '~> 5.0', '>= 5.0.2', group: %i[development test]
gem 'bixby', group: %i[development test]
gem 'blacklight', '~> 7.29'
gem 'blacklight_advanced_search'
gem 'blacklight_oai_provider', '~> 7.0'
Expand Down Expand Up @@ -94,7 +95,9 @@ gem 'rspec-its', group: %i[test]
gem 'rspec_junit_formatter', group: %i[test]
gem 'rspec-rails', '>= 3.6.0', group: %i[development test]
gem 'rspec-retry', group: %i[test]
gem 'rubocop', '1.28.2', group: %i[development test]
gem 'rubocop', '~> 1.61.0', group: %i[development test]
gem 'rubocop-capybara', group: %i[development test]
gem 'rubocop-factory_bot', group: %i[development test]
gem 'rubocop-rails', '~> 2.15', group: %i[development test]
gem 'rubocop-rspec', '~> 1.22', '<= 1.22.2', group: %i[development test]
gem 'sass-rails', '~> 6.0' # Use SCSS for stylesheets
Expand Down Expand Up @@ -143,4 +146,4 @@ gem 'willow_sword', github: 'scientist-softserv/willow_sword', branch: 'main'
# of the time use the `samvera-labs/hyku_knapsack` remote branch.
gem 'hyku_knapsack', github: 'samvera-labs/hyku_knapsack', branch: 'required_for_knapsack_instances'

# rubocop:enable Layout/LineLength
# rubocop:enable Metrics/MethodLength
Loading

0 comments on commit b44da37

Please sign in to comment.