Files
poli0981andClaude Fable 5.2 1342979353 ci: Qodana - JetBrains' code analysis from a workflow of its own, and what its first run reported settled (D93) (#373)
* ci: Qodana - a workflow of its own from JetBrains' template, Qodana Community for .NET over FrameLedger.slnx (D93)

The first run: the linter in its Linux container, EnableWindowsTargeting passed
to it, no quality gate yet - what it builds and what it reports decides the rest.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* ci: Qodana's gate is zero problems, and the inspections this project argues with are off in .editorconfig, each with its reason (D93)

Pushed before the fixes on purpose: the run this starts has the settings and
none of the fixes, so it shows the gate failing on what is left.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

* fix: what Qodana's first run reported, settled - about 400 fixes in 181 files, none changing behaviour; the documents (D93)

Redundant qualifiers, casts, using directives, nullable suppressions and unsafe
modifiers removed from the report's own positions; var for built-in types and
one-line block bodies brought to .editorconfig's style by dotnet format; every
XAML item template names its DataType and a binding that reached its page through
DataContext.ViewModel names the page's type; two unread fields, two overwritten
initialisers and an unused parameter removed; SpokenTextAutomationPeer no longer
assumes the base peer's name is a string.

docs/13_CI_CD.md §Qodana, CLAUDE.md, the wiki's workflow table, HANDOFF's
decisions index (D93) and the changelog entry.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-10 16:13:04 +00:00

76 lines
3.7 KiB
C#

// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using FluentAssertions;
using FrameLedger.Infrastructure.Detection;
namespace FrameLedger.Infrastructure.Tests.Detection;
/// <summary>
/// Where a game's install begins, given its executable.
/// </summary>
/// <remarks>
/// Every case here is a real layout measured on 2026-08-03, not an invented one.
/// The Unreal case is the one that mattered: the executable sits three levels
/// below everything that identifies the game, so the first version of the probe
/// reported Lies of P as shipping no DLSS and — far worse — the anti-cheat
/// pre-scan would have looked for `EasyAntiCheat/` in a folder that holds the
/// shipping binary and nothing else.
/// </remarks>
public sealed class InstallRootTests
{
[Theory]
// Unreal: exe three levels below the install root.
[InlineData(@"D:\SteamLibrary\steamapps\common\Lies of P\LiesofP\Binaries\Win64\LOP-Win64-Shipping.exe",
@"D:\SteamLibrary\steamapps\common\Lies of P")]
// Unity: exe already at the root.
[InlineData(@"D:\SteamLibrary\steamapps\common\Deadly Heart Gambit\DeadlyHeartGambit.exe",
@"D:\SteamLibrary\steamapps\common\Deadly Heart Gambit")]
// Whole-segment, case-insensitive.
[InlineData(@"C:\Games\STEAMAPPS\Common\Title\Bin\game.exe", @"C:\Games\STEAMAPPS\Common\Title")]
[InlineData(@"C:\Program Files\Epic Games\SomeTitle\Sub\game.exe", @"C:\Program Files\Epic Games\SomeTitle")]
[InlineData(@"D:\GOG Galaxy\Games\SomeTitle\bin\game.exe", @"D:\GOG Galaxy\Games\SomeTitle")]
public void RecognisedLayoutsResolveToTheInstallRoot(string exe, string expected) =>
InstallRoot.Resolve(exe).Should().Be(expected);
[Theory]
// Alan Wake 2 as actually installed: no store boundary anywhere in the path.
[InlineData(@"D:\another\epic\AlanWake2\AlanWake2.exe", @"D:\another\epic\AlanWake2")]
// A trailing `steamapps` is not a boundary — a boundary needs a child.
[InlineData(@"D:\backup\steamapps\stray.exe", @"D:\backup\steamapps")]
public void AnUnrecognisedLayoutKeepsTheExeDirectory(string exe, string expected) =>
// Walking up blindly would be worse than staying put: one level above
// D:\another\epic\AlanWake2 is a folder of unrelated games, and refusing
// this title because a sibling ships anti-cheat is a false refusal with
// no appeal.
InstallRoot.Resolve(exe).Should().Be(expected);
[Fact]
public void BothExecutablesOfAnUnrealTitleResolveToTheSameRoot()
{
// Unreal titles conventionally ship TWO executables: a shim at the
// install root and the real shipping binary nested under
// <Project>\Binaries\Win64\. Lies of P has LOP.exe and
// LOP-Win64-Shipping.exe; measured 2026-08-03.
//
// Which one a user adds to their watchlist must not change what we
// detect, or what the anti-cheat pre-scan looks at. Before this
// resolution existed the two answered differently — the root shim gave
// "everything undetermined", the nested binary gave "fsr only" — and
// neither was right.
const string root = @"D:\SteamLibrary\steamapps\common\Lies of P";
string viaShim = InstallRoot.Resolve(Path.Combine(root, "LOP.exe"));
string viaShipping = InstallRoot.Resolve(
Path.Combine(root, @"LiesofP\Binaries\Win64\LOP-Win64-Shipping.exe"));
viaShim.Should().Be(root);
viaShipping.Should().Be(root);
viaShim.Should().Be(viaShipping, "the entry point must not change the answer");
}
[Fact]
public void ItRejectsAnEmptyPath() =>
((Action)(() => InstallRoot.Resolve(" "))).Should().Throw<ArgumentException>();
}