Skip to content

[code-simplifier] refactor: remove redundant hasDotnet guard from hasCsproj #63

@github-actions

Description

@github-actions

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 redundant hasDotnet && guard from hasCsproj definition

Improvement Made

Removed redundant condition:

-  const hasCsproj = hasDotnet && files.some((f) => f.endsWith(".csproj"));
+  const hasCsproj = files.some((f) => f.endsWith(".csproj"));

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.

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.

Generated by Code Simplifier ·

  • expires on Mar 17, 2026, 12:43 PM UTC

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 SettingsActionsGeneral 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions