Add tests for the .editorconfig options that were never set by a test - #1419
Merged
Merged
Conversation
Ten documented options were not exercised by any test, so a renamed key, a mis-parsed value, or a flipped default would have gone unnoticed until users hit it in their own repositories. Each option now has a test for both directions: the default behavior and the behavior once the option is set to the other value. - MA0003.excluded_methods - MA0011.exclude_tostring_methods - MA0045.enable_db_special_cases - MA0045.enable_sqlite_special_cases - MA0053.class_with_virtual_member_should_be_sealed - MA0075.consider_nullable_types - MA0075.exclude_tostring_methods - MA0076.consider_nullable_types - MA0104.only_consider_public_symbols - MA0139.allow_non_constant_formats MA0045 and MA0053 pair a documented key with another one, so their tests also pin the precedence: MA0045.enable_*_special_cases overrides the MA0042 key, and the documented class_with_virtual_member_should_be_sealed overrides the hidden misspelled class_with_virtual_member_shoud_be_sealed.
Both sides added a test at the same place in NamedParameterAnalyzerTests, around a shared body. Kept both: the two MA0003.excluded_methods tests of this branch and Int32_ExcludedMethodWithEmptyRegex_ShouldReportDiagnostic from main.
This was referenced Sep 6, 2026
Closed
This was referenced Oct 1, 2026
Closed
Open
Open
Bump Meziantou.Analyzer from 3.0.139 to 3.0.291
Analogy-LogViewer/Analogy.LogViewer.NLog.Targets#586
Open
Bump Meziantou.Analyzer from 3.0.139 to 3.0.291
Analogy-LogViewer/Analogy.AspNetCore.LogProvider#565
Open
Open
Open
Open
Open
Open
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.
What
Ten documented
.editorconfigoptions were not set by any test in the test assembly. Each now has a test in both directions: the default behavior, and the behavior once the option is set to the other value.MA0003.excluded_methodsNamedParameterAnalyzerTests.csMA0011.exclude_tostring_methodsUseIFormatProviderAnalyzerTests.csMA0045.enable_sqlite_special_cases,MA0045.enable_db_special_casesDoNotUseBlockingCallInAsyncContextAnalyzerTests.csMA0053.class_with_virtual_member_should_be_sealedClassMustBeSealedAnalyzerTests.csMA0075.exclude_tostring_methods,MA0075.consider_nullable_types,MA0076.consider_nullable_typesDoNotUseImplicitCultureSensitiveToStringAnalyzerTests.csMA0104.only_consider_public_symbolsDotNotUseNameFromBCLAnalyzerTests.csMA0139.allow_non_constant_formatsLoggerParameterTypeAnalyzer_SerilogTests.csTests only — no analyzer or documentation changes.
dotnet run --project src/DocumentationGeneratorexits 0 with no markdown changes.Why
These options are the documented escape hatch when a rule misfires. With no test setting the key, a rename, a mis-parse, or a flipped default fails silently and only surfaces in users' own repositories.
Two cases were sharper than the rest:
MA0053defines a hidden legacy key with a typo (class_with_virtual_member_shoud_be_sealed) alongside the documentedclass_with_virtual_member_should_be_sealed. Both existing tests set only the misspelled legacy key, so the spelling users are told to write indocs/Rules/MA0053.mdhad no coverage at all.MA0045andMA0139each duplicate a key owned by a sibling rule (MA0042andMA0124). Only the sibling's copy was covered.Notes for the reviewer
MA0045.enable_*_special_casesoverrides theMA0042key (in both directions), and the documentedMA0053spelling overrides the hidden misspelled one.MA0045.enable_db_special_casesandMA0045.enable_sqlite_special_casesdefault totrue, so the meaningful direction — turning the DB/SQLite special-casing off — had never been taken by a test.mainwas merged in to resolve a conflict inNamedParameterAnalyzerTests.cs, where both sides added a test at the same place around a shared body. Both are kept: this branch's twoMA0003.excluded_methodstests, andInt32_ExcludedMethodWithEmptyRegex_ShouldReportDiagnosticfrommain.Verification
Full suite after merging
main: 19668 passed, 0 failed, 0 skipped across roslyn4.8 / 4.14 / 5.0 / 5.6 / 5.9.