[SCAL-324479]: Allow up to 2 PRIMARY custom actions per target - #692
Open
tushardeepakts wants to merge 1 commit into
Open
tushardeepakts wants to merge 1 commit into
tushardeepakts wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a limit of up to 2 PRIMARY custom actions per target. It updates the validation logic in src/utils/custom-actions.ts to track and enforce this limit, adds a corresponding error message, updates JSDoc documentation, and includes comprehensive unit tests. Feedback on the pull request points out a style guide violation in a JSDoc comment where a complete sentence does not end with a period.
Comment on lines
60
to
68
| /** | ||
| * Validates a single custom action based on its target type | ||
| * @param action - The custom action to validate | ||
| * @param primaryActionsPerTarget - Map to track primary actions per target | ||
| * @param primaryActionsPerTarget - Map tracking PRIMARY actions accepted so | ||
| * far, keyed by target | ||
| * @returns CustomActionValidation with isValid flag and reason string | ||
| * | ||
| * | ||
| * @hidden | ||
| */ |
Contributor
There was a problem hiding this comment.
According to the repository style guide (Rule 6), every description that forms a complete sentence should end with a period. Please add a period at the end of the description.
Suggested change
| /** | |
| * Validates a single custom action based on its target type | |
| * @param action - The custom action to validate | |
| * @param primaryActionsPerTarget - Map to track primary actions per target | |
| * @param primaryActionsPerTarget - Map tracking PRIMARY actions accepted so | |
| * far, keyed by target | |
| * @returns CustomActionValidation with isValid flag and reason string | |
| * | |
| * | |
| * @hidden | |
| */ | |
| /** | |
| * Validates a single custom action based on its target type. | |
| * @param action - The custom action to validate | |
| * @param primaryActionsPerTarget - Map tracking PRIMARY actions accepted so | |
| * far, keyed by target | |
| * @returns CustomActionValidation with isValid flag and reason string | |
| * | |
| * @hidden | |
| */ |
References
- Every description that forms a complete sentence should end with a period. (link)
commit: |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
getCustomActions()so theprimaryActionsPerTargetmap is now enforced, preventing an unlimited number ofPRIMARY-position custom actions.MAX_PRIMARY_ACTIONS_PER_TARGET = 2.validateCustomActionto enforce a maximum of 2 validPRIMARYactions per target:PRIMARYactions are rejected with the newTOO_MANY_PRIMARY_ACTIONSerror.CustomActionsPosition.PRIMARYJSDoc intypes.tsto document the 2-action limit.