Skip to content

Fix errors/warnings for pre-existing code smells after reintroducing editorconfig et al - #393

Merged
ChrisonSimtian merged 4 commits into
mainfrom
chore/fix-csharp-style-warnings
Jun 22, 2026
Merged

Fix errors/warnings for pre-existing code smells after reintroducing editorconfig et al#393
ChrisonSimtian merged 4 commits into
mainfrom
chore/fix-csharp-style-warnings

Conversation

@ChrisonSimtian

@ChrisonSimtian ChrisonSimtian commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Fixes pre-existing C# warnings / code smells surfaced after reintroducing .editorconfig (#388).

Scope narrowed per @dennisdoomen's review — the two larger, opinion-dependent changes were split out so this PR stays focused and reviewable:

What remains here

Remove unused method parameters and usings across utilities and CLI
ControlFlow, SchemaUtility, CodeGenerator, ProcessTasks, GitHubActionsAttribute, and the CLI navigation/setup/update commands all had method signatures declaring parameters that were never read. Removed the dead parameters and one unused using import. A stale splash-screen comment is also corrected.

Introduce SingleFileSerializerBase and clean up the persistence serializer
The generic arity suffix on the base class name was noise (there is only one concrete base), so it is renamed to SingleFileSerializerBase. The await using FileStream pattern is replaced with synchronous using to fix a netstandard2.0 compile break (FileStream is not IAsyncDisposable there — CS8417). Also fixed: a namespace mismatch on ISerializerModelExtension, two doc-comment typos in ISolutionSerializer, and redundant lambda parameter names in XmlFolder.

Make PropertyInfo argument optional for tool-option formatters
Formatter methods were always invoked with two arguments (value, PropertyInfo), forcing every formatter to declare the PropertyInfo parameter even when unused. Removing it in CorFlagsSettings (as part of the unused-parameter cleanup above) caused a parameter-count mismatch at runtime. The invoker now matches arguments to the formatter's declared arity, making the PropertyInfo parameter genuinely optional without breaking existing two-parameter formatters.

Verification

Full dotnet build fallout.slnx succeeds (0 errors).

@ChrisonSimtian
ChrisonSimtian requested a review from a team as a code owner June 17, 2026 09:05
@ChrisonSimtian ChrisonSimtian added enhancement New feature or request target/vCurrent Targets the current version labels Jun 17, 2026
Comment thread build/Build.CI.GitHubActions.cs Outdated
@ChrisonSimtian ChrisonSimtian changed the title Refactor MSBuild settings and tasks for consistency and clarity Fix errors/warnings for pre-existing code smells after reintroducing editorconfig et al Jun 18, 2026
ChrisonSimtian added a commit that referenced this pull request Jun 18, 2026
Aligns the MSBuild settings type with the project's PascalCase-acronym
convention (MsBuild, not MSBuild), matching the surrounding API surface.
Also drops an unused PropertyInfo parameter from the FormatPlatform formatter.

Split out of #393 so the rename can be reviewed on its own.

