Skip to content

Commit

Permalink
🧹 Prepping for rubocop
Browse files Browse the repository at this point in the history
This commit will change the Docker image to rc1 because rc2 stopped
working (at least locally).  Also getting things ready to run rubocop.
  • Loading branch information
kirkkwang committed Dec 13, 2023
1 parent 032e08e commit 2d7f8b7
Show file tree
Hide file tree
Showing 7 changed files with 412 additions and 242 deletions.
170 changes: 82 additions & 88 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,133 +1,127 @@
# Turn on RSpec cops
require: rubocop-rspec
inherit_from: .rubocop_todo.yml
inherit_from:
- .rubocop_fixme.yml

# With the rubocop 0.47.0 and rubocop-rspec 1.8.0 the following stderr message was sent:
# An error occurred while RSpec/DescribedClass cop was inspecting path/to/file
RSpec/DescribedClass:
Enabled: false
inherit_gem:
bixby: bixby_default.yml

AllCops:
TargetRubyVersion: 2.6
DisplayCopNames: true
TargetRubyVersion: 2.3
Exclude:
- 'bin/**/*'
- 'db/**/*'
- 'config/**/*'
- 'vendor/**/*'
- '.internal_test_app/**/*'
- 'spec/fixtures/**/*'
- 'spec/internal/**/*'
- 'script/**/*'
- 'spec/test_app_templates/**/*'
- 'Rakefile'
- 'lib/tasks/rubocop.rake'
# disabling collections controller as most of the rubocop errors are in hyrax
- 'app/controllers/hyrax/dashboard/collections_controller.rb'

Rails:
Enabled: true
- 'vendor/**/*'
- 'lib/hyrax/specs/**/*'

Rails/DynamicFindBy:
Whitelist:
- find_by_user_key
Lint/ImplicitStringConcatenation:
Exclude:
- 'lib/importer/factory/object_factory.rb'
- 'lib/generators/hyrax/**/*'

Rails/UnknownEnv:
Environments:
- development
- production
- staging
- test
Rails/Output:
Exclude:
- 'lib/generators/**/*'

Metrics/LineLength:
Max: 120
Metrics/BlockLength:
ExcludedMethods: ['included']
Exclude:
- 'app/controllers/catalog_controller.rb'
- 'spec/controllers/curation_concerns/generic_works_controller_spec.rb'
- 'spec/services/iiif_collection_thumbnail_path_service_spec.rb'
- 'spec/services/iiif_work_thumbnail_path_service_spec.rb'
- 'spec/routing/proprietor/accounts_routing_spec.rb'
- 'hyrax.gemspec'
- 'app/models/concerns/hyrax/content_block_behavior.rb'
- 'app/services/hyrax/workflow/workflow_schema.rb'
- 'config/initializers/simple_form.rb'
- 'config/features.rb'
- 'config/routes.rb'
- 'lib/generators/hyrax/templates/catalog_controller.rb'
- 'lib/generators/hyrax/templates/config/initializers/simple_form_bootstrap.rb'
- 'lib/hyrax/rails/routes.rb'
- 'lib/tasks/*.rake'
- 'spec/**/*.rb'
- 'tasks/benchmark.rake'

Layout/IndentationConsistency:
EnforcedStyle: rails
Style/AsciiComments:
Enabled: false

Layout/DotPosition:
EnforcedStyle: leading
# rubocop suggests !thing.nil? instead, but that is NOT equivalent
Style/DoubleNegation:
Enabled: false

Style/CollectionMethods:
PreferredMethods:
collect: 'map'
collect!: 'map!'
inject: 'reduce'
detect: 'find'
find_all: 'select'

Style/Documentation:
Style/SymbolArray:
Enabled: false

Style/StringLiterals:
Style/ClassAndModuleChildren:
Enabled: false

Style/WordArray:
Style/SingleLineBlockParams:
Enabled: false

Metrics/ClassLength:
Exclude:
- 'app/controllers/catalog_controller.rb'
Rails/ApplicationJob:
Enabled: false

Metrics/ModuleLength:
Max: 200
Rails/ApplicationRecord:
Enabled: false

Rails/HasAndBelongsToMany:
Exclude:
- 'app/models/role.rb'
Rails/RakeEnvironment:
Enabled: false

RSpec/AnyInstance:
# We define custom methods like `find_by_user_key`,
# `find_by_created_date`, etc
Rails/DynamicFindBy:
Enabled: false

RSpec/InstanceVariable:
Rails/FilePath:
Exclude:
- 'spec/controllers/hyku/registrations_controller_spec.rb'
- 'spec/abilities/**/*'

RSpec/NamedSubject:
Enabled: false
Rails/OutputSafety:
Exclude:
- 'app/builders/hyrax/form_builder.rb'
- 'app/helpers/hyrax/citations_behaviors/formatters/apa_formatter.rb'
- 'app/helpers/hyrax/citations_behaviors/formatters/chicago_formatter.rb'
- 'app/helpers/hyrax/citations_behaviors/formatters/mla_formatter.rb'
- 'app/helpers/hyrax/collections_helper.rb'
- 'app/helpers/hyrax/content_block_helper_behavior.rb'
- 'app/helpers/hyrax/hyrax_helper_behavior.rb'
- 'app/presenters/hyrax/fixity_status_presenter.rb'
- 'app/presenters/hyrax/presents_attributes.rb'
- 'app/renderers/hyrax/renderers/attribute_renderer.rb'
- 'spec/views/hyrax/my/works/_list_works.html.erb_spec.rb'

RSpec/DescribeClass:
Exclude:
- 'spec/requests/**/*'
- 'spec/abilities/**/*'
- 'spec/config/hyrax_events_spec.rb'
- 'spec/conversions/**/*'
- 'spec/features/**/*'
- 'spec/inputs/**/*'
- 'spec/javascripts/jasmine_spec.rb'
- 'spec/tasks/rake_spec.rb'
- 'spec/views/**/*'
- 'spec/routing/**/*'
- 'spec/tasks/**/*'

Rails/FilePath:
Exclude:
- 'spec/routing/**/*'
# # By default RSpec/MessageSpies has the following:
# # Prefer have_received for setting message expectations. Setup form as a spy using allow or instance_spy.
# # The default assumes EnforcedStyle is 'have_received'. Most of our specs are 'receive'
RSpec/MessageSpies:
Enabled: false

RSpec/ExpectActual:
Exclude:
- 'spec/routing/**/*'
Enabled: false

RSpec/VerifiedDoubles:
RSpec/LetSetup:
Enabled: false

RSpec/MessageExpectation:
Enabled: false

# By default RSpec/MessageSpies has the following:
# Prefer have_received for setting message expectations. Setup form as a spy using allow or instance_spy.
RSpec/MessageSpies:
Enabled: true
EnforcedStyle: receive

RSpec/ExampleLength:
Max: 20

RSpec/NestedGroups:
Max: 4

RSpec/MultipleExpectations:
Enabled: false

Metrics/BlockLength:
Exclude:
- 'spec/**/*.rb'
- 'lib/tasks/*.rake'
- 'app/controllers/catalog_controller.rb'

RSpec/FilePath:
Exclude:
- 'spec/config/application_spec.rb'
RSpec/LeadingSubject:
Enabled: false
Loading

0 comments on commit 2d7f8b7

Please sign in to comment.