Drop all local color method calls

- The central logging method decides the color of the output
  - pass Rubocop complaints
This commit is contained in:
Olle Jonsson
2016-09-01 11:02:19 +02:00
committed by James Casey
parent f647dc0d98
commit 7e77fd6c57
6 changed files with 29 additions and 34 deletions

View File

@@ -74,7 +74,7 @@ module GitHubChangelogGenerator
commit = @fetcher.fetch_commit(event)
issue[:actual_date] = commit[:author][:date]
rescue
puts "Warning: Can't fetch commit #{event[:commit_id]}. It is probably referenced from another repo.".color(:yellow)
puts "Warning: Can't fetch commit #{event[:commit_id]}. It is probably referenced from another repo."
issue[:actual_date] = issue[:closed_at]
end
end

View File

@@ -39,10 +39,10 @@ module GitHubChangelogGenerator
index2 = hash[tag2]
log += generate_log_between_tags(all_tags[index1], all_tags[index2])
else
raise ChangelogGeneratorError, "Can't find tag #{tag2} -> exit".color(:red)
raise ChangelogGeneratorError, "Can't find tag #{tag2} -> exit"
end
else
raise ChangelogGeneratorError, "Can't find tag #{tag1} -> exit".color(:red)
raise ChangelogGeneratorError, "Can't find tag #{tag1} -> exit"
end
log
end
@@ -141,7 +141,7 @@ module GitHubChangelogGenerator
(1...filtered_tags.size).each do |index|
log += generate_log_between_tags(filtered_tags[index], filtered_tags[index - 1])
end
if @filtered_tags.count != 0
if filtered_tags.any?
log += generate_log_between_tags(nil, filtered_tags.last)
end

View File

@@ -19,7 +19,7 @@ module GitHubChangelogGenerator
# @param [Hash] tag_name name of the tag
# @return [Time] time of specified tag
def get_time_of_tag(tag_name)
raise ChangelogGeneratorError, "tag_name is nil".color(:red) if tag_name.nil?
raise ChangelogGeneratorError, "tag_name is nil" if tag_name.nil?
name_of_tag = tag_name["name"]
time_for_name = @tag_times_hash[name_of_tag]
@@ -99,7 +99,7 @@ module GitHubChangelogGenerator
filtered_tags = all_tags
tag = @options[:due_tag]
if tag
if (all_tags.count > 0) && (all_tags.map(&:name).include? tag)
if all_tags.any? && all_tags.map(&:name).include?(tag)
idx = all_tags.index { |t| t.name == tag }
last_index = all_tags.count - 1
filtered_tags = if idx > 0 && idx < last_index