Class: Pronto::RubyCritic::Formatter
- Inherits:
-
Object
- Object
- Pronto::RubyCritic::Formatter
- Defined in:
- lib/pronto/rubycritic/formatter.rb
Overview
Chooses output markup based on CI environment. GitHub renders rich markdown (headings, tables, <details>) in PR review comments; GitLab does not render <details> reliably in MR / commit comments so plain markdown is used there.
Constant Summary collapse
- GITHUB =
:github- GITLAB =
:gitlab- PLAIN =
:plain- SEVERITY_EMOJI =
{ info: '💡', warning: '⚠️', error: '🔴', fatal: '🚨' }.freeze
- BRAND_NAME =
'pronto-rubycritic'- BRAND_URL =
'https://github.com/Rishabhs343/custom-pronto-gem'
Instance Attribute Summary collapse
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
-
#style ⇒ Object
readonly
Returns the value of attribute style.
Class Method Summary collapse
Instance Method Summary collapse
- #call(mod, smell) ⇒ Object
-
#initialize(style: PLAIN, severity: :warning) ⇒ Formatter
constructor
A new instance of Formatter.
Constructor Details
Instance Attribute Details
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
37 38 39 |
# File 'lib/pronto/rubycritic/formatter.rb', line 37 def severity @severity end |
#style ⇒ Object (readonly)
Returns the value of attribute style.
37 38 39 |
# File 'lib/pronto/rubycritic/formatter.rb', line 37 def style @style end |
Class Method Details
.detect(env: ENV, severity: :warning) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/pronto/rubycritic/formatter.rb', line 24 def self.detect(env: ENV, severity: :warning) style = if env['GITHUB_ACTIONS'] then GITHUB elsif env['GITLAB_CI'] then GITLAB else PLAIN end new(style: style, severity: severity) end |