Skip to content

Conversation

@jpobst
Copy link
Contributor

@jpobst jpobst commented Oct 5, 2021

Context: #6271

Making culture-aware string comparisons when not intended can result in very hard to diagnose bugs. (See #6271)

Like we added in JI (dotnet/java-interop#879), we should use the appropriate Roslyn code analyzers set to Error severity to ensure that we fix current issues and do not introduce any new issues in the future.

One complication with enabling these rules is that the .NET 6+ version of these rules are stricter and require overloads that do not exist in .NET Framework or .NET Standard to fix the violations. Enabling these rules in .editorconfig affects all $(TargetFrameworkMoniker)s; we will instead use Configuration.props to only enable them for non-.NET 6+ builds.

Also tweaks and reuses the existing Roslyn Analyzers logic to exclude external code, as many libraries that are used for testing (like Mono.Debugg[ing|er].Soft) have issues surfaced by these analyzers.

Note that some non-test comparisons on filenames/paths were switch from case-sensitive to case-insensitive compares.

@jpobst jpobst force-pushed the localization-analyzers branch 2 times, most recently from 7377b06 to 45e5fd3 Compare October 5, 2021 23:30
@jpobst jpobst force-pushed the localization-analyzers branch from 45e5fd3 to 853b39c Compare October 5, 2021 23:31
@jpobst jpobst marked this pull request as ready for review October 6, 2021 14:53
@jpobst jpobst removed the request for review from radekdoulik October 6, 2021 14:59
@jpobst
Copy link
Contributor Author

jpobst commented Oct 7, 2021

Update non-test file/path comparisons to use OrdinalIgnoreCase.

@jonpryor jonpryor merged commit ad5f6e8 into main Oct 8, 2021
@jonpryor jonpryor deleted the localization-analyzers branch October 8, 2021 17:18
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants