Files
poli0981andClaude Opus 5.5 6d10b3092e fix: what SonarCloud found that was real - Explorer by full path and quoted, the action pinned, two string reads bounded, module renamed, three C# smells (beta.24 PR-2) (#317)
- App: one Services/Explorer helper starts %WINDIR%\explorer.exe by full path and
  always quotes the path (S4036; three of five call sites passed it bare). Tests.
- Workflows: ilammy/msvc-dev-cmd pinned to its v1.13.0 commit (S7637).
- Native: FlGuardRulesFilePath returns wcsnlen(out, cap); the NVAPI bridge
  measures the driver's branch name with strnlen over its buffer (S5813);
  `module` renamed in the hook inventory and dllmain (S1669, rename only, no
  code change); fl-probe-hookprofile drops compound assignment on a volatile
  (S6191, deprecated in C++20).
- PipeServer.RunAsync loops while not cancelled and ends cancelled (S2190);
  ProcessLauncher's unused static Start overload is removed (S3427); a launch's
  own session passes CancellationToken.None with its reason (S8949).
- 13_CI_CD §SonarCloud: the 17 accepted S5813 sites with why each string is
  terminated; S3869 accepted (no SafeHandle overload from CsWin32 here).
- Dependabot #314 (VS Threading Analyzers 18.12.1, Meziantou 3.0.307): the
  first-start view model's answer task (VSTHRD003) and one test fake's
  synchronous wait (VSTHRD002) are suppressed with their reasons; the whole
  solution builds with both the current and the bumped analyzers.

Gate: ./build.ps1 check ALL GATES PASSED (312 s); 32/32 native tests.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 10:26:32 +00:00

49 lines
2.0 KiB
C#

// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.IO;
using FluentAssertions;
using FrameLedger.App.Services;
namespace FrameLedger.App.Tests;
/// <summary>
/// Explorer is started by its full path and handed a quoted path (beta.24 PR-2, SonarCloud <c>csharpsquid:S4036</c>):
/// never a name the search path resolves, never a path Explorer has to guess the end of. Nothing here starts it.
/// </summary>
public sealed class ExplorerTests
{
[Fact]
public void ItIsTheOneInTheWindowsFolder()
{
string windows = Environment.GetFolderPath(Environment.SpecialFolder.Windows);
Explorer.ExecutablePath.Should().Be(Path.Combine(windows, "explorer.exe"));
Path.IsPathRooted(Explorer.ExecutablePath).Should().BeTrue("a bare name would be resolved through PATH");
}
[Fact]
public void AFolderIsQuotedWhateverItHoldsAndLosesItsTrailingSeparator()
{
Explorer.FolderArguments(@"C:\Users\Ann Lee\AppData\Local\FrameLedger\logs")
.Should().Be("\"C:\\Users\\Ann Lee\\AppData\\Local\\FrameLedger\\logs\"");
Explorer.FolderArguments(@"D:\Games\Dying Light, The Beast\")
.Should().Be("\"D:\\Games\\Dying Light, The Beast\"", "a trailing \\ before the closing quote would escape it");
Explorer.FolderArguments("\"C:\\already quoted\"").Should().Be("\"C:\\already quoted\"", "a quoted path is not quoted twice");
}
[Fact]
public void AFileIsSelectedInItsFolder() =>
Explorer.SelectArguments(@"C:\Users\Ann Lee\Desktop\frameledger-bug.zip")
.Should().Be("/select,\"C:\\Users\\Ann Lee\\Desktop\\frameledger-bug.zip\"");
[Theory]
[InlineData("")]
[InlineData(" ")]
public void NoPathIsRefused(string path)
{
FluentActions.Invoking(() => Explorer.FolderArguments(path)).Should().Throw<ArgumentException>();
FluentActions.Invoking(() => Explorer.SelectArguments(path)).Should().Throw<ArgumentException>();
}
}