chore(tools): clean up ConfigFilesGenerator inspection warnings#156
Conversation
Resolves Rider inspection findings in `tools/ConfigFilesGenerator/Program.cs`: - merge duplicated `if (X) return current;` branches in `ResolveMsBuildProperty` (visited.Add + properties.TryGetValue) into a single `||`-guarded check - drop the always-true ternary at the tail of `GetRootFolderPath`; the `while (!path.IsEmpty)` loop only exits when `IsEmpty` is true, so the false-branch was dead - collapse `ContainsKey` + indexer + redundant `continue` in `LoadMsBuildProperties` into `properties.TryAdd(name, value)` - drop the redundant `System.Text.` qualifier on `Encoding.UTF8` (`using System.Text;` is already in scope) Behavior preserved; this is purely a quality-of-life cleanup so the file stays inspection-clean as Version.props churns. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📜 Recent review details⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🧰 Additional context used📓 Path-based instructions (4)tools/**/*.{cs,csproj}📄 CodeRabbit inference engine (tools/CLAUDE.md)
Files:
**/*.{cs,csx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.cs📄 CodeRabbit inference engine (Custom checks)
Files:
tools/**⚙️ CodeRabbit configuration file
Files:
🔇 Additional comments (1)
📝 WalkthroughWalkthroughThe 🚥 Pre-merge checks | ✅ 7 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (7 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
|
@coderabbitai autofix |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Autofix skipped. No unresolved CodeRabbit review comments with fix instructions found. |
There was a problem hiding this comment.
Pull request overview
This PR performs a small, behavior-preserving cleanup to eliminate Rider inspection warnings in tools/ConfigFilesGenerator/Program.cs, keeping the ConfigFilesGenerator tool’s logic unchanged while simplifying a few code paths.
Changes:
- Simplifies
ResolveMsBuildPropertyby combining two early-return guards into a single||condition. - Removes dead code in
GetRootFolderPathby replacing an always-true conditional return with a direct throw at loop exit. - Replaces a
ContainsKey+ indexer assignment pattern withDictionary.TryAddinLoadMsBuildProperties, and removes redundant control flow. - Drops a redundant
System.Text.qualifier now thatusing System.Text;is in scope.
Summary
Surgical cleanup of Rider inspection findings in
tools/ConfigFilesGenerator/Program.cs. Net diff: +4 / −11, no behavior change.if (X) return current;branches inResolveMsBuildProperty(visited.Add+properties.TryGetValue) into a single||-guarded check — fixes the RiderDuplicated 'if' brancheserror.GetRootFolderPath. The surroundingwhile (!path.IsEmpty)loop only exits whenIsEmptyis true, so the false-branch was dead.ContainsKey+ indexer + redundant trailingcontinueinLoadMsBuildPropertiesintoproperties.TryAdd(name, value)— addresses both the Dictionary lookup → TryAdd and redundant control-flow jump suggestions.System.Text.qualifier onEncoding.UTF8(using System.Text;is already in scope).The wrapper-induced indent warning the user saw ("expected indent 7 spaces") cleared up implicitly: a local uncommitted refactor had wrapped the top-level statements in
internal class Program { ... }, re-indenting every line. That was reverted before applying these edits, so the file remains a top-level-statements program as committed onmain.Rider's analysis on the resulting file: zero errors.
Test plan
global.jsonpins 10.0.300 withlatestFeature).dotnet run --project tools/ConfigFilesGeneratorregeneratessrc/Config/Analyzer.*.editorconfigbyte-identically.tools/ConfigFilesGenerator/Program.csreports no findings on the seven previously-flagged categories.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmithwith what you need.Summary by CodeRabbit