Skip to content

fix: resolve analyzer findings surfaced by the RatScanner gate - #2

Merged
DysektAI merged 1 commit into
masterfrom
feat/analyzer-fixes
Aug 7, 2026
Merged

fix: resolve analyzer findings surfaced by the RatScanner gate#2
DysektAI merged 1 commit into
masterfrom
feat/analyzer-fixes

Conversation

@DysektAI

@DysektAI DysektAI commented Aug 7, 2026

Copy link
Copy Markdown
Member

User description

Summary

Hand-reviewed fixes for the curated Roslyn analyzer gate (AnalysisLevel 10.0-recommended + IDE0005/0051/0052, EnforceCodeStyleInBuild) that RatScanner applies solution-wide via its root Directory.Build.props + .editorconfig.

Changes

Rule Fix
CA2201 State-machine invariant throws ExceptionInvalidOperationException (Icon, Inspection, Inventory, MultiInspection)
CA2211 Mutable public static fields (Config.LogDebug, Path.Debug, Path.LogFile) → properties; settable behavior preserved (RatScannerMain assigns LogFile)
CA1305 Locale-stable config-hash formatting — cache keys must not vary by machine locale (Config.Processing.GetHash, Config.Processing.Inventory.GetHash, IconManager hash, Extensions.SHA256Hash)
CA1310 Ordinal prefix comparison for icon keys (IconManager.GetItem)
CA1816 GC.SuppressFinalize only in IDisposable.Dispose; DisposeStrict documented as intentionally excluded (idempotent via _disposed)
IDE0051 Removed dead private MultiInspection.PathConfig property
IDE0005 Unused usings (Inspection, ProcessingTimings, Vector2)
CA1824 NeutralResourcesLanguage("en") for embedded English resources (new Properties/AssemblyInfo.cs)

Verification

Built as part of RatScanner's solution: Debug and Release both 0 warnings / 0 errors with the curated set elevated to errors; 317/317 tests pass.

Review in cubic


CodeAnt-AI Description

Stabilize analyzer behavior and configuration-based cache results

What Changed

  • Cache and icon hashes now produce the same results regardless of the computer's regional settings.
  • Invalid processing states now report a specific failure, and icon matching uses exact path comparisons.
  • Resource cleanup now suppresses finalization during normal disposal while preserving strict cleanup error reporting.
  • Configuration paths and debug logging remain changeable through supported properties.

Impact

✅ Consistent cache results across locales
✅ Clearer processing failures
✅ Reliable resource cleanup

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Hand-reviewed fixes for the curated Roslyn gate (AnalysisLevel
10.0-recommended + IDE0005/0051/0052) applied solution-wide by the parent
repo:

- CA2201: state-machine invariant throws -> InvalidOperationException.
- CA2211: mutable public static fields (Config.LogDebug, Path.Debug,
  Path.LogFile) -> properties; settable behavior preserved.
- CA1305: locale-stable config-hash formatting (cache keys must not vary
  by machine locale).
- CA1310: ordinal prefix comparison for icon keys.
- CA1816: GC.SuppressFinalize only in IDisposable.Dispose; DisposeStrict
  documented as intentionally excluded.
- IDE0051: removed dead private MultiInspection.PathConfig property.
- IDE0005: unused usings (Inspection, ProcessingTimings, Vector2).
- CA1824: NeutralResourcesLanguage("en") for the embedded English
  resources (new Properties/AssemblyInfo.cs).
@codeant-ai

This comment was marked as resolved.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Configuration and content hashes now remain consistent across different regional settings.
    • Improved handling of icon, inspection, and processing errors with more specific failure reporting.
    • Static icon matching is now more reliable and consistent.
  • Refactor

    • Improved resource handling and cleanup behavior during engine shutdown.
    • Configuration settings now support safer runtime updates without changing their defaults.
  • Chores

    • Added English resource metadata and removed unused internal code.

Walkthrough

The changes convert selected configuration fields to properties, make configuration and icon hashing culture-independent, use specific exceptions for invalid processing states, adjust disposal finalization handling, add English resource metadata, and remove unused declarations.

