style(rubucop): Fixing styling for latest Rubocop

Apparently, new lines are requires after guard clauses now. I like it.
This commit is contained in:
Pixelastic 2018-12-07 17:32:18 +01:00
parent fc7847e842
commit 44701ef764
6 changed files with 13 additions and 2 deletions

View File

@ -209,6 +209,7 @@ module Jekyll
def self.verbose? def self.verbose?
value = get('verbose') value = get('verbose')
return true if value == true return true if value == true
false false
end end
@ -218,6 +219,7 @@ module Jekyll
def self.dry_run? def self.dry_run?
value = get('dry_run') value = get('dry_run')
return true if value == true return true if value == true
false false
end end
@ -228,6 +230,7 @@ module Jekyll
def self.force_settings? def self.force_settings?
value = get('force_settings') value = get('force_settings')
return true if value == true return true if value == true
false false
end end
@ -238,6 +241,7 @@ module Jekyll
def self.extensions_to_index def self.extensions_to_index
extensions = algolia('extensions_to_index') extensions = algolia('extensions_to_index')
return [] if extensions.nil? return [] if extensions.nil?
extensions = extensions.split(',') if extensions.is_a? String extensions = extensions.split(',') if extensions.is_a? String
extensions extensions
end end

View File

@ -57,6 +57,7 @@ module Jekyll
known_errors.each do |potential_error| known_errors.each do |potential_error|
error_check = send("#{potential_error}?", error, context) error_check = send("#{potential_error}?", error, context)
next if error_check == false next if error_check == false
return { return {
name: potential_error, name: potential_error,
details: error_check details: error_check

View File

@ -328,6 +328,7 @@ module Jekyll
Logger.log("I:Updating settings of index #{index.name}") Logger.log("I:Updating settings of index #{index.name}")
return if Configurator.dry_run? return if Configurator.dry_run?
set_settings(settings) set_settings(settings)
end end

View File

@ -49,6 +49,7 @@ module Jekyll
# line - The line to display, following the same format as .log # line - The line to display, following the same format as .log
def self.verbose(line) def self.verbose(line)
return unless Configurator.verbose? return unless Configurator.verbose?
log(line) log(line)
end end

View File

@ -42,6 +42,7 @@ module Jekyll
# html - String representation of the HTML node # html - String representation of the HTML node
def self.html_to_text(html) def self.html_to_text(html)
return nil if html.nil? return nil if html.nil?
text = Nokogiri::HTML(html).text text = Nokogiri::HTML(html).text
text.tr("\n", ' ').squeeze(' ').strip text.tr("\n", ' ').squeeze(' ').strip
end end
@ -54,6 +55,7 @@ module Jekyll
hash.each do |key, value| hash.each do |key, value|
next if value.nil? next if value.nil?
next if value.is_a?(String) && value.empty? next if value.is_a?(String) && value.empty?
new_hash[key] = value new_hash[key] = value
end end
new_hash new_hash
@ -84,6 +86,7 @@ module Jekyll
# It is basically a wrapper around [].find, handling more edge-cases # It is basically a wrapper around [].find, handling more edge-cases
def self.find_by_key(items, key, value) def self.find_by_key(items, key, value)
return nil if items.nil? return nil if items.nil?
items.find do |item| items.find do |item|
item[key] == value item[key] == value
end end
@ -140,6 +143,7 @@ module Jekyll
end end
return nil if diff.empty? return nil if diff.empty?
diff diff
end end

View File

@ -33,7 +33,7 @@ describe(Jekyll::Algolia::Indexer) do
.with(hash_including( .with(hash_including(
application_id: 'app_id', application_id: 'app_id',
api_key: 'api_key' api_key: 'api_key'
)) ))
end end
end end
@ -215,7 +215,7 @@ describe(Jekyll::Algolia::Indexer) do
.to have_received(:create) .to have_received(:create)
.with(hash_including( .with(hash_including(
total: 12 total: 12
)) ))
expect(progress_bar_instance).to have_received(:increment).twice expect(progress_bar_instance).to have_received(:increment).twice
end end
end end