Class: Txray::Reporters::Sarif
- Inherits:
-
Object
- Object
- Txray::Reporters::Sarif
- Defined in:
- lib/txray/reporters/sarif.rb
Constant Summary collapse
- LEVELS =
{ high: "error", medium: "warning", low: "note" }.freeze
Instance Method Summary collapse
-
#initialize(io: $stdout) ⇒ Sarif
constructor
A new instance of Sarif.
- #report(result) ⇒ Object
Constructor Details
#initialize(io: $stdout) ⇒ Sarif
Returns a new instance of Sarif.
10 11 12 |
# File 'lib/txray/reporters/sarif.rb', line 10 def initialize(io: $stdout) @io = io end |
Instance Method Details
#report(result) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/txray/reporters/sarif.rb', line 14 def report(result) @io.puts JSON.pretty_generate( "$schema" => "https://json.schemastore.org/sarif-2.1.0.json", version: "2.1.0", runs: [ { tool: tool, results: result.offenses.map { |offense| sarif_result(offense) } } ] ) end |