-
Notifications
You must be signed in to change notification settings - Fork 2
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
CHANGE @W-17397505@ Added core version to certain outputs #172
base: dev
Are you sure you want to change the base?
Conversation
ad2d244
to
2a799d1
Compare
2a799d1
to
c6649f6
Compare
@@ -1,7 +1,7 @@ | |||
{ | |||
"name": "@salesforce/code-analyzer-core", | |||
"description": "Core Package for the Salesforce Code Analyzer", | |||
"version": "0.19.1", | |||
"version": "0.20.0-SNAPSHOT", |
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.
I wasn't sure whether we wanted to do an 0.20.0
for this or an 0.19.2
. I'm fine with either.
@@ -14,6 +14,8 @@ export enum OutputFormat { | |||
SARIF = "SARIF" | |||
} | |||
|
|||
export const CODE_ANALYZER_CORE_NAME: string = 'code-analyzer'; |
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.
If memory serves, this was the name we agreed on, and it means all our conventions for engine names (lowercase, skewer-case, etc).
getCoreVersion(): string { | ||
if (!this.coreVersion) { | ||
const pathToPackageJson: string = path.join(__dirname, '..', 'package.json'); | ||
const packageJson: { version: string } = JSON.parse(fs.readFileSync(pathToPackageJson, 'utf-8')); |
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.
I'm using fs.readFileSync()
here instead of a Promise because I wanted to keep the results formatting a synchronous process instead of introducing await
s everywhere.
We cache the result to make sure we only do the read once, so there shouldn't be a noticeable impact on performance.
47015a7
to
a9cfd7d
Compare
Adds the
code-analyzer-core
version to certain output formats, with the name"code-analyzer"
and the value being pulled from Core'spackage.json
version property.The outputs affected are:
I chose not to include it in SARIF because I couldn't figure out a good place to slot it into the schema, since It's not technically a tool that has violations or rules associated with it.