Skip to content

Commit d6982d0

Browse files
committed
Merge pull request #18 from nsidc/cop-fixes
Cop fixes
2 parents b9d9e9b + 8c34430 commit d6982d0

31 files changed

+138
-130
lines changed

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,6 @@ one terminal window.
9393

9494
RuboCop can be configured by modifying `.rubocop.yml`.
9595

96-
Pushing with failing tests or RuboCop violations will cause the Jenkins build to
97-
break. Jenkins jobs to build and deploy this project are named
98-
"NSIDC_Search_SOLR_()…" and can be viewed under the
99-
[NSIDC Search tab](https://scm.nsidc.org/jenkins/view/NSIDC%20Search/).
100-
10196
### Testing
10297

10398
Unit tests can be run with `rspec`, `bundle exec rake spec:unit`, or `bundle
@@ -114,7 +109,7 @@ Requirements:
114109
* [Bundler](http://bundler.io/)
115110
* [Gem Release](https://github.com/svenfuchs/gem-release)
116111
* [Rake](https://github.com/ruby/rake)
117-
* a [RubyGems](https://rubygems.org) account that has
112+
* A [RubyGems](https://rubygems.org) account that has
118113
[ownership](http://guides.rubygems.org/publishing/) of the gem
119114
* RuboCop and the unit tests should all pass (`rake`)
120115

@@ -125,7 +120,7 @@ tagging, and publishing to RubyGems.
125120
|---------------------------|-------------|
126121
| `rake release:pre[false]` | Increase the current prerelease version number, push changes |
127122
| `rake release:pre[true]` | Increase the current prerelease version number, publish release\* |
128-
| `rake release:none` | Drop the prerelease version, publish release, then `pre[false]` |
123+
| `rake release:none` | Drop the prerelease version, publish release, then `pre[false]` (does a patch release) |
129124
| `rake release:minor` | Increase the minor version number, publish release, then `pre[false]` |
130125
| `rake release:major` | Increase the major version number, publish release, then `pre[false]` |
131126

bin/search_solr_tools

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ class SolrHarvestCLI < Thor
5858
harvester.delete_old_documents(options[:timestamp],
5959
"data_centers:\"#{SearchSolrTools::Helpers::SolrFormat::DATA_CENTER_NAMES[options[:data_center].upcase.to_sym][:long_name]}\"",
6060
SearchSolrTools::SolrEnvironments[harvester.environment][:collection_name],
61-
true
62-
)
61+
true)
6362
end
6463

6564
no_tasks do
@@ -90,7 +89,7 @@ class SolrHarvestCLI < Thor
9089

9190
def get_harvester_class(data_center_name)
9291
name = data_center_name.downcase.to_s
93-
fail("Invalid data center #{name}") unless harvester_map.key?(name)
92+
raise("Invalid data center #{name}") unless harvester_map.key?(name)
9493

9594
harvester_map[name]
9695
end

lib/search_solr_tools/harvesters/ade_auto_suggest.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module Harvesters
33
class AdeAutoSuggest < AutoSuggest
44
def harvest_and_delete
55
puts 'Building auto-suggest indexes for ADE'
6-
super(method(:harvest), "source:\"ADE\"", @env_settings[:auto_suggest_collection_name])
6+
super(method(:harvest), 'source:"ADE"', @env_settings[:auto_suggest_collection_name])
77
end
88

99
def harvest
@@ -12,7 +12,8 @@ def harvest
1212
end
1313

1414
def fields
15-
{ 'full_keywords_and_parameters' => { weight: 2, source: 'ADE', creator: method(:keyword_creator) },
15+
{
16+
'full_keywords_and_parameters' => { weight: 2, source: 'ADE', creator: method(:keyword_creator) },
1617
'full_authors' => { weight: 1, source: 'ADE', creator: method(:author_creator) }
1718
}
1819
end

lib/search_solr_tools/harvesters/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def insert_solr_docs(docs, content_type = XML_CONTENT_TYPE, core = SolrEnvironme
8181
end
8282
puts "#{success} document#{success == 1 ? '' : 's'} successfully added to Solr."
8383
puts "#{failure} document#{failure == 1 ? '' : 's'} not added to Solr."
84-
fail 'Some documents failed to be inserted into Solr' if failure > 0
84+
raise 'Some documents failed to be inserted into Solr' if failure > 0
8585
end
8686

8787
def insert_solr_doc(doc, content_type = XML_CONTENT_TYPE, core = SolrEnvironments[@environment][:collection_name])

lib/search_solr_tools/harvesters/bcodmo.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def harvest_and_delete
1818
def harvest_bcodmo_into_solr
1919
result = translate_bcodmo
2020
insert_solr_docs result[:add_docs], Base::JSON_CONTENT_TYPE
21-
fail 'Failed to harvest some records from the provider' if result[:failure_ids].length > 0
21+
raise 'Failed to harvest some records from the provider' if result[:failure_ids].length > 0
2222
end
2323

2424
def translate_bcodmo

lib/search_solr_tools/harvesters/eol.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def harvest_eol_into_solr
2222
doc = open_xml_document(dataset)
2323
if doc.xpath('//xmlns:metadata').size > 1
2424
# THREDDS allows for a dataset of datasests, EOL should not utilize this
25-
fail "Complex dataset encountered at #{doc.xpath('//xmlns:catalog').to_html}"
25+
raise "Complex dataset encountered at #{doc.xpath('//xmlns:catalog').to_html}"
2626
end
2727
metadata_doc = open_xml_document(doc.xpath('//xmlns:metadata')[0]['xlink:href'])
2828
{ 'add' => { 'doc' => @translator.translate(doc, metadata_doc) } }

lib/search_solr_tools/harvesters/gtnp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def harvest_and_delete
2828
def harvest_gtnp_into_solr
2929
result = translate_gtnp
3030
insert_solr_docs result[:add_docs], Base::JSON_CONTENT_TYPE
31-
fail 'Failed to harvest some records from the provider' if result[:failure_ids].length > 0
31+
raise 'Failed to harvest some records from the provider' if result[:failure_ids].length > 0
3232
end
3333

3434
def translate_gtnp

lib/search_solr_tools/harvesters/ices.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ def build_csw_request(resultType = 'results', maxRecords = '25', startPosition =
4848
'maxRecords' => maxRecords,
4949
'startPosition' => startPosition,
5050
'constraintLanguage' => 'CQL_TEXT',
51-
'outputSchema' => 'http://www.isotc211.org/2005/gmd'
52-
)
51+
'outputSchema' => 'http://www.isotc211.org/2005/gmd')
5352
end
5453
end
5554
end

lib/search_solr_tools/harvesters/ncdc_paleo.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ def build_csw_request(resultType = 'results', maxRecords = '1000', startPosition
5252
Helpers::CswIsoQueryBuilder.get_query_string(ncdc_paleo_url,
5353
'resultType' => resultType,
5454
'maxRecords' => maxRecords,
55-
'startPosition' => startPosition
56-
)
55+
'startPosition' => startPosition)
5756
end
5857
end
5958
end

lib/search_solr_tools/harvesters/nodc.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ def build_csw_request(resultType = 'results', maxRecords = '25', startPosition =
4848
'maxRecords' => maxRecords,
4949
'startPosition' => startPosition,
5050
'constraint' => bbox_constraint,
51-
'outputSchema' => 'http://www.isotc211.org/2005/gmd'
52-
)
51+
'outputSchema' => 'http://www.isotc211.org/2005/gmd')
5352
end
5453

5554
def bbox_constraint

0 commit comments

Comments
 (0)