Sha256: 9d7cd553ddfe5550a92619ce4e540d779cc6e6eacb9a87be6b9204cb9f21b547

Contents?: true

Size: 1.83 KB

Versions: 16

Compression:

Stored size: 1.83 KB

Contents

module Fastlane
  # Adds all the necessary emojis (obv)
  #
  class InspectorReporter
    NUMBER_OF_ISSUES_INLINE = 3

    # Called just as the investigation has begun.
    def inspector_started_query(query, inspector)
      puts ""
      puts "Looking for related GitHub issues on #{inspector.repo_owner}/#{inspector.repo_name}..."
      puts "Search query: #{query}" if $verbose
      puts ""
    end

    # Called once the inspector has recieved a report with more than one issue.
    def inspector_successfully_recieved_report(report, inspector)
      report.issues[0..(NUMBER_OF_ISSUES_INLINE - 1)].each { |issue| print_issue_full(issue) }

      if report.issues.count > NUMBER_OF_ISSUES_INLINE
        puts "and #{report.total_results - NUMBER_OF_ISSUES_INLINE} more at: #{report.url}"
      end
    end

    # Called once the report has been recieved, but when there are no issues found.
    def inspector_recieved_empty_report(report, inspector)
      puts "Found no similar issues. To create a new issue, please visit:"
      puts "https://github.com/#{inspector.repo_owner}/#{inspector.repo_name}/issues/new"
    end

    # Called when there have been networking issues in creating the report.
    def inspector_could_not_create_report(error, query, inspector)
      puts "Could not access the GitHub API, you may have better luck via the website."
      puts "https://github.com/#{inspector.repo_owner}/#{inspector.repo_name}/search?q=#{query}&type=Issues&utf8=✓"
      puts "Error: #{error.name}"
    end

    private

    def print_issue_full(issue)
      resolved = issue.state == 'closed'
      status = (resolved ? issue.state.green : issue.state.red)

      puts "➡️  #{issue.title.yellow}"
      puts "   #{issue.html_url} [#{status}] #{issue.comments} 💬"
      puts "   #{Time.parse(issue.updated_at).to_pretty}"
      puts ""
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
fastlane_core-0.53.0 lib/fastlane_core/ui/github_issue_inspector_reporter.rb
fastlane_core-0.52.3 lib/fastlane_core/ui/github_issue_inspector_reporter.rb
fastlane_core-0.52.2 lib/fastlane_core/ui/github_issue_inspector_reporter.rb
fastlane_core-0.52.1 lib/fastlane_core/ui/github_issue_inspector_reporter.rb
fastlane_core-0.52.0 lib/fastlane_core/ui/github_issue_inspector_reporter.rb
fastlane_core-0.51.0 lib/fastlane_core/ui/github_issue_inspector_reporter.rb
fastlane_core-0.50.3 lib/fastlane_core/ui/github_issue_inspector_reporter.rb
fastlane_core-0.50.2 lib/fastlane_core/ui/github_issue_inspector_reporter.rb
fastlane_core-0.50.1 lib/fastlane_core/ui/github_issue_inspector_reporter.rb
fastlane_core-0.50.0 lib/fastlane_core/ui/github_issue_inspector_reporter.rb
fastlane_core-0.49.0 lib/fastlane_core/ui/github_issue_inspector_reporter.rb
fastlane_core-0.48.3 lib/fastlane_core/ui/github_issue_inspector_reporter.rb
fastlane_core-0.48.2 lib/fastlane_core/ui/github_issue_inspector_reporter.rb
fastlane_core-0.48.1 lib/fastlane_core/ui/github_issue_inspector_reporter.rb
fastlane_core-0.48.0 lib/fastlane_core/ui/github_issue_inspector_reporter.rb
fastlane_core-0.47.0 lib/fastlane_core/ui/github_issue_inspector_reporter.rb