Skip to content

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

@WilliamBerryiii

Description

@WilliamBerryiii

Issue Description

Validate-MarkdownFrontmatter.ps1 contains a Get-ChangedMarkdownFileGroup function that duplicates functionality already available in LintingHelpers.psm1 (Get-ChangedFilesFromGit). The script should use the shared module function instead of reimplementing git diff parsing.

Additional Context

Current state:

  • scripts/linting/Validate-MarkdownFrontmatter.ps1 has Get-ChangedMarkdownFileGroup (~40 lines)
  • scripts/linting/Modules/LintingHelpers.psm1 exports Get-ChangedFilesFromGit with similar logic

Recommended approach:

  1. Import LintingHelpers.psm1 at the top of Validate-MarkdownFrontmatter.ps1
  2. Replace Get-ChangedMarkdownFileGroup calls with Get-ChangedFilesFromGit filtered by .md extension
  3. Remove the duplicate function

Testing:

  • Run npm run pester for existing tests
  • Test with npm run lint:frontmatter on changed markdown files
  • Verify -ChangesOnly parameter still works correctly

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions