Skip to content

Commit

Permalink
Update rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Nov 10, 2017
1 parent 9ba6540 commit 0248d8f
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 47 deletions.
14 changes: 14 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,31 @@ Metrics/LineLength:
- 'spec/models/spotlight/dor/indexer_spec.rb'
- 'spec/features/bibliography_formatting_spec.rb'

Style/PercentLiteralDelimiters:
PreferredDelimiters:
'%i': '()'
'%w': '()'

Style/StringLiterals:
Enabled: true
EnforcedStyle: single_quotes

Style/SymbolArray:
Enabled: false

Metrics/ClassLength:
Exclude:
- 'app/controllers/catalog_controller.rb'

Capybara/FeatureMethods:
Enabled: false

RSpec/NamedSubject:
Enabled: false

RSpec/ContextWording:
Enabled: false

Bundler/OrderedGems:
Enabled: false

Expand Down
98 changes: 63 additions & 35 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,98 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2017-03-19 00:57:52 -0700 using RuboCop version 0.47.1.
# on 2017-11-10 12:01:05 -0800 using RuboCop version 0.51.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: 4
# Offense count: 3
# Cop supports --auto-correct.
Layout/EmptyLineAfterMagicComment:
Exclude:
- 'app/controllers/saved_searches_controller.rb'
- 'app/controllers/search_history_controller.rb'
- 'lib/traject/macros/general.rb'

# Offense count: 2
Lint/RescueWithoutErrorClass:
Exclude:
- 'app/services/dor_solr_document_builder.rb'
- 'lib/traject/dor_config.rb'

# Offense count: 6
Metrics/AbcSize:
Max: 19

# Offense count: 4
# Offense count: 5
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 87
Max: 23

# Offense count: 2
# Offense count: 6
RSpec/AnyInstance:
Exclude:
- 'spec/models/dor_harvester_spec.rb'
- 'spec/services/sync_bibliography_service_spec.rb'
- 'spec/services/dor_solr_document_builder_spec.rb'

# Offense count: 4
# Configuration parameters: Max.
RSpec/ExampleLength:
# Offense count: 10
RSpec/BeforeAfterAll:
Exclude:
- 'spec/features/bibliography_service_feature_spec.rb'
- 'spec/models/spotlight/dor/indexer_spec.rb'
- 'spec/spec_helper.rb'
- 'spec/rails_helper.rb'
- 'spec/support/**/*.rb'
- 'spec/features/bibliography_display_manuscript_spec.rb'
- 'spec/features/bibliography_resource_integration_spec.rb'
- 'spec/features/canvas_display_spec.rb'
- 'spec/features/canvas_resource_integration_spec.rb'
- 'spec/features/manuscript_display_bibliography_spec.rb'
- 'spec/models/search_builder_spec.rb'

# Offense count: 2
# Offense count: 3
RSpec/EmptyLineAfterSubject:
Exclude:
- 'spec/models/solr_document_spec.rb'
- 'spec/models/user_spec.rb'
- 'spec/services/upload_solr_document_builder_spec.rb'

# Offense count: 3
RSpec/ExpectInHook:
Exclude:
- 'spec/helpers/catalog_helper_spec.rb'
- 'spec/views/catalog/_exhibits_document_header_default.html.erb_spec.rb'
- 'spec/views/viewers/edit.html.erb_spec.rb'

# Offense count: 3
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: have_received, receive
RSpec/MessageSpies:
# SupportedStyles: implicit, each, example
RSpec/HookArgument:
Exclude:
- 'spec/models/zotero_api/client_spec.rb'
- 'spec/rails_helper.rb'
- 'spec/support/request_spec_helper.rb'

# Offense count: 37
# Offense count: 57
RSpec/MultipleExpectations:
Max: 7
Max: 6

# Offense count: 28
# Offense count: 1
# Configuration parameters: Max.
RSpec/NestedGroups:
Exclude:
- 'spec/models/spotlight/dor/indexer_spec.rb'
- 'spec/models/zotero_api/client_spec.rb'
- 'spec/requests/bibliography_service_spec.rb'
- 'spec/services/dor_solr_document_builder_spec.rb'

