* 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>
57 lines
2.1 KiB
C#
57 lines
2.1 KiB
C#
// SPDX-License-Identifier: GPL-3.0-only
|
|
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
|
|
|
|
using System.Reflection;
|
|
using FluentAssertions;
|
|
using FrameLedger.Shared;
|
|
|
|
namespace FrameLedger.Infrastructure.Tests;
|
|
|
|
/// <summary>
|
|
/// D73: the release line is the <c>RELEASE_LINE</c> file, stamped into the assemblies by <c>Directory.Build.props</c> and
|
|
/// read back by <see cref="BuildLine"/>. On <c>main</c> the file says <c>main</c> and on the <c>alpha</c> branch
|
|
/// <c>alpha</c>, so these tests hold on both: what they pin is that the three agree, not which line this is.
|
|
/// </summary>
|
|
public sealed class BuildLineTests
|
|
{
|
|
private static string RepoRoot()
|
|
{
|
|
for (DirectoryInfo? dir = new(AppContext.BaseDirectory); dir is not null; dir = dir.Parent)
|
|
{
|
|
if (File.Exists(Path.Combine(dir.FullName, "FrameLedger.slnx")))
|
|
{
|
|
return dir.FullName;
|
|
}
|
|
}
|
|
|
|
throw new InvalidOperationException("the repository root (FrameLedger.slnx) is not above " + AppContext.BaseDirectory);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("main", false)]
|
|
[InlineData("alpha", true)]
|
|
[InlineData(null, false)]
|
|
[InlineData("", false)]
|
|
[InlineData("Alpha", false)]
|
|
[InlineData("beta", false)]
|
|
public void OnlyTheExactWordAlphaIsTheAlphaLine(string? stamped, bool alpha)
|
|
{
|
|
BuildLine line = BuildLine.Parse(stamped);
|
|
|
|
line.IsAlpha.Should().Be(alpha);
|
|
line.Should().BeSameAs(alpha ? BuildLine.Alpha : BuildLine.Main);
|
|
}
|
|
|
|
[Fact]
|
|
public void TheBuildCarriesTheLineTheRepositoryNames()
|
|
{
|
|
string file = File.ReadAllText(Path.Combine(RepoRoot(), "RELEASE_LINE")).Trim();
|
|
string? stamped = typeof(BuildLine).Assembly.GetCustomAttributes<AssemblyMetadataAttribute>()
|
|
.FirstOrDefault(static a => string.Equals(a.Key, BuildLine.MetadataKey, StringComparison.Ordinal))?.Value;
|
|
|
|
file.Should().BeOneOf("main", "alpha");
|
|
stamped.Should().Be(file, "Directory.Build.props stamps RELEASE_LINE into every assembly");
|
|
BuildLine.Current.Name.Should().Be(file);
|
|
}
|
|
}
|