Changes

Runtime consistency updates

Layer / File(s) Summary
Deterministic configuration hashing
RatEye/Config/Config.cs, RatEye/Config/Path.cs, RatEye/Config/Processing.cs, RatEye/Config/Processing/Inventory.cs, RatEye/Extensions.cs
Configuration fields now use get/set properties. Numeric and SHA-256 formatting now uses invariant culture.
Icon hashing and path matching
RatEye/IconManager.cs
Icon content hashes use invariant formatting. Static-icon path matching uses ordinal comparison.
Processing error contracts and cleanup
RatEye/Processing/Icon.cs, RatEye/Processing/Inspection.cs, RatEye/Processing/Inventory.cs, RatEye/Processing/MultiInspection.cs
Invalid processing states and disabled static-icon matching now throw InvalidOperationException. An unused property was removed.
Lifecycle and assembly maintenance
RatEye/RatEyeEngine.cs, RatEye/Properties/AssemblyInfo.cs, RatEye/ProcessingTimings.cs, RatEye/Vector2.cs
Disposal methods now control finalization suppression directly. English resource metadata was added. Unused imports were removed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • tarkovtracker-org/RatEye#1: The changes overlap in configuration, hashing, icon processing, exception handling, and RatEyeEngine disposal code.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the primary change: resolving analyzer findings from the RatScanner gate.
Description check ✅ Passed The description directly explains the analyzer fixes, affected areas, and verification results.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/analyzer-fixes

Comment @coderabbitai help to get the list of available commands.

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Aug 7, 2026
@codeant-ai

This comment was marked as resolved.

@gitar-bot

This comment was marked as resolved.

@kilo-code-bot

This comment was marked as resolved.

@DysektAI
DysektAI merged commit d46a04e into master Aug 7, 2026
14 of 15 checks passed
@DysektAI
DysektAI deleted the feat/analyzer-fixes branch August 7, 2026 19:04
@codeant-ai

codeant-ai Bot commented Aug 7, 2026

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to commit 426ff69
CategorySuggestion                                                                                                                                    SeverityGenerated at (UTC)
Api mismatch
Changing a public field into a property breaks binary compatibility for existing consumers

Replacing the public static field with an auto-property changes the public metadata
contract. Consumers compiled against the previous field will fail with
MissingFieldException when they access Config.LogDebug, so preserve the field or
provide a compatibility strategy before changing this public API.

RatEye/Config/Config.cs [13]

Why it matters? 🤔
  • ❌ Existing compiled RatEye consumers can fail at runtime.
  • ⚠️ Current source consumers require recompilation after package replacement.
  • ⚠️ Package version remains 4.0.1 in RatEye.csproj:8.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** RatEye/Config/Config.cs
**Line:** 13:13
**Comment:**
	*Api Mismatch: Replacing the public static field with an auto-property changes the public metadata contract. Consumers compiled against the previous field will fail with `MissingFieldException` when they access `Config.LogDebug`, so preserve the field or provide a compatibility strategy before changing this public API.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
Major2026-08-07 19:04
Changing public path fields into properties breaks binary compatibility for existing consumers

Replacing the public static Debug and LogFile fields with properties changes their
public metadata contract. Existing binaries compiled against those fields will fail
with MissingFieldException when accessing either path, which is a breaking library
API change; retain field compatibility or introduce a versioned API transition.

RatEye/Config/Path.cs [83-88]

Why it matters? 🤔
  • ❌ Existing compiled logging consumers can fail at runtime.
  • ❌ Debug image and log-file workflows become unavailable.
  • ⚠️ Package version remains 4.0.1 in RatEye.csproj:8.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** RatEye/Config/Path.cs
**Line:** 83:88
**Comment:**
	*Api Mismatch: Replacing the public static `Debug` and `LogFile` fields with properties changes their public metadata contract. Existing binaries compiled against those fields will fail with `MissingFieldException` when accessing either path, which is a breaking library API change; retain field compatibility or introduce a versioned API transition.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
Major2026-08-07 19:04

@DysektAI DysektAI self-assigned this Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant