From 70b5a10bdf376bde6445c4a8a8795e3b99d46ccf Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Mon, 5 Mar 2018 15:11:33 -0800 Subject: [PATCH] Linty McLintface --- github_changelog_generator.gemspec | 2 +- .../generator/generator_processor.rb | 4 ++-- .../generator/generator_tags.rb | 14 +++++++------- lib/github_changelog_generator/octo_fetcher.rb | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/github_changelog_generator.gemspec b/github_changelog_generator.gemspec index a70f5949f..8cad84cbc 100644 --- a/github_changelog_generator.gemspec +++ b/github_changelog_generator.gemspec @@ -1,6 +1,6 @@ # frozen_string_literal: true -lib = File.expand_path("../lib", __FILE__) +lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "github_changelog_generator/version" diff --git a/lib/github_changelog_generator/generator/generator_processor.rb b/lib/github_changelog_generator/generator/generator_processor.rb index b51c0cbc4..32104ee32 100644 --- a/lib/github_changelog_generator/generator/generator_processor.rb +++ b/lib/github_changelog_generator/generator/generator_processor.rb @@ -125,11 +125,11 @@ def tag_older_new_tag?(newer_tag_time, time) tag_in_range_new end - def tag_newer_old_tag?(older_tag_time, t) + def tag_newer_old_tag?(older_tag_time, time) tag_in_range_old = if older_tag_time.nil? true else - t > older_tag_time + time > older_tag_time end tag_in_range_old end diff --git a/lib/github_changelog_generator/generator/generator_tags.rb b/lib/github_changelog_generator/generator/generator_tags.rb index 7568a1790..53393c27b 100644 --- a/lib/github_changelog_generator/generator/generator_tags.rb +++ b/lib/github_changelog_generator/generator/generator_tags.rb @@ -4,8 +4,8 @@ module GitHubChangelogGenerator class Generator # fetch, filter tags, fetch dates and sort them in time order def fetch_and_filter_tags - detect_since_tag - detect_due_tag + since_tag + due_tag all_tags = @fetcher.get_all_tags fetch_tags_dates(all_tags) # Creates a Hash @tag_times_hash @@ -35,7 +35,7 @@ def build_tag_section_mapping(section_tags, filtered_tags) tag = section_tags[i] # Don't create section header for the "since" tag - next if @since_tag && tag["name"] == @since_tag + next if since_tag && tag["name"] == since_tag # Don't create a section header for the first tag in between_tags next if options[:between_tags] && tag == section_tags.last @@ -98,11 +98,11 @@ def detect_link_tag_time(newer_tag) end # @return [Object] try to find newest tag using #Reader and :base option if specified otherwise returns nil - def detect_since_tag + def since_tag @since_tag ||= options.fetch(:since_tag) { version_of_first_item } end - def detect_due_tag + def due_tag @due_tag ||= options.fetch(:due_tag, nil) end @@ -125,7 +125,7 @@ def get_filtered_tags(all_tags) # @return [Array] filtered tags according :since_tag option def filter_since_tag(all_tags) filtered_tags = all_tags - tag = detect_since_tag + tag = since_tag if tag if all_tags.map { |t| t["name"] }.include? tag idx = all_tags.index { |t| t["name"] == tag } @@ -145,7 +145,7 @@ def filter_since_tag(all_tags) # @return [Array] filtered tags according :due_tag option def filter_due_tag(all_tags) filtered_tags = all_tags - tag = detect_due_tag + tag = due_tag if tag if all_tags.any? && all_tags.map { |t| t["name"] }.include?(tag) idx = all_tags.index { |t| t["name"] == tag } diff --git a/lib/github_changelog_generator/octo_fetcher.rb b/lib/github_changelog_generator/octo_fetcher.rb index 68f1148ff..897c17dce 100644 --- a/lib/github_changelog_generator/octo_fetcher.rb +++ b/lib/github_changelog_generator/octo_fetcher.rb @@ -55,7 +55,7 @@ def github_options end def configure_octokit_ssl - ca_file = @options[:ssl_ca_file] || ENV["SSL_CA_FILE"] || File.expand_path("../ssl_certs/cacert.pem", __FILE__) + ca_file = @options[:ssl_ca_file] || ENV["SSL_CA_FILE"] || File.expand_path("ssl_certs/cacert.pem", __dir__) Octokit.connection_options = { ssl: { ca_file: ca_file } } end @@ -316,8 +316,8 @@ def check_github_response end # Presents the exception, and the aborts with the message. - def fail_with_message(e, message) - Helper.log.error("#{e.class}: #{e.message}") + def fail_with_message(error, message) + Helper.log.error("#{error.class}: #{error.message}") sys_abort(message) end