Skip to content

Treat Meziantou.Framework.Assertions.Assert as non-culture sensitive#1202

Merged
meziantou merged 1 commit into
mainfrom
meziantou-meziantou-framework-assert-non-culture
Jun 26, 2026
Merged

Treat Meziantou.Framework.Assertions.Assert as non-culture sensitive#1202
meziantou merged 1 commit into
mainfrom
meziantou-meziantou-framework-assert-non-culture

Conversation

@meziantou

Copy link
Copy Markdown
Owner

Motivation

UseStringComparisonAnalyzer (MA0001/MA0002) already treats Xunit.Assert methods as non-culture sensitive -- meaning when a StringComparison overload exists it reports MA0001 ("use an overload with StringComparison") rather than MA0002 ("avoid culture-sensitive method"). This PR extends the same treatment to Meziantou.Framework.Assertions.Assert.

Changes

  • UseStringComparisonAnalyzer.cs: Added a _meziantouFrameworkAssertSymbol field and a check for it in IsNonCultureSensitiveMethod, mirroring the existing Xunit.Assert handling.
  • UseStringComparisonAnalyzerNonCultureSensitiveTests.cs: Added a test verifying MA0001 is reported (not MA0002) for Meziantou.Framework.Assertions.Assert methods that have a StringComparison overload. The type is defined inline in the test source, following the same pattern used for Newtonsoft.Json.Linq.JObject tests.

…in UseStringComparisonAnalyzer

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@meziantou meziantou merged commit 0807c1e into main Jun 26, 2026
13 checks passed
@meziantou meziantou deleted the meziantou-meziantou-framework-assert-non-culture branch June 26, 2026 17:10
This was referenced Jun 26, 2026
This was referenced Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant