[Repo Assist] Warn on unrecognized .editorconfig property values instead of silently ignoring them - #3321
Merged
nojaf merged 2 commits intoMar 30, 2026
Conversation
…y ignoring them Fixes #1236: previously, a property value in .editorconfig that could not be parsed (e.g. a typo like 'truee' for a boolean) was silently ignored and the default was used. This made it very hard to diagnose configuration mistakes. Now, when a key is present in .editorconfig but its value cannot be parsed, a warning is emitted to stderr and the default is used. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…260330-6b7698294b5a4617
nojaf
marked this pull request as ready for review
March 30, 2026 06:51
nojaf
approved these changes
Mar 30, 2026
nojaf
deleted the
repo-assist/improve-editorconfig-warnings-20260330-6b7698294b5a4617
branch
August 19, 2026 06:46
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
Closes #1236.
When a property key is present in
.editorconfigbut its value cannot be parsed (e.g., a typo liketrueefor a boolean, or an unrecognized enum string), Fantomas previously silently fell back to the default value. This made configuration mistakes very hard to diagnose.This PR emits a warning to stderr for such cases while still using the default value, matching the behaviour users would expect from other tools.
Root Cause
In
parseOptionsFromEditorConfig, the active pattern matching fell through to a catch-all| _ -> defaultValuethat covered both the "key not found" case (expected, silent) and the "key found but value unparseable" case (unexpected, should warn). These two were indistinguishable.Fix
Split the wildcard into two explicit arms:
| false, _ -> defaultValue— key not found; silently use default (expected)| true, invalidValue -> eprintfn ... ; defaultValue— key found but value invalid; warn to stderrTrade-offs
stderr, keepingstdoutclean for piped formatting output.Test Status
invalid editorconfig value emits warning to stderr and uses defaultinEditorConfigurationTests.fsEditorConfigurationTestspassFantomas.Core.Testspassdotnet build fantomas.sln -c Release)