-
Notifications
You must be signed in to change notification settings - Fork 7
🩹 [Patch]: Adjust GitHubRepository format to show aligned sizes #507
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
Conversation
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
GitHubRepository format to show aligned sizes
MariusStorhaug
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Please fix.
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
MariusStorhaug
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Please fix.
…t formatter Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
… block Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Fixed in commit 20243f9. The test structure has been improved to properly follow Pester best practices with test cases outside the "It" block, proper use of |
…t pattern validation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves the formatting consistency of file sizes in the GitHubRepository class by standardizing byte formatting and enhancing test coverage. The changes ensure proper column alignment by formatting all sizes with 2 decimal places and consistent spacing.
- Standardized byte formatting to include 2 decimal places and extra space before 'B' unit for alignment
- Refactored tests to use Pester's
-ForEachparameter and actually test the formatter logic - Optimized test performance by moving class import to BeforeAll block
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/classes/public/GitHubFormatter.ps1 | Updated FormatFileSize method to format bytes with 2 decimal places and consistent spacing |
| tests/GitHubFormatter.Tests.ps1 | Enhanced test coverage with proper Pester patterns and actual formatter testing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This pull request updates the file size formatting logic in
GitHubFormatterto ensure consistent output with two decimal places for all units, including bytes, and adjusts the related tests to match the new output format. The most important changes are grouped below:GitHubRepositoryformat to show aligned sizes #506File size formatting improvements:
FormatFileSizeinGitHubFormatter.ps1to always display byte values with two decimal places (e.g., "0.00 B" instead of "0 B").Test updates for new formatting:
GitHubFormatter.Tests.ps1to expect two-decimal formatting for bytes and adjusted regex patterns to match the new output (e.g.,\d+[.,]\d{2}\s{2}B).