BREAKING: MsBuildSettings is public API and this rename ships no transition
shim, so it is a hard break. It targets experimental and is batched to the
yearly major cut per the channel model (CLAUDE.md rule #1). CHANGELOG updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ChrisonSimtian added a commit that referenced this pull request Jun 18, 2026
Aligns the MSBuild settings type with the project's PascalCase-acronym
convention (MsBuild, not MSBuild), matching the surrounding API surface.

Split out of #393 so the rename can be reviewed on its own.

BREAKING: MsBuildSettings is public API and this rename ships no transition
shim, so it is a hard break. It targets experimental and is batched to the
yearly major cut per the channel model (CLAUDE.md rule #1). CHANGELOG updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dennisdoomen
dennisdoomen force-pushed the chore/fix-csharp-style-warnings branch 3 times, most recently from f6b86ed to a15bf8f Compare June 20, 2026 07:15
@ChrisonSimtian
ChrisonSimtian force-pushed the chore/fix-csharp-style-warnings branch from a15bf8f to bc09229 Compare June 20, 2026 07:24
dennisdoomen
dennisdoomen previously approved these changes Jun 20, 2026

@dennisdoomen dennisdoomen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A suggestion and a verification

Comment thread src/Persistence/Fallout.Persistence.Solution/Serializer/ISolutionSerializer.cs Outdated
Comment thread src/Fallout.Tooling/ToolOptions.Arguments.cs Outdated
dennisdoomen and others added 4 commits June 22, 2026 19:32
Surfaced by re-enabling the editorconfig. Across the build utilities,
CLI commands, and tool infrastructure, method signatures declared
parameters that were never read by the implementation. Each call site
passed values that went unused, and removing them makes the intent of
each method clear.

Areas touched: ControlFlow suppression helpers (includeStackTrace),
SchemaUtility enumeration schema builder (SchemaContext), CLI
navigation and setup/update commands (redundant path and project-name
arguments), GitHubActionsAttribute step builder (GitHubActionsImage),
CodeGenerator runtime information applicator (specificationFile,
sourceFileProvider, namespaceProvider), ProcessTasks invocation logger
(hasEnvironmentVariables). One unused `using System.IO` import and a
stale comment in the splash screen are also cleaned up.
…lizer

The generic arity suffix on the base class name was noise — there is only
one concrete base, so the backtick-1 form added no information. Renaming
to SingleFileSerializerBase makes the type easier to reference and matches
the naming of the interface it implements.

The file-stream handling switches from `await using` to synchronous
`using`. `FileStream` does not implement `IAsyncDisposable` on
`netstandard2.0`, so the async disposal form failed to compile there
(CS8417). Synchronous disposal of a local read/write stream is correct
on all target frameworks.

Also fixed: a namespace mismatch on ISerializerModelExtension, two
doc-comment typos in ISolutionSerializer, and redundant lambda
parameter names in XmlFolder.
Formatter methods were always invoked with two arguments (value,
PropertyInfo), requiring every formatter to declare a PropertyInfo
parameter even when it didn't use it. Removing that unused parameter
then caused a parameter-count mismatch at runtime, surfacing as test
failures once the CorFlagsSettings formatter was cleaned up.

The invoker now matches arguments to the formatter's declared arity:
single-parameter formatters receive [value] only; two-parameter
formatters still receive [value, PropertyInfo]. Existing formatters are
unaffected; formatters that don't need reflection context can now omit
the PropertyInfo parameter.
…-arity nitpick

Reverts the inadvertent namespace move of the public ISolutionSerializer
interfaces (ISolutionSerializer, ISolutionSerializer<TSettings>,
ISolutionSingleFileSerializer<TSettings>) from Fallout.Persistence.Solution
to .Serializer. The move was an IDE-applied "namespace matches folder" tidy
that slipped into this otherwise non-breaking style-cleanup PR. It is a
breaking change to public API (per @dennisdoomen's review) and also diverges
from the upstream vs-solutionpersistence layout, which deliberately keeps the
primary interface in the root namespace while concrete serializers live under
.Serializer. Restoring the original namespace also drops the now-unneeded
using in ISerializerModelExtension.cs (.Model is a child namespace and sees
the parent's types without an explicit using).

Also tighten the formatter-arity check to `== 1` (a formatter always takes at
least the value argument, so a length of 0 is not a valid shape).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ChrisonSimtian
ChrisonSimtian force-pushed the chore/fix-csharp-style-warnings branch from 014c79d to 76c552a Compare June 22, 2026 07:32
ChrisonSimtian added a commit that referenced this pull request Jun 22, 2026
…d/ folder

Makes accessibility explicit on shipped/tested surface — no behavioural change:
- Component interfaces (IFalloutBuild, ICreateGitHubRelease, IHasTwitterCredentials,
  ISignPackages, IToolOptionsWithFramework): drop the redundant `public` from
  interface members (implicitly public; matches the for_non_interface_members rule).
- Consumer/sample builds under tests/ and DefaultInterfaceExecutionTest: explicit
  internal/private.

The dogfood build/ folder is deliberately exempted rather than encapsulated: a
[build/**.cs] editorconfig section relaxes dotnet_style_require_accessibility_modifiers
there, so build scripts stay terse (convenience over ceremony, per @dennisdoomen's
"never bothered with visibility in builds" note). The explicit modifiers this PR
originally added under build/ are dropped to match.

Split out of #393.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ChrisonSimtian
ChrisonSimtian merged commit e5894dd into main Jun 22, 2026
1 of 2 checks passed
@ChrisonSimtian
ChrisonSimtian deleted the chore/fix-csharp-style-warnings branch June 22, 2026 08:06
ChrisonSimtian added a commit that referenced this pull request Jun 22, 2026
…d/ folder

Makes accessibility explicit on shipped/tested surface — no behavioural change:
- Component interfaces (IFalloutBuild, ICreateGitHubRelease, IHasTwitterCredentials,
  ISignPackages, IToolOptionsWithFramework): drop the redundant `public` from
  interface members (implicitly public; matches the for_non_interface_members rule).
- Consumer/sample builds under tests/ and DefaultInterfaceExecutionTest: explicit
  internal/private.

The dogfood build/ folder is deliberately exempted rather than encapsulated: a
[build/**.cs] editorconfig section relaxes dotnet_style_require_accessibility_modifiers
there, so build scripts stay terse (convenience over ceremony, per @dennisdoomen's
"never bothered with visibility in builds" note). The explicit modifiers this PR
originally added under build/ are dropped to match.

Split out of #393.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ChrisonSimtian added a commit that referenced this pull request Jun 22, 2026
…d/ folder

Makes accessibility explicit on shipped/tested surface — no behavioural change:
- Component interfaces (IFalloutBuild, ICreateGitHubRelease, IHasTwitterCredentials,
  ISignPackages, IToolOptionsWithFramework): drop the redundant `public` from
  interface members (implicitly public; matches the for_non_interface_members rule).
- Consumer/sample builds under tests/ and DefaultInterfaceExecutionTest: explicit
  internal/private.

The dogfood build/ folder is deliberately exempted rather than encapsulated: a
[build/**.cs] editorconfig section relaxes dotnet_style_require_accessibility_modifiers
there, so build scripts stay terse (convenience over ceremony, per @dennisdoomen's
"never bothered with visibility in builds" note). The explicit modifiers this PR
originally added under build/ are dropped to match.

Split out of #393.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dennisdoomen dennisdoomen removed the enhancement New feature or request label Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working target/vCurrent Targets the current version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants