Class: Hone::Formatters::SARIF

Inherits:
Base
  • Object
show all
Defined in:
lib/hone/formatters/sarif.rb

Overview

SARIF (Static Analysis Results Interchange Format) formatter for GitHub Code Scanning.

SARIF is a standard format for static analysis tools, supported by GitHub Code Scanning and other security/code quality platforms.

Examples:

Usage

formatter = Hone::Formatters::SARIF.new(findings)
puts formatter.format

See Also:

Constant Summary collapse

SARIF_VERSION =
"2.1.0"
SARIF_SCHEMA =
"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json"
PRIORITY_TO_LEVEL =

Maps Hone priority levels to SARIF severity levels.

  • error: A serious problem that should be addressed immediately
  • warning: A potential problem that should be reviewed
  • note: Informational finding
{
  hot_cpu: "error",
  hot_alloc: "error",
  jit_unfriendly: "warning",
  warm: "warning",
  cold: "note",
  unknown: "note"
}.freeze

Constants included from Filterable

Filterable::PRIORITY_LABELS

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from Filterable

#filter_cold, #format_percent, #priority_label

Constructor Details

This class inherits a constructor from Hone::Formatters::Base

Instance Method Details

#formatObject



34
35
36
# File 'lib/hone/formatters/sarif.rb', line 34

def format
  ::JSON.pretty_generate(build_sarif)
end