Class: Hone::Reporter
- Inherits:
-
Object
- Object
- Hone::Reporter
- Includes:
- Formatters::Filterable
- Defined in:
- lib/hone/reporter.rb
Constant Summary collapse
- COLORS =
ANSI color codes
{ reset: "\e[0m", bold: "\e[1m", dim: "\e[2m", red: "\e[31m", green: "\e[32m", yellow: "\e[33m", cyan: "\e[36m", white: "\e[37m", bright_red: "\e[91m", gray: "\e[90m" }.freeze
- PRIORITY_CONFIG =
Priority display configuration
{ hot_cpu: {label: "High impact", color: %i[bold bright_red], metric: :cpu}, hot_alloc: {label: "High impact", color: %i[bold red], metric: :alloc}, jit_unfriendly: {label: "JIT issue", color: %i[bold yellow], metric: nil}, warm: {label: "Moderate", color: [:yellow], metric: nil}, cold: {label: "Low", color: %i[dim gray], metric: nil}, unknown: {label: "Unknown", color: [:dim], metric: nil} }.freeze
- SEPARATOR_WIDTH =
72- CONTEXT_LINES =
2
Constants included from Formatters::Filterable
Formatters::Filterable::PRIORITY_LABELS
Instance Method Summary collapse
- #format ⇒ Object (also: #report)
-
#initialize(findings, options = {}) ⇒ Reporter
constructor
A new instance of Reporter.
Methods included from Formatters::Filterable
Constructor Details
#initialize(findings, options = {}) ⇒ Reporter
Returns a new instance of Reporter.
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/hone/reporter.rb', line 34 def initialize(findings, = {}) @findings = findings @show_cold = .fetch(:show_cold, false) @quiet = .fetch(:quiet, false) @verbose = .fetch(:verbose, false) @color = .fetch(:color, $stdout.tty? && !ENV["NO_COLOR"]) @profile_path = [:profile_path] @file_path = [:file_path] @hot_threshold = .fetch(:hot_threshold, Correlator::HOT_THRESHOLD) @warm_threshold = .fetch(:warm_threshold, Correlator::WARM_THRESHOLD) @source_cache = {} end |
Instance Method Details
#format ⇒ Object Also known as: report
47 48 49 50 51 52 53 |
# File 'lib/hone/reporter.rb', line 47 def format output = [] output << header unless @quiet output << findings_output output << summary output.flatten.compact.join("\n") end |