Skip to content

Rework the ScoreBlock component to make it more easily usable #121

@AMorgaut

Description

@AMorgaut

Is your feature request related to a problem? Please describe.

Current implementation inherit from raw property names like "label-bold", "label", and "label-long" which are a bit confusing

It also expect a project id and a branch name which are used to generate a link which is highly specific to Sonar

Example:

<ScoreBlock
    :value="'C'"
    :label-bold="'Your app is not fully optimized.'"
    :label="'Keep going! You can continue by fixing the recommended rule on the right side. This is the one that currently has the highest impact on your app.'"
    :label-long="'You have between 10 and 19 minor severities or you have 1 or many major severity.'"
    :minor-severities="15"
    :major-severities="3"
    :critical-severities="0"
    :project-key="'FOO'"
    :branch="'main'"
/>

Describe the solution you'd like

Property names

The component should expose property names that are more explicit to how it will use them

Proposition:

BEFORE AFTER
label-bold label
label description
label-long tips
project-key /removed/
branch /removed/
/new/ link
<ScoreBlock
    :value="'C'"
    :label="'Your app is not fully optimized.'"
    :description="'Keep going! You can continue by fixing the recommended rule on the right side. This is the one that currently has the highest impact on your app.'"
    :tips="'You have between 10 and 19 minor severities or you have 1 or many major severity.'"
    :minor-severities="15"
    :major-severities="3"
    :critical-severities="0"
    :link="`${globalThis.baseUrl}/project/issues?id=FOO&branch=main&resolved=false`"
/>

Optional properties

It would be also better if no properties were mandatory. The component would then only render what it can from the received data. (Meaning also that there may potentially not be any link to click on).

Link vs Callback

It should be interesting to provide a seeIssues() callback property instead of an url link
property

The reason is that in some contexts, like in a VSCode extension, we may prefer to show the issues locally in the IDE were de developer is coding instead of in a separated browser window

Note that this enhancement requires to also modify the RuleCriticities component which is used by ScoreBlock

Unit tests

The ScoreBlock component should have unit tests like the ones of AbcdeScore

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions