[Repo Assist] test: add FormatCheck build target for CI formatting validation#2164
Draft
github-actions[bot] wants to merge 2 commits into
Draft
Conversation
Add a 'FormatCheck' FAKE target that runs 'dotnet fantomas --check' over the src/ and build/ directories without modifying any files. This lets CI pipelines (or developers) verify that all F# source files are correctly formatted before running the full build. The existing 'Format' target reformats files in-place and is useful for developers to apply formatting locally. FormatCheck complements it by providing a pure verification step suitable for automated pipelines. Run locally with: dotnet run --project build -- -t FormatCheck To fix failures: dotnet run --project build -- -t Format Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 was created by Repo Assist, an automated AI assistant.
Summary
Adds a
FormatCheckFAKE build target that runsdotnet fantomas --checkover thesrc/andbuild/directories without modifying any files.Motivation (Task 9 — Testing Improvements)
The repository currently has no automated quality gate for code formatting in CI. The existing
Formattarget reformats files in-place (useful locally), but there is no way to verify formatting is correct without also changing files — which is undesirable in a read-only CI step.FormatCheckfills this gap:fantomas --check src build— exits with a non-zero code if any file is incorrectly formattedpr.yml) as a lightweight pre-check before the full builddotnet run --project build -- -t FormatCheckUsage
Adding to CI (future)
Because the CI workflow file is protected, maintainers can add this to
.github/workflows/pr.ymlwith a single line change:This can be added as a separate step before the existing
Run Teststep, or run as its own matrix entry.Test Status
Fantomas format check: ✅ (verified
Program.fsformats cleanly after the change).Build: ✅ — the change only adds a new target definition and a tree edge; existing targets are unaffected.