You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds the opt-in alternative rule SX1412 for projects that require UTF-8 source files without a byte order mark. It complements SA1412, reports files with a different or unknown encoding and files with a UTF-8 BOM, and provides single-document and Fix All code fixes. The analyzer is disabled by default.
Adds SX1412 to the alternative rules catalog, documents its conflict with SA1412, and adds Czech, Russian, and Simplified Chinese rule documentation. New resource strings are translated into Russian and Simplified Chinese; Czech falls back to English because this resource family has no Czech localization.
Validation: SX1412 tests pass in the C# 6 and C# 15 test projects (5 tests each). The analyzer and code-fix projects build with zero warnings. The analyzer checks the source tree's encoding without syntax-node or semantic-model analysis.
This adds a new rule rather than fixing a behavior that could fail on master, so the new-rule tests are not described as reproductions of a master failure.
Provide an alternative to SA1412 for projects that require UTF-8 source files without a byte order mark, with a code fix, translations, and documentation.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
❌ Patch coverage is 92.39766% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.62%. Comparing base (9869738) to head (697efc3). ⚠️ Report is 2 commits behind head on master.
Recognize strict UTF-8 without a BOM, include the new rule in every localized navigation, and link to its local documentation until publication.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This AddDocument overload creates a regular C# document, losing the original SourceCodeKind. Applying the encoding fix to a script document can therefore turn valid constructs such as #r directives into compiler errors. Fix All calls the same transformation. Preserve document.SourceCodeKind on the replacement document.
Use explicit DiagnosticDescriptor construction for status generation
The rule-status generator only recognizes explicit ObjectCreationExpressionSyntax initializers (tools/StyleCop.Analyzers.Status.Generator/SolutionReader.cs:241–253). It skips this target-typed new(...) and returns Unknown instead of DisabledByDefault for SX1412. Use new DiagnosticDescriptor(...) so the existing generator can read the rule's status.
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
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.
Fixes #2100
Adds the opt-in alternative rule SX1412 for projects that require UTF-8 source files without a byte order mark. It complements SA1412, reports files with a different or unknown encoding and files with a UTF-8 BOM, and provides single-document and Fix All code fixes. The analyzer is disabled by default.
Adds SX1412 to the alternative rules catalog, documents its conflict with SA1412, and adds Czech, Russian, and Simplified Chinese rule documentation. New resource strings are translated into Russian and Simplified Chinese; Czech falls back to English because this resource family has no Czech localization.
Validation: SX1412 tests pass in the C# 6 and C# 15 test projects (5 tests each). The analyzer and code-fix projects build with zero warnings. The analyzer checks the source tree's encoding without syntax-node or semantic-model analysis.
This adds a new rule rather than fixing a behavior that could fail on master, so the new-rule tests are not described as reproductions of a master failure.