Centralize file path validation for issue providers#1268
Merged
pascalberger merged 4 commits intodevelopfrom Oct 22, 2025
Merged
Centralize file path validation for issue providers#1268pascalberger merged 4 commits intodevelopfrom
pascalberger merged 4 commits intodevelopfrom
Conversation
Copilot
AI
changed the title
[WIP] Centralize file path validation for issue providers
Centralize file path validation for issue providers
Sep 24, 2025
3ac81ec to
3a993e8
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR consolidates duplicate file path validation logic from three issue providers (MsBuild, TAP, and SARIF) into a single static method on BaseIssueProvider, improving maintainability and ensuring consistent validation behavior across all providers.
Key Changes:
- Added centralized
BaseIssueProvider.ValidateFilePathstatic method with automatic path type detection and validation - Updated all three providers to delegate to the centralized method instead of maintaining separate implementations
- Added comprehensive test coverage for the new validation method
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Cake.Issues/BaseIssueProvider.cs | Adds new static ValidateFilePath method with automatic path detection and validation logic |
| src/Cake.Issues.Tests/BaseIssueProviderTests.cs | Adds comprehensive test suite covering all validation scenarios including null checks, absolute/relative paths, and edge cases |
| src/Cake.Issues.Tap/BaseTapLogFileFormat.cs | Replaces local implementation with delegation to centralized method |
| src/Cake.Issues.Sarif/SarifIssuesProvider.cs | Removes manual path type detection logic and delegates to centralized method |
| src/Cake.Issues.MsBuild/BaseMsBuildLogFileFormat.cs | Replaces local implementation with delegation to centralized method |
Co-authored-by: pascalberger <2190718+pascalberger@users.noreply.github.com>
Co-authored-by: pascalberger <2190718+pascalberger@users.noreply.github.com>
3a993e8 to
b241268
Compare
b241268 to
acd3512
Compare
pascalberger
approved these changes
Oct 22, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR centralizes the file path validation logic that was previously duplicated across multiple issue providers (MsBuild, TAP, and SARIF) into a single, reusable method on the
BaseIssueProviderclass.Problem
The
ValidateFilePathmethod existed in three different implementations with similar but slightly different logic:BaseMsBuildLogFileFormat.ValidateFilePath- validated absolute paths onlyBaseTapLogFileFormat.ValidateFilePath- handled both relative and absolute paths with auto-detectionSarifIssuesProvider.ValidateFilePath- took an explicitisAbsolutePathparameterThis duplication made the codebase harder to maintain and could lead to inconsistent behavior across providers.
Solution
Added a centralized
BaseIssueProvider.ValidateFilePathstatic method that:(bool Valid, string FilePath)All existing provider implementations now delegate to this centralized method:
Benefits
Testing
Fixes #975.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.