lib/sarif/base_sarif.rb
# Retrieves result section for sarif report
Retrieves result section for sarif report
Retrieves result section for sarif report
def build_result(parsed_issue)
      result = {
        "ruleId": parsed_issue[:id],
        "ruleIndex": @mapped_rules[parsed_issue[:id]],
        "level": sarif_level(parsed_issue[:level]),
        "message": {
          "text": parsed_issue[:details]
        },
        "locations": [
          {
            "physicalLocation": {
              "artifactLocation": {
                "uri": parsed_issue[:uri],
                "uriBaseId": "%SRCROOT%"
              }
            }
          }
        ]
      }
      location = result[:locations][0][:physicalLocation]
      if !parsed_issue[:start_line].nil?
        location[:region] = {
          "startLine": parsed_issue[:start_line].to_i,
          "startColumn": parsed_issue[:start_column].to_i
        }
      end
      location[:region][:snippet] = { "text": parsed_issue[:code] } if !parsed_issue[:code].nil?
      result[:properties] = parsed_issue[:properties] unless parsed_issue[:properties].nil?
      result
    end
def build_result ( parsed_issue ) result = { "ruleId" : parsed_issue [ :id ] , "ruleIndex" : @mapped_rules [ parsed_issue [ :id ] ] , "level" : sarif_level ( parsed_issue [ :level ] ) , "message" : { "text" : parsed_issue [ :details ] } , "locations" : [ { "physicalLocation" : { "artifactLocation" : { "uri" : parsed_issue [ :uri ] , "uriBaseId" : "%SRCROOT%" } } } ] } location = result [ :locations ] [ 0 ] [ :physicalLocation ] if ! parsed_issue [ :start_line ] . nil? location [ :region ] = { "startLine" : parsed_issue [ :start_line ] . to_i , "startColumn" : parsed_issue [ :start_column ] . to_i } end location [ :region ] [ :snippet ] = { "text" : parsed_issue [ :code ] } if ! parsed_issue [ :code ] . nil? result [ :properties ] = parsed_issue [ :properties ] unless parsed_issue [ :properties ] . nil? result end
Retrieves result section for sarif report
Retrieves result section for sarif report
parsed_issue
<not_specific>