# Offense count: 8
RSpec/SubjectStub:
# Offense count: 1
# Configuration parameters: Strict, EnforcedStyle, SupportedStyles.
# SupportedStyles: inflected, explicit
RSpec/PredicateMatcher:
Exclude:
- 'spec/models/dor_harvester_spec.rb'
- 'spec/models/spotlight/dor/indexer_spec.rb'
- 'spec/models/zotero_api/client_spec.rb'
- 'spec/features/bibliography_resource_integration_spec.rb'

# Offense count: 1
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
# Offense count: 2
RSpec/SubjectStub:
Exclude:
- 'app/models/spotlight/dor/indexer.rb'
- 'spec/models/dor_harvester_spec.rb'

# Offense count: 1
# Configuration parameters: MinBodyLength.
Style/GuardClause:
# Offense count: 2
Rails/OutputSafety:
Exclude:
- 'app/services/sync_bibliography_service.rb'
- 'app/helpers/application_helper.rb'
14 changes: 8 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@ GEM
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.2.1)
rainbow (2.2.2)
rake
rake (12.2.1)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
Expand Down Expand Up @@ -479,14 +480,15 @@ GEM
rspec-mocks (~> 3.7.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.0)
rubocop (0.47.1)
rubocop (0.51.0)
parallel (~> 1.10)
parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
rainbow (>= 2.2.2, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
rubocop-rspec (1.10.0)
rubocop (>= 0.42.0)
rubocop-rspec (1.20.0)
rubocop (>= 0.51.0)
ruby-oembed (0.12.0)
ruby-progressbar (1.9.0)
rubyzip (1.2.1)
Expand Down Expand Up @@ -615,7 +617,7 @@ GEM
unf_ext
unf_ext (0.0.7.4)
unicode (0.4.4.4)
unicode-display_width (1.1.3)
unicode-display_width (1.3.0)
warden (1.2.7)
rack (>= 1.0)
web-console (3.4.0)
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def manuscript_title(options = {})
def table_of_contents_separator(options = {})
return if options[:value].blank?
contents = options[:value][0].split('--').map(&:strip)
contents = contents.join('<br />').html_safe # rubocop:disable Rails/OutputSafety
contents = contents.join('<br />').html_safe
render partial: 'catalog/table_of_contents', locals: { contents: contents }
end
end
4 changes: 2 additions & 2 deletions app/helpers/catalog_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ module CatalogHelper
#
# @param [SolrDocument] document
# @return [Boolean]
# rubocop:disable Style/PredicateName
# rubocop:disable Naming/PredicateName
def has_thumbnail?(document)
return super unless document.reference? || document.canvas?

true
end
# rubocop:enable Style/PredicateName
# rubocop:enable Naming/PredicateName

# @note thumbnail handling moves to a presenter in Blacklight 7.
# Overriding Blacklight to provide a default thumbnail for references.
Expand Down
1 change: 1 addition & 0 deletions app/models/application_record.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#:nodoc:
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
2 changes: 1 addition & 1 deletion spec/helpers/catalog_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

describe '#render_thumbnail_tag' do
before do
allow(helper).to receive_messages(
expect(helper).to receive_messages(
blacklight_config: CatalogController.blacklight_config,
current_search_session: {},
document_index_view_type: :list,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
let(:exhibit) { create(:exhibit) }

before do
allow(view).to receive_messages(
expect(view).to receive_messages(
current_exhibit: exhibit,
document: document,
document_counter: 0,
Expand Down
2 changes: 1 addition & 1 deletion spec/views/viewers/edit.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
before do
assign(:viewer, viewer)
assign(:exhibit, exhibit)
allow(view).to receive_messages(configuration_page_title: 'Viewers')
expect(view).to receive_messages(configuration_page_title: 'Viewers')
stub_template 'spotlight/shared/_exhibit_sidebar.html.erb' => 'ignore'
render
end
Expand Down

0 comments on commit 0248d8f

Please sign in to comment.