🔍 Duplicate Code Detected: Syncpack declarativeTasks definitions
Analysis of commit 96b0702
Assignee: @copilot
Summary
fluidBuild.config.cjs defines two declarative tasks (syncpack lint-semver-ranges and syncpack list-mismatches) with near-identical inputGlobs/outputGlobs/gitignore blocks. This is a copy-paste pattern where only the task key differs, and it risks the two tasks drifting over time.
Duplication Details
Pattern: identical declarative task configuration objects
- Severity: Medium
- Occurrences: 2
- Locations:
fluidBuild.config.cjs (lines 230-243)
fluidBuild.config.cjs (lines 244-257)
- Code Sample:
"syncpack lint-semver-ranges": {
inputGlobs: [
"syncpack.config.cjs",
"package.json",
...releaseGroupPackageJsonGlobs,
],
outputGlobs: [
"package.json",
...releaseGroupPackageJsonGlobs,
],
gitignore: ["input", "output"],
},
"syncpack list-mismatches": {
inputGlobs: [
"syncpack.config.cjs",
"package.json",
...releaseGroupPackageJsonGlobs,
],
outputGlobs: [
"package.json",
...releaseGroupPackageJsonGlobs,
],
gitignore: ["input", "output"],
},
Impact Analysis
- Maintainability: Updates to the glob set (e.g., adding/removing inputs) must be made twice.
- Bug Risk: One task can be updated while the other is accidentally left behind, creating inconsistent incremental build behavior.
- Code Bloat: ~28 lines of duplicated configuration.
Refactoring Recommendations
-
Extract a shared task object
- Define a constant like
const syncpackDeclarativeTask = { inputGlobs: [...], outputGlobs: [...], gitignore: [...] }.
- Reuse it for both keys:
"syncpack lint-semver-ranges": syncpackDeclarativeTask
"syncpack list-mismatches": syncpackDeclarativeTask
- Estimated effort: ~0.25h
- Benefits: eliminates drift risk and reduces repeated edits.
-
(Optional) Use a small factory helper
- If future variants diverge slightly, use
makeSyncpackTask({ /* overrides */ }) with shallow overrides.
Implementation Checklist
Analysis Metadata
- Analyzed Files: 5 (
*.cjs, *.mjs at repo root; excluding workflows/tests)
- Detection Method: Serena semantic + pattern analysis
- Commit: 96b0702
- Analysis Date: 2026-03-04T07:58:25.089Z
AI generated by Duplicate Code Detector
To add this workflow in your repository, run gh aw add github/gh-aw/.github/workflows/duplicate-code-detector.md@94662b1dee8ce96c876ba9f33b3ab8be32de82a4. See usage guide.
🔍 Duplicate Code Detected: Syncpack declarativeTasks definitions
Analysis of commit 96b0702
Assignee:
@copilotSummary
fluidBuild.config.cjsdefines two declarative tasks (syncpack lint-semver-rangesandsyncpack list-mismatches) with near-identicalinputGlobs/outputGlobs/gitignoreblocks. This is a copy-paste pattern where only the task key differs, and it risks the two tasks drifting over time.Duplication Details
Pattern: identical declarative task configuration objects
fluidBuild.config.cjs(lines 230-243)fluidBuild.config.cjs(lines 244-257)Impact Analysis
Refactoring Recommendations
Extract a shared task object
const syncpackDeclarativeTask = { inputGlobs: [...], outputGlobs: [...], gitignore: [...] }."syncpack lint-semver-ranges": syncpackDeclarativeTask"syncpack list-mismatches": syncpackDeclarativeTask(Optional) Use a small factory helper
makeSyncpackTask({ /* overrides */ })with shallow overrides.Implementation Checklist
fluidBuild.config.cjsfluid-buildincremental behavior unchanged for these tasksAnalysis Metadata
*.cjs,*.mjsat repo root; excluding workflows/tests)