refactor: remove duplicate git diff logic in frontmatter validator#473
refactor: remove duplicate git diff logic in frontmatter validator#473cnaples79 wants to merge 4 commits intomicrosoft:mainfrom
Conversation
- Remove Get-ChangedMarkdownFileGroup test region (function deleted) - Remove Git Fallback Strategy tests (FallbackStrategy param not in shared function) - Remove ChangedFilesOnly Integration tests (function no longer exists) - Update integration test mocks to use Get-ChangedFilesFromGit - Update parameter filters to include FileExtensions check - Update test names to reference correct function Fixes failing PowerShell tests after refactoring to use shared helper
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #473 +/- ##
==========================================
+ Coverage 76.22% 76.50% +0.28%
==========================================
Files 20 20
Lines 3503 3478 -25
==========================================
- Hits 2670 2661 -9
+ Misses 833 817 -16
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
katriendg
left a comment
There was a problem hiding this comment.
Thank you @cnaples79 for taking on this issue and contributing improvements.
With the current approach and deleted tests however, there are a few elements no longer tested in as much detail because LintingHelpers.Tests.ps1 does not cover some of what the deleted paths tested.
Could you give it another pass using either Task-Researcher or RPI to help you question which parts of the branch have removed tests that are now no longer/not yet covered, and should now be extended in the LintingHelpers.Tests.ps1.
This will ensure we don't lose any of the granularity of the testing which was previously there.
Summary
Get-ChangedMarkdownFileGroupfunction from frontmatter validatorGet-ChangedFilesFromGithelper fromLintingHelpers.psm1Rationale
Issue #322 identified duplicated git diff logic. This refactoring eliminates 491 lines of duplicate code by reusing the shared linting helper.
Changes
Get-ChangedFilesFromGitFiles changed:
scripts/linting/Validate-MarkdownFrontmatter.ps1(-106 lines)scripts/tests/linting/Validate-MarkdownFrontmatter.Tests.ps1(-386 lines)Validation
LintingHelpers.Tests.ps1Fixes #322