MA0099: add opt-in configuration options for report location and zero-member filtering#1215
Merged
Merged
Conversation
…-member filtering - Add MA0099.exclude_enum_without_zero_member (bool, default false): when true, skip the diagnostic when the target enum has no named member with value 0 - Add MA0099.report_on (string, default 'all'): when set to 'argument', only report the diagnostic when the zero literal appears as a method/constructor argument (where accidental overload selection is the primary risk) - Add tests for both new options - Update docs/Rules/MA0099.md to document the new configuration options Closes #1210 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This was referenced Jul 4, 2026
Merged
This was referenced Jul 14, 2026
Open
Open
Open
Bump Meziantou.Analyzer from 3.0.103 to 3.0.123
Analogy-LogViewer/Analogy.LogViewer.OpenTelemetry#66
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.
Closes #1210
Changes
Added two opt-in editorconfig options for MA0099 (
DoNotUseZeroToInitializeAnEnumValue):MA0099.exclude_enum_without_zero_member(bool, defaultfalse)When set to
true, the diagnostic is suppressed when the target enum has no named member with value0— i.e., there is no named value the user could use instead.MA0099.report_on(string, defaultall)When set to
argument, the diagnostic is only reported when the zero literal appears as a method or constructor argument. This is the location where accidental overload selection is the primary risk.Both options can be used independently or together. Default behavior is unchanged.