You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hasDotnet is true whenever any file ends with .csproj (that extension is one of hasDotnet's own conditions). Therefore hasDotnet && files.some(f => f.endsWith('.csproj')) is logically equivalent to files.some(f => f.endsWith('.csproj')) — the hasDotnet && guard can never be the deciding factor.
Making hasCsproj a plain predicate (matching the style of adjacent hasFsproj) removes the cognitive overhead of tracking the redundant dependency and makes the variable declarations consistent.
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch simplify/remove-redundant-dotnet-guard-3ba8d414b7fcbdf0.
Code Simplification — 2026-03-16
This PR removes a redundant boolean guard introduced in #60 to improve code clarity while preserving identical behavior.
Files Simplified
packages/core/src/services/analyzer.ts— removed redundanthasDotnet &&guard fromhasCsprojdefinitionImprovement Made
Removed redundant condition:
hasDotnetistruewhenever any file ends with.csproj(that extension is one ofhasDotnet's own conditions). ThereforehasDotnet && files.some(f => f.endsWith('.csproj'))is logically equivalent tofiles.some(f => f.endsWith('.csproj'))— thehasDotnet &&guard can never be the deciding factor.Making
hasCsproja plain predicate (matching the style of adjacenthasFsproj) removes the cognitive overhead of tracking the redundant dependency and makes the variable declarations consistent.Changes Based On
Recent changes from:
Testing
Behavior is identical — the guard was always vacuously true when the inner predicate was true. CI will run the full test suite to confirm.
Note
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch
simplify/remove-redundant-dotnet-guard-3ba8d414b7fcbdf0.Click here to create the pull request
To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests.
Show patch (31 lines)
From 7f3f4e80ddddf5e2d745aafb42a230129abfea3c Mon Sep 17 00:00:00 2001 From: GitHub Copilot <copilot@github.com> Date: Mon, 16 Mar 2026 12:41:42 +0000 Subject: [PATCH] refactor: remove redundant hasDotnet guard from hasCsproj hasDotnet checks f.endsWith('.csproj') as one of its conditions, so hasDotnet && files.some(f => f.endsWith('.csproj')) is equivalent to files.some(f => f.endsWith('.csproj')). Remove the redundant guard. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- packages/core/src/services/analyzer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/services/analyzer.ts b/packages/core/src/services/analyzer.ts index 2b2118e..5e901c0 100644 --- a/packages/core/src/services/analyzer.ts +++ b/packages/core/src/services/analyzer.ts @@ -92,7 +92,7 @@ export async function analyzeRepo(repoPath: string): Promise<RepoAnalysis> { f === "global.json" || f === "Directory.Build.props" ); - const hasCsproj = hasDotnet && files.some((f) => f.endsWith(".csproj")); + const hasCsproj = files.some((f) => f.endsWith(".csproj")); const hasFsproj = files.some((f) => f.endsWith(".fsproj")); const hasPomXml = files.includes("pom.xml"); const hasBuildGradle = files.includes("build.gradle") || files.includes("build.gradle.kts"); -- 2.53.0