Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -307,31 +307,6 @@ Security/Eval:
Exclude:
- "spec/models/blacklight/solr/response_spec.rb"

# Offense count: 9
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: prefer_alias, prefer_alias_method
Style/Alias:
Exclude:
- "app/models/concerns/blacklight/document.rb"
- "app/models/concerns/blacklight/document/dublin_core.rb"
- "lib/blacklight/configuration.rb"
- "lib/blacklight/search_builder.rb"
- "lib/blacklight/solr/response.rb"
- "lib/blacklight/solr/response/group_response.rb"

# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
# FunctionalMethods: let, let!, subject, watch
# AllowedMethods: lambda, proc, it
Style/BlockDelimiters:
Exclude:
- "app/views/catalog/index.rss.builder"
- "app/views/catalog/opensearch.xml.builder"

# Offense count: 47
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle, EnforcedStyleForClasses, EnforcedStyleForModules.
Expand All @@ -348,14 +323,6 @@ Style/CommentedKeyword:
- "spec/controllers/catalog_controller_spec.rb"
- "spec/services/blacklight/search_service_spec.rb"

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
# SupportedStyles: assign_to_condition, assign_inside_condition
Style/ConditionalAssignment:
Exclude:
- "lib/blacklight/solr/response/spelling.rb"

# Offense count: 2
Style/DocumentDynamicEvalDefinition:
Exclude:
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/blacklight/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module Blacklight::Document
end

attr_reader :response, :_source
alias_method :solr_response, :response
alias solr_response response

delegate :[], :key?, :keys, :to_h, :as_json, to: :_source

Expand Down
4 changes: 2 additions & 2 deletions app/models/concerns/blacklight/document/dublin_core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def export_as_oai_dc_xml
xml.target!
end

alias_method :export_as_xml, :export_as_oai_dc_xml
alias_method :export_as_dc_xml, :export_as_oai_dc_xml
alias export_as_xml export_as_oai_dc_xml
alias export_as_dc_xml export_as_oai_dc_xml

private

Expand Down
8 changes: 4 additions & 4 deletions app/views/catalog/index.rss.builder
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# frozen_string_literal: true

xml.instruct! :xml, version: "1.0"
xml.rss(version: "2.0") {
xml.channel {
xml.rss(version: "2.0") do
xml.channel do
xml.title(t('blacklight.search.page_title.title', constraints: render_search_to_page_title(params), application_name: application_name))
xml.link(search_action_url(search_state.to_h.merge(only_path: false)))
xml.description(t('blacklight.search.page_title.title', constraints: render_search_to_page_title(params), application_name: application_name))
xml.language('en-us')
@response.documents.each_with_index do |document, document_counter|
xml << render_xml_partials(document, blacklight_config.view_config(:rss).partials, document_counter: document_counter)
end
}
}
end
end
4 changes: 2 additions & 2 deletions app/views/catalog/opensearch.xml.builder
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# frozen_string_literal: true

xml.instruct! :xml, version: '1.0'
xml.OpenSearchDescription(xmlns: 'http://a9.com/-/spec/opensearch/1.1/') {
xml.OpenSearchDescription(xmlns: 'http://a9.com/-/spec/opensearch/1.1/') do
xml.ShortName application_name
xml.Description "#{application_name} Search"
xml.Image asset_url('favicon.ico'), height: 16, width: 16, type: 'image/x-icon'
xml.Contact
xml.Url type: 'text/html', method: 'get', template: "#{url_for controller: 'catalog', only_path: false}?q={searchTerms}&amp;page={startPage?}"
xml.Url type: 'application/rss+xml', method: 'get', template: "#{url_for controller: 'catalog', only_path: false}.rss?q={searchTerms}&amp;page={startPage?}"
xml.Url type: 'application/x-suggestions+json', method: 'get', template: "#{url_for controller: 'catalog', action: 'opensearch', format: 'json', only_path: false}?q={searchTerms}"
}
end
2 changes: 1 addition & 1 deletion lib/blacklight/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ def build(klass)
conf.klass = klass
end
end
alias_method :inheritable_copy, :build
alias inheritable_copy build

# Get a view configuration for the given view type + action. The effective
# view configuration is inherited from:
Expand Down
6 changes: 3 additions & 3 deletions lib/blacklight/search_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ def to_hash
.tap { clear_changes }
end

alias_method :query, :to_hash
alias_method :to_h, :to_hash
alias query to_hash
alias to_h to_hash

# The CatalogController #index action uses this.
# Solr parameters can come from a number of places. From lowest
Expand Down Expand Up @@ -172,7 +172,7 @@ def start(value = nil)
val = 0 if @start < 0
val
end
alias_method :padding, :start
alias padding start

def page=(value)
params_will_change!
Expand Down
2 changes: 1 addition & 1 deletion lib/blacklight/solr/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def header
def documents
@documents ||= (response['docs'] || []).collect { |doc| document_factory.build(doc, self, options) }
end
alias_method :docs, :documents
alias docs documents

def grouped
@groups ||= self["grouped"].map do |field, group|
Expand Down
2 changes: 1 addition & 1 deletion lib/blacklight/solr/response/group_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def initialize key, group, response
@response = response
end

alias_method :group_field, :key
alias group_field key

def groups
@groups ||= group["groups"].map do |g|
Expand Down
16 changes: 8 additions & 8 deletions lib/blacklight/solr/response/spelling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ def words
# suggestion => [{ frequency =>, word => }] # for extended results
# suggestion => ['word'] # for non-extended results
orig_freq = term_info['origFreq']
if term_info['suggestion'].first.is_a?(Hash)
word_suggestions << term_info['suggestion'].map do |suggestion|
suggestion['word'] if suggestion['freq'] > orig_freq
end
else
# only extended suggestions have frequency so we just return all suggestions
word_suggestions << term_info['suggestion']
end
word_suggestions << if term_info['suggestion'].first.is_a?(Hash)
term_info['suggestion'].map do |suggestion|
suggestion['word'] if suggestion['freq'] > orig_freq
end
else
# only extended suggestions have frequency so we just return all suggestions
term_info['suggestion']
end
end
end
end
Expand Down
Loading