fix: Add StringComparison to all string operations and promote CA1307/CA1310 to warning (#34, #8)#84
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses analyzer enforcement for explicit string comparison across the LSP server and applies small code quality cleanups from prior review feedback.
Changes:
- Adds explicit
StringComparison.Ordinalto string operations and promotes CA1307/CA1310 to warnings. - Moves
BufferManagerinto theSdkLspServernamespace and reduces selected handler classes frompublictointernal. - Cleans up unused using/config entries and updates exception filters in
SdkIndex.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
.editorconfig |
Promotes CA1307/CA1310 severity and removes non-standard guidelines setting. |
Server/BufferManager.cs |
Adds namespace and changes BufferManager to internal. |
Server/SdkIndex.cs |
Adds ordinal comparison and fatal-exception filtering. |
Server/Store/DynamicData/DynamicValuesCacheEntry.cs |
Removes unused using. |
Server/Handlers/HoverHandler/HoverHandler.cs |
Adds explicit string comparisons and makes handler internal. |
Server/Handlers/HoverHandler/SdkDynamicOperationsDiscovery.cs |
Adds explicit string comparisons. |
Server/Handlers/CompletionHandler/CompletionHandler.cs |
Adds explicit string comparisons and makes handler internal. |
Server/Handlers/CodeLensHandler.cs |
Makes handler internal. |
Server/Handlers/CodeActionHandler/DynamicSchemaCodeActionHandler.cs |
Adds explicit string comparison and makes handler internal. |
Server/Handlers/CodeActionHandler/GenerateDynamicSchemaCommandHandler.cs |
Makes command handler internal. |
137cea0 to
ee3db31
Compare
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.
Summary
Fixes #34 (CA1307/CA1310 StringComparison violations) and #8 (small code quality fixes).
CA1307/CA1310 — StringComparison (38 violations fixed)
Added explicit
StringComparison.Ordinalto all.Contains(),.StartsWith(),.EndsWith(),.IndexOf(), and.Replace()calls across the server codebase. Promoted CA1307/CA1310 severity fromsuggestiontowarningin.editorconfigso future violations are caught at build time (TreatWarningsAsErrorsis enabled).Issue #8 — Code quality fixes
namespace SdkLspServer;and changed class tointernal(waspublicin global namespace). Updated 5 consuming handler classes tointernalto match.using System.Collections.Concurrent;.guidelines = 120key.catch (Exception e)blocks tocatch (Exception ex) when (!ex.IsFatal())matching the pattern used elsewhere in the file.Verification
dotnet build— zero warnings (all 38 CA1307/CA1310 violations resolved)dotnet test— 233 passed, 15 skipped, 0 failed (matches baseline)