Skip to content

feat: add footPrint & priorityRule VS CODE extension#201

Open
kev59420 wants to merge 5 commits into
mainfrom
addMetricVsCodeExtension
Open

feat: add footPrint & priorityRule VS CODE extension#201
kev59420 wants to merge 5 commits into
mainfrom
addMetricVsCodeExtension

Conversation

@kev59420

@kev59420 kev59420 commented May 20, 2026

Copy link
Copy Markdown
  • Fix of Bugs
  • Addition of the Priority Rule
  • Addition of Carbon Footprint Estimation

@kev59420 kev59420 force-pushed the addMetricVsCodeExtension branch from f4ac48e to cd28941 Compare May 20, 2026 13:12
@sonarqubecloud

sonarqubecloud Bot commented Jun 4, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
9.6% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@kylecbritz-cap kylecbritz-cap requested a review from AMorgaut June 8, 2026 08:30
@kylecbritz-cap

Copy link
Copy Markdown

I've made changes to fix the two failed builds previously.

Comment on lines +1 to +2
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue: We cannot include comments this way in a JSON File

A raw option could be to add a "_comments" array property at the root of the json object with these 2 lines as string items (not recommended)

A better way would be to

  • add a README.md file in the .vscode folder with such tips
  • add a json schema link property "$schema": "vscode://schemas/tasks"

Comment on lines +1 to +4
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue: We cannot include comments this way in a JSON File

A raw option could be to add a "_comments" array property at the root of the json object with these 2 lines as string items (not recommended)

A better way would be to

  • add a README.md file in the .vscode folder with such tips
  • add a json schema link property "$schema": "vscode://schemas/launch"
    • this vscode schema is dynamic which is why this link is very local

}

/**
* @param {any} priorityRuleData

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue: any is not a valid JSDoc type


await this.#updateBranches();
await this.updatePriorityRule();
await this.updateFootPrint();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

niptick: be consistent with the code base

The updateBranches() is private (defined by the JS standard symbol #), so should be the updatePriorityRule() and updateFootPrint() methods


await this.#updateBranches();
await this.updatePriorityRule();
await this.updateFootPrint();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

typo: updateFootPrintshould be updateFootprint

Footprint is a single word

See: https://en.wikipedia.org/wiki/Carbon_footprint

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

suggestion(non-blocking): configuration.service.mjs files should be unit tested

Non blocking only because there no vscode unit tests yet
But highly recommended

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

suggestion(non-blocking): score.script.mjs files should be unit tested

Non blocking only because there no vscode unit tests yet
But highly recommended

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

suggestion(non-blocking): score.view.mjs files should be unit tested

Non blocking only because there no vscode unit tests yet
But highly recommended

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

suggestion(non-blocking): extension.mjs files should be unit tested

Non blocking only because there no vscode unit tests yet
But highly recommended

return issues
}

export async function getIssueCount({ project, branch }) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue: this function should be unit tested

this.#service.show(true);
const url = `${server}coding_rules?languages=${priorityRule.lang}&q=${priorityRule?.name.split(' ').join('+')}&open=java%3AS2187`
this.#service.postMessage({ type: 'updatePriorityRule', value: {
priorityRule: priorityRule,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

niptick: the syntax could be simplified

{ priorityRule, url } is enough

* @param {number} [config.lifetime] The expected "lifetime" of the servers in years (default: 4)
* @param {number} [config.energyDemand] The annual "Energy Demand" for each server (default: 1670 kWh/year for a DELL PowerEdge R640)
* @param {number} [config.carbonIntensity] The "Carbon Intensity" of the environment where the application is running (default: 0.336 kgCO2/kWh for North America)
* @returns

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

doc: the returned type is missing

window.showErrorMessage(error.message)
}
this.#service.show(true);
this.#service.postMessage({ type: 'updateFootPrint', value: footPrint });

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue: the value is sent as a number without any formating

It should indicate the unit of measurement and the number of digits should be controlled

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.

4 participants