microsoft / microsoft/FluidFramework
Duplicate Code: Repeated workspace/releaseGroup config blocks in _buildProject.config.cjs
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.9k
- Forks
- 586
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 146
Description
🔍 Duplicate Code Detected: Workspace/ReleaseGroup Config Blocks
Analysis of commit 92bb9570be8d1ff42628f2e025467a8462857e29
Assignee: @copilot
Summary
_buildProject.config.cjs contains many near-identical workspace/releaseGroup object blocks (directory + releaseGroups + include/rootPackageName/defaultInterdependencyRange + optional adoPipelineUrl). This is >10 lines duplicated across 10+ occurrences and increases the risk of inconsistent future edits.
Duplication Details
Pattern: Repeated “single release group workspace” object shape
-
Severity: Medium
-
Occurrences: 10+ similar blocks
-
Locations (examples):
_buildProject.config.cjs(lines 35-96)_buildProject.config.cjs(lines 98-205)
-
Code Sample (repeated structure):
"(workspace-name)": {
directory: "(path)",
releaseGroups: {
"(release-group-name)": {
include: [/* ... */],
rootPackageName: "(root)",
defaultInterdependencyRange: "workspace:~",
// (optional) adoPipelineUrl: "(redacted)"
},
},
},
Concrete repeated instances:
client/build-tools/server/gitrest/historianblocks in_buildProject.config.cjs(lines 35-96).- Multiple independent package workspaces like
@fluidframework/build-common,@fluidframework/common-utils,@fluidframework/eslint-config-fluid, etc. (lines 98-203).
Impact Analysis
- Maintainability: Changes to common fields (e.g.,
defaultInterdependencyRange) must be replicated everywhere. - Bug Risk: Easy to miss one workspace when updating required fields or adding a new standard property.
- Code Bloat: Large config file dominated by repetitive boilerplate rather than the data that varies.
Refactoring Recommendations
-
Extract helper to build common workspace config blocks
- Add a small factory like
makeSingleReleaseGroupWorkspace({ directory, groupName, include, rootPackageName, adoPipelineUrl? })inside_buildProject.config.cjs. - Benefits: centralizes defaults like
defaultInterdependencyRange: "workspace:~"and standard object shape.
- Add a small factory like
-
Use a data table + map to generate workspaces
- Define an array of definitions and
Object.fromEntries()to buildworkspaces. - Benefits: reduces copy/paste and makes adding/removing workspaces less error-prone.
- Define an array of definitions and
Implementation Checklist
- Review duplication findings
- Decide whether to refactor now or accept as config repetition
- Implement helper/table-based generation
- Validate build-tools consumers still read the same effective config
Analysis Metadata
- Analyzed Files: 5 (
*.cjs/*.mjsin sparse checkout) - Detection Method: Serena semantic + targeted pattern search
- Commit: 92bb9570be8d1ff42628f2e025467a8462857e29
- Analysis Date: 2026-03-15T07:59:22.572Z
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in _buildProject.config.cjs, reviewing the repeated workspace and releaseGroup blocks at the listed line ranges and the proposed helper or data-table approaches. Compare the generated result with the current effective configuration and validate that build-tools consumers still read it unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100