-
Notifications
You must be signed in to change notification settings - Fork 4
NEW @W-17159591@ Added version property to output #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,12 @@ export class XmlOutputFormatter implements OutputFormatter { | |
| violationCountsNode.node('sev4').text(`${resultsOutput.violationCounts.sev4}`); | ||
| violationCountsNode.node('sev5').text(`${resultsOutput.violationCounts.sev5}`); | ||
|
|
||
| const versionsNode: xmlbuilder.XMLElement = resultsNode.node('versions'); | ||
| const engineNames: string[] = results.getEngineNames(); | ||
| for (const engineName of engineNames) { | ||
| versionsNode.node(engineName).text(results.getEngineRunResults(engineName).getEngineVersion()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm... This would be the first time we would be generating dynamic tags. Thankfully tag names can contain hyphens. That is, we would have This is fine but we have to keep in mind that if we ever publish an xsd associated with these dynamic tags, we'd have to use something like |
||
| } | ||
|
|
||
| const violationsNode: xmlbuilder.XMLElement = resultsNode.node('violations'); | ||
| for (const violationOutput of resultsOutput.violations) { | ||
| const violationNode: xmlbuilder.XMLElement = violationsNode.node('violation'); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,5 +8,6 @@ | |
| "sev4": 0, | ||
| "sev5": 0 | ||
| }, | ||
| "versions": {}, | ||
| "violations": [] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,5 +9,6 @@ | |
| <sev4>0</sev4> | ||
| <sev5>0</sev5> | ||
| </violationCounts> | ||
| <versions></versions> | ||
| <violations></violations> | ||
| </results> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SARIF supports both
semanticVersionandversion.semanticVersionshould be used if the version is known to conform to Semantic Version 2 schema. Since all of the versions we're returning are pulled directly from thepackage.json, they therefore definitionally conform to the schema.My assumption is that external plugin authors will also return something that resembles a SemVer, and thus this should be valid for them too. If that assumption is incorrect, I can just change to the
versionproperty trivially.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the validator https://sarifweb.azurewebsites.net/Validation validate with semanticVersion supplied but not version?
Also yeah, not sure how things will work out given that we are not forcing SemVer in the engine api... so I wonder if we just use "version". Is "version" what we used with v4?
Alternatively, we could just see if it is of a specific format (X.Y.Z) and if so, then use semanticVersion and if not then just fall back to version.