Class: LcpRuby::I18nCheck::Reporter
- Inherits:
-
Object
- Object
- LcpRuby::I18nCheck::Reporter
- Defined in:
- lib/lcp_ruby/i18n_check/reporter.rb
Overview
Renders a list of ‘Offense` records to one of three formats and returns a process exit code (0 unless any :error-severity offense is present).
The JSON output is a versioned, stable contract:
{ "version": 1, "offenses": [...], "summary": {...} }
IDE / CI clients should gate on ‘version` before consuming `offenses`.
Defined Under Namespace
Classes: UnknownFormatError
Constant Summary collapse
- FORMATS =
%i[text github json].freeze
- JSON_SCHEMA_VERSION =
1
Instance Method Summary collapse
Instance Method Details
#report(offenses, format: :text, io: $stdout) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/lcp_ruby/i18n_check/reporter.rb', line 17 def report(offenses, format: :text, io: $stdout) format = format.to_sym unless FORMATS.include?(format) raise UnknownFormatError, "unknown format #{format.inspect}; expected one of #{FORMATS.inspect}" end send("format_#{format}", offenses, io) summary_exit_code(offenses) end |