Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CLAUDE.md
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Expand Down Expand Up @@ -42,6 +42,11 @@ The opt-in lives in `.sonarlint/sonar-local.props` (the analyzer package) and
analyzer package ships disabled). Nothing imports these automatically, so normal builds, the CI
pipeline, and packaging are unaffected.

On current `main` the run is clean apart from five `S2699` warnings (test methods that assert
nothing) in `CodeBlocker.Test`. It found and named `S4144` on `ScopeTests.cs` — two test methods with
identical bodies, one of which did not test what its name claimed — which is the kind of finding the
setup exists for.

**Known gap:** SonarCloud reported one new issue on PR #87 that this configuration does not
reproduce, and sonarcloud.io is not reachable from the agent sandbox to identify it. The rule
behind it is either absent from the analyzer package or shipped disabled and not listed in the
Expand Down
13 changes: 8 additions & 5 deletions CodeBlocker.Test/ScopeTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023-2026 ktsu-dev contributors
// Copyright (c) 2023-2026 ktsu-dev contributors

namespace CodeBlocker.Tests;

Expand Down Expand Up @@ -352,16 +352,19 @@ public void ScopeWithEmptyCustomIndentStringShouldWork()
[TestMethod]
public void ScopeAfterManualDisposeOfCodeBlockerShouldThrowException()
{
// Arrange
// Arrange - open a scope, so there is one still active when the CodeBlocker goes away

CodeBlocker codeBlocker = CodeBlocker.Create();
#pragma warning disable CA2000 // Dispose objects before losing scope - disposing the scope is the act under test, and it throws, so a using block would let the exception escape the assert.
Scope scope = new(codeBlocker);
#pragma warning restore CA2000

// Act - Dispose the CodeBlocker while scope is still active
// Act - Dispose the CodeBlocker while the scope is still active

codeBlocker.Dispose();

// Assert - Creating scope with disposed CodeBlocker should throw
// Assert - Closing the scope writes its brace to the disposed writer

Assert.ThrowsExactly<ObjectDisposedException>(() => new Scope(codeBlocker));
Assert.ThrowsExactly<ObjectDisposedException>(scope.Dispose);
}
}
Loading