feat: added new evaluate command to check the score of the asyncapi document
Resolves: #1131
- Started implementing new command to evaluate the asyncapi file:
- Use four parameters to describe the score of file:
if (document?.info().hasDescription()) {
scoreEvalate+=0.15;
}
if (document?.info().hasLicense()) {
scoreEvalate+=0.25;
}
if (!document?.servers().isEmpty()) {
scoreEvalate+=0.25;
}
if (!document?.channels().isEmpty()) {
scoreEvalate+=0.35;
}
const finalScore = (scoreEvalate/1)*100;
@AayushSaini101 do we need a new command for the linked issue ?
#1131
I guess it would be if we add new command for this, What do you think ? @Amzani @peter-rr @Souvikns
#1131
I guess it would be if we add new command for this, What do you think ? @Amzani @peter-rr @Souvikns
Was seeing the incorrect issue then 👍🏻
@AayushSaini101 do we need a new command for the linked issue ?
This might be used under validate command, however, for a better DX and maintainability having a dedicated command looks like a better approach.
@AayushSaini101 do we need a new command for the linked issue ?
This might be used under
validatecommand, however, for a better DX and maintainability having a dedicated command looks like a better approach.
Agreed, how about adding it as a flag --evaluate. Any way parsing will be done for both validate and evaluate. Could think some more ideas 🤔.
IMO, I would opt for just adding a flag to validate command since the feature to be added should work like an extension for the validation process. Also I think --score would be semantically more clear and easier to understand than --evaluate. So the resulting command could be something like asyncapi validate --score.
WDYT? @AayushSaini101 @Amzani @Shurtu-gal
IMO, I would opt for just adding a flag to validate command since the feature to be added should work like an extension for the validation process. Also I think --score would be semantically more clear and easier to understand than --evaluate. So the resulting command could be something like asyncapi validate --score.
Evaluation and Validation are closely related, having asyncapi validate --score looks good to me as long as we can make the new feature easily maintainable, and users can discover it.
/update
There are some issues with sonar-cloud as well @AayushSaini101.
@Shurtu-gal @Amzani @Souvikns I have added score flag in the existing validate command, and added a test case to verify the score and command. Ready for review. : ) Thanks
@Shurtu-gal @Amzani Ready for review. Hopefull for the last review cycle :)
/update
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
/u
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
/rtm
:tada: This PR is included in version 2.2.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket: