Skip to content

Conversation

@jfeingold35
Copy link
Contributor

No description provided.

tool: {
driver: {
name: engineRunResults.getEngineName(),
semanticVersion: engineRunResults.getEngineVersion(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SARIF supports both semanticVersion and version. semanticVersion should 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 the package.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 version property trivially.

Copy link
Contributor

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.

@jfeingold35 jfeingold35 marked this pull request as draft December 3, 2024 18:12
tool: {
driver: {
name: engineRunResults.getEngineName(),
semanticVersion: engineRunResults.getEngineVersion(),
Copy link
Contributor

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.

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());
Copy link
Contributor

Choose a reason for hiding this comment

The 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 <versions><pmd>X.Y.Z</pmd><retire-js>X.Y.Z</retire-js></versions> for example.

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 <xs:any minOccurs="0" maxOccurs="unbounded"/> when documenting the tags under the versions tag.

@jfeingold35 jfeingold35 marked this pull request as ready for review December 3, 2024 19:33
@jfeingold35 jfeingold35 merged commit d1d032b into dev Dec 3, 2024
5 checks passed
@stephen-carter-at-sf stephen-carter-at-sf deleted the d/W-17159591 branch January 30, 2025 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants