Loading
Salesforce Enforces New Security Requirements in Summer 2026Read More
Scalability
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          ApexGuru Code Duplicates

          ApexGuru Code Duplicates

          Identify exact and near-duplicate Apex code across your org to reduce maintenance burden and free up governor limit headroom.

          What's Analyzed

          • Custom Apex code in your org
          • Exact matches (identical code) and near duplicates (95% or greater similarity)
          • File-level, method-level, and block-level duplicates

          What's Excluded

          • Test classes (files ending in Test.cls or Tests.cls, or with @IsTest annotation)
          • Managed package code
          • Platform-required boilerplate (constructors, Batch Apex interface methods, Schedulable/Queueable execute methods, trigger handler methods)
          • Code blocks under 5 lines or under 200 characters of non-comment code
          • Fuzzy matches (80-95% similarity)

          Limitations

          • Apex classes only (LWC, Aura, VF, Flows not analyzed)
          • Test classes excluded (files ending in Test.cls/Tests.cls or with @IsTest)
          • Managed package code excluded
          • Platform-required boilerplate filtered (constructors, Batch/Schedulable/Queueable interface methods, trigger handlers)
          • Minimum thresholds: 5 lines / 200 characters of non-comment code
          • Only Exact + Near-duplicate (≥95%) reported — Fuzzy (80–95%) excluded
          • Results capped at top 100 findings
          • Multi-org not available this release
          • Read-only, no code modification

          The report organizes duplicate groups by priority (High, Medium, Low Effort) and shows total Apex characters reducible through consolidation.

          1. From Setup, in the Quick Find box, enter Scale Insights, then click ApexGuru Insights.
          2. Select a Report Creation Date.
          3. Click the Code Duplicates tab.

          Each finding displays:

          Element Description
          Group Title Apex class or method name with file count.
          Stats The number of copies and characters reducible.
          Diagnosis What the duplicate is and why it matters.
          Resolution Pattern Suggested consolidation action.
          Match Type Exact (identical) or Near Duplicate (similar with minor differences).
          Duplicate Instances Specific files or methods with character counts.

          Working with the Report

          Filter findings by Scope (File, Method, Block), Effort (Low, Medium, High), or Match Type (Exact or Near Duplicate).

          The Characters Reducible metric shows how many characters you can eliminate by consolidating duplicates. The calculation is the size of one copy times (number of copies − 1). For example, 3 copies of a 5,000-character method is calculated as 5,000 times 2, which equals 10,000 characters reducible (you keep one copy, remove the rest).

          Click Download PDF to export findings with character counts, recommended fixes, and effort classifications.

          Best Practices

          • Start with Low Effort groups for quick wins. Sort by Characters Reducible for maximum impact.
          • Review Exact duplicates first. They are safest to consolidate.
          • Share PDF reports with your development team.
          • Rerun scans after consolidation to track progress.
           
          Loading
          Salesforce Help | Article