Skip to content

Conversation

@cnaples79
Copy link

@cnaples79 cnaples79 commented Feb 11, 2026

Summary

  • Removes duplicate Get-ChangedMarkdownFileGroup function from frontmatter validator
  • Replaces with shared Get-ChangedFilesFromGit helper from LintingHelpers.psm1
  • Removes obsolete test code for deleted function
  • Updates remaining tests to mock the new shared function

Rationale

Issue #322 identified duplicated git diff logic. This refactoring eliminates 491 lines of duplicate code by reusing the shared linting helper.

Changes

  • Source: Removed 104-line duplicate function, replaced with shared helper call
  • Tests: Removed 386 lines of obsolete test code for deleted function
  • Tests: Updated integration test mocks to use Get-ChangedFilesFromGit

Files changed:

  • scripts/linting/Validate-MarkdownFrontmatter.ps1 (-106 lines)
  • scripts/tests/linting/Validate-MarkdownFrontmatter.Tests.ps1 (-386 lines)

Validation

  • All CI checks passing
  • PowerShell tests pass
  • Shared function already has test coverage in LintingHelpers.Tests.ps1

Fixes #322

- 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
@cnaples79 cnaples79 requested a review from a team as a code owner February 11, 2026 00:44
@codecov-commenter
Copy link

codecov-commenter commented Feb 11, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 76.50%. Comparing base (8133b36) to head (db265a2).

Files with missing lines Patch % Lines
scripts/linting/Validate-MarkdownFrontmatter.ps1 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            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     
Flag Coverage Δ
pester 76.50% <0.00%> (+0.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
scripts/linting/Validate-MarkdownFrontmatter.ps1 70.05% <0.00%> (+4.28%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@katriendg katriendg left a comment

Choose a reason for hiding this comment

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

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.

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.

refactor: Remove duplicate git diff logic in Validate-MarkdownFrontmatter.ps1

4 participants