Availability
✅
❌
From
January 25
The duplicate check functionality helps identify duplicate metadata components across your Salesforce project. This analysis is crucial for maintaining clean code organization and preventing conflicts in your deployment process.
Duplicate checking scans your project's metadata components and identifies:
Components that exist in multiple packages
Components in aliasified packages
Components in unclaimed directories (not associated with a package)
The duplicate checker:
Scans all specified directories for metadata components
Creates a unique identifier for each component based on type and name
Identifies components that appear in multiple locations
Provides detailed reporting with context about each duplicate
Duplicate checking can be configured through several flags in the project:analyze command:
--show-aliasfy-notes
Show information about aliasified packages
true
--fail-on-unclaimed
Fail when duplicates are in unclaimed packages
false
The duplicate check provides three types of findings:
Direct Duplicates: Same component in multiple packages
Aliasified Components: Components in aliasified packages (typically expected)
Unclaimed Components: Components in directories (such as unpacakged or src/temp) not associated with packages
The analysis uses several indicators to help you understand the results:
❌ Indicates a problematic duplicate that needs attention
⚠️ Indicates a duplicate that might be intentional (e.g., in aliasified packages)
(aliasified) Marks components in aliasified packages
(unclaimed) Marks components in unclaimed directories
Regular Scanning: Run duplicate checks regularly during development
Clean Package Structure: Keep each component in its appropriate package
Proper Package Configuration: Ensure all directories are properly claimed in sfdx-project.json
Documented Exceptions: Document cases where duplication is intentional
Some components may need to exist in multiple packages. In these cases:
Use aliasified packages when appropriate
Document the reason for duplication
Consider creating a shared package for common components
If you find components in unclaimed directories:
Add the directory to sfdx-project.json
Assign it to an appropriate package
Re-run the analysis to verify the fix
Duplicates in aliasified packages are often intentional:
Used for environment-specific configurations
Different versions of components for different contexts
Not considered errors by default
Integration is limited only to GitHub at the monent, The command needs GITHUB_APP_PRIVATE_KEY and GITHUB_APP_ID to be set in an env variable for the results to be reported as a GitHub check
When integrating duplicate checking in your CI/CD pipeline:
Configure Failure Conditions:
Generate Reports:
Review Results:
Use generated reports for tracking
Address critical duplicates
Document accepted duplicates
False Positives
Verify package configurations in sfdx-project.json
Check if components should be in aliasified packages
Ensure directories are properly claimed
Missing Components
Verify scan scope (package, domain, or path)
Check file permissions
Validate metadata format