Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#38) Add rule for validating ID length #53

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

AdmiringWorm
Copy link
Member

Description Of Changes

This implements the note rule CPMR0069, that verifies that the length of
the package identifier is not longer than 20 characters without a dash
between the words.

This implementation is more restrict than what is currently implemented
on Package Validator as it will also consider packages that have certain
extension, just by removing this extension first and it will also verify
that any section between dashes is not longer than 20 characters.

Motivation and Context

To implement rules already present on Package Validator.

Testing

  1. Create a nuspec file.
  2. Update the identifier to be more than 20 characters.
  3. Run choco pack on the created nuspec file.
  4. Verify the rule CPMR0069 is flagged.
  5. Update the identifier to 19 characters, then add .extension to the identifier (total length should be 29).
  6. Run choco pack on the updated nuspec file.
  7. Verify tthe rule CPMR0069 is NOT flagged.
  8. Update the identifier with an additional character before .extension (total identifier length should be 30).
  9. Run choco pack on the updated nuspec file.
  10. Verify the rule CPMR0069 is flagged.
  11. Update the the identifier to be multiple words split with a dash (-) where all words are less than 20 characters.
  12. Run choco pack on the updated nuspec file.
  13. Verify the rule CPMR0069 is NOT flagged.
  14. Update the identifier again, and make one of the words more than 20 characters.
  15. Run choco pack on the updated nuspec file.
  16. Verify the rule CPMR0069 is flagged.

Operating Systems Testing

  • Windows 10

Change Types Made

  • Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • Breaking change (fix or feature that could cause existing functionality to change).
  • Documentation changes.
  • PowerShell code changes.

Change Checklist

  • Requires a change to the documentation.
  • Documentation has been updated.
  • Tests to cover my changes, have been added.
  • All new and existing tests passed?
  • PowerShell code changes: PowerShell v2 compatibility checked?

Related Issue

Fixes #38

This implements the note rule CPMR0069, that verifies that the length of
the package identifier is not longer than 20 characters without a dash
between the words.

This implementation is more restrict than what is currently implemented
on Package Validator as it will also consider packages that have certain
extension, just by removing this extension first and it will also verify
that any section between dashes is not longer than 20 characters.
@AdmiringWorm AdmiringWorm self-assigned this Jul 26, 2024
@AdmiringWorm AdmiringWorm requested a review from gep13 July 26, 2024 14:41
Copy link
Member

@gep13 gep13 left a comment

Choose a reason for hiding this comment

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

LGTM!

@gep13 gep13 merged commit aa3e029 into chocolatey-community:develop Jul 29, 2024
1 check passed
@gep13
Copy link
Member

gep13 commented Jul 29, 2024

@AdmiringWorm Great work! Thanks for getting this added!

@AdmiringWorm AdmiringWorm deleted the issue38 branch August 5, 2024 11:29
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.

Implement note rule CPMR0069 - Package Id is too long, and doesn't contain dashes
2 participants