cli icon indicating copy to clipboard operation
cli copied to clipboard

feat: added new evaluate command to check the score of the asyncapi document

Open AayushSaini101 opened this issue 1 year ago • 12 comments

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 avatar May 08 '24 12:05 AayushSaini101

@AayushSaini101 do we need a new command for the linked issue ?

Shurtu-gal avatar May 08 '24 13:05 Shurtu-gal

#1131

I guess it would be if we add new command for this, What do you think ? @Amzani @peter-rr @Souvikns

AayushSaini101 avatar May 08 '24 15:05 AayushSaini101

#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 👍🏻

Shurtu-gal avatar May 08 '24 16:05 Shurtu-gal

@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.

Amzani avatar May 13 '24 10:05 Amzani

@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.

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 🤔.

Shurtu-gal avatar May 13 '24 14:05 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.

WDYT? @AayushSaini101 @Amzani @Shurtu-gal

peter-rr avatar May 13 '24 17:05 peter-rr

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.

Amzani avatar May 14 '24 10:05 Amzani

/update

There are some issues with sonar-cloud as well @AayushSaini101.

Shurtu-gal avatar May 17 '24 14:05 Shurtu-gal

@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

AayushSaini101 avatar May 18 '24 06:05 AayushSaini101

@Shurtu-gal @Amzani Ready for review. Hopefull for the last review cycle :)

AayushSaini101 avatar Jun 07 '24 08:06 AayushSaini101

/update

peter-rr avatar Jun 12 '24 08:06 peter-rr

/u

Shurtu-gal avatar Jul 31 '24 05:07 Shurtu-gal

/rtm

Shurtu-gal avatar Jul 31 '24 05:07 Shurtu-gal

:tada: This PR is included in version 2.2.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

asyncapi-bot avatar Jul 31 '24 05:07 asyncapi-bot