Public report of truongboongcu-dev/monoka, published 17 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 17 November 2026, 00:42 UTC · Survey ID cd_90337abeddaa4a608fe851fc008bba37
truongboongcu-dev/monoka
Measured 17 November 2026, 00:39 UTC, at code version f3a71c5
First survey, so nothing to compare with yet
CAI scoreWeak
CriticalWeakAdequateStrongExemplary
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A very large codebase: 588,513 lines of product code in 5 projects, tests not counted · Estimated rebuild effort: about 4.7 person-years · Weakest lens: Production Readiness, 17.0
Findings by how serious they are
95 critical3201 serious132 minor
24 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
17 November 2026, 00:39 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
63of 63 dimensions measured by tools.
3420of 3428 findings point to an exact file and line, so you can open each one in the code. The other 8 concern the repository as a whole, such as missing documentation.
63dimensions across 8 lenses, read from 588,513 lines of product code in 5 projects.
truongboongcu-dev/monoka falls short of our standard for production because we found no working pipeline that builds or tests changes to the code and no automated security scanning of the code, its secrets or its dependencies. It scores 29.0 out of 100 and is rated Weak, and three of its 95 critical findings are security problems.
Production Readiness, at 17.0, is the weakest lens and counts most in the score. The best first step is fixing the password or key in the code, worth about 9.0 points. Adding an automated build and test pipeline would lift Production Readiness itself, worth about 4.3 points. Raising Production Readiness to 70 would lift the score to about 38.2.
One password or key in the code and one in the code's history are open to anyone who can read the repository. One weakness in the code could be used by an attacker, and twenty-nine images have no description for people who can't see them. Replacing each exposed password or key, fixing the weaknesses the scanner points to and describing the images would close these risks. The 24 form fields without a label need a label.
The product code is 588,513 lines, about €680,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Production Readiness rose from 17.0 to 70, the lowest score rated Strong, the score would rise from 29.0 to about 38.2.
Code composition: what the lines of code are
Product code 100%Tests 0%
Rebuild cost: about €680,000 · Estimate
Cost to rebuild
€220,000 to €1,100,000, for 3,748 to 11,890 hours of work, about 4.7 person-years for 2 to 9 engineers
Difficulty of the problem
High, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.7 at a score of 29. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Very large: 588,513 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 1 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED.
Raises the score by about 9.0 points · Low effort · REDACTED Scanning
2
Add a CI workflow that builds and runs the test suite on every push/PR.
Raises the score by about 4.3 points · Medium effort · CI/CD gates
3
Run what this repository's stack ships: phpstan or psalm — or `semgrep --config=auto`, which runs on any language — locally for now, since there is no CI pipeline here yet, and as a step of the first workflow you add so a security regression fails the build instead of landing.
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Where the investment is most exposed · Value at risk
This code would cost about €680,000 to build again, about 4.7 person-years of work. Its weakest lens is Production Readiness, at 17.0 (Critical). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
Resolve the 1 Leaked secret finding(s) in REDACTED Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 9.0 points for low effort, because it clears the 1 REDACTED Scanning findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 5.9 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 12% on every change. The history of the code shows how much it changes: about 1,212,390 lines over the last 90 days, which is about 4,916,915 lines a year. At that pace, the extra work comes to an estimated 638.2 to 3829.4 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture — module dependency graph
Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.
Architecture: which parts of the code depend on which
The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.
364 modules, with 473 dependencies between them. 9 loops run through 28 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 324 more are left out to keep it readable.
Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
Automattic.WooCommerce.Admin uses (global), so a change to (global) can break Automattic.WooCommerce.Admin, while a change to Automattic.WooCommerce.Admin can't break (global).
Position
Below the diagonal: Automattic.WooCommerce.Admin uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Admin.API.Reports uses (global), so a change to (global) can break Automattic.WooCommerce.Admin.API.Reports, while a change to Automattic.WooCommerce.Admin.API.Reports can't break (global).
Position
Below the diagonal: Automattic.WooCommerce.Admin.API.Reports uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Api.Infrastructure uses Automattic.WooCommerce.Api.Infrastructure.Schema, so a change to Automattic.WooCommerce.Api.Infrastructure.Schema can break Automattic.WooCommerce.Api.Infrastructure, while a change to Automattic.WooCommerce.Api.Infrastructure can't break Automattic.WooCommerce.Api.Infrastructure.Schema.
Position
Below the diagonal: Automattic.WooCommerce.Api.Infrastructure uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Api.Infrastructure uses Automattic.WooCommerce.Api.Pagination, so a change to Automattic.WooCommerce.Api.Pagination can break Automattic.WooCommerce.Api.Infrastructure, while a change to Automattic.WooCommerce.Api.Infrastructure can't break Automattic.WooCommerce.Api.Pagination.
Position
Below the diagonal: Automattic.WooCommerce.Api.Infrastructure uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Api.Utils.Products uses (global), so a change to (global) can break Automattic.WooCommerce.Api.Utils.Products, while a change to Automattic.WooCommerce.Api.Utils.Products can't break (global).
Position
Below the diagonal: Automattic.WooCommerce.Api.Utils.Products uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Api.Utils.Products uses Automattic.WooCommerce.Api.Pagination, so a change to Automattic.WooCommerce.Api.Pagination can break Automattic.WooCommerce.Api.Utils.Products, while a change to Automattic.WooCommerce.Api.Utils.Products can't break Automattic.WooCommerce.Api.Pagination.
Position
Below the diagonal: Automattic.WooCommerce.Api.Utils.Products uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Blocks.Assets uses Automattic.WooCommerce.Blocks.Domain, so a change to Automattic.WooCommerce.Blocks.Domain can break Automattic.WooCommerce.Blocks.Assets, while a change to Automattic.WooCommerce.Blocks.Assets can't break Automattic.WooCommerce.Blocks.Domain.
Position
Below the diagonal: Automattic.WooCommerce.Blocks.Assets uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Internal uses (global), so a change to (global) can break Automattic.WooCommerce.Internal, while a change to Automattic.WooCommerce.Internal can't break (global).
Position
Below the diagonal: Automattic.WooCommerce.Internal uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Internal.ProductFeed.Feed uses (global), so a change to (global) can break Automattic.WooCommerce.Internal.ProductFeed.Feed, while a change to Automattic.WooCommerce.Internal.ProductFeed.Feed can't break (global).
Position
Below the diagonal: Automattic.WooCommerce.Internal.ProductFeed.Feed uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Internal.StockNotifications.Utilities uses (global), so a change to (global) can break Automattic.WooCommerce.Internal.StockNotifications.Utilities, while a change to Automattic.WooCommerce.Internal.StockNotifications.Utilities can't break (global).
Position
Below the diagonal: Automattic.WooCommerce.Internal.StockNotifications.Utilities uses a module listed above it, which is the healthy direction.
16→27 Automattic.WooCommerce.Internal.StockNotifications.Utilities uses Automattic.WooCommerce.Internal.StockNotificationspart of a loop✕
Connections
1 pair of types, where a type in Automattic.WooCommerce.Internal.StockNotifications.Utilities uses a type in Automattic.WooCommerce.Internal.StockNotifications.
Automattic.WooCommerce.Internal.StockNotifications.Utilities uses Automattic.WooCommerce.Internal.StockNotifications, so a change to Automattic.WooCommerce.Internal.StockNotifications can break Automattic.WooCommerce.Internal.StockNotifications.Utilities, while a change to Automattic.WooCommerce.Internal.StockNotifications.Utilities can't break Automattic.WooCommerce.Internal.StockNotifications.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
Automattic.WooCommerce.StoreApi uses (global), so a change to (global) can break Automattic.WooCommerce.StoreApi, while a change to Automattic.WooCommerce.StoreApi can't break (global).
Position
Below the diagonal: Automattic.WooCommerce.StoreApi uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Files.DTO uses WordPress.AiClient.Common, so a change to WordPress.AiClient.Common can break WordPress.AiClient.Files.DTO, while a change to WordPress.AiClient.Files.DTO can't break WordPress.AiClient.Common.
Position
Below the diagonal: WordPress.AiClient.Files.DTO uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.DTO uses WordPress.AiClient.Common, so a change to WordPress.AiClient.Common can break WordPress.AiClient.Providers.DTO, while a change to WordPress.AiClient.Providers.DTO can't break WordPress.AiClient.Common.
Position
Below the diagonal: WordPress.AiClient.Providers.DTO uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.Http.DTO uses WordPress.AiClient.Common, so a change to WordPress.AiClient.Common can break WordPress.AiClient.Providers.Http.DTO, while a change to WordPress.AiClient.Providers.Http.DTO can't break WordPress.AiClient.Common.
Position
Below the diagonal: WordPress.AiClient.Providers.Http.DTO uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.Http.DTO uses WordPress.AiClientDependencies.Psr.Http.Message, so a change to WordPress.AiClientDependencies.Psr.Http.Message can break WordPress.AiClient.Providers.Http.DTO, while a change to WordPress.AiClient.Providers.Http.DTO can't break WordPress.AiClientDependencies.Psr.Http.Message.
Position
Below the diagonal: WordPress.AiClient.Providers.Http.DTO uses a module listed above it, which is the healthy direction.
20→31 WordPress.AiClient.Providers.Http.DTO uses WordPress.AiClient.Providers.Http.Contractspart of a loop✕
Connections
1 pair of types, where a type in WordPress.AiClient.Providers.Http.DTO uses a type in WordPress.AiClient.Providers.Http.Contracts.
WordPress.AiClient.Providers.Http.DTO uses WordPress.AiClient.Providers.Http.Contracts, so a change to WordPress.AiClient.Providers.Http.Contracts can break WordPress.AiClient.Providers.Http.DTO, while a change to WordPress.AiClient.Providers.Http.DTO can't break WordPress.AiClient.Providers.Http.Contracts.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
WordPress.AiClient.Providers.Models.DTO uses WordPress.AiClient.Common, so a change to WordPress.AiClient.Common can break WordPress.AiClient.Providers.Models.DTO, while a change to WordPress.AiClient.Providers.Models.DTO can't break WordPress.AiClient.Common.
Position
Below the diagonal: WordPress.AiClient.Providers.Models.DTO uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Admin.Features.Fulfillments uses (global), so a change to (global) can break Automattic.WooCommerce.Admin.Features.Fulfillments, while a change to Automattic.WooCommerce.Admin.Features.Fulfillments can't break (global).
Position
Below the diagonal: Automattic.WooCommerce.Admin.Features.Fulfillments uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Admin.Features.Fulfillments uses Automattic.WooCommerce.Internal, so a change to Automattic.WooCommerce.Internal can break Automattic.WooCommerce.Admin.Features.Fulfillments, while a change to Automattic.WooCommerce.Admin.Features.Fulfillments can't break Automattic.WooCommerce.Internal.
Position
Below the diagonal: Automattic.WooCommerce.Admin.Features.Fulfillments uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Blocks.BlockTypes uses (global), so a change to (global) can break Automattic.WooCommerce.Blocks.BlockTypes, while a change to Automattic.WooCommerce.Blocks.BlockTypes can't break (global).
Position
Below the diagonal: Automattic.WooCommerce.Blocks.BlockTypes uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Blocks.BlockTypes uses Automattic.WooCommerce.Blocks.Assets, so a change to Automattic.WooCommerce.Blocks.Assets can break Automattic.WooCommerce.Blocks.BlockTypes, while a change to Automattic.WooCommerce.Blocks.BlockTypes can't break Automattic.WooCommerce.Blocks.Assets.
Position
Below the diagonal: Automattic.WooCommerce.Blocks.BlockTypes uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Blocks.Domain.Services uses (global), so a change to (global) can break Automattic.WooCommerce.Blocks.Domain.Services, while a change to Automattic.WooCommerce.Blocks.Domain.Services can't break (global).
Position
Below the diagonal: Automattic.WooCommerce.Blocks.Domain.Services uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Blocks.Domain.Services uses Automattic.WooCommerce.Blocks.Domain, so a change to Automattic.WooCommerce.Blocks.Domain can break Automattic.WooCommerce.Blocks.Domain.Services, while a change to Automattic.WooCommerce.Blocks.Domain.Services can't break Automattic.WooCommerce.Blocks.Domain.
Position
Below the diagonal: Automattic.WooCommerce.Blocks.Domain.Services uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Blocks.Domain.Services uses Automattic.WooCommerce.Admin, so a change to Automattic.WooCommerce.Admin can break Automattic.WooCommerce.Blocks.Domain.Services, while a change to Automattic.WooCommerce.Blocks.Domain.Services can't break Automattic.WooCommerce.Admin.
Position
Below the diagonal: Automattic.WooCommerce.Blocks.Domain.Services uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Blocks.Domain.Services uses Automattic.WooCommerce.Blocks.Assets, so a change to Automattic.WooCommerce.Blocks.Assets can break Automattic.WooCommerce.Blocks.Domain.Services, while a change to Automattic.WooCommerce.Blocks.Domain.Services can't break Automattic.WooCommerce.Blocks.Assets.
Position
Below the diagonal: Automattic.WooCommerce.Blocks.Domain.Services uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Internal.Admin.Settings uses (global), so a change to (global) can break Automattic.WooCommerce.Internal.Admin.Settings, while a change to Automattic.WooCommerce.Internal.Admin.Settings can't break (global).
Position
Below the diagonal: Automattic.WooCommerce.Internal.Admin.Settings uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Internal.Admin.Settings uses Automattic.WooCommerce.Proxies, so a change to Automattic.WooCommerce.Proxies can break Automattic.WooCommerce.Internal.Admin.Settings, while a change to Automattic.WooCommerce.Internal.Admin.Settings can't break Automattic.WooCommerce.Proxies.
Position
Below the diagonal: Automattic.WooCommerce.Internal.Admin.Settings uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Internal.Admin.Settings uses Automattic.WooCommerce.Internal, so a change to Automattic.WooCommerce.Internal can break Automattic.WooCommerce.Internal.Admin.Settings, while a change to Automattic.WooCommerce.Internal.Admin.Settings can't break Automattic.WooCommerce.Internal.
Position
Below the diagonal: Automattic.WooCommerce.Internal.Admin.Settings uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Internal.Orders uses (global), so a change to (global) can break Automattic.WooCommerce.Internal.Orders, while a change to Automattic.WooCommerce.Internal.Orders can't break (global).
Position
Below the diagonal: Automattic.WooCommerce.Internal.Orders uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Internal.Orders uses Automattic.WooCommerce.Proxies, so a change to Automattic.WooCommerce.Proxies can break Automattic.WooCommerce.Internal.Orders, while a change to Automattic.WooCommerce.Internal.Orders can't break Automattic.WooCommerce.Proxies.
Position
Below the diagonal: Automattic.WooCommerce.Internal.Orders uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Internal.Orders uses Automattic.WooCommerce.Internal, so a change to Automattic.WooCommerce.Internal can break Automattic.WooCommerce.Internal.Orders, while a change to Automattic.WooCommerce.Internal.Orders can't break Automattic.WooCommerce.Internal.
Position
Below the diagonal: Automattic.WooCommerce.Internal.Orders uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Internal.StockNotifications uses (global), so a change to (global) can break Automattic.WooCommerce.Internal.StockNotifications, while a change to Automattic.WooCommerce.Internal.StockNotifications can't break (global).
Position
Below the diagonal: Automattic.WooCommerce.Internal.StockNotifications uses a module listed above it, which is the healthy direction.
1 pair of types, where a type in Automattic.WooCommerce.Internal.StockNotifications uses a type in Automattic.WooCommerce.Internal.StockNotifications.Utilities.
Automattic.WooCommerce.Internal.StockNotifications uses Automattic.WooCommerce.Internal.StockNotifications.Utilities, so a change to Automattic.WooCommerce.Internal.StockNotifications.Utilities can break Automattic.WooCommerce.Internal.StockNotifications, while a change to Automattic.WooCommerce.Internal.StockNotifications can't break Automattic.WooCommerce.Internal.StockNotifications.Utilities.
Position
Below the diagonal: Automattic.WooCommerce.Internal.StockNotifications uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Internal.Utilities uses (global), so a change to (global) can break Automattic.WooCommerce.Internal.Utilities, while a change to Automattic.WooCommerce.Internal.Utilities can't break (global).
Position
Below the diagonal: Automattic.WooCommerce.Internal.Utilities uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Internal.Utilities uses Automattic.WooCommerce.Internal, so a change to Automattic.WooCommerce.Internal can break Automattic.WooCommerce.Internal.Utilities, while a change to Automattic.WooCommerce.Internal.Utilities can't break Automattic.WooCommerce.Internal.
Position
Below the diagonal: Automattic.WooCommerce.Internal.Utilities uses a module listed above it, which is the healthy direction.
28→33 Automattic.WooCommerce.Internal.Utilities uses Automattic.WooCommerce.Internal.DataStores.Orderspart of a loop✕
Connections
2 pairs of types, where a type in Automattic.WooCommerce.Internal.Utilities uses a type in Automattic.WooCommerce.Internal.DataStores.Orders.
Automattic.WooCommerce.Internal.Utilities uses Automattic.WooCommerce.Internal.DataStores.Orders, so a change to Automattic.WooCommerce.Internal.DataStores.Orders can break Automattic.WooCommerce.Internal.Utilities, while a change to Automattic.WooCommerce.Internal.Utilities can't break Automattic.WooCommerce.Internal.DataStores.Orders.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
Automattic.WooCommerce.StoreApi.Schemas.V1 uses (global), so a change to (global) can break Automattic.WooCommerce.StoreApi.Schemas.V1, while a change to Automattic.WooCommerce.StoreApi.Schemas.V1 can't break (global).
Position
Below the diagonal: Automattic.WooCommerce.StoreApi.Schemas.V1 uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.StoreApi.Schemas.V1 uses Automattic.WooCommerce.StoreApi, so a change to Automattic.WooCommerce.StoreApi can break Automattic.WooCommerce.StoreApi.Schemas.V1, while a change to Automattic.WooCommerce.StoreApi.Schemas.V1 can't break Automattic.WooCommerce.StoreApi.
Position
Below the diagonal: Automattic.WooCommerce.StoreApi.Schemas.V1 uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Messages.DTO uses WordPress.AiClient.Common, so a change to WordPress.AiClient.Common can break WordPress.AiClient.Messages.DTO, while a change to WordPress.AiClient.Messages.DTO can't break WordPress.AiClient.Common.
Position
Below the diagonal: WordPress.AiClient.Messages.DTO uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Messages.DTO uses WordPress.AiClient.Files.DTO, so a change to WordPress.AiClient.Files.DTO can break WordPress.AiClient.Messages.DTO, while a change to WordPress.AiClient.Messages.DTO can't break WordPress.AiClient.Files.DTO.
Position
Below the diagonal: WordPress.AiClient.Messages.DTO uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.Http.Contracts uses WordPress.AiClientDependencies.Psr.Http.Message, so a change to WordPress.AiClientDependencies.Psr.Http.Message can break WordPress.AiClient.Providers.Http.Contracts, while a change to WordPress.AiClient.Providers.Http.Contracts can't break WordPress.AiClientDependencies.Psr.Http.Message.
Position
Below the diagonal: WordPress.AiClient.Providers.Http.Contracts uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.Http.Contracts uses WordPress.AiClient.Providers.Http.DTO, so a change to WordPress.AiClient.Providers.Http.DTO can break WordPress.AiClient.Providers.Http.Contracts, while a change to WordPress.AiClient.Providers.Http.Contracts can't break WordPress.AiClient.Providers.Http.DTO.
Position
Below the diagonal: WordPress.AiClient.Providers.Http.Contracts uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.Models.Contracts uses WordPress.AiClient.Providers.DTO, so a change to WordPress.AiClient.Providers.DTO can break WordPress.AiClient.Providers.Models.Contracts, while a change to WordPress.AiClient.Providers.Models.Contracts can't break WordPress.AiClient.Providers.DTO.
Position
Below the diagonal: WordPress.AiClient.Providers.Models.Contracts uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.Models.Contracts uses WordPress.AiClient.Providers.Models.DTO, so a change to WordPress.AiClient.Providers.Models.DTO can break WordPress.AiClient.Providers.Models.Contracts, while a change to WordPress.AiClient.Providers.Models.Contracts can't break WordPress.AiClient.Providers.Models.DTO.
Position
Below the diagonal: WordPress.AiClient.Providers.Models.Contracts uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Internal.DataStores.Orders uses (global), so a change to (global) can break Automattic.WooCommerce.Internal.DataStores.Orders, while a change to Automattic.WooCommerce.Internal.DataStores.Orders can't break (global).
Position
Below the diagonal: Automattic.WooCommerce.Internal.DataStores.Orders uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Internal.DataStores.Orders uses Automattic.WooCommerce.Proxies, so a change to Automattic.WooCommerce.Proxies can break Automattic.WooCommerce.Internal.DataStores.Orders, while a change to Automattic.WooCommerce.Internal.DataStores.Orders can't break Automattic.WooCommerce.Proxies.
Position
Below the diagonal: Automattic.WooCommerce.Internal.DataStores.Orders uses a module listed above it, which is the healthy direction.
Automattic.WooCommerce.Internal.DataStores.Orders uses Automattic.WooCommerce.Internal.Utilities, so a change to Automattic.WooCommerce.Internal.Utilities can break Automattic.WooCommerce.Internal.DataStores.Orders, while a change to Automattic.WooCommerce.Internal.DataStores.Orders can't break Automattic.WooCommerce.Internal.Utilities.
Position
Below the diagonal: Automattic.WooCommerce.Internal.DataStores.Orders uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.Contracts uses WordPress.AiClient.Providers.DTO, so a change to WordPress.AiClient.Providers.DTO can break WordPress.AiClient.Providers.Contracts, while a change to WordPress.AiClient.Providers.Contracts can't break WordPress.AiClient.Providers.DTO.
Position
Below the diagonal: WordPress.AiClient.Providers.Contracts uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.Contracts uses WordPress.AiClient.Providers.Models.DTO, so a change to WordPress.AiClient.Providers.Models.DTO can break WordPress.AiClient.Providers.Contracts, while a change to WordPress.AiClient.Providers.Contracts can't break WordPress.AiClient.Providers.Models.DTO.
Position
Below the diagonal: WordPress.AiClient.Providers.Contracts uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.Contracts uses WordPress.AiClient.Providers.Models.Contracts, so a change to WordPress.AiClient.Providers.Models.Contracts can break WordPress.AiClient.Providers.Contracts, while a change to WordPress.AiClient.Providers.Contracts can't break WordPress.AiClient.Providers.Models.Contracts.
Position
Below the diagonal: WordPress.AiClient.Providers.Contracts uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Results.DTO uses WordPress.AiClient.Common, so a change to WordPress.AiClient.Common can break WordPress.AiClient.Results.DTO, while a change to WordPress.AiClient.Results.DTO can't break WordPress.AiClient.Common.
Position
Below the diagonal: WordPress.AiClient.Results.DTO uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Results.DTO uses WordPress.AiClient.Files.DTO, so a change to WordPress.AiClient.Files.DTO can break WordPress.AiClient.Results.DTO, while a change to WordPress.AiClient.Results.DTO can't break WordPress.AiClient.Files.DTO.
Position
Below the diagonal: WordPress.AiClient.Results.DTO uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Results.DTO uses WordPress.AiClient.Providers.DTO, so a change to WordPress.AiClient.Providers.DTO can break WordPress.AiClient.Results.DTO, while a change to WordPress.AiClient.Results.DTO can't break WordPress.AiClient.Providers.DTO.
Position
Below the diagonal: WordPress.AiClient.Results.DTO uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Results.DTO uses WordPress.AiClient.Providers.Models.DTO, so a change to WordPress.AiClient.Providers.Models.DTO can break WordPress.AiClient.Results.DTO, while a change to WordPress.AiClient.Results.DTO can't break WordPress.AiClient.Providers.Models.DTO.
Position
Below the diagonal: WordPress.AiClient.Results.DTO uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Results.DTO uses WordPress.AiClient.Messages.DTO, so a change to WordPress.AiClient.Messages.DTO can break WordPress.AiClient.Results.DTO, while a change to WordPress.AiClient.Results.DTO can't break WordPress.AiClient.Messages.DTO.
Position
Below the diagonal: WordPress.AiClient.Results.DTO uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Operations.DTO uses WordPress.AiClient.Common, so a change to WordPress.AiClient.Common can break WordPress.AiClient.Operations.DTO, while a change to WordPress.AiClient.Operations.DTO can't break WordPress.AiClient.Common.
Position
Below the diagonal: WordPress.AiClient.Operations.DTO uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Operations.DTO uses WordPress.AiClient.Results.DTO, so a change to WordPress.AiClient.Results.DTO can break WordPress.AiClient.Operations.DTO, while a change to WordPress.AiClient.Operations.DTO can't break WordPress.AiClient.Results.DTO.
Position
Below the diagonal: WordPress.AiClient.Operations.DTO uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers uses WordPress.AiClient.Providers.DTO, so a change to WordPress.AiClient.Providers.DTO can break WordPress.AiClient.Providers, while a change to WordPress.AiClient.Providers can't break WordPress.AiClient.Providers.DTO.
Position
Below the diagonal: WordPress.AiClient.Providers uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers uses WordPress.AiClient.Providers.Models.DTO, so a change to WordPress.AiClient.Providers.Models.DTO can break WordPress.AiClient.Providers, while a change to WordPress.AiClient.Providers can't break WordPress.AiClient.Providers.Models.DTO.
Position
Below the diagonal: WordPress.AiClient.Providers uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers uses WordPress.AiClient.Providers.Http.Contracts, so a change to WordPress.AiClient.Providers.Http.Contracts can break WordPress.AiClient.Providers, while a change to WordPress.AiClient.Providers can't break WordPress.AiClient.Providers.Http.Contracts.
Position
Below the diagonal: WordPress.AiClient.Providers uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers uses WordPress.AiClient.Providers.Models.Contracts, so a change to WordPress.AiClient.Providers.Models.Contracts can break WordPress.AiClient.Providers, while a change to WordPress.AiClient.Providers can't break WordPress.AiClient.Providers.Models.Contracts.
Position
Below the diagonal: WordPress.AiClient.Providers uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers uses WordPress.AiClient.Providers.Contracts, so a change to WordPress.AiClient.Providers.Contracts can break WordPress.AiClient.Providers, while a change to WordPress.AiClient.Providers can't break WordPress.AiClient.Providers.Contracts.
Position
Below the diagonal: WordPress.AiClient.Providers uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Builders uses WordPress.AiClient.Files.DTO, so a change to WordPress.AiClient.Files.DTO can break WordPress.AiClient.Builders, while a change to WordPress.AiClient.Builders can't break WordPress.AiClient.Files.DTO.
Position
Below the diagonal: WordPress.AiClient.Builders uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Builders uses WordPress.AiClient.Providers.Http.DTO, so a change to WordPress.AiClient.Providers.Http.DTO can break WordPress.AiClient.Builders, while a change to WordPress.AiClient.Builders can't break WordPress.AiClient.Providers.Http.DTO.
Position
Below the diagonal: WordPress.AiClient.Builders uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Builders uses WordPress.AiClient.Providers.Models.DTO, so a change to WordPress.AiClient.Providers.Models.DTO can break WordPress.AiClient.Builders, while a change to WordPress.AiClient.Builders can't break WordPress.AiClient.Providers.Models.DTO.
Position
Below the diagonal: WordPress.AiClient.Builders uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Builders uses WordPress.AiClient.Messages.DTO, so a change to WordPress.AiClient.Messages.DTO can break WordPress.AiClient.Builders, while a change to WordPress.AiClient.Builders can't break WordPress.AiClient.Messages.DTO.
Position
Below the diagonal: WordPress.AiClient.Builders uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Builders uses WordPress.AiClient.Providers.Models.Contracts, so a change to WordPress.AiClient.Providers.Models.Contracts can break WordPress.AiClient.Builders, while a change to WordPress.AiClient.Builders can't break WordPress.AiClient.Providers.Models.Contracts.
Position
Below the diagonal: WordPress.AiClient.Builders uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Builders uses WordPress.AiClient.Results.DTO, so a change to WordPress.AiClient.Results.DTO can break WordPress.AiClient.Builders, while a change to WordPress.AiClient.Builders can't break WordPress.AiClient.Results.DTO.
Position
Below the diagonal: WordPress.AiClient.Builders uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Builders uses WordPress.AiClient.Providers, so a change to WordPress.AiClient.Providers can break WordPress.AiClient.Builders, while a change to WordPress.AiClient.Builders can't break WordPress.AiClient.Providers.
Position
Below the diagonal: WordPress.AiClient.Builders uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.ApiBasedImplementation uses WordPress.AiClient.Providers.DTO, so a change to WordPress.AiClient.Providers.DTO can break WordPress.AiClient.Providers.ApiBasedImplementation, while a change to WordPress.AiClient.Providers.ApiBasedImplementation can't break WordPress.AiClient.Providers.DTO.
Position
Below the diagonal: WordPress.AiClient.Providers.ApiBasedImplementation uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.ApiBasedImplementation uses WordPress.AiClient.Providers.Http.DTO, so a change to WordPress.AiClient.Providers.Http.DTO can break WordPress.AiClient.Providers.ApiBasedImplementation, while a change to WordPress.AiClient.Providers.ApiBasedImplementation can't break WordPress.AiClient.Providers.Http.DTO.
Position
Below the diagonal: WordPress.AiClient.Providers.ApiBasedImplementation uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.ApiBasedImplementation uses WordPress.AiClient.Providers.Models.DTO, so a change to WordPress.AiClient.Providers.Models.DTO can break WordPress.AiClient.Providers.ApiBasedImplementation, while a change to WordPress.AiClient.Providers.ApiBasedImplementation can't break WordPress.AiClient.Providers.Models.DTO.
Position
Below the diagonal: WordPress.AiClient.Providers.ApiBasedImplementation uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.ApiBasedImplementation uses WordPress.AiClient.Providers.Http.Contracts, so a change to WordPress.AiClient.Providers.Http.Contracts can break WordPress.AiClient.Providers.ApiBasedImplementation, while a change to WordPress.AiClient.Providers.ApiBasedImplementation can't break WordPress.AiClient.Providers.Http.Contracts.
Position
Below the diagonal: WordPress.AiClient.Providers.ApiBasedImplementation uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.ApiBasedImplementation uses WordPress.AiClient.Providers.Models.Contracts, so a change to WordPress.AiClient.Providers.Models.Contracts can break WordPress.AiClient.Providers.ApiBasedImplementation, while a change to WordPress.AiClient.Providers.ApiBasedImplementation can't break WordPress.AiClient.Providers.Models.Contracts.
Position
Below the diagonal: WordPress.AiClient.Providers.ApiBasedImplementation uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.ApiBasedImplementation uses WordPress.AiClient.Providers.Contracts, so a change to WordPress.AiClient.Providers.Contracts can break WordPress.AiClient.Providers.ApiBasedImplementation, while a change to WordPress.AiClient.Providers.ApiBasedImplementation can't break WordPress.AiClient.Providers.Contracts.
Position
Below the diagonal: WordPress.AiClient.Providers.ApiBasedImplementation uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.ApiBasedImplementation uses WordPress.AiClient.Providers, so a change to WordPress.AiClient.Providers can break WordPress.AiClient.Providers.ApiBasedImplementation, while a change to WordPress.AiClient.Providers.ApiBasedImplementation can't break WordPress.AiClient.Providers.
Position
Below the diagonal: WordPress.AiClient.Providers.ApiBasedImplementation uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.OpenAiCompatibleImplementation uses WordPress.AiClient.Providers.Http.DTO, so a change to WordPress.AiClient.Providers.Http.DTO can break WordPress.AiClient.Providers.OpenAiCompatibleImplementation, while a change to WordPress.AiClient.Providers.OpenAiCompatibleImplementation can't break WordPress.AiClient.Providers.Http.DTO.
Position
Below the diagonal: WordPress.AiClient.Providers.OpenAiCompatibleImplementation uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.OpenAiCompatibleImplementation uses WordPress.AiClient.Messages.DTO, so a change to WordPress.AiClient.Messages.DTO can break WordPress.AiClient.Providers.OpenAiCompatibleImplementation, while a change to WordPress.AiClient.Providers.OpenAiCompatibleImplementation can't break WordPress.AiClient.Messages.DTO.
Position
Below the diagonal: WordPress.AiClient.Providers.OpenAiCompatibleImplementation uses a module listed above it, which is the healthy direction.
WordPress.AiClient.Providers.OpenAiCompatibleImplementation uses WordPress.AiClient.Results.DTO, so a change to WordPress.AiClient.Results.DTO can break WordPress.AiClient.Providers.OpenAiCompatibleImplementation, while a change to WordPress.AiClient.Providers.OpenAiCompatibleImplementation can't break WordPress.AiClient.Results.DTO.
Position
Below the diagonal: WordPress.AiClient.Providers.OpenAiCompatibleImplementation uses a module listed above it, which is the healthy direction.
3 pairs of types, where a type in WordPress.AiClient.Providers.OpenAiCompatibleImplementation uses a type in WordPress.AiClient.Providers.ApiBasedImplementation.
WordPress.AiClient.Providers.OpenAiCompatibleImplementation uses WordPress.AiClient.Providers.ApiBasedImplementation, so a change to WordPress.AiClient.Providers.ApiBasedImplementation can break WordPress.AiClient.Providers.OpenAiCompatibleImplementation, while a change to WordPress.AiClient.Providers.OpenAiCompatibleImplementation can't break WordPress.AiClient.Providers.ApiBasedImplementation.
Position
Below the diagonal: WordPress.AiClient.Providers.OpenAiCompatibleImplementation uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 18.3 · Critical · gated by D2, R1, R10, R3, X5 ·
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A05:2025 — Injection
136
High / Critical
A01:2025 — Broken Access Control
11
Medium
A07:2025 — Authentication Failures
3
High / Critical
Roadmap
Top priorities: Resolve the 1 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED; Add a CI workflow that builds and runs the test suite on every push/PR; Run what this repository's stack ships: phpstan or psalm — or `semgrep --config=auto`, which runs on any language — locally for now, since there is no CI pipeline here yet, and as a step of the first workflow you add so a security regression fails the build instead of landing.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 1 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED.
Run what this repository's stack ships: phpstan or psalm — or `semgrep --config=auto`, which runs on any language — locally for now, since there is no CI pipeline here yet, and as a step of the first workflow you add so a security regression fails the build instead of landing.
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
Per-file score 0–10 — a quality signature. Of 763 files carrying findings, judged against the Production bar: 0% slop · 65% mixed · 35% near-clean.
File
Score
Band
Worst signal
REDACTED
2.7
Slop
Static Analysis (SAST): High: REDACTED
REDACTED
4.0
Mixed
Static Analysis (SAST): Medium: REDACTED
REDACTED
4.0
Mixed
Static Analysis (SAST): Medium: REDACTED
REDACTED
4.0
Mixed
Data Compliance (PII/GDPR): Medium: REDACTED
REDACTED
4.0
Mixed
Static Analysis (SAST): Medium: REDACTED
REDACTED
4.0
Mixed
Static Analysis (SAST): Medium: REDACTED
REDACTED
4.0
Mixed
Static Analysis (SAST): Medium: REDACTED
REDACTED
4.0
Mixed
Static Analysis (SAST): Medium: REDACTED
REDACTED
4.0
Mixed
Static Analysis (SAST): Medium: REDACTED
REDACTED
4.0
Mixed
Static Analysis (SAST): Medium: REDACTED
REDACTED
4.0
Mixed
Static Analysis (SAST): Medium: REDACTED
REDACTED
4.0
Mixed
Static Analysis (SAST): Medium: REDACTED
REDACTED
4.2
Mixed
Secrets (history): REDACTED: REDACTED
REDACTED
4.9
Mixed
Static Analysis (SAST): Medium: REDACTED
REDACTED
4.9
Mixed
Static Analysis (SAST): Medium: REDACTED
REDACTED
4.9
Mixed
Static Analysis (SAST): Medium: REDACTED
REDACTED
5.0
Mixed
Static Analysis (SAST): Medium: REDACTED
REDACTED
5.0
Mixed
Static Analysis (SAST): Medium: REDACTED
REDACTED
5.1
Mixed
Static Analysis (SAST): Medium: REDACTED
REDACTED
5.1
Mixed
Static Analysis (SAST): Medium: REDACTED
How the grades work
Every finding carries one of four grades. Three say how serious it is. The fourth says this
survey could not settle it — and it is a grade, not a gap.
Critical — 95
A definite problem that already costs you something and drags the score down: a
missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here
tends to cause failures elsewhere.
Serious — 3201
Likely wrong, but not failing yet. It degrades
the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to
carry for two years either.
Minor — 132
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 24
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 63 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.7, the weighted average across measured dimensions.
Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.
What we checked — 63 dimensions across the health lenses
Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.
How to trust any code-health report — three questions
Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 3420 of 3428 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: test source is present (.php) but the built-in coverage collector has no runner for this repository's ecosystem — so this suite was never executed by it. Not scored — this is a gap in the analyzer's language coverage, not a defect in the repo.
D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.php) but the built-in reliability runner does not support this repository's ecosystem, so flakiness couldn't be assessed. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
D12 Dependency Hygiene — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. No dependency manifest this pass reads for hygiene (a Python pyproject.toml/requirements.txt (pip/uv/Poetry), a Swift Package.swift/Package.resolved, a Cargo manifest, a Go module (go.mod/go.sum), a Gradle version catalogue, a Maven POM, an sbt build (build.sbt), composer.json, package.json, a Dart pubspec.yaml, an Elixir mix.exs/mix.lock (Hex), a rebar.config / erlang.mk DEPS (Hex), a Ruby Gemfile/Gemfile.lock or .gemspec (Bundler/RubyGems)) was found in this repository, so no package was assessed. Zero packages read is NOT a clean dependency tree, so this is NOT SCORED — a gap in the analyzer, not a verdict about this repository. This row is about dependency HYGIENE — outdated, deprecated or unmaintained direct dependencies; known CVEs in the same dependency graph are a separate question, reported under D30 wherever the manifest is OSV-readable.
D14 License Compliance — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Not scored — no dependency manifest this pass reads for licence data (a Python pyproject.toml/requirements.txt (pip/uv/Poetry), a Swift Package.swift/Package.resolved, a Cargo manifest, a Go module (go.mod/go.sum), a Gradle version catalogue, a Maven POM, an sbt build (build.sbt), composer.json, package.json, a Dart pubspec.yaml, an Elixir mix.exs/mix.lock (Hex), a rebar.config / erlang.mk DEPS (Hex), a Ruby Gemfile/Gemfile.lock or .gemspec (Bundler/RubyGems)) was found in this repository, so it declares no third-party dependency closure to grade. A gap in the analyzer, NOT a finding that this repository's licences are compliant: a manifest in an ecosystem outside that list, or third-party code copied into the tree, is not read — so this dimension asserts nothing about this repository's licensing in either direction.
D15 Churn × Complexity Hotspots — measured, with a gap in what it reached — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Git history depth insufficient — this repository has 7 commit(s), too few for a reliable trend signal. The clone is complete, so there is no deeper history to fetch: the signal returns as the project accumulates history.
D16 Bus Factor — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Single-contributor repository — bus factor is not applicable (1 contributor(s) across 7 commit(s) sampled, automation and bot accounts excluded). Concentration needs a team to concentrate: with one contributor there is nobody to spread the knowledge to, so there is nothing here for the owner to act on.
D19 Documentation Quality — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
D20 ADR Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The ADR lexicon (adr-lexicon-1) covers de, en, it, nl. A record identified as another language, or whose language could not be identified (fewer than 25 words of prose, or no clear winner), is never read with English rules: its missing-section, status, consequence-cost and same-question rules abstain, and only the structural rules (title, single option, dangling link, enforcement field) run.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's naming rules read C# through Roslyn and every other language through its sidecar model; these languages are left out (PHP's reading is its own change, a Roslyn-loaded VB or F# project has no population builder yet). Their declarations carry no naming verdict this run — this says nothing about whether their names are consistent.
D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is an ADMISSION gap, not an environment fault: no published-package marker D22 reads admitted any project here. D22 DOES collect the public API of every language in this tree, and admits a project only when its manifest makes that ecosystem's publication act in a form the marker recognises — so what is missing is not a collector but an admission rule for the publication act this repository makes, if it makes one. The remedy is a better discriminator for that marker — not a collector, and no change to the scan image can close it. The marker's rules are measured to refuse applications, so one refused repository is the rule working as calibrated; several are the evidence that it is too strict. For npm the surface is what a published package.json's entry points (exports, main, module, types) export, followed through the source; an entry that names build output the tree does not commit (dist/, build/) is not followed back to source, because only a tsconfig outDir/rootDir pair states that mapping and a bundler's input lives in executable configuration this engine does not evaluate.
D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
D32 Data Compliance (PII/GDPR) — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. `wp-content/plugins/woocommerce/assets/client/admin/app/index.js`, `wp-content/plugins/woocommerce/assets/client/admin/components/index.js`, `wp-content/plugins/woocommerce/assets/client/admin/data/index.js`, `wp-content/plugins/woocommerce/assets/client/admin/email-editor/index.js`, `wp-content/plugins/woocommerce/assets/client/admin/embed/index.js`, … (+26 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
D34 Knowledge Freshness — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Too few commits to judge knowledge freshness (7 commit(s) sampled).
D35 Change Coupling — measured, with a gap in what it reached — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Git history depth insufficient — this repository has 7 commit(s), too few for a reliable change-coupling signal. The clone is complete, so there is no deeper history to fetch: the signal returns as the project accumulates history.
D44 Platform End-of-Life — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This dimension reads a project's own statement about the platform it runs on: a TargetFramework in a .NET project file, a .nvmrc or .python-version, a capped requires-python, a Rust toolchain file or Cargo.toml rust-version, a .go-version, .java-version, .ruby-version, .tool-versions or .sdkmanrc, a go.mod go directive, a Maven or Gradle Java level or toolchain, a Gemfile's ruby directive, a mix.exs elixir requirement, a rebar.config minimum_otp_vsn, a pubspec.yaml SDK constraint, a build.sbt scalaVersion, or a framework major pinned by a dependency constraint. This repository carries none of them, so nothing about its platform was established. That is a gap in this analyzer's coverage, NOT a finding that the platform is supported — a language whose runtime is declared elsewhere (Package.swift, a Dockerfile) is simply not read here yet.
AC2 Forms & labels — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 65 further occurrence(s) are not listed individually; the score already reflects all 105.
AC6 Visual & motion safety — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Visual & motion safety could not be assessed in this run — the check did not complete, so it is not scored. This is a gap in the analyzer, not a finding about this repository. Engine failure: ArgumentOutOfRangeException: startIndex cannot be larger than length of string. (Parameter 'startIndex').
AX1 Captive dependencies — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in wp-content/plugins/woocommerce/src/Container.php, whose lifetimes are not modelled yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
AXB1 Runtime evidence locked — no reproducible boot — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Subject: 277 markup document(s) — HTML, Razor, JSX, Vue, Svelte or server templates. The Runtime Evidence tier boots an app only via docker-compose, an Aspire AppHost, a Dockerfile, an npm dev script, a web service's own toolchain entry point (cargo, go, dotnet, Python, Spring Boot), or an Android app's own Gradle wrapper (run on an emulator); an Apple or Flutter app needs a host it lacks. None applied, so no live runtime a11y/egress/header evidence was collected. You can widen what we reach: add a docker-compose.yml (or an Aspire AppHost) that brings the app up with its dependencies. We then boot it in an isolated sandbox and gathers real runtime evidence — you change nothing in your pipeline (no CI step, no SDK).
C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. '$wpdb' is imported (wp-cron.php:65), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
C3 Audit Trail — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. '$wpdb' is imported (wp-cron.php:65), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
C4 Data Retention — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. '$wpdb' is imported (wp-cron.php:65), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
C5 Data-Subject Rights — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. '$wpdb' is imported (wp-cron.php:65), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
DM8 Value-object opportunities — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check finds primitive parameters that travel together through several signatures of the domain (a missing value object). Its deterministic rule has not yet shown 95 % precision on adjudicated rows, so the clumps it finds are counted here and not published as findings, and the card carries no score. That is a limit of the analyzer, not a finding about your code.
DM9 Scattered domain decisions — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Arm two tells a construction that PRODUCES a measurement from one that merely passes it along, and this repository's frontend does not compute that fact. A measurement built independently in two places would not appear above.
DM9 Scattered domain decisions — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Some of this repository's production types come from a frontend that does not bind comparison operands to the members they read, which arm one needs, and those types were not walked for this dimension. The counts above speak for the languages that declare it.
GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java source only, and this repository's PHP is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby, Scala and Rust source only, and this repository's PHP is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
P2 Observability — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 11 further occurrence(s) are not listed individually; the score already reflects all 51.
P5 DR & Backup — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
R10 Code Duplication — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 119 further occurrence(s) are not listed individually; the score already reflects all 159.
R2 Cyclomatic Complexity — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 257 further occurrence(s) are not listed individually; the score already reflects all 297.
R4 Test Coverage — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 58 further occurrence(s) are not listed individually; the score already reflects all 98.
X1 Async correctness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X10 Duplicated predicate — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 265 further occurrence(s) are not listed individually; the score already reflects all 305.
X12 Unreachable branch — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X24 Document value interpolated into markup unescaped — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X24 Document value interpolated into markup unescaped — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 96 further occurrence(s) are not listed individually; the score already reflects all 136.
X29 Per-element action decided by a fixed element — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X3 Exception handling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 47 further occurrence(s) are not listed individually; the score already reflects all 87.
X4 Structured logging — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Python, PHP, Dart, Ruby, Scala, Rust, Go, Swift, Erlang, F# and Visual Basic source only, and no C# was loaded, and this repository's JavaScript/TypeScript, Python and PHP log through no library that carries a message's values as fields (pino, winston, bunyan, tslog, LogTape, roarr; Python's logging, structlog; PHP's PSR-3 loggers), so its log calls cannot be judged, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D7 Architectural Integrity: Layering is checked against detected/declared rules — an architecture whose boundaries live in convention or in code review, not in a rule a scanner can read, is not enforced here.
D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D32 Data Compliance (PII/GDPR): PII/GDPR signals are heuristic pattern matches in code — they flag likely handling concerns, not legal compliance, and cannot trace where data actually flows at runtime.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
AC4 Keyboard semantics: Keyboard semantics are inferred from markup attributes — interactivity wired purely in script, focus managed at runtime, and component-level handlers are invisible. A clean result means "no static keyboard-trap shape", not a keyboard-operability proof.
AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
DM4 Rich vs anemic model: Behaviour is detected as state mutation inside a method body — a method that enforces an invariant by validating-and-throwing without mutating reads as a query, and mutation delegated through an interface the scan can't resolve isn't credited; entities with zero public properties still drop out of the population. It detects that state changes, not whether the rule is correct.
DM6 Domain ↔ infrastructure boundary: Infrastructure reached through a hand-rolled wrapper, a domain-named facade, reflection, or a string-keyed service locator resolves to a non-infra type and isn't seen; the body scan is symbol resolution over syntax, not full dataflow. A clean result means "no resolved infra reference in a domain body", not a proof of purity.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
450 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was jquery.flexslider.$.flexslider at 331. A further 12 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being WC_Validation.is_postcode at 31 — they are counted neither in the figure above nor in this dimension's score. 4 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: wp-content/plugins/woocommerce/includes/class-wc-validation.php (WC_Validation.is_postcode at 31), wp-content/plugins/woocommerce/includes/legacy/class-wc-legacy-cart.php (WC_Legacy_Cart.__get at 27), wp-content/plugins/woocommerce/includes/gateways/paypal/class-wc-gateway-paypal.php (WC_Gateway_Paypal.get_icon_image at 21), wp-content/plugins/woocommerce/includes/wc-formatting-functions.php (wc-formatting-functions.wc_format_postcode at 17). They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.
+ 386 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 1 body over 240 down to 240 or less in Cyclomatic Complexity — start with jquery.flexslider.$.flexslider (cyclomatic 331). — Refactoring it lifts Cyclomatic Complexity from 4.8 to about 5.1/10.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 717 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 11 bodies over 120 down to 120 or less in Cognitive Complexity — start with WC_REST_Products_Controller.prepare_object_for_database (cognitive 197), Controller.prepare_object_for_database (cognitive 197), (anonymous) (cognitive 180). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 11 together lifts Cognitive Complexity from 3.4 to about 4.3/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes8.3 / 10Strong✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
Resolve the 131 MethodTooLong finding(s) in God Classes — start with Controller.php (7), REDACTED (4), class-wc-shop-customizer.php (4). — One of this dimension's main actionable groups (131 warning-level).
Resolve the 97 FileTooLong finding(s) in God Classes — start with select2.full.js (2), select2.js (2), DataStore.php (2). — One of this dimension's main actionable groups (97 warning-level).
Resolve the 86 ClassTooLong finding(s) in God Classes — start with DataStore.php (3), Controller.php (2), PaymentsExtensionSuggestions.php. — One of this dimension's main actionable groups (86 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.
673 duplicated block group(s) detected. 6.7 % of the production lines (39,545 of 588,513) are in a reported copy. A further 430 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 5 of the 1103 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.
+ 379 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 28 Duplicated block (13 lines × 2) finding(s) in Code Duplication — start with class-wc-background-process.php (2), REDACTED (2), class-wc-rest-products-v1-controller.php (2). — One of this dimension's main actionable groups (28 warning-level).
Resolve the 27 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with class-wc-meta-box-order-data.php (2), class-wc-rest-orders-v1-controller.php (2), class-wc-meta-box-coupon-data.php. — One of this dimension's main actionable groups (27 warning-level).
Resolve the 25 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with DataStore.php (2), abstract-wc-widget.php, class-wc-admin-exporters.php. — One of this dimension's main actionable groups (25 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.
Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.
Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.
5 production modules (source-import), 0 dependency cycle(s), 0 unstable depended-on module(s). No manifest declares this repository's modules, so the modules are its top-level source directories and the edges the imports between them; 0 module(s) off the main sequence, with abstractness counted on 3 of the 5 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 70 Low cohesion finding(s) in Cohesion (LCOM4) — start with Controller.php (3), DataStore.php (2), class-wc-brands.php. — One of this dimension's main actionable groups (70 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the code respects its intended layering / architecture rules.
Method: Enforcement rung (Prevented/Verified/Documented) per checkable ADR via Roslyn, plus dependency cycles via the engine shared with D5/AX3. Deterministic, exact.
No mechanizable ADR was identified, so enforcement is not measured. Dependency cycles not checked (no project-reference graph; where this repository's language has an import-cycle lens, cycles are reported there).
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
21 deducted task-comment markers across 588513 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
Resolve the 20 TodoComment finding(s) in Explicit Debt — start with acf-field-functions.php (3), class-wc-legacy-cart.php (2), form-front.php (2). — One of this dimension's main actionable groups (20 warning-level).
Resolve the 1 HackComment finding(s) in Explicit Debt — start with form-customizer.php. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
0 of 3 evaluated ADRs have a defect readable from the log itself (a missing or empty section, no title, a single option, consequences with no cost, no status, a missing enforcement field, a status the log contradicts, a dangling link, an unlinked second decision on one question, a date that is no calendar day). How well each record argues its case is not measured.
What it measures: Whether comments are worth it — explaining WHY (valuable) rather than WHAT (redundant).
Method: Every inline C# comment compared word by word with the identifiers, literals and constructs of the code it annotates (taken from the syntax); a comment whose words that code already contains is redundant, as are closing-brace labels and generator template text. Comments giving a reason or a reference are kept; other scripts and languages are not judged. Deterministic, exhaustive, advisory.
doc comments repeat the nameswp-content/plugins/woocommerce/assets/js/admin/api-keys.js:13
What to do
Resolve the 34 redundant comment finding(s) in Comment Value — start with address-autocomplete.js (7), wc-shipping-zone-methods.js (4), checkout.js (4). — One of this dimension's main actionable groups (34 recommendation-level).
Detailed fixes: d24_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
1 finding(s): 0 critical, 1 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
REDACTED
REDACTED
What to do
Resolve the 1 REDACTED finding(s) in Secrets (history) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
137 finding(s): 0 critical, 1 high, 136 medium, 0 low. semgrep hit a parse error in 70 file(s) — `wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.js`, `wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js`, `wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js`, `REDACTED`, `wp-content/plugins/woocommerce/assets/client/admin/app/index.js`, … (+65 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them.
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
+ 4 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 60 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (19), REDACTED (19), REDACTED (4). — One of this dimension's main actionable groups (60 warning-level).
Resolve the 45 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (45). — One of this dimension's main actionable groups (45 warning-level).
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D32 · Data Compliance (PII/GDPR)3.2 / 10Weak✓ Tool-verified
What it measures: Likely personal-data (PII / GDPR) handling concerns — logging or storing data without safeguards.
Method: Heuristic PII/GDPR LEAK scan via semgrep across the repo, using our own ruleset: personal data crossing a boundary it should not — reaching a log/console sink, a URL or query string, or unprotected browser storage. Matches map to severity and a 0-10 wide normalizer. A clean sweep is unscored rather than an unearned 10, and is a statement about the leak paths checked only — this dimension does not inventory the personal data a repository holds (the personal-data map and the C1-C5 compliance cards do that), so it never reports that a repository has no personal-data surface. Reported LOUDLY as a measurement gap if the ruleset is missing from the analyzer image. Exhaustive over the leak paths, advisory-leaning; degrades on parse failure.
11 finding(s): 0 critical, 0 high, 11 medium, 0 low. semgrep could not parse 31 file(s) — `wp-content/plugins/woocommerce/assets/client/admin/app/index.js`, `wp-content/plugins/woocommerce/assets/client/admin/components/index.js`, `wp-content/plugins/woocommerce/assets/client/admin/data/index.js`, `wp-content/plugins/woocommerce/assets/client/admin/email-editor/index.js`, `wp-content/plugins/woocommerce/assets/client/admin/embed/index.js`, … (+26 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.
REDACTED
What to do
Resolve the 11 REDACTED finding(s) in Data Compliance (PII/GDPR) — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (11 warning-level).
Detailed fixes: d32_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
No strong hidden change-coupling between production files.
✓ On the Gold path — maintain.
Detailed fixes: d35_recommendation.md.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC1 · Text alternatives3.8 / 10Weak✓ Tool-verified
Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.
An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative. (×29) — wp-content/plugins/woocommerce/assets/js/admin/marketplace-suggestions.js:174, REDACTED:87, wp-content/plugins/woocommerce/includes/admin/meta-boxes/views/html-product-data-variations.php:37, …
A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content. — wp-content/plugins/woocommerce/assets/js/jquery-qrcode/jquery.qrcode.js:1265
An <embed> has no fallback-content mechanism, so it needs an aria-label/aria-labelledby/title to be described. (×2) — REDACTED:88, REDACTED:89
What to do
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Do you agree with this assessment?
AC2 · Forms & labels4.9 / 10Weak✓ Tool-verified
Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.
Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×21) — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:1839, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:3890, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:5855, …
A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label. (×7) — REDACTED:3098, REDACTED:6590, REDACTED:3759, …
This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id. (×8) — REDACTED:4299, wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-field-conditional-logic.php:25, wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-locations.php:9, …
This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label. (×3) — REDACTED:5429, wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:1154, wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:1158
A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one). — REDACTED:3875
What to do
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.
Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative. (×3) — REDACTED:7144, REDACTED:7161, REDACTED:3759
A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope). (×10) — wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-field-conditional-logic.php:58, wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-field.php:59, wp-content/plugins/woocommerce/includes/admin/helper/views/html-main.php:72, …
Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one. (×4) — wp-content/plugins/advanced-custom-fields-pro/pro/admin/views/html-settings-updates.php:16, wp-content/plugins/woocommerce/src/Internal/ReceiptRendering/Templates/order-receipt.php:13, wp-content/themes/monoka/page-sell-well.php:41, …
The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en"). (×2) — wp-content/plugins/woocommerce/assets/js/dompurify/purify.js:822, wp-content/plugins/woocommerce/src/Internal/ReceiptRendering/Templates/order-receipt.php:2
A page with no <title> gives no name in the tab, history or screen-reader page list. Add a descriptive <title> in <head>. (×3) — wp-content/plugins/woocommerce/assets/js/dompurify/purify.js:822, wp-content/plugins/woocommerce/src/Internal/ReceiptRendering/Templates/order-receipt.php:2, wp-content/themes/monoka/header.php:2
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. (×5) — wp-content/plugins/woocommerce/assets/js/dompurify/purify.js:822, wp-content/plugins/woocommerce/src/Internal/ReceiptRendering/Templates/order-receipt.php:2, wp-content/plugins/woocommerce/templates/auth/header.php:22, …
An iframe with no title (or an empty one) is announced only as "frame". Add a non-empty title describing its content, or an aria-label. (×4) — REDACTED:90, REDACTED:93, REDACTED:2431, …
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Other · Accessibility — Whether interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: elements that pose a keyboard-semantics question, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) — a non-natively-interactive element carrying a click handler, a double-click or hover enter/leave binding, a pointer-only gesture on a tabindex="0" element, or `cursor: pointer` from the repo's own CSS; an href-less or placeholder-href (#, javascript:) anchor; and any element with a positive tabindex. Natively interactive elements used correctly (<button>, <a href>, form controls) are NOT in the population — there is nothing to judge — so a page of nothing but correct controls gives AC4 nothing to measure. Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".
The repo's own CSS styles .acf-accordion-title with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. — REDACTED:969
The repo's own CSS styles .acf-rel-item with `cursor: pointer`, so this <span> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. (×3) — REDACTED:3088, REDACTED:3097, REDACTED:3409
The repo's own CSS styles .acf-modal-close with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. — REDACTED:3880
The repo's own CSS styles .acf-gallery-attachment with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. — wp-content/plugins/advanced-custom-fields-pro/pro/assets/js/acf-pro-input.js:1480
An <a href="#"> (or javascript:) with a click handler is a button dressed as a link — it announces the wrong role and stops working without JS. Use a <button> for an action. — wp-content/plugins/woocommerce/assets/js/admin/marketplace-suggestions.js:71
An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action. — wp-content/plugins/woocommerce/assets/js/frontend/checkout.js:1092
The repo's own CSS styles .form-toggle with `cursor: pointer`, so this <span> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. (×2) — wp-content/plugins/woocommerce/includes/admin/helper/views/html-main.php:163, wp-content/plugins/woocommerce/includes/admin/helper/views/html-main.php:219
The repo's own CSS styles .tips with `cursor: pointer`, so this <span> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. — wp-content/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php:157
This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. — wp-content/plugins/woocommerce/templates/single-product/photoswipe.php:23
A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler. — wp-content/themes/monoka/assets/js/cart.js:132
The repo's own CSS styles .thumb-inner with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. — wp-content/themes/monoka/single-product.php:51
The repo's own CSS styles .swatch-item with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. — wp-content/themes/monoka/single-product.php:113
What to do
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.
Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
A plain <span> has the implicit role "generic", which supports no ARIA states, so this aria-expanded is dropped and assistive tech is never told the state at all. Put aria-expanded on the element that owns the behaviour (the button or control the user operates), or give this <span> a role that supports aria-expanded. (×2) — wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:1368, wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:1362
What to do
Use valid, non-abstract roles, supply the ARIA state each role requires, and never put aria-hidden on a focusable element.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Other · Architecture — Whether the codebase has a recognisable, scale-appropriate structure (a named architectural style, or modular enough for its size) rather than being an ad-hoc ball of mud.
Method: Roslyn plus csproj analysis: architecture style detection (DDD, clean, vertical-slice, CQRS) and structure fitness for repo size. Deterministic.
Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.
`BlockInterface` declares 18 methods: `get_name`, `get_id`, `get_order`, `set_order`, `get_attributes`, `set_attributes`, `set_attribute`, `get_parent`, `get_root_template`, `remove`, `is_detached`, `add_hide_condition`, `remove_hide_condition`, `get_hide_conditions`, `add_disable_condition`, `remove_disable_condition`, `get_disable_conditions`, `get_formatted_template`. Counted over its public instance methods, once per name; constants and static methods are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — wp-content/plugins/woocommerce/src/Admin/BlockTemplates/BlockInterface.php:8
`UriInterface` declares 16 methods: `getScheme`, `getAuthority`, `getUserInfo`, `getHost`, `getPort`, `getPath`, `getQuery`, `getFragment`, `withScheme`, `withUserInfo`, `withHost`, `withPort`, `withPath`, `withQuery`, `withFragment`, `__toString`. Counted over its public instance methods, once per name; constants and static methods are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — wp-includes/php-ai-client/third-party/Psr/Http/Message/UriInterface.php:25
What to do
Split fat interfaces into focused role-interfaces so clients depend only on what they use.
Do you agree with this assessment?
C2 · Access Controls7.0 / 10Strong✓ Tool-verified
Other · Security — Whether access is authorized by default — a framework authorization attribute/decorator or policy, or imperative guard methods (throw-on-violation) called from handlers.
Method: Roslyn scan: [Authorize] usage and authorization policies, plus imperative throw-on-violation guard methods detected via syntax. Deterministic.
Authorization IS enforced here (by route guards, auth middleware or checks that refuse a caller) — this is NOT a claim that endpoints are unprotected. What's missing is a NAMED rule set: who may do what is encoded inline where it is checked, so the rules can't be listed, reviewed or tested apart from the code that applies them. Recommendation, not a defect.
What to do
Name the access rules — Gate abilities and policy classes (Gate::define, a UserPolicy), spatie/laravel-permission roles and permissions, or a Symfony Voter — and consult them where access is checked ($this->authorize, a can: middleware, #[IsGranted]), so the rule set is reviewable and testable on its own.
Other · Domain Modelling — Whether aggregates reference each other by identity (id) rather than by direct object reference — the core DDD consistency-boundary rule.
Method: Roslyn (DDD-gated): aggregate roots identified by convention; each aggregate field checked for direct references to other aggregates versus id-only. Deterministic, DDD-native.
Coverage: Population: aggregate roots identified by AggregateRoot/IAggregateRoot base/interface NAME convention; reference-by-identity then checked exhaustively within that set — a root not using those names is invisible.
Do you agree with this assessment?
DM10 · One transaction, one aggregate10.0 / 10Exemplary○ Nothing flagged
Other · Domain Modelling — Whether a single operation mutates more than one aggregate root. An aggregate is a consistency boundary, so saving two together fuses them into one — the second's invariants come to depend on the first's transaction, and the pair can no longer be separated. Reads of other aggregates are not counted.
Method: Neutral body surface (DDD-gated): every method body scanned for repository WRITE calls (Add/Update/Save/Remove/Delete/Insert/Store and their async forms), keyed on the ARGUMENT type rather than the repository type — three `IRepository<T>` writes collapse to one repository but are three distinct aggregates. Reads (Get/Find/Load/Query) are excluded, so loading another aggregate for context never counts. Score is offending methods over methods that write at all. Deterministic.
Other · Domain Modelling — Whether an aggregate can be constructed in a state its own rules forbid — a public constructor that takes a raw primitive, stores it, and validates nothing, with no factory beside it. A constructor taking only value objects is not counted: each parameter has already validated itself.
Method: Neutral surface (DDD-gated): each non-abstract entity/aggregate checked for a PUBLIC constructor taking at least one RAW PRIMITIVE parameter whose body contains no guard token (throw / Guard. / Ensure. / ArgumentException / CheckRule / an XException.ThrowIf* helper). C#: a static factory beside a public constructor does not exempt it, and a public parameterless constructor followed by public raw-primitive setters that refuse nothing is charged when the type also declares a validating way in (a guarded constructor or a guarding static method returning the type); TypeScript: a static Create/Of/From/New factory exempts the type. A constructor taking only value objects is never charged -- measured: 64 of 87 unguarded public constructors on the C# corpus take value objects only, so ignoring parameter types would be 73% false positives. One finding per entity. Deterministic.
Do you agree with this assessment?
DM12 · Ambient inputs in the domain10.0 / 10Exemplary○ Nothing flagged
Other · Domain Modelling — Whether domain types receive the time and randomness their rules depend on, rather than reading the process clock or a global random source directly — an ambient read makes the rule it feeds untestable at the instant that matters and lets two reads inside one operation disagree.
Method: Roslyn (DDD-gated, C#/VB only): domain-layer types scanned for ambient reads — DateTime/DateTimeOffset.Now/UtcNow/Today, Random.Shared, new Random(), Stopwatch.GetTimestamp — resolved against the semantic model, with a comment/string-stripped token fallback only where resolution fails. Body reads are scored; field/property initialisers are surfaced unscored. Apply/When folds excluded (ES1 owns them). Deterministic, symbol-resolved.
Do you agree with this assessment?
DM4 · Rich vs anemic model10.0 / 10Exemplary✓ Tool-verified
Other · Domain Modelling — Whether aggregates/entities carry the behaviour that protects their invariants, rather than being data bags driven by external services.
Method: Roslyn (DDD-gated): entity method BODIES classified mutator-vs-query — only methods that mutate the entity's own declared state count as invariant-protecting behaviour, so a getter/passthrough doesn't rescue an anemic class. Deterministic, exhaustive over domain-layer entities.
Coverage: Population: entities by name/base convention; rich-vs-anemic judged by classifying each method body mutator-vs-query — logic-bearing domain types outside the convention are invisible.
Other · Domain Modelling — Whether entities protect their state — private/init-only setters, and collections handed out as read-only views rather than the mutable backing collection — instead of exposing writable state that bypasses invariants. Softened when a rehydration framework (Marten/EF) is present.
Method: Roslyn (DDD-gated): entities scanned for publicly writable state — public setters, and (C#/VB) own mutable collections handed out through an auto-property, a public field or a bare-field expression getter, where a computed/copying getter is never charged. One finding per entity; score softened when Marten/EF rehydration frameworks present. Deterministic, framework-aware.
Coverage: Population: entities by convention; encapsulation (setter shape) checked exhaustively within the set.
Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies (EF/Marten/HTTP/ASP.NET) — the clean-architecture dependency rule.
Method: Roslyn (DDD-gated): domain-layer types scanned for infrastructure usage in member SIGNATURES and inside method/accessor BODIES — resolved calls and object-creations into EF/Marten/HTTP/Mongo/Redis/message-bus types (not just a namespace allowlist). Deterministic, symbol-resolved, exhaustive over domain-layer bodies, DDD-native.
Coverage: Domain layer identified by NAMESPACE heuristic; infrastructure then resolved by symbol in member SIGNATURES and method/accessor BODIES — rename the layer and the check evaporates.
Other · Domain Modelling — Whether one domain rule is decided — or one measurement produced — in more than one place, rather than living on the type that owns it.
Method: Neutral body surface plus Roslyn (DDD-gated), two arms. DECISION (Roslyn only): a predicate over a domain type's members judged in two or more types, where none of those decisions live on the owning type — operands of comparisons and relational property patterns only, so a member merely passed as an argument is not judged. DERIVATION: a plain all-numeric carrier of ≥2 members, with no base type and exactly one constructor, CONSTRUCTED as the result of a method (returned or assigned, never inline as an argument) in two or more types other than its own — the same measurement produced twice, which centralising the judgement does not fix. DERIVATION runs on every language whose frontend declares the produced-or-passed fact per construction (Roslyn and the Java sidecar today); a target with only the derivation arm carries an engine gap naming the decision arm as not assessed, and a frontend that declares nothing keeps the dimension not measured rather than clean. Single-member rules, test code and generated code are out of population for both. Advisory.
Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
The root README is 2 words, against a bar of 120. Of the three newcomer-critical sections this check looks for by heading, in the README and in the repository documents it links, it found no a build/run or getting-started section, no a testing section, no an architecture or project-map section. Sections are matched on HEADING text only, so material written under a heading this check does not recognise — or with no heading at all — is not seen and this row may understate what the document covers. — README.md:1
What to do
Expand the README with getting-started, architecture overview and a project map.
Add a build/run (quick start) section to the root README — the first thing a newcomer needs.
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Most of the production code is in directories of its own, but 15 application file(s) sit at the repository root beside the build and tooling files (`index.php`, `wp-activate.php`, `wp-blog-header.php`, `wp-comments-post.php`, `wp-config-sample.php` and 10 more).
Do you agree with this assessment?
P1 · CI/CD gates0.0 / 10Critical✓ Tool-verified
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
No CI workflow found (.github/workflows, azure-pipelines.yml, .gitlab-ci.yml, …) — changes aren't gated by an automated build/test.
What to do
Add a CI workflow that builds and runs the test suite on every push/PR.
`wp-content/themes/monoka/assets/js/custom-slider/jquery.nivo.slider.js` reports through `console.*` at line 600 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/themes/monoka/assets/js/custom-slider/jquery.nivo.slider.js:600
`wp-content/plugins/woocommerce/assets/js/frontend/utils/address-autocomplete-common.js` reports through `console.*` at line 40 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/js/frontend/utils/address-autocomplete-common.js:40
`wp-content/plugins/woocommerce/assets/js/frontend/utils/address-autocomplete-common.js` reports through `console.*` at line 105 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/js/frontend/utils/address-autocomplete-common.js:105
`wp-content/plugins/woocommerce/assets/js/frontend/utils/address-autocomplete-common.js` reports through `console.*` at line 133 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/js/frontend/utils/address-autocomplete-common.js:133
`wp-content/plugins/woocommerce/assets/client/blocks/add-to-cart-form.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/blocks/add-to-cart-form.js:1
`wp-content/plugins/woocommerce/assets/client/blocks/add-to-cart-with-options.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/blocks/add-to-cart-with-options.js:1
`wp-content/plugins/woocommerce/assets/client/blocks/blocks-checkout-events.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/blocks/blocks-checkout-events.js:1
`wp-content/plugins/woocommerce/assets/client/blocks/product-description.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/blocks/product-description.js:1
`wp-content/plugins/woocommerce/assets/client/blocks/product-details.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/blocks/product-details.js:1
`wp-content/plugins/woocommerce/assets/client/blocks/product-gallery.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/blocks/product-gallery.js:1
`wp-content/plugins/woocommerce/assets/client/blocks/product-image.js` reports through `console.*` at line 4 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/blocks/product-image.js:4
`wp-content/plugins/woocommerce/assets/client/blocks/product-price-frontend.js` reports through `console.*` at line 2 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/blocks/product-price-frontend.js:2
`wp-content/plugins/woocommerce/assets/client/blocks/product-price.js` reports through `console.*` at line 2 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/blocks/product-price.js:2
`wp-content/plugins/woocommerce/assets/client/blocks/product-query.js` reports through `console.*` at line 14 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/blocks/product-query.js:14
`wp-content/plugins/woocommerce/assets/client/blocks/product-reviews.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/blocks/product-reviews.js:1
`wp-content/plugins/woocommerce/assets/client/blocks/product-specifications.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/blocks/product-specifications.js:1
`wp-content/plugins/woocommerce/assets/client/blocks/product-title.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/blocks/product-title.js:1
`wp-content/plugins/woocommerce/assets/client/blocks/wc-blocks-google-analytics.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/blocks/wc-blocks-google-analytics.js:1
`wp-content/plugins/woocommerce/assets/client/blocks/wc-blocks-registry.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/blocks/wc-blocks-registry.js:1
`wp-content/plugins/woocommerce/assets/client/blocks/woocommerce/product-elements.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/blocks/woocommerce/product-elements.js:1
`wp-content/plugins/woocommerce/assets/client/admin/product-editor/blocks/generic/tab/edit.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/admin/product-editor/blocks/generic/tab/edit.js:1
`wp-content/plugins/woocommerce/assets/client/admin/chunks/2999.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/admin/chunks/2999.js:1
`wp-content/plugins/woocommerce/assets/client/admin/chunks/5945.js` reports through `console.*` at line 2 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/admin/chunks/5945.js:2
`wp-content/plugins/woocommerce/assets/client/admin/chunks/analytics-report.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/woocommerce/assets/client/admin/chunks/analytics-report.js:1
`wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js` reports through `console.*` at line 347 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js:347
`wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js` reports through `console.*` at line 351 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js:351
`wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js` reports through `console.*` at line 356 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js:356
`REDACTED` reports through `console.*` at line 770 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — REDACTED:770
`REDACTED` reports through `console.*` at line 790 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — REDACTED:790
`REDACTED` reports through `console.*` at line 834 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — REDACTED:834
`REDACTED` reports through `console.*` at line 1928 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — REDACTED:1928
`REDACTED` reports through `console.*` at line 1936 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — REDACTED:1936
`REDACTED` reports through `console.*` at line 1963 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — REDACTED:1963
`REDACTED` reports through `console.*` at line 1984 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — REDACTED:1984
`REDACTED` reports through `console.*` at line 2006 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — REDACTED:2006
`REDACTED` reports through `console.*` at line 2033 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — REDACTED:2033
`REDACTED` reports through `console.*` at line 6246 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — REDACTED:6246
`REDACTED` reports through `console.*` at line 6355 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — REDACTED:6355
`REDACTED` reports through `console.*` at line 558 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — REDACTED:558
`REDACTED` reports through `console.*` at line 559 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — REDACTED:559
What to do
Route service-code `console.*` output through the module's structured logger (with named fields), so delivery outcomes and failures reach the log pipeline with a level.
Add a health-check endpoint (Laravel's /up health route or a /health route) so orchestrators and load balancers can probe liveness/readiness.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
No static application security testing detected. For this repository's stack, add phpstan or psalm (or `semgrep --config=auto`, which runs on any language) — this repository has no CI pipeline yet, so run it locally to clear the existing findings, then make it a step of the first workflow you add so a regression fails the build. What was searched, so you can tell an absence from a miss: the 0 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
What to do
Run what this repository's stack ships: phpstan or psalm — or `semgrep --config=auto`, which runs on any language — locally for now, since there is no CI pipeline here yet, and as a step of the first workflow you add so a security regression fails the build instead of landing.
Enable Dependabot/Renovate or a dependency-review gate.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
Do you agree with this assessment?
R1 · Type Safety0.0 / 10Critical✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
0 typed · 104 plain JS — the untyped files are wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js, wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js, REDACTED (+98 more).
What to do
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
React / JS · Code Health — The share of the scored frontend lines inside a near-exact copy-pasted block of substantial extent (the D4 clone algorithm over JS/TS tokens, D-386; each line once, 10 at none and 0 at a quarter of the lines, as D4): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Scored on the share of the scored frontend lines inside a reported copy, on the same curve as D4. Deterministic.
8 of the duplicated blocks reported below have copies in at least two of the sibling directories advanced-custom-fields-pro, woocommerce under wp-content/plugins/. That concentration is one structural fact, not 8 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 8 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:2963
wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:2963 · wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:2963 · wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:2963 · wp-content/plugins/woocommerce/assets/js/select2/select2.js:2963 — the 4 copies are spread across 4 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:2963
wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:3688 · wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:3672 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:3688
wp-content/themes/monoka/assets/font-awesome/js/free.js:2261 · wp-content/themes/monoka/assets/font-awesome/js/pro.js:318 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — wp-content/themes/monoka/assets/font-awesome/js/free.js:2261
wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:4727 · wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:4727 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:4727
wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:757 · wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:757 · wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:757 · wp-content/plugins/woocommerce/assets/js/select2/select2.js:757 — the 4 copies are spread across 4 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:757
wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:4867 · wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:4851 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:4867
wp-content/themes/monoka/assets/font-awesome/js/free.js:3212 · wp-content/themes/monoka/assets/font-awesome/js/pro.js:1414 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — wp-content/themes/monoka/assets/font-awesome/js/free.js:3212
wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:336 · wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:336 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:336
wp-content/plugins/advanced-custom-fields-pro/pro/assets/js/acf-pro-input.js:62 · wp-content/plugins/advanced-custom-fields-pro/pro/assets/js/acf-pro-input.js:662 — the two spans are one implementation copied and then locally edited — 1553 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — wp-content/plugins/advanced-custom-fields-pro/pro/assets/js/acf-pro-input.js:62
wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:5382 · wp-content/plugins/woocommerce/assets/js/select2/select2.js:5382 · wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:5537 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:5382
wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:1097 · wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:1091 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:1097
wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:1670 · wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:1654 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:1670
wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:5785 · wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:5785 · wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:5960 — the 3 copies are spread across 3 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete. — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:5785
wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:6121 · wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:6121 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:6121
wp-content/themes/monoka/assets/font-awesome/js/free.js:2048 · wp-content/themes/monoka/assets/font-awesome/js/pro.js:65 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — wp-content/themes/monoka/assets/font-awesome/js/free.js:2048
wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-classes.js:27 · wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-providers.js:32 — the two spans are one implementation copied and then locally edited — 1062 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-classes.js:27
wp-content/plugins/woocommerce/assets/js/admin/settings-views-html-settings-tax.js:37 · wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zones.js:19 — the two spans are one implementation copied and then locally edited — 725 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — wp-content/plugins/woocommerce/assets/js/admin/settings-views-html-settings-tax.js:37
wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:1445 · wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:1434 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:1445
wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:20 · wp-content/plugins/woocommerce/assets/js/admin/users.js:10 — the two spans are one implementation copied and then locally edited — 539 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:20
wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:6533 · wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:5802 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:6533
wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js:1704 · REDACTED:580 — the two spans are one implementation copied and then locally edited — 263 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js:1704
wp-content/plugins/woocommerce/assets/js/admin/wc-brands-enhanced-select.js:5 · wp-content/plugins/woocommerce/assets/js/admin/wc-enhanced-select.js:4 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — wp-content/plugins/woocommerce/assets/js/admin/wc-brands-enhanced-select.js:5
wp-content/themes/monoka/assets/font-awesome/js/free.js:5 · wp-content/themes/monoka/assets/font-awesome/js/free.js:586 · wp-content/themes/monoka/assets/font-awesome/js/free.js:862 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — wp-content/themes/monoka/assets/font-awesome/js/free.js:5
wp-content/themes/monoka/assets/font-awesome/js/free.js:1988 · wp-content/themes/monoka/assets/font-awesome/js/pro.js:5 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — wp-content/themes/monoka/assets/font-awesome/js/free.js:1988
wp-content/plugins/woocommerce/assets/js/admin/wc-enhanced-select.js:282 · wp-content/plugins/woocommerce/assets/js/admin/wc-enhanced-select.js:328 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — wp-content/plugins/woocommerce/assets/js/admin/wc-enhanced-select.js:282
wp-content/plugins/woocommerce/assets/js/admin/product-ordering.js:25 · wp-content/plugins/woocommerce/assets/js/admin/term-ordering.js:63 — the two spans are one implementation copied and then locally edited — 263 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — wp-content/plugins/woocommerce/assets/js/admin/product-ordering.js:25
REDACTED:208 · REDACTED:248 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:208
wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:1695 · wp-content/plugins/woocommerce/assets/js/admin/wc-brands-enhanced-select.js:7 · wp-content/plugins/woocommerce/assets/js/admin/wc-enhanced-select.js:6 — the 3 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete. — wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:1695
wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:165 · wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:207 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:165
wp-content/plugins/woocommerce/assets/js/admin/wc-recent-reviews-widget-async.js:4 · wp-content/plugins/woocommerce/assets/js/admin/wc-status-widget-async.js:4 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — wp-content/plugins/woocommerce/assets/js/admin/wc-recent-reviews-widget-async.js:4
REDACTED:1507 · REDACTED:1606 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:1507
wp-content/themes/monoka/assets/js/owl-setup.js:2 · wp-content/themes/monoka/assets/js/owl-setup.js:39 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — wp-content/themes/monoka/assets/js/owl-setup.js:2
wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:486 · wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:731 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:486
REDACTED:2374 · REDACTED:2518 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:2374
wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js:381 · wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js:914 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js:381
wp-content/plugins/woocommerce/assets/js/frontend/address-autocomplete.js:225 · wp-content/plugins/woocommerce/assets/js/frontend/address-autocomplete.js:281 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — wp-content/plugins/woocommerce/assets/js/frontend/address-autocomplete.js:225
wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js:815 · REDACTED:4110 — the two spans are one implementation copied and then locally edited — 114 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js:815
REDACTED:522 · REDACTED:548 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:522
wp-content/plugins/woocommerce/assets/js/frontend/checkout.js:328 · wp-content/plugins/woocommerce/assets/js/frontend/checkout.js:365 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — wp-content/plugins/woocommerce/assets/js/frontend/checkout.js:328
What to do
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.
Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.
Va has cyclomatic complexity 80 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2
Ra has cyclomatic complexity 53 and cognitive complexity 67; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2
_limitMinMaxDateTime has cyclomatic complexity 52 and cognitive complexity 120; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:586
compute has cyclomatic complexity 50 and cognitive complexity 46; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2
(anonymous) has cyclomatic complexity 47 and cognitive complexity 52; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.js:2720
_onDragRelease has cyclomatic complexity 46 and cognitive complexity 60; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:1955
b has cyclomatic complexity 45 and cognitive complexity 51; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2
_newInst has cyclomatic complexity 43 and cognitive complexity 53; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:169
_onTimeChange has cyclomatic complexity 43 and cognitive complexity 51; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:779
(anonymous) has cyclomatic complexity 43 and cognitive complexity 41; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — wp-content/themes/monoka/assets/font-awesome/js/pro.js:5
_injectTimePicker has cyclomatic complexity 41 and cognitive complexity 105; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:373
apply has cyclomatic complexity 40 and cognitive complexity 74; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. (×6) — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:4565, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:4565, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:4565, …
n has cyclomatic complexity 40 and cognitive complexity 48; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2
(anonymous) has cyclomatic complexity 39 and cognitive complexity 380; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2
getProjectionStyles has cyclomatic complexity 39 and cognitive complexity 49; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2
(anonymous) has cyclomatic complexity 39 and cognitive complexity 36; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2
handleKeyDown has cyclomatic complexity 38 and cognitive complexity 85; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2
c has cyclomatic complexity 38 and cognitive complexity 84; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2
(anonymous) has cyclomatic complexity 38 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2
(anonymous) has cyclomatic complexity 37 and cognitive complexity 31; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2
resolveTargetDelta has cyclomatic complexity 36 and cognitive complexity 51; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2
_optionDatepicker has cyclomatic complexity 34 and cognitive complexity 61; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:1822
do_variation_action has cyclomatic complexity 34 and cognitive complexity 36; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product-variation.js:1230
_panOrMoveMainScroll has cyclomatic complexity 33 and cognitive complexity 81; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:1521
(anonymous) has cyclomatic complexity 33 and cognitive complexity 31; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — wp-content/themes/monoka/assets/font-awesome/js/free.js:1988
normalize has cyclomatic complexity 32 and cognitive complexity 63; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. (×4) — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:65, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:65, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:65, …
normalize has cyclomatic complexity 32 and cognitive complexity 59; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. (×2) — wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:77, wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:77
(anonymous) has cyclomatic complexity 29 and cognitive complexity 37; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2
_renderMovement has cyclomatic complexity 28 and cognitive complexity 50; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:1791
fetch has cyclomatic complexity 28 and cognitive complexity 35; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — wp-content/plugins/woocommerce/assets/js/sourcebuster/sourcebuster.js:795
calcProjection has cyclomatic complexity 28 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2
Do you agree with this assessment?
R3 · Large Files0.0 / 10Critical✓ Tool-verified
React / JS · Code Health — How many source files exceed the large-file threshold.
Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.
REDACTED has 8673 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js has 5331 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:1
wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js has 5168 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:1
wp-content/plugins/woocommerce/assets/js/select2/select2.full.js has 5168 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:1
wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js has 4753 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:1
wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js has 4606 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:1
wp-content/plugins/woocommerce/assets/js/select2/select2.js has 4606 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/woocommerce/assets/js/select2/select2.js:1
REDACTED has 3748 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.js has 2982 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.js:1
REDACTED has 2958 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
REDACTED has 2955 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
wp-content/themes/monoka/assets/font-awesome/js/pro.js has 2367 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/themes/monoka/assets/font-awesome/js/pro.js:1
wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js has 2085 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:1
wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js has 1938 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js:1
wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product-variation.js has 1554 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product-variation.js:1
wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js has 1534 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:1
wp-content/plugins/advanced-custom-fields-pro/pro/assets/js/acf-pro-input.js has 1435 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/advanced-custom-fields-pro/pro/assets/js/acf-pro-input.js:1
wp-content/plugins/woocommerce/assets/js/frontend/checkout.js has 1318 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/woocommerce/assets/js/frontend/checkout.js:1
wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product.js has 1276 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product.js:1
wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart-variation.js has 1153 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart-variation.js:1
wp-content/plugins/woocommerce/assets/js/frontend/address-autocomplete.js has 911 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/woocommerce/assets/js/frontend/address-autocomplete.js:1
wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js has 862 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js:1
wp-content/plugins/woocommerce/assets/js/admin/variation-gallery.js has 829 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/woocommerce/assets/js/admin/variation-gallery.js:1
wp-content/plugins/woocommerce/assets/js/sourcebuster/sourcebuster.js has 768 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/woocommerce/assets/js/sourcebuster/sourcebuster.js:1
REDACTED has 762 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
wp-content/plugins/woocommerce/assets/js/frontend/cart.js has 726 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/woocommerce/assets/js/frontend/cart.js:1
REDACTED has 708 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
wp-content/plugins/woocommerce/assets/js/frontend/single-product.js has 472 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/woocommerce/assets/js/frontend/single-product.js:1
wp-content/plugins/woocommerce/assets/js/frontend/a8c-address-autocomplete-service.js has 429 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/woocommerce/assets/js/frontend/a8c-address-autocomplete-service.js:1
wp-content/plugins/woocommerce/assets/js/admin/marketplace-suggestions.js has 417 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/woocommerce/assets/js/admin/marketplace-suggestions.js:1
wp-content/plugins/woocommerce/assets/js/frontend/order-review.js has 413 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — wp-content/plugins/woocommerce/assets/js/frontend/order-review.js:1
What to do
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Do you agree with this assessment?
R4 · Test Coverage0.4 / 10Critical✓ Tool-verified
React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.
Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.
No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×40) — REDACTED:1, wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:1, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:1, …
What to do
Add tests that import the unreached modules (directly or through their public entry).
Do you agree with this assessment?
R7 · Dead Code9.5 / 10Exemplary✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
Unreachable from the 104 application, 0 tooling and 3 test entry point(s) detected in this repo. This repository declares no build, type-check or test script, so nothing here would fail on a wrong deletion — confirm by hand that nothing loads each file (including by a path built at runtime) before removing it. An undetected custom entry would make these reachable.
no import path from any entry point (104 application, 0 tooling, 3 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make (×2) — wp-content/plugins/classic-editor/scripts/post.js, wp-content/plugins/classic-editor/js/block-editor-plugin.js
What to do
Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.
Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.
Other · Security — Only what this repository's own non-C# files could be read for was assessed — markup this repository SHIPS is scored for third-party script integrity whether or not the repository serves it itself, since a page handed to a consumer runs in that consumer’s origin. Nothing else in this dimension was assessed: the transport, cookie, input-validation and crypto controls are read from a source model that was not loaded for this repository’s language, so their absence here is not a finding about this repository.
Method: Roslyn plus filesystem scan: HSTS/security headers, secure cookies, input validation, middleware order, weak crypto (MD5/SHA1/DES); HTTPS-metadata context-aware. On a repository with no .NET source it reads JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Elixir source itself (test, vendored, generated and minified paths not) for the arms that hold whether or not the code serves HTTP: a weak hash or cipher, key material fixed in the source, a TLS client that accepts any certificate, and (JavaScript/TypeScript, Ruby, Scala, Rust and Elixir) an obsolete TLS version; the server controls are not assessed there, and a Dart, Ruby, Scala, Rust or Elixir repository that serves no HTTP of its own is N/A on them. Deterministic.
`//platform.twitter.com/widgets.js` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session. The URL also names no version, so it resolves to whatever that origin serves at fetch time — the executed bytes can change with nobody touching this repository. 6 such include(s) across the repository's markup. — REDACTED:93
`product` is set explicitly here. The OWASP Secure Headers Project lists it among the response headers to REMOVE: it names the server, framework or tooling behind the application, which is exactly what an attacker looks up known exploits for. (No deduction on this card.) — wp-content/plugins/woocommerce/assets/client/blocks/484.js:1
What to do
Pin third-party scripts and verify them: name an exact version in the URL and add an `integrity="sha384-…"` hash alongside `crossorigin="anonymous"` (both are required — an integrity hash on a cross-origin script without `crossorigin` is not evaluated, it blocks the script). Where the vendor ships a continuously-updated loader and publishes no stable hash (tag managers, analytics, chat widgets), Subresource Integrity is not available: constrain it instead with a `Content-Security-Policy` that names the exact origins allowed to execute, and drop the script from the pages that do not need it. Where the page is shipped inside a package that others host, prefer vendoring the asset and serving it from the app’s own origin, so no consumer inherits a third-party dependency they did not choose.
Stop sending `product`: delete the write, and suppress the framework's own copy where it has one (Kestrel `AddServerHeader = false`, Express `app.disable('x-powered-by')` / `helmet.hidePoweredBy()`, nginx `server_tokens off`, IIS `<requestFiltering removeServerHeader="true" />`).
Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.
Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.
Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.
Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.
Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.
`mailSend` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the `sendmail_from` ini setting (changed at line 2118, put back at line 2143) — which says the change was meant to last no longer than this call. But the restore is an ordinary statement on the straight-line path, not a `finally`, so it is skipped by any exception thrown in between: PHP then keeps the overwritten value for the rest of the request — and in a CLI command, a queue worker or a long-running server (Octane, Swoole, RoadRunner, FrankenPHP) for the rest of the process's life — and every later relative path, child-process launch, date, number format, XML parse or error report in ANY class reads it. That failure is silent and remote from its cause: the function that breaks is not the function that moved the value. The durable fix is not to widen the restore but to stop mutating the global: pass the value to the operation that needs it — `cwd` and `env` to Symfony `Process` (`new Process($command, $cwd, $env)`) or `proc_open($command, $spec, $pipes, $cwd, $env)`, absolute paths instead of `chdir`, an explicit `DateTimeZone` or locale to `DateTimeImmutable`/`IntlDateFormatter`/`NumberFormatter`, an explicit encoding to the `mb_*` call, `LIBXML_NOERROR`/`libxml_get_errors` handling in one place. Where the global genuinely must move, wrap it `try`/`finally` so the restore runs on every path. — wp-includes/PHPMailer/PHPMailer.php:2080
`decodeHeader` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the internal multibyte encoding (changed at line 3812, put back at line 3823) — which says the change was meant to last no longer than this call. But the restore is an ordinary statement on the straight-line path, not a `finally`, so it is skipped by any exception thrown in between: PHP then keeps the overwritten value for the rest of the request — and in a CLI command, a queue worker or a long-running server (Octane, Swoole, RoadRunner, FrankenPHP) for the rest of the process's life — and every later relative path, child-process launch, date, number format, XML parse or error report in ANY class reads it. That failure is silent and remote from its cause: the function that breaks is not the function that moved the value. The durable fix is not to widen the restore but to stop mutating the global: pass the value to the operation that needs it — `cwd` and `env` to Symfony `Process` (`new Process($command, $cwd, $env)`) or `proc_open($command, $spec, $pipes, $cwd, $env)`, absolute paths instead of `chdir`, an explicit `DateTimeZone` or locale to `DateTimeImmutable`/`IntlDateFormatter`/`NumberFormatter`, an explicit encoding to the `mb_*` call, `LIBXML_NOERROR`/`libxml_get_errors` handling in one place. Where the global genuinely must move, wrap it `try`/`finally` so the restore runs on every path. — wp-includes/PHPMailer/PHPMailer.php:3802
`connect` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the error handler (changed at line 254, reset at line 273) — which says the change was meant to last no longer than this call. But the restore is an ordinary statement on the straight-line path, not a `finally`, so it is skipped by any exception thrown in between: PHP then keeps the overwritten value for the rest of the request — and in a CLI command, a queue worker or a long-running server (Octane, Swoole, RoadRunner, FrankenPHP) for the rest of the process's life — and every later relative path, child-process launch, date, number format, XML parse or error report in ANY class reads it. That failure is silent and remote from its cause: the function that breaks is not the function that moved the value. The durable fix is not to widen the restore but to stop mutating the global: pass the value to the operation that needs it — `cwd` and `env` to Symfony `Process` (`new Process($command, $cwd, $env)`) or `proc_open($command, $spec, $pipes, $cwd, $env)`, absolute paths instead of `chdir`, an explicit `DateTimeZone` or locale to `DateTimeImmutable`/`IntlDateFormatter`/`NumberFormatter`, an explicit encoding to the `mb_*` call, `LIBXML_NOERROR`/`libxml_get_errors` handling in one place. Where the global genuinely must move, wrap it `try`/`finally` so the restore runs on every path. — wp-includes/PHPMailer/POP3.php:245
`getSMTPConnection` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the error handler (changed at line 420, reset at line 448) — which says the change was meant to last no longer than this call. But the restore is an ordinary statement on the straight-line path, not a `finally`, so it is skipped by any exception thrown in between: PHP then keeps the overwritten value for the rest of the request — and in a CLI command, a queue worker or a long-running server (Octane, Swoole, RoadRunner, FrankenPHP) for the rest of the process's life — and every later relative path, child-process launch, date, number format, XML parse or error report in ANY class reads it. That failure is silent and remote from its cause: the function that breaks is not the function that moved the value. The durable fix is not to widen the restore but to stop mutating the global: pass the value to the operation that needs it — `cwd` and `env` to Symfony `Process` (`new Process($command, $cwd, $env)`) or `proc_open($command, $spec, $pipes, $cwd, $env)`, absolute paths instead of `chdir`, an explicit `DateTimeZone` or locale to `DateTimeImmutable`/`IntlDateFormatter`/`NumberFormatter`, an explicit encoding to the `mb_*` call, `LIBXML_NOERROR`/`libxml_get_errors` handling in one place. Where the global genuinely must move, wrap it `try`/`finally` so the restore runs on every path. — wp-includes/PHPMailer/SMTP.php:407
`startTLS` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the error handler (changed at line 505, reset at line 513) — which says the change was meant to last no longer than this call. But the restore is an ordinary statement on the straight-line path, not a `finally`, so it is skipped by any exception thrown in between: PHP then keeps the overwritten value for the rest of the request — and in a CLI command, a queue worker or a long-running server (Octane, Swoole, RoadRunner, FrankenPHP) for the rest of the process's life — and every later relative path, child-process launch, date, number format, XML parse or error report in ANY class reads it. That failure is silent and remote from its cause: the function that breaks is not the function that moved the value. The durable fix is not to widen the restore but to stop mutating the global: pass the value to the operation that needs it — `cwd` and `env` to Symfony `Process` (`new Process($command, $cwd, $env)`) or `proc_open($command, $spec, $pipes, $cwd, $env)`, absolute paths instead of `chdir`, an explicit `DateTimeZone` or locale to `DateTimeImmutable`/`IntlDateFormatter`/`NumberFormatter`, an explicit encoding to the `mb_*` call, `LIBXML_NOERROR`/`libxml_get_errors` handling in one place. Where the global genuinely must move, wrap it `try`/`finally` so the restore runs on every path. — wp-includes/PHPMailer/SMTP.php:486
`client_send` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the error handler (changed at line 1252, reset at line 1256) — which says the change was meant to last no longer than this call. But the restore is an ordinary statement on the straight-line path, not a `finally`, so it is skipped by any exception thrown in between: PHP then keeps the overwritten value for the rest of the request — and in a CLI command, a queue worker or a long-running server (Octane, Swoole, RoadRunner, FrankenPHP) for the rest of the process's life — and every later relative path, child-process launch, date, number format, XML parse or error report in ANY class reads it. That failure is silent and remote from its cause: the function that breaks is not the function that moved the value. The durable fix is not to widen the restore but to stop mutating the global: pass the value to the operation that needs it — `cwd` and `env` to Symfony `Process` (`new Process($command, $cwd, $env)`) or `proc_open($command, $spec, $pipes, $cwd, $env)`, absolute paths instead of `chdir`, an explicit `DateTimeZone` or locale to `DateTimeImmutable`/`IntlDateFormatter`/`NumberFormatter`, an explicit encoding to the `mb_*` call, `LIBXML_NOERROR`/`libxml_get_errors` handling in one place. Where the global genuinely must move, wrap it `try`/`finally` so the restore runs on every path. — wp-includes/PHPMailer/SMTP.php:1240
`get_lines` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the error handler (changed at line 1357, reset at line 1361) — which says the change was meant to last no longer than this call. But the restore is an ordinary statement on the straight-line path, not a `finally`, so it is skipped by any exception thrown in between: PHP then keeps the overwritten value for the rest of the request — and in a CLI command, a queue worker or a long-running server (Octane, Swoole, RoadRunner, FrankenPHP) for the rest of the process's life — and every later relative path, child-process launch, date, number format, XML parse or error report in ANY class reads it. That failure is silent and remote from its cause: the function that breaks is not the function that moved the value. The durable fix is not to widen the restore but to stop mutating the global: pass the value to the operation that needs it — `cwd` and `env` to Symfony `Process` (`new Process($command, $cwd, $env)`) or `proc_open($command, $spec, $pipes, $cwd, $env)`, absolute paths instead of `chdir`, an explicit `DateTimeZone` or locale to `DateTimeImmutable`/`IntlDateFormatter`/`NumberFormatter`, an explicit encoding to the `mb_*` call, `LIBXML_NOERROR`/`libxml_get_errors` handling in one place. Where the global genuinely must move, wrap it `try`/`finally` so the restore runs on every path. — wp-includes/PHPMailer/SMTP.php:1340
`next_week_start` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the default timezone (changed at line 335, put back at line 337) — which says the change was meant to last no longer than this call. But the restore is an ordinary statement on the straight-line path, not a `finally`, so it is skipped by any exception thrown in between: PHP then keeps the overwritten value for the rest of the request — and in a CLI command, a queue worker or a long-running server (Octane, Swoole, RoadRunner, FrankenPHP) for the rest of the process's life — and every later relative path, child-process launch, date, number format, XML parse or error report in ANY class reads it. That failure is silent and remote from its cause: the function that breaks is not the function that moved the value. The durable fix is not to widen the restore but to stop mutating the global: pass the value to the operation that needs it — `cwd` and `env` to Symfony `Process` (`new Process($command, $cwd, $env)`) or `proc_open($command, $spec, $pipes, $cwd, $env)`, absolute paths instead of `chdir`, an explicit `DateTimeZone` or locale to `DateTimeImmutable`/`IntlDateFormatter`/`NumberFormatter`, an explicit encoding to the `mb_*` call, `LIBXML_NOERROR`/`libxml_get_errors` handling in one place. Where the global genuinely must move, wrap it `try`/`finally` so the restore runs on every path. — wp-content/plugins/woocommerce/src/Admin/API/Reports/TimeInterval.php:328
`wc_string_to_timestamp` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the default timezone (changed at line 747, put back at line 755) — which says the change was meant to last no longer than this call. But the restore is an ordinary statement on the straight-line path, not a `finally`, so it is skipped by any exception thrown in between: PHP then keeps the overwritten value for the rest of the request — and in a CLI command, a queue worker or a long-running server (Octane, Swoole, RoadRunner, FrankenPHP) for the rest of the process's life — and every later relative path, child-process launch, date, number format, XML parse or error report in ANY class reads it. That failure is silent and remote from its cause: the function that breaks is not the function that moved the value. The durable fix is not to widen the restore but to stop mutating the global: pass the value to the operation that needs it — `cwd` and `env` to Symfony `Process` (`new Process($command, $cwd, $env)`) or `proc_open($command, $spec, $pipes, $cwd, $env)`, absolute paths instead of `chdir`, an explicit `DateTimeZone` or locale to `DateTimeImmutable`/`IntlDateFormatter`/`NumberFormatter`, an explicit encoding to the `mb_*` call, `LIBXML_NOERROR`/`libxml_get_errors` handling in one place. Where the global genuinely must move, wrap it `try`/`finally` so the restore runs on every path. — wp-content/plugins/woocommerce/includes/wc-formatting-functions.php:741
What to do
Each finding names the statement that changes the process-global value and the statement that puts it back. Confirm from the two that nothing between them is protected — then prefer removing the mutation over widening the restore: a working directory or an environment variable passed to the operation that needs it (the `cwd` and `env` options of `child_process`, or of `Deno.Command`) is scoped to that operation, which is what the save-and-restore was trying to approximate. Where the global genuinely must move, a `try`/`finally` is the least that makes the restore unconditional. In PHP the same holds for `chdir`, `putenv`, `setlocale`, `date_default_timezone_set`, `ini_set` and the error-handler stack: pass the value to the operation (`Process` with `cwd`/`env`, an explicit `DateTimeZone`) or restore in a `finally`.
Other · Code Health — Whether async functions that make a cancellable request accept or pass on an AbortSignal (adoption curve).
Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.
Only 0/1 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
`select` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — wp-content/plugins/woocommerce/assets/js/frontend/a8c-address-autocomplete-service.js:396
What to do
Thread an AbortSignal through async functions that make requests, so the work stops when its caller gives up.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.
Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.
Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X27 · Collection changed while being enumerated7.9 / 10Strong✓ Tool-verified
Other · Code Health — Whether a `foreach` leaves the array or collection it is walking alone — PHP raises nothing, but the loop's view and the collection part: an array walked by value (and a Doctrine or Laravel collection) is walked as the snapshot taken when the loop began, so an element added in the body is never visited and one removed is visited anyway; an array walked by reference (`as &$v`) and an SPL container (`SplObjectStorage`, `ArrayObject`, `SplQueue`) are walked live, so an added element is walked too and a removal skips the next one; and after an `array_splice`, `array_shift` or sort every later key names a different element.
Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.
line 377 walks `$preload_settings` by value, so the walk is the snapshot taken when the loop began, and line 379 changes that same collection with `$preload_settings = …` before the next iteration: the loop carries on over the old value while the body now works on the new one. PHP raises nothing, so the loop completes over a different set than the code meant. — wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:377
line 169 walks `$preload_settings` by value, so the walk is the snapshot taken when the loop began, and line 171 changes that same collection with `$preload_settings = …` before the next iteration: the loop carries on over the old value while the body now works on the new one. PHP raises nothing, so the loop completes over a different set than the code meant. — wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php:169
line 97 walks `$edges` by value, so the walk is the snapshot taken when the loop began, and line 99 changes that same collection with `$edges = …` before the next iteration: the loop carries on over the old value while the body now works on the new one. PHP raises nothing, so the loop completes over a different set than the code meant. — wp-content/plugins/woocommerce/src/Api/Pagination/Connection.php:97
line 999 walks `$page_ids` by value, so the walk is the snapshot taken when the loop began, and line 1000 changes that same collection with `$page_ids = …` before the next iteration: the loop carries on over the old value while the body now works on the new one. PHP raises nothing, so the loop completes over a different set than the code meant. — wp-content/plugins/woocommerce/includes/wc-core-functions.php:999
line 1328 walks `$results` by value, so the walk is the snapshot taken when the loop began, and line 1337 changes that same collection with `$results[] = …` before the next iteration: the added element is never visited by this loop, so whatever it was added for is not done here. PHP raises nothing, so the loop completes over a different set than the code meant. — wp-content/plugins/woocommerce/includes/wc-core-functions.php:1328
line 1222 walks `$product_cats` by value, so the walk is the snapshot taken when the loop began, and line 1223 changes that same collection with `$product_cats = …` before the next iteration: the loop carries on over the old value while the body now works on the new one. PHP raises nothing, so the loop completes over a different set than the code meant. — wp-content/plugins/woocommerce/includes/wc-product-functions.php:1222
line 502 walks `$term_ids` by value, so the walk is the snapshot taken when the loop began, and line 503 changes that same collection with `$term_ids = …` before the next iteration: the loop carries on over the old value while the body now works on the new one. PHP raises nothing, so the loop completes over a different set than the code meant. — wp-content/plugins/woocommerce/includes/wc-term-functions.php:502
line 296 walks `$terms` by value, so the walk is the snapshot taken when the loop began, and line 299 changes that same collection with `$terms[] = …` before the next iteration: the added element is never visited by this loop, so whatever it was added for is not done here. PHP raises nothing, so the loop completes over a different set than the code meant. — wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-products.php:296
line 340 walks `$categories` by value, so the walk is the snapshot taken when the loop began, and line 343 changes that same collection with `$categories[] = …` before the next iteration: the added element is never visited by this loop, so whatever it was added for is not done here. PHP raises nothing, so the loop completes over a different set than the code meant. — wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-products.php:340
What to do
Each finding names the two lines that cannot both stand — the `foreach` over the collection, and the change to it in the body. Confirm from those two, then pick one: build the result instead of editing the walked collection (`$kept = array_filter($items, $keep)`, `$batch->reject(…)`); for a worklist, loop `while (($next = array_shift($queue)) !== null)` so what is added is visited; walk a copy (`foreach (array_values($items) as …)`, `foreach (clone $storage as …)`) and change the original; remove only the CURRENT element (`unset($items[$key])`), which an array walk tolerates; or — where only the first match was ever meant — `break` straight after the change.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×10) — wp-includes/PHPMailer/PHPMailer.php:3017, wp-includes/PHPMailer/POP3.php:354, wp-includes/PHPMailer/POP3.php:362, …
`catch (\Throwable)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×12) — wp-content/plugins/woocommerce/src/Internal/StockNotifications/Frontend/SignupService.php:279, wp-content/plugins/woocommerce/src/Internal/StockNotifications/AsyncTasks/NotificationsProcessor.php:231, wp-content/plugins/woocommerce/src/Internal/ShopperLists/ShopperList.php:225, …
`catch (\Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×8) — wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/LookupDataStore.php:83, wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:3192, wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableQuery.php:1074, …
`catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×10) — wp-content/plugins/woocommerce/src/Internal/Orders/MobileMessagingHandler.php:48, wp-content/plugins/woocommerce/src/Internal/Orders/MobileMessagingHandler.php:88, wp-content/plugins/woocommerce/src/Internal/Orders/OrderAttributionController.php:377, …
What to do
Swallowed exception (empty catch)
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether PHP's static analysis checks null and is not undermined by a nullness baseline — PHPStan from level 8 (`checkNullables`) or Psalm at `errorLevel` 3 or stricter is what makes `?User` a type whose method call is an error, and the null entries of a baseline, `@psalm-suppress PossiblyNull…` and `@phpstan-ignore *.nonObject` are what silence it.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
This repository commits no PHPStan or Psalm configuration (`phpstan.neon[.dist]`, `phpstan.dist.neon`, `psalm.xml[.dist]`, or one a composer.json script names with `--configuration`), so nothing checks null: a `?Customer` reaches `->name()` silently and throws `Error: Call to a member function name() on null` the first time it is null. If the build passes a level on a command line instead, put it in a committed configuration — this check reads configuration, and configuration is all it can read.
What to do
Raise PHPStan to level 8 (`level: 8` in `phpstan.neon.dist`, or `max`) or Psalm to `errorLevel="3"` or stricter, so `?Type` is a type the checker holds you to; generate a baseline for what that surfaces only to pay it down, not to keep it. Then resolve the baselined nullness errors rather than adding to them: each is a call on a value the checker showed could be null — narrow it (`if ($x === null) { … }`, `?->`, an early return), make the property non-nullable and initialise it in the constructor, or change the return type so the null cannot arrive.
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 13 of 55 WCAG 2.2 Level A/AA success criteria (24%; ≈26% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 42 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 3 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X6 Hand-rolled structured-format parsing — 3 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 4 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 6 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
C3 Audit Trail — Not assessed: this repository stores data through '$wpdb' (wp-cron.php:65) but declares no persisted model this check reads (Laravel migration columns, Eloquent $fillable/$hidden lists, Doctrine #[ORM\Column] properties). Personal data may be written through raw SQL or a hosted backend, so whether its changes need an audit trail could not be established, and the trail's absence is not scored.
C4 Data Retention — Not assessed: this repository stores data through '$wpdb' (wp-cron.php:65) but declares no persisted model this check reads (Laravel migration columns, Eloquent $fillable/$hidden lists, Doctrine #[ORM\Column] properties). Personal data may be written through raw SQL or a hosted backend, so whether a retention limit applies here could not be established, and its absence is not scored.
C5 Data-Subject Rights — Not assessed: this repository stores data through '$wpdb' (wp-cron.php:65) but declares no persisted model this check reads (Laravel migration columns, Eloquent $fillable/$hidden lists, Doctrine #[ORM\Column] properties). Personal data may be written through raw SQL or a hosted backend, so whether data-subject rights apply here could not be established, and their absence is not scored.
P4 Deployment & Rollback — not evidenced — no deploy/rollback/approval signal in the repo; absence of evidence is not evidence of a manual release
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
P6 Release Hygiene — not evidenced — no changelog, version stamp or semver release tag in the repo
Not included — 65 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC6 Visual & motion safety — Visual & motion safety could not be assessed in this run — the check did not complete, so it is not scored. This is a gap in the analyzer, not a finding about this repository.
AX1 Captive dependencies — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX2 Stateful singletons — Not applicable: PHP builds its object graph per request and shares none of it between requests. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — no test/production split to check
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
AXB1 Runtime evidence locked — no reproducible boot — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
C1 Data Protection — Not assessed: this repository stores data through '$wpdb' (wp-cron.php:65) but declares no persisted model this check reads (Laravel migration columns, Eloquent $fillable/$hidden lists, Doctrine #[ORM\Column] properties). Personal data may be written through raw SQL or a hosted backend, so the absence of a personal-data field here is not evidence that none is stored, and encryption at rest is not scored over a subject that could not be established.
D10 Test Quality — ~607 lines of test source are present (.php) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
D11 Test Reliability — Test reliability not included — no .php test runner
D12 Dependency Hygiene — Dependency hygiene not measured — no supported dependency manifest was read
D14 License Compliance — No dependency manifest found — no declared dependency closure to grade for licences
D16 Bus Factor — single-contributor repository — bus factor is not applicable
D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
D19 Documentation Quality — D19 reads .NET projects and npm packages as units; 1 folder(s) declared by composer.json were not judged for an overview, an example or the map.
D21 Naming Consistency — Naming consistency does not read PHP yet; not measured.
D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Aggregate roots were found in only one source directory (woocommerce), which is a layered codebase, not two contexts. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D25 ADR Conformance — None of 0 binding record(s) states a rule in checkable form (a backticked element with a prohibition, or an `adr-rules` block), so conformance cannot be read from the code. Write the rule as an `adr-rules` block (`forbid:` a symbol, a package or a dependency) to make it checkable.
D26 Project Cohesion — This repository is one build unit, `wp-content/plugins/woocommerce/lib` (0 LoC, 1 module-visible types across 1 directories), within the size bounds. Not scored: a single unit of this size gives project cohesion nothing to grade.
D27 Navigability — symbol resolution incomplete — navigability not assessed
D30 Dependency Vulnerabilities — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Python pyproject.toml/requirements.txt (pip/uv/Poetry), a Swift Package.swift/Package.resolved, a Cargo manifest, a Go module (go.mod/go.sum), a Gradle version catalogue, a Maven POM, an sbt build (build.sbt), composer.json, package.json, a Dart pubspec.yaml, an Elixir mix.exs/mix.lock (Hex), a rebar.config / erlang.mk DEPS (Hex), a Ruby Gemfile/Gemfile.lock or .gemspec (Bundler/RubyGems) — not scanned yet).
D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
D34 Knowledge Freshness — too few commits to judge knowledge freshness
D36 Supply-chain Provenance & Signing — No CI/build pipeline found (.github/.forgejo/.gitea workflows, .circleci, .buildkite, .woodpecker, .teamcity, .gitlab-ci.yml, .travis.yml, bitbucket-pipelines.yml, .drone.yml, .cirrus.yml, .woodpecker.yml, appveyor.yml, azure-pipelines*.yml, .pipelines/, .vsts-ci/, .azuredevops/, Jenkinsfile); there is no build to attest provenance for.
D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D43 Malicious Dependencies — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Python pyproject.toml/requirements.txt (pip/uv/Poetry), a Swift Package.swift/Package.resolved, a Cargo manifest, a Go module (go.mod/go.sum), a Gradle version catalogue, a Maven POM, an sbt build (build.sbt), composer.json, package.json, a Dart pubspec.yaml, an Elixir mix.exs/mix.lock (Hex), a rebar.config / erlang.mk DEPS (Hex), a Ruby Gemfile/Gemfile.lock or .gemspec (Bundler/RubyGems) — not scanned yet).
D44 Platform End-of-Life — Platform end-of-life not assessed — this repository declares no platform this pass reads
D8 Code Coverage — Coverage not included — suite not readable by the collector
DM2 Strongly-typed ids — no id-bearing domain types detected — strongly-typed-id adoption not assessable
DM3 Integration-event coupling — no integration events detected — coupling check not applicable
DM7 Repository granularity — no repository abstraction detected (e.g. uses a document session)
DM8 Value-object opportunities — not scored — the deterministic rule found 0 candidate clump(s); its rows are withheld until it has a measured precision of 95 % (a sample of fewer than 10 rows cannot show one)
ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
M4 Documentation accuracy — Not applicable: the 1 current-state document(s) make no claim of a kind M4 checks.
P12 CI test-gate honesty — no CI workflow found
P7 Outbound HTTP resilience — no outbound HTTP usage detected — no HTTP client call or construction in the JavaScript/TypeScript, PHP source (service entry point: wp-activate.php:29 ($_GET[))
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for PHPBench subjects (`bench*` methods, or `@Subject`/`#[Subject]` ones) in a file importing PhpBench or carrying its annotations, `bench*` methods in a `*Bench.php` file where PHPBench is installed, or phpbench/phpbench in a composer.json or a phpbench.json, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
R5 Dependency Freshness — no package-lock.json — dependency freshness not measured (would require an npm lockfile); JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
R6 Tooling — no package.json in the repository — test/lint/typecheck wiring is read from package.json scripts (corroborated against CI), so this project's own toolchain isn't measured here
R8 Dependency Hygiene — Not measured — no package.json declares any dependency, so there is nothing to check imports against (imports may resolve through a host runtime rather than node).
X1 Async correctness — X1 reached only 13% of this repository's production lines — php (579,088 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X12 Unreachable branch — X12 reached only 13% of this repository's production lines — php (579,088 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X24 Document value interpolated into markup unescaped — X24 reached only 13% of this repository's production lines — php (579,088 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X26 Unsynchronised callback handoff — Not applicable: this check looks for a collection written by a callback on one thread while the body waiting on it touches it on another, and in this repository's languages no collection is reachable from two threads at once. PHP gives a request one thread of its own; the event-loop libraries (ReactPHP, Amp) run callbacks one at a time, and ext-parallel copies every value across its channels, so no array or collection is reachable from two threads at once. TypeScript/JavaScript runs every callback on the one thread that owns its objects: a callback runs only when the body waiting on it has yielded, never alongside it, and a worker thread receives a COPY of what it is sent. A SharedArrayBuffer carries raw bytes, never an Array, Map or Set, so no collection is reachable from two threads at once. Not a gap in the analyzer and not a finding about your code.
X29 Per-element action decided by a fixed element — X29 reached only 13% of this repository's production lines — php (579,088 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X4 Structured logging — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
Critical — 95 finding(s)
AC1 · Text alternatives· <img> without a text alternative · ×29
<img> without a text alternative wp-content/plugins/woocommerce/assets/js/admin/marketplace-suggestions.js:174— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative REDACTED:87— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative wp-content/plugins/woocommerce/includes/admin/meta-boxes/views/html-product-data-variations.php:37— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative wp-content/themes/monoka/functions.php:113— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative wp-content/themes/monoka/mini-cart.php:49— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative wp-content/themes/monoka/mini-cart.php:82— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative wp-content/themes/monoka/mini-cart.php:84— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative wp-content/themes/monoka/mini-cart.php:99— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative wp-content/themes/monoka/page-home.php:70— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative REDACTED:26— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative REDACTED:32— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative REDACTED:36— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative REDACTED:42— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative REDACTED:46— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative REDACTED:52— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative REDACTED:56— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative REDACTED:26— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative REDACTED:32— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative REDACTED:36— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative REDACTED:42— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative REDACTED:46— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative REDACTED:52— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative REDACTED:56— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative REDACTED:62— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative REDACTED:66— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
+ 4 more in this group — see findings.md.
AC2 · Forms & labels· <input> without a programmatic label · ×19
<input> without a programmatic label wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:1839— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:3890— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:1839— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:3890— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label REDACTED:1279— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label REDACTED:4300— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label REDACTED:4761— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label REDACTED:5323— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label REDACTED:5379— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label REDACTED:5429— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label REDACTED:5456— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label REDACTED:5628— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label REDACTED:5659— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:95— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:1154— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:1839— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:3890— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label wp-content/plugins/woocommerce/assets/js/select2/select2.js:1839— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label wp-content/plugins/woocommerce/assets/js/select2/select2.js:3890— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC4 · Keyboard semantics· Clickable element isn't keyboard-operable · ×11
Clickable element isn't keyboard-operable REDACTED:969— The repo's own CSS styles .acf-accordion-title with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable REDACTED:3088— The repo's own CSS styles .acf-rel-item with `cursor: pointer`, so this <span> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable REDACTED:3097— The repo's own CSS styles .acf-rel-item with `cursor: pointer`, so this <span> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable REDACTED:3409— The repo's own CSS styles .acf-rel-item with `cursor: pointer`, so this <span> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable REDACTED:3880— The repo's own CSS styles .acf-modal-close with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable wp-content/plugins/advanced-custom-fields-pro/pro/assets/js/acf-pro-input.js:1480— The repo's own CSS styles .acf-gallery-attachment with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable wp-content/plugins/woocommerce/includes/admin/helper/views/html-main.php:163— The repo's own CSS styles .form-toggle with `cursor: pointer`, so this <span> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable wp-content/plugins/woocommerce/includes/admin/helper/views/html-main.php:219— The repo's own CSS styles .form-toggle with `cursor: pointer`, so this <span> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable wp-content/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php:157— The repo's own CSS styles .tips with `cursor: pointer`, so this <span> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable wp-content/themes/monoka/single-product.php:51— The repo's own CSS styles .thumb-inner with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable wp-content/themes/monoka/single-product.php:113— The repo's own CSS styles .swatch-item with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
AC2 · Forms & labels· <label> that labels no control · ×8
<label> that labels no control REDACTED:4299— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-field-conditional-logic.php:25— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-locations.php:9— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control wp-content/plugins/advanced-custom-fields-pro/pro/admin/views/html-settings-updates.php:65— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control wp-content/plugins/advanced-custom-fields-pro/pro/admin/views/html-settings-updates.php:73— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control wp-content/plugins/advanced-custom-fields-pro/pro/admin/views/html-settings-updates.php:81— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control wp-content/plugins/advanced-custom-fields-pro/pro/admin/views/html-settings-updates.php:104— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control wp-content/plugins/advanced-custom-fields-pro/pro/admin/views/html-settings-updates.php:114— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
AC2 · Forms & labels· Link with no accessible name · ×7
Link with no accessible name REDACTED:3098— A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label.
Link with no accessible name REDACTED:6590— A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label.
Link with no accessible name REDACTED:3759— A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label.
Link with no accessible name REDACTED:4013— A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label.
Link with no accessible name wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-field-conditional-logic.php:141— A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label.
Link with no accessible name wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/html-location-rule.php:89— A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label.
Link with no accessible name wp-content/plugins/advanced-custom-fields-pro/pro/assets/js/acf-pro-input.js:1489— A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label.
AC3 · Page structure· <iframe> without a title · ×4
<iframe> without a title REDACTED:90— An iframe with no title (or an empty one) is announced only as "frame". Add a non-empty title describing its content, or an aria-label.
<iframe> without a title REDACTED:93— An iframe with no title (or an empty one) is announced only as "frame". Add a non-empty title describing its content, or an aria-label.
<iframe> without a title REDACTED:2431— An iframe with no title (or an empty one) is announced only as "frame". Add a non-empty title describing its content, or an aria-label.
<iframe> without a title wp-content/themes/monoka/taxonomy-product_cat.php:43— An iframe with no title (or an empty one) is announced only as "frame". Add a non-empty title describing its content, or an aria-label.
AC2 · Forms & labels· <select> without a programmatic label · ×3
<select> without a programmatic label wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:5855— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<select> without a programmatic label wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:72— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<select> without a programmatic label wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:5855— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC3 · Page structure· Document without a <title> · ×3
Document without a <title> wp-content/plugins/woocommerce/assets/js/dompurify/purify.js:822— A page with no <title> gives no name in the tab, history or screen-reader page list. Add a descriptive <title> in <head>.
Document without a <title> wp-content/plugins/woocommerce/src/Internal/ReceiptRendering/Templates/order-receipt.php:2— A page with no <title> gives no name in the tab, history or screen-reader page list. Add a descriptive <title> in <head>.
Document without a <title> wp-content/themes/monoka/header.php:2— A page with no <title> gives no name in the tab, history or screen-reader page list. Add a descriptive <title> in <head>.
AC2 · Forms & labels· <textarea> without a programmatic label · ×2
<textarea> without a programmatic label REDACTED:635— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<textarea> without a programmatic label wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:1158— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<html> without a lang wp-content/plugins/woocommerce/assets/js/dompurify/purify.js:822— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang wp-content/plugins/woocommerce/src/Internal/ReceiptRendering/Templates/order-receipt.php:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
AC5 · ARIA correctness· aria-expanded on a <span> with no role to carry it · ×2
aria-expanded on a <span> with no role to carry it wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:1368— A plain <span> has the implicit role "generic", which supports no ARIA states, so this aria-expanded is dropped and assistive tech is never told the state at all. Put aria-expanded on the element that owns the behaviour (the button or control the user operates), or give this <span> a role that supports aria-expanded.
aria-expanded on a <span> with no role to carry it wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:1362— A plain <span> has the implicit role "generic", which supports no ARIA states, so this aria-expanded is dropped and assistive tech is never told the state at all. Put aria-expanded on the element that owns the behaviour (the button or control the user operates), or give this <span> a role that supports aria-expanded.
AC2 · Forms & labels· <button> with no accessible text · ×1
<button> with no accessible text REDACTED:3875— A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
AC4 · Keyboard semantics· Click handler on a non-interactive <div> · ×1
Click handler on a non-interactive <div> wp-content/themes/monoka/assets/js/cart.js:132— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
MethodTooLong: PaymentsExtensionSuggestions.get_all_extensions_base_details wp-content/plugins/woocommerce/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestions.php:3347— MethodTooLong — get_all_extensions_base_details runs 821 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 721 over it, 8.21× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: WC_REST_Orders_V2_Controller.get_item_schema wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:1150— MethodTooLong — get_item_schema runs 733 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 633 over it, 7.33× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DefaultPaymentGateways.get_all wp-content/plugins/woocommerce/src/Admin/Features/PaymentGatewaySuggestions/DefaultPaymentGateways.php:54— MethodTooLong — get_all runs 723 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 623 over it, 7.23× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: WC_REST_Products_V1_Controller.get_item_schema wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1742— MethodTooLong — get_item_schema runs 669 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 569 over it, 6.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Controller.get_item_schema wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1448— MethodTooLong — get_item_schema runs 567 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 467 over it, 5.67× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: WC_Countries.get_country_locale wp-content/plugins/woocommerce/includes/class-wc-countries.php:896— MethodTooLong — get_country_locale runs 551 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 451 over it, 5.51× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: WC_REST_Products_Controller.get_item_schema wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1178— MethodTooLong — get_item_schema runs 536 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 436 over it, 5.36× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: WC_REST_Products_V2_Controller.get_item_schema wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1837— MethodTooLong — get_item_schema runs 488 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 388 over it, 4.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ProductSchema.get_properties wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductSchema.php:52— MethodTooLong — get_properties runs 423 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 323 over it, 4.23× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: WC_REST_Order_Refunds_V2_Controller.get_item_schema wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php:374— MethodTooLong — get_item_schema runs 389 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 289 over it, 3.89× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: OrderSchema.get_item_schema_properties wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Schema/OrderSchema.php:109— MethodTooLong — get_item_schema_properties runs 368 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 268 over it, 3.68× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: PaymentsRestController.get_schema_for_payment_provider wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsRestController.php:687— MethodTooLong — get_schema_for_payment_provider runs 343 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 243 over it, 3.43× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DefaultPaymentGateways.get_recommendation_priority wp-content/plugins/woocommerce/src/Admin/Features/PaymentGatewaySuggestions/DefaultPaymentGateways.php:1140— MethodTooLong — get_recommendation_priority runs 340 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 240 over it, 3.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DefaultMarketingRecommendations.get_all wp-content/plugins/woocommerce/src/Admin/Features/MarketingRecommendations/DefaultMarketingRecommendations.php:19— MethodTooLong — get_all runs 328 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 228 over it, 3.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DefaultFreeExtensions.get_plugin wp-content/plugins/woocommerce/src/Internal/Admin/RemoteFreeExtensions/DefaultFreeExtensions.php:110— MethodTooLong — get_plugin runs 324 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 224 over it, 3.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: WC_Meta_Box_Order_Data.output wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:192— MethodTooLong — output runs 323 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 223 over it, 3.23× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: WooPaymentsRestController.register_routes wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:65— MethodTooLong — register_routes runs 309 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 209 over it, 3.09× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: WC_REST_Product_Variations_Controller.get_item_schema wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:552— MethodTooLong — get_item_schema runs 305 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 205 over it, 3.05× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: FeaturesController.init_feature_definitions REDACTED:288— MethodTooLong — init_feature_definitions runs 284 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 184 over it, 2.84× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: WC_REST_Product_Variations_V2_Controller.get_item_schema wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:773— MethodTooLong — get_item_schema runs 280 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 180 over it, 2.80× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: WC_Report_Sales_By_Date.query_report_data wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-date.php:49— MethodTooLong — query_report_data runs 277 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 177 over it, 2.77× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Products.get_collection_params wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Products.php:107— MethodTooLong — get_collection_params runs 252 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 152 over it, 2.52× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: WC_Settings_General.get_settings_for_default_section wp-content/plugins/woocommerce/includes/admin/settings/class-wc-settings-general.php:64— MethodTooLong — get_settings_for_default_section runs 251 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 151 over it, 2.51× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: SimpleProductTemplate.add_general_group_blocks wp-content/plugins/woocommerce/src/Internal/Features/ProductBlockEditor/ProductTemplates/SimpleProductTemplate.php:153— MethodTooLong — add_general_group_blocks runs 250 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 150 over it, 2.50× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ItemSchema.get_properties wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ItemSchema.php:16— MethodTooLong — get_properties runs 247 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 147 over it, 2.47× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FileTooLong: REDACTED REDACTED— FileTooLong — 4341 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 1500 significant lines; this is 2841 over it, 2.89× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: selectWoo/selectWoo.full.js wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js— FileTooLong — 3997 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 1500 significant lines; this is 2497 over it, 2.66× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: 4/select2.full.js wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js— FileTooLong — 3891 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 1500 significant lines; this is 2391 over it, 2.59× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: select2/select2.full.js wp-content/plugins/woocommerce/assets/js/select2/select2.full.js— FileTooLong — 3891 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 1500 significant lines; this is 2391 over it, 2.59× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: selectWoo/selectWoo.js wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js— FileTooLong — 3590 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 1500 significant lines; this is 2090 over it, 2.39× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: 4/select2.js wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js— FileTooLong — 3495 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 1500 significant lines; this is 1995 over it, 2.33× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: select2/select2.js wp-content/plugins/woocommerce/assets/js/select2/select2.js— FileTooLong — 3495 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 1500 significant lines; this is 1995 over it, 2.33× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: Suggestions/PaymentsExtensionSuggestions.php wp-content/plugins/woocommerce/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestions.php— FileTooLong — 2944 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: PaymentsExtensionSuggestions (18-4568). The bar is 500 significant lines; this is 2444 over it, 5.89× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: PHPMailer/PHPMailer.php wp-includes/PHPMailer/PHPMailer.php— FileTooLong — 2225 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: PHPMailer (32-5525). The bar is 500 significant lines; this is 1725 over it, 4.45× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: REDACTED REDACTED— FileTooLong — 2019 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1519 over it, 4.04× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 1995 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: WC_AJAX (31-4294). The bar is 500 significant lines; this is 1495 over it, 3.99× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: js/free.js wp-content/themes/monoka/assets/font-awesome/js/free.js— FileTooLong — 1900 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1400 over it, 3.80× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: js/pro.js wp-content/themes/monoka/assets/font-awesome/js/pro.js— FileTooLong — 1811 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 1500 significant lines; this is 311 over it, 1.21× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: includes/class-wc-install.php wp-content/plugins/woocommerce/includes/class-wc-install.php— FileTooLong — 1801 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1301 over it, 3.60× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: jquery-flot/jquery.flot.js wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js— FileTooLong — 1784 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1284 over it, 3.57× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 1607 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 1500 significant lines; this is 107 over it, 1.07× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: Version1/class-wc-rest-products-v1-controller.php wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php— FileTooLong — 1553 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: WC_REST_Products_V1_Controller (30-2653). The bar is 500 significant lines; this is 1053 over it, 3.11× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: REDACTED REDACTED— FileTooLong — 1536 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 1500 significant lines; this is 36 over it, 1.02× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: includes/wc-update-functions.php wp-content/plugins/woocommerce/includes/wc-update-functions.php— FileTooLong — 1525 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1025 over it, 3.05× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: Version2/class-wc-rest-products-v2-controller.php wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php— FileTooLong — 1512 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: WC_REST_Products_V2_Controller (28-2581). The bar is 500 significant lines; this is 1012 over it, 3.02× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: Orders/OrdersTableDataStore.php wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php— FileTooLong — 1498 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: OrdersTableDataStore (29-3565). The bar is 500 significant lines; this is 998 over it, 3.00× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: Products/Controller.php wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php— FileTooLong — 1487 significant lines (blank, comment-only and punctuation-only lines excluded), about 98% of them inside a single declaration: Controller (44-2606). The bar is 500 significant lines; this is 987 over it, 2.97× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: REDACTED REDACTED— FileTooLong — 1469 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: WC_Admin_Setup_Wizard (21-2369). The bar is 500 significant lines; this is 969 over it, 2.94× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: helper/class-wc-helper.php wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php— FileTooLong — 1419 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: WC_Helper (21-2933). The bar is 500 significant lines; this is 919 over it, 2.84× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: timepicker/jquery-ui-timepicker-addon.js wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js— FileTooLong — 1416 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 916 over it, 2.83× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
ClassTooLong: PaymentsExtensionSuggestions wp-content/plugins/woocommerce/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestions.php:18— ClassTooLong — 2936 significant lines (blank, comment-only and punctuation-only lines excluded), 15 methods. The bar is 400 significant lines; this is 2536 over it, 7.34× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PHPMailer wp-includes/PHPMailer/PHPMailer.php:32— ClassTooLong — 2223 significant lines (blank, comment-only and punctuation-only lines excluded), 128 methods. The bar is 400 significant lines; this is 1823 over it, 5.56× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WC_AJAX REDACTED:31— ClassTooLong — 1976 significant lines (blank, comment-only and punctuation-only lines excluded), 112 methods. The bar is 400 significant lines; this is 1576 over it, 4.94× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WC_REST_Products_V1_Controller wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:30— ClassTooLong — 1544 significant lines (blank, comment-only and punctuation-only lines excluded), 36 methods. The bar is 400 significant lines; this is 1144 over it, 3.86× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WC_REST_Products_V2_Controller wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:28— ClassTooLong — 1502 significant lines (blank, comment-only and punctuation-only lines excluded), 35 methods. The bar is 400 significant lines; this is 1102 over it, 3.76× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: OrdersTableDataStore wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:29— ClassTooLong — 1480 significant lines (blank, comment-only and punctuation-only lines excluded), 112 methods. The bar is 400 significant lines; this is 1080 over it, 3.70× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WC_Admin_Setup_Wizard REDACTED:21— ClassTooLong — 1465 significant lines (blank, comment-only and punctuation-only lines excluded), 64 methods. The bar is 400 significant lines; this is 1065 over it, 3.66× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Controller wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:44— ClassTooLong — 1463 significant lines (blank, comment-only and punctuation-only lines excluded), 26 methods. The bar is 400 significant lines; this is 1063 over it, 3.66× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WC_Helper wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:21— ClassTooLong — 1412 significant lines (blank, comment-only and punctuation-only lines excluded), 73 methods. The bar is 400 significant lines; this is 1012 over it, 3.53× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WC_REST_Orders_V2_Controller wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:28— ClassTooLong — 1312 significant lines (blank, comment-only and punctuation-only lines excluded), 32 methods. The bar is 400 significant lines; this is 912 over it, 3.28× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WC_REST_Products_Controller wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:28— ClassTooLong — 1262 significant lines (blank, comment-only and punctuation-only lines excluded), 19 methods. The bar is 400 significant lines; this is 862 over it, 3.16× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WC_Product_Data_Store_CPT wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:27— ClassTooLong — 1245 significant lines (blank, comment-only and punctuation-only lines excluded), 52 methods. The bar is 400 significant lines; this is 845 over it, 3.11× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: DefaultPaymentGateways wp-content/plugins/woocommerce/src/Admin/Features/PaymentGatewaySuggestions/DefaultPaymentGateways.php:16— ClassTooLong — 1169 significant lines (blank, comment-only and punctuation-only lines excluded), 10 methods. The bar is 400 significant lines; this is 769 over it, 2.92× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WooPaymentsService wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:23— ClassTooLong — 1111 significant lines (blank, comment-only and punctuation-only lines excluded), 65 methods. The bar is 400 significant lines; this is 711 over it, 2.78× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WC_Countries wp-content/plugins/woocommerce/includes/class-wc-countries.php:16— ClassTooLong — 978 significant lines (blank, comment-only and punctuation-only lines excluded), 36 methods. The bar is 400 significant lines; this is 578 over it, 2.45× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WC_Abstract_Order wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:33— ClassTooLong — 949 significant lines (blank, comment-only and punctuation-only lines excluded), 115 methods. The bar is 400 significant lines; this is 549 over it, 2.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: FeaturesController REDACTED:37— ClassTooLong — 914 significant lines (blank, comment-only and punctuation-only lines excluded), 46 methods. The bar is 400 significant lines; this is 514 over it, 2.29× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: PaymentsRestController wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsRestController.php:18— ClassTooLong — 877 significant lines (blank, comment-only and punctuation-only lines excluded), 23 methods. The bar is 400 significant lines; this is 477 over it, 2.19× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: MobileAppQRLogin wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:24— ClassTooLong — 863 significant lines (blank, comment-only and punctuation-only lines excluded), 42 methods. The bar is 400 significant lines; this is 463 over it, 2.16× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WC_Cart wp-content/plugins/woocommerce/includes/class-wc-cart.php:29— ClassTooLong — 829 significant lines (blank, comment-only and punctuation-only lines excluded), 114 methods. The bar is 400 significant lines; this is 429 over it, 2.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WC_Order wp-content/plugins/woocommerce/includes/class-wc-order.php:22— ClassTooLong — 819 significant lines (blank, comment-only and punctuation-only lines excluded), 145 methods. The bar is 400 significant lines; this is 419 over it, 2.05× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: ListTable REDACTED:17— ClassTooLong — 814 significant lines (blank, comment-only and punctuation-only lines excluded), 56 methods. The bar is 400 significant lines; this is 414 over it, 2.04× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WC_REST_Product_Variations_Controller wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:30— ClassTooLong — 809 significant lines (blank, comment-only and punctuation-only lines excluded), 13 methods. The bar is 400 significant lines; this is 409 over it, 2.02× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: SimpleProductTemplate wp-content/plugins/woocommerce/src/Internal/Features/ProductBlockEditor/ProductTemplates/SimpleProductTemplate.php:18— ClassTooLong — 770 significant lines (blank, comment-only and punctuation-only lines excluded), 12 methods. The bar is 400 significant lines; this is 370 over it, 1.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: WooPaymentsRestController wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:21— ClassTooLong — 743 significant lines (blank, comment-only and punctuation-only lines excluded), 24 methods. The bar is 400 significant lines; this is 343 over it, 1.86× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WC_Product wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php:34— TooManyMethods — 175 methods. The bar is 30 methods; this is 145 over it, 5.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WC_Order wp-content/plugins/woocommerce/includes/class-wc-order.php:22— TooManyMethods — 145 methods. The bar is 30 methods; this is 115 over it, 4.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: wc-update-functions wp-content/plugins/woocommerce/includes/wc-update-functions.php:1— TooManyMethods — 144 methods. The bar is 30 methods; this is 114 over it, 4.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: PHPMailer wp-includes/PHPMailer/PHPMailer.php:32— TooManyMethods — 128 methods. The bar is 30 methods; this is 98 over it, 4.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WC_Abstract_Order wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:33— TooManyMethods — 115 methods. The bar is 30 methods; this is 85 over it, 3.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: api-helpers wp-content/plugins/advanced-custom-fields-pro/includes/api/api-helpers.php:1— TooManyMethods — 114 methods. The bar is 30 methods; this is 84 over it, 3.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WC_Cart wp-content/plugins/woocommerce/includes/class-wc-cart.php:29— TooManyMethods — 114 methods. The bar is 30 methods; this is 84 over it, 3.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WC_AJAX REDACTED:31— TooManyMethods — 112 methods. The bar is 30 methods; this is 82 over it, 3.73× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: OrdersTableDataStore wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:29— TooManyMethods — 112 methods. The bar is 30 methods; this is 82 over it, 3.73× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: wc-deprecated-functions wp-content/plugins/woocommerce/includes/wc-deprecated-functions.php:1— TooManyMethods — 110 methods. The bar is 30 methods; this is 80 over it, 3.67× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WC_Customer wp-content/plugins/woocommerce/includes/class-wc-customer.php:18— TooManyMethods — 92 methods. The bar is 30 methods; this is 62 over it, 3.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: wc-core-functions wp-content/plugins/woocommerce/includes/wc-core-functions.php:1— TooManyMethods — 87 methods. The bar is 30 methods; this is 57 over it, 2.90× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WC_Helper wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:21— TooManyMethods — 73 methods. The bar is 30 methods; this is 43 over it, 2.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WC_Coupon REDACTED:22— TooManyMethods — 72 methods. The bar is 30 methods; this is 42 over it, 2.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: PromptBuilder wp-includes/php-ai-client/src/Builders/PromptBuilder.php:50— TooManyMethods — 72 methods. The bar is 30 methods; this is 42 over it, 2.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WooCommerce wp-content/plugins/woocommerce/includes/class-woocommerce.php:52— TooManyMethods — 69 methods. The bar is 30 methods; this is 39 over it, 2.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WC_Install wp-content/plugins/woocommerce/includes/class-wc-install.php:30— TooManyMethods — 67 methods. The bar is 30 methods; this is 37 over it, 2.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: wc-formatting-functions wp-content/plugins/woocommerce/includes/wc-formatting-functions.php:1— TooManyMethods — 66 methods. The bar is 30 methods; this is 36 over it, 2.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: wc-template-functions REDACTED:1— TooManyMethods — 66 methods. The bar is 30 methods; this is 36 over it, 2.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WooPaymentsService wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:23— TooManyMethods — 65 methods. The bar is 30 methods; this is 35 over it, 2.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WC_Admin_Setup_Wizard REDACTED:21— TooManyMethods — 64 methods. The bar is 30 methods; this is 34 over it, 2.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: wc-product-functions wp-content/plugins/woocommerce/includes/wc-product-functions.php:1— TooManyMethods — 64 methods. The bar is 30 methods; this is 34 over it, 2.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: DataStore wp-content/plugins/woocommerce/src/Admin/API/Reports/DataStore.php:64— TooManyMethods — 60 methods. The bar is 30 methods; this is 30 over it, 2.00× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ListTable REDACTED:17— TooManyMethods — 56 methods. The bar is 30 methods; this is 26 over it, 1.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: WC_Query wp-content/plugins/woocommerce/includes/class-wc-query.php:17— TooManyMethods — 52 methods. The bar is 30 methods; this is 22 over it, 1.73× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Low cohesion: WC_Brands (LCOM4 32) wp-content/plugins/woocommerce/includes/class-wc-brands.php:14— WC_Brands's methods fall into 32 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 32 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: WooCommerce (LCOM4 28) wp-content/plugins/woocommerce/includes/class-woocommerce.php:52— WooCommerce's methods fall into 28 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 28 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: WC_Brands_Admin (LCOM4 23) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-brands.php:18— WC_Brands_Admin's methods fall into 23 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 23 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: WC_Admin_List_Table_Products (LCOM4 23) REDACTED:27— WC_Admin_List_Table_Products's methods fall into 23 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 23 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: DataStore (LCOM4 16) wp-content/plugins/woocommerce/src/Admin/API/Reports/DataStore.php:64— DataStore's methods fall into 16 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 16 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: WC_Emails (LCOM4 15) wp-content/plugins/woocommerce/includes/class-wc-emails.php:26— WC_Emails's methods fall into 15 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 15 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: WC_Countries (LCOM4 12) wp-content/plugins/woocommerce/includes/class-wc-countries.php:16— WC_Countries's methods fall into 12 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 12 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: WC_REST_Controller (LCOM4 12) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-controller.php:30— WC_REST_Controller's methods fall into 12 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 12 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: ShippingController (LCOM4 12) wp-content/plugins/woocommerce/src/Blocks/Shipping/ShippingController.php:19— ShippingController's methods fall into 12 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 12 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: ServerRequest (LCOM4 12) wp-includes/php-ai-client/third-party/Nyholm/Psr7/ServerRequest.php:17— ServerRequest's methods fall into 12 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 12 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: WC_Admin_Taxonomies (LCOM4 11) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-taxonomies.php:19— WC_Admin_Taxonomies's methods fall into 11 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 11 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: WC_Admin_List_Table_Orders (LCOM4 11) wp-content/plugins/woocommerce/includes/admin/list-tables/class-wc-admin-list-table-orders.php:27— WC_Admin_List_Table_Orders's methods fall into 11 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 11 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: WC_Legacy_Cart (LCOM4 11) wp-content/plugins/woocommerce/includes/legacy/class-wc-legacy-cart.php:21— WC_Legacy_Cart's methods fall into 11 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 11 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: Init (LCOM4 11) wp-content/plugins/woocommerce/src/Admin/Features/ProductBlockEditor/Init.php:25— Init's methods fall into 11 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 11 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: WC_Gateway_Paypal (LCOM4 10) wp-content/plugins/woocommerce/includes/gateways/paypal/class-wc-gateway-paypal.php:48— WC_Gateway_Paypal's methods fall into 10 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 10 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: Fulfillment (LCOM4 10) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Fulfillment.php:24— Fulfillment's methods fall into 10 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 10 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: Checkout (LCOM4 10) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Checkout.php:19— Checkout's methods fall into 10 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 10 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: BlockTypesController (LCOM4 10) wp-content/plugins/woocommerce/src/Blocks/BlockTypesController.php:20— BlockTypesController's methods fall into 10 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 10 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: WC_Admin_Importers (LCOM4 9) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-importers.php:16— WC_Admin_Importers's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: FulfillmentsRenderer (LCOM4 9) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsRenderer.php:17— FulfillmentsRenderer's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: Cart (LCOM4 9) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Cart.php:11— Cart's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: WC_Payment_Gateway (LCOM4 8) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-payment-gateway.php:31— WC_Payment_Gateway's methods fall into 8 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 8 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: WC_Settings_API (LCOM4 8) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:17— WC_Settings_API's methods fall into 8 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 8 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: WC_Product_Variable (LCOM4 8) wp-content/plugins/woocommerce/includes/class-wc-product-variable.php:20— WC_Product_Variable's methods fall into 8 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 8 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: WC_Data_Store_WP (LCOM4 8) wp-content/plugins/woocommerce/includes/data-stores/class-wc-data-store-wp.php:17— WC_Data_Store_WP's methods fall into 8 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 8 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
R4 · Test Coverage· No test reaches this file · ×40
No test reaches this file REDACTED:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/plugins/woocommerce/assets/js/select2/select2.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/themes/monoka/assets/font-awesome/js/free.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file REDACTED:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file REDACTED:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file REDACTED:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/themes/monoka/assets/font-awesome/js/pro.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/plugins/advanced-custom-fields-pro/pro/assets/js/acf-pro-input.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product-variation.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/plugins/classic-editor/scripts/post.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart-variation.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/plugins/woocommerce/assets/js/admin/variation-gallery.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file wp-content/plugins/woocommerce/assets/js/sourcebuster/sourcebuster.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file REDACTED:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
(anonymous)::(anonymous)::apply (cognitive 74) wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:4565— (anonymous)::(anonymous)::apply has cognitive complexity 74 (threshold 15). Drivers by points: if/else 34 (59 pts), error handling 2 (7 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::(anonymous)::apply (cognitive 74) wp-content/plugins/woocommerce/assets/js/select2/select2.js:4565— (anonymous)::(anonymous)::apply has cognitive complexity 74 (threshold 15). Drivers by points: if/else 34 (59 pts), error handling 2 (7 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::(anonymous)::apply (cognitive 74) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:4705— (anonymous)::(anonymous)::apply has cognitive complexity 74 (threshold 15). Drivers by points: if/else 34 (59 pts), error handling 2 (7 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::(anonymous)::apply (cognitive 74) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:4689— (anonymous)::(anonymous)::apply has cognitive complexity 74 (threshold 15). Drivers by points: if/else 34 (59 pts), error handling 2 (7 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::(anonymous)::apply (cognitive 74) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:4565— (anonymous)::(anonymous)::apply has cognitive complexity 74 (threshold 15). Drivers by points: if/else 34 (59 pts), error handling 2 (7 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::(anonymous)::apply (cognitive 74) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:4565— (anonymous)::(anonymous)::apply has cognitive complexity 74 (threshold 15). Drivers by points: if/else 34 (59 pts), error handling 2 (7 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::(anonymous)::(anonymous)::normalize (cognitive 63) wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:65— (anonymous)::(anonymous)::(anonymous)::normalize has cognitive complexity 63 (threshold 15). Drivers by points: if/else 16 (43 pts), boolean chains 11, loops 3 (9 pts) (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
(anonymous)::(anonymous)::(anonymous)::normalize (cognitive 63) wp-content/plugins/woocommerce/assets/js/select2/select2.js:65— (anonymous)::(anonymous)::(anonymous)::normalize has cognitive complexity 63 (threshold 15). Drivers by points: if/else 16 (43 pts), boolean chains 11, loops 3 (9 pts) (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
(anonymous)::(anonymous)::(anonymous)::normalize (cognitive 63) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:65— (anonymous)::(anonymous)::(anonymous)::normalize has cognitive complexity 63 (threshold 15). Drivers by points: if/else 16 (43 pts), boolean chains 11, loops 3 (9 pts) (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
(anonymous)::(anonymous)::(anonymous)::normalize (cognitive 63) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:65— (anonymous)::(anonymous)::(anonymous)::normalize has cognitive complexity 63 (threshold 15). Drivers by points: if/else 16 (43 pts), boolean chains 11, loops 3 (9 pts) (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
(anonymous)::(anonymous)::(anonymous)::normalize (cognitive 59) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:77— (anonymous)::(anonymous)::(anonymous)::normalize has cognitive complexity 59 (threshold 15). Drivers by points: if/else 15 (39 pts), boolean chains 12, loops 3 (8 pts) (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
(anonymous)::(anonymous)::(anonymous)::normalize (cognitive 59) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:77— (anonymous)::(anonymous)::(anonymous)::normalize has cognitive complexity 59 (threshold 15). Drivers by points: if/else 15 (39 pts), boolean chains 12, loops 3 (8 pts) (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
(anonymous)::do_variation_action (cognitive 36) wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product-variation.js:1230— (anonymous)::do_variation_action has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (32 pts), boolean chains 3, match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::(anonymous)::fromElement (cognitive 30) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:5071— (anonymous)::(anonymous)::fromElement has cognitive complexity 30 (threshold 15). Drivers by points: if/else 19 (25 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
(anonymous)::(anonymous)::(anonymous)::main (cognitive 29) wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:304— (anonymous)::(anonymous)::(anonymous)::main has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 7, ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::(anonymous)::fromElement (cognitive 29) wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:4931— (anonymous)::(anonymous)::fromElement has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::(anonymous)::(anonymous)::main (cognitive 29) wp-content/plugins/woocommerce/assets/js/select2/select2.js:304— (anonymous)::(anonymous)::(anonymous)::main has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 7, ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::(anonymous)::fromElement (cognitive 29) wp-content/plugins/woocommerce/assets/js/select2/select2.js:4931— (anonymous)::(anonymous)::fromElement has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::(anonymous)::(anonymous)::main (cognitive 29) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:321— (anonymous)::(anonymous)::(anonymous)::main has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 7, ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::(anonymous)::(anonymous)::main (cognitive 29) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:321— (anonymous)::(anonymous)::(anonymous)::main has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 7, ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::(anonymous)::fromElement (cognitive 29) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:5055— (anonymous)::(anonymous)::fromElement has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::(anonymous)::(anonymous)::main (cognitive 29) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:304— (anonymous)::(anonymous)::(anonymous)::main has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 7, ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::(anonymous)::fromElement (cognitive 29) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:4931— (anonymous)::(anonymous)::fromElement has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::(anonymous)::(anonymous)::main (cognitive 29) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:304— (anonymous)::(anonymous)::(anonymous)::main has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 7, ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::(anonymous)::fromElement (cognitive 29) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:4931— (anonymous)::(anonymous)::fromElement has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Frontend/SignupService.php:279— `catch (\Throwable)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/StockNotifications/AsyncTasks/NotificationsProcessor.php:231— `catch (\Throwable)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/ShopperLists/ShopperList.php:225— `catch (\Throwable)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/LookupDataStore.php:83— `catch (\Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/Orders/MobileMessagingHandler.php:48— `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/Orders/MobileMessagingHandler.php:88— `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/Orders/OrderAttributionController.php:377— `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/EmailEditor/Integration.php:318— `catch (\Throwable)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/EmailEditor/Integration.php:321— `catch (\Throwable)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/EmailEditor/Integration.php:478— `catch (\Throwable)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/Email/EmailLogger.php:373— `catch (\Throwable)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:3192— `catch (\Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableQuery.php:1074— `catch (\Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/BatchProcessing/BatchProcessingController.php:581— `catch (\Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/Api/QueryCache.php:179— `catch (\Throwable)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/Api/QueryCache.php:373— `catch (\Throwable)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php:418— `catch (\Throwable)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/Admin/SiteHealth.php:92— `catch (\Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/Admin/WCAdminAssets.php:465— `catch (\Throwable)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/SettingsUIRequestContext.php:349— `catch (\Throwable)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/Admin/Orders/PageController.php:454— `catch (\Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/Admin/Notes/WooSubscriptionsNotes.php:160— `catch (\Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/Admin/Notes/WooSubscriptionsNotes.php:403— `catch (\Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/Admin/Logging/FileV2/File.php:239— `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) wp-content/plugins/woocommerce/src/Internal/Admin/Logging/FileV2/File.php:255— `catch (Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
(anonymous)::(anonymous)::apply (cyclomatic 40) wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:4565— (anonymous)::(anonymous)::apply has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::(anonymous)::apply (cyclomatic 40) wp-content/plugins/woocommerce/assets/js/select2/select2.js:4565— (anonymous)::(anonymous)::apply has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::(anonymous)::apply (cyclomatic 40) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:4705— (anonymous)::(anonymous)::apply has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::(anonymous)::apply (cyclomatic 40) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:4689— (anonymous)::(anonymous)::apply has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::(anonymous)::apply (cyclomatic 40) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:4565— (anonymous)::(anonymous)::apply has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::(anonymous)::apply (cyclomatic 40) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:4565— (anonymous)::(anonymous)::apply has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::do_variation_action (cyclomatic 34) wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product-variation.js:1230— (anonymous)::do_variation_action has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::(anonymous)::(anonymous)::normalize (cyclomatic 32) wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:65— (anonymous)::(anonymous)::(anonymous)::normalize has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::(anonymous)::(anonymous)::normalize (cyclomatic 32) wp-content/plugins/woocommerce/assets/js/select2/select2.js:65— (anonymous)::(anonymous)::(anonymous)::normalize has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::(anonymous)::(anonymous)::normalize (cyclomatic 32) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:77— (anonymous)::(anonymous)::(anonymous)::normalize has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::(anonymous)::(anonymous)::normalize (cyclomatic 32) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:77— (anonymous)::(anonymous)::(anonymous)::normalize has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::(anonymous)::(anonymous)::normalize (cyclomatic 32) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:65— (anonymous)::(anonymous)::(anonymous)::normalize has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::(anonymous)::(anonymous)::normalize (cyclomatic 32) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:65— (anonymous)::(anonymous)::(anonymous)::normalize has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::(anonymous)::handler (cyclomatic 27) wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:6230— (anonymous)::(anonymous)::handler has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
(anonymous)::(anonymous)::handler (cyclomatic 27) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:6405— (anonymous)::(anonymous)::handler has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
(anonymous)::(anonymous)::handler (cyclomatic 27) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:6230— (anonymous)::(anonymous)::handler has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
(anonymous)::(anonymous)::fromElement (cyclomatic 24) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:5071— (anonymous)::(anonymous)::fromElement has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
(anonymous)::(anonymous)::fromElement (cyclomatic 23) wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:4931— (anonymous)::(anonymous)::fromElement has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::(anonymous)::fromElement (cyclomatic 23) wp-content/plugins/woocommerce/assets/js/select2/select2.js:4931— (anonymous)::(anonymous)::fromElement has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::(anonymous)::fromElement (cyclomatic 23) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:5055— (anonymous)::(anonymous)::fromElement has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::(anonymous)::fromElement (cyclomatic 23) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:4931— (anonymous)::(anonymous)::fromElement has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::(anonymous)::fromElement (cyclomatic 23) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:4931— (anonymous)::(anonymous)::fromElement has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::(anonymous)::(anonymous)::main (cyclomatic 22) wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:304— (anonymous)::(anonymous)::(anonymous)::main has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::(anonymous)::(anonymous)::main (cyclomatic 22) wp-content/plugins/woocommerce/assets/js/select2/select2.js:304— (anonymous)::(anonymous)::(anonymous)::main has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::(anonymous)::(anonymous)::main (cyclomatic 22) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:321— (anonymous)::(anonymous)::(anonymous)::main has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/includes/abstracts/class-wc-background-process.php:96— wp-content/plugins/woocommerce/includes/abstracts/class-wc-background-process.php:96-108 | wp-content/plugins/woocommerce/includes/libraries/wp-background-process.php:295-307 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/abstracts/class-wc-background-process.php:96` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) REDACTED:317— REDACTED:317-329 | wp-content/plugins/woocommerce/includes/admin/importers/class-wc-product-csv-importer-controller.php:200-214 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:316` calls `_deprecated_function` and `wp-content/plugins/woocommerce/includes/admin/importers/class-wc-product-csv-importer-controller.php:199` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1778— wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1778-1790 | wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1951-1963 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1778` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-product-usage-notice.php:342— wp-content/plugins/woocommerce/includes/admin/helper/class-wc-product-usage-notice.php:342-354 | wp-content/plugins/woocommerce/includes/admin/helper/class-wc-product-usage-notice.php:369-381 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) REDACTED:339— REDACTED:339-351 | REDACTED:407-419 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) REDACTED:3246— REDACTED:3246-3258 | REDACTED:3325-3337 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:3246` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:3243` calls `format_tax_rate_class` and `REDACTED:3322` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-customer.php:555— wp-content/plugins/woocommerce/includes/class-wc-customer.php:555-567 | wp-content/plugins/woocommerce/includes/class-wc-customer.php:698-710 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-order-item-product.php:566— wp-content/plugins/woocommerce/includes/class-wc-order-item-product.php:566-578 | wp-content/plugins/woocommerce/includes/class-wc-order-item-product.php:592-604 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:919— wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:919-931 | wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:3445-3457 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:919` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-grouped-data-store-cpt.php:27— wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-grouped-data-store-cpt.php:27-39 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variation-data-store-cpt.php:598-610 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1513— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1513-1525 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:390-402 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1513` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) REDACTED:408— REDACTED:408-420 | REDACTED:404-416 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:418` calls `wc_attribute_taxonomy_slug` and `REDACTED:422` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:448— wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:448-460 | wp-content/plugins/woocommerce/src/Admin/API/Reports/PerformanceIndicators/Controller.php:458-470 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Admin/API/Reports/PerformanceIndicators/Controller.php:456` calls `usort`, `array` and `wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:446` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:1513— wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:1513-1525 | wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:1659-1671 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:1513` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:1526` calls `check_invalid_scan_rate_limit` and `wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:1672` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Notes.php:200— wp-content/plugins/woocommerce/src/Admin/API/Notes.php:200-212 | wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/TaskLists.php:86-98 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Notes.php:200` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/OrderAwareControllerTrait.php:30— wp-content/plugins/woocommerce/src/Admin/API/Reports/OrderAwareControllerTrait.php:30-43 | wp-content/plugins/woocommerce/src/Admin/API/Reports/OrderAwareControllerTrait.php:70-82 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentUtils.php:577— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentUtils.php:577-589 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentUtils.php:642-654 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentUtils.php:577` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:407— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:407-419 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:588-600 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/AddToCartWithOptions.php:225— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/AddToCartWithOptions.php:225-237 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/MiniCart.php:770-782 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/AddToCartWithOptions.php:225` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/MiniCart.php:784` calls `do_blocks` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/AddToCartWithOptions.php:238` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:424— wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:424-436 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php:226-238 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php` and `wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 105 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/src/Internal/Caches/ProductVersionStringInvalidator.php:143— wp-content/plugins/woocommerce/src/Internal/Caches/ProductVersionStringInvalidator.php:143-155 | wp-content/plugins/woocommerce/src/Internal/Caches/ProductVersionStringInvalidator.php:230-242 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:34— wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:34-46 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:300-312 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:34` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/Agentic/CheckoutSessionSchema.php:568— wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/Agentic/CheckoutSessionSchema.php:568-580 | wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/Agentic/CheckoutSessionSchema.php:591-603 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/Agentic/CheckoutSessionSchema.php:568` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/includes/abstracts/class-wc-background-process.php:162— wp-content/plugins/woocommerce/includes/abstracts/class-wc-background-process.php:162-175 | wp-content/plugins/woocommerce/includes/libraries/wp-background-process.php:414-426 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (13 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:236— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:236-248 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:478-490 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-coupon-data.php:195— wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-coupon-data.php:195-203 | wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-coupon-data.php:213-221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:729— wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:729-737 | wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:757-765 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:729` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:742— wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:742-750 | wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:770-778 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:742` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-order-item-fee.php:222— wp-content/plugins/woocommerce/includes/class-wc-order-item-fee.php:222-230 | wp-content/plugins/woocommerce/includes/class-wc-order-item-shipping.php:170-178 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/class-wc-order-item-fee.php` and `wp-content/plugins/woocommerce/includes/class-wc-order-item-shipping.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-order-item-fee.php:222` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/class-wc-order-item-shipping.php:167` calls `array_map`, `elseif`, `empty` and `wp-content/plugins/woocommerce/includes/class-wc-order-item-fee.php:220` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-query.php:1046— wp-content/plugins/woocommerce/includes/class-wc-query.php:1046-1054 | wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:505-513 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-query.php:1046` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php:212— wp-content/plugins/woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php:212-220 | wp-content/plugins/woocommerce/src/Gateways/PayPal/Request.php:1201-1209 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:628— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:628-636 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:884-892 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 228 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:628` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/includes/wc-user-functions.php:613— wp-content/plugins/woocommerce/includes/wc-user-functions.php:613-621 | wp-content/plugins/woocommerce/includes/wc-user-functions.php:634-642 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/wc-user-functions.php:613` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php:204— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php:204-212 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php:215-223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/src/Api/Pagination/Connection.php:121— wp-content/plugins/woocommerce/src/Api/Pagination/Connection.php:121-129 | wp-content/plugins/woocommerce/src/Api/Utils/Products/ProductMapper.php:181-189 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Reviews/ProductReviewAuthorName.php:37— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Reviews/ProductReviewAuthorName.php:37-45 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Reviews/ProductReviewContent.php:63-71 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:236— wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:236-244 | wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:246-254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableFieldQuery.php:107— wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableFieldQuery.php:107-115 | wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableMetaQuery.php:223-231 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableFieldQuery.php` and `wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableMetaQuery.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableFieldQuery.php:107` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php:169— wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php:169-177 | wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php:179-187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Schema/OrderSchema.php:711— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Schema/OrderSchema.php:711-719 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Schema/OrderSchema.php:737-745 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Schema/OrderSchema.php:711` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/CartUpdateCustomer.php:89— wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/CartUpdateCustomer.php:89-97 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/CartUpdateCustomer.php:100-108 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/CartUpdateCustomer.php:89` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQuery.php:472— wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQuery.php:472-480 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQuery.php:482-490 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) wp-includes/PHPMailer/PHPMailer.php:2710— wp-includes/PHPMailer/PHPMailer.php:2710-2718 | wp-includes/PHPMailer/PHPMailer.php:2731-2739 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) wp-includes/php-ai-client/src/Providers/Http/HttpTransporter.php:111— wp-includes/php-ai-client/src/Providers/Http/HttpTransporter.php:111-119 | wp-includes/php-ai-client/src/Providers/Http/HttpTransporter.php:121-129 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1137— wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1137-1145 | wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1258-1266 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1137` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/includes/admin/wc-admin-functions.php:358— wp-content/plugins/woocommerce/includes/admin/wc-admin-functions.php:358-366 | wp-content/plugins/woocommerce/includes/admin/wc-admin-functions.php:412-420 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/wc-admin-functions.php:358` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterCheckboxList.php:82— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterCheckboxList.php:82-90 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterChips.php:91-99 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterCheckboxList.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterChips.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-customer.php:1014— wp-content/plugins/woocommerce/includes/class-wc-customer.php:1014-1022 | wp-content/plugins/woocommerce/includes/class-wc-order.php:1176-1184 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:820— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:820-828 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:1119-1127 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 228 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:994— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:994-1002 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1610-1618 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-widget.php:379— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-widget.php:379-386 | REDACTED:277-284 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-widget.php:379` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-exporters.php:77— wp-content/plugins/woocommerce/includes/admin/class-wc-admin-exporters.php:77-84 | wp-content/plugins/woocommerce/includes/admin/class-wc-admin-importers.php:81-88 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/class-wc-admin-exporters.php:77` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:267— wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:267-274 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:319-326 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:267` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:266` calls `array` and `wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:318` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-code.php:167— wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-code.php:167-174 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-code.php:184-191 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-date.php:177— wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-date.php:177-184 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-date.php:185-192 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-date.php:177` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:700— wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:700-707 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php:1195-1202 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:700` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/includes/data-stores/class-wc-customer-download-data-store.php:465— wp-content/plugins/woocommerce/includes/data-stores/class-wc-customer-download-data-store.php:465-472 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-customer-download-log-data-store.php:193-200 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/data-stores/class-wc-customer-download-log-data-store.php:192` calls `array` and `wp-content/plugins/woocommerce/includes/data-stores/class-wc-customer-download-data-store.php:463` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:750— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:750-757 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:1021-1028 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 228 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:1029` calls `maybe_set_item_meta_data` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:759` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1395— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1395-1402 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:391-398 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 1094 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php:186— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php:186-194 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php:269-276 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Controller.php:46— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Controller.php:46-53 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/Stats/Controller.php:76-83 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Controller.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/Stats/Controller.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/DataStore.php:102— wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/DataStore.php:102-109 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/DataStore.php:121-128 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/DataStore.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/DataStore.php` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsRenderer.php:492— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsRenderer.php:492-499 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsRenderer.php:524-531 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsRenderer.php:492` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterPrice.php:208— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterPrice.php:208-215 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterRating.php:190-197 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterPrice.php:208` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:239— wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:239-246 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQuery.php:475-482 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:239` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/LookupDataStore.php:386— wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/LookupDataStore.php:386-393 | wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/LookupDataStore.php:415-425 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/LookupDataStore.php:415` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Frontend/ProductPageIntegration.php:149— wp-content/plugins/woocommerce/src/Internal/StockNotifications/Frontend/ProductPageIntegration.php:149-156 | wp-content/plugins/woocommerce/src/Internal/StockNotifications/Frontend/ProductPageIntegration.php:179-186 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductBrandSchema.php:83— wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductBrandSchema.php:83-90 | wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductCategorySchema.php:81-88 — before extracting anything, compare `wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductBrandSchema.php` and `wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductCategorySchema.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php:55— wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php:55-62 | wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php:132-139 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php:55` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php:63` calls `foreach` and `wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php:139` does not — after which the two agree again for 5 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) REDACTED:1799— REDACTED:1799-1806 | REDACTED:1900-1907 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-https.php:91— wp-content/plugins/woocommerce/includes/class-wc-https.php:91-98 | wp-content/plugins/woocommerce/includes/class-wc-https.php:111-118 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-https.php:91` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:1259— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:1259-1266 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:1281-1288 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/includes/gateways/class-wc-payment-gateway-cc.php:29— wp-content/plugins/woocommerce/includes/gateways/class-wc-payment-gateway-cc.php:29-36 | wp-content/plugins/woocommerce/includes/gateways/class-wc-payment-gateway-echeck.php:29-36 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-notes-v2-controller.php:169— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-notes-v2-controller.php:169-180 | wp-content/plugins/woocommerce/src/Admin/API/DataDownloadIPs.php:134-141 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/DataStore.php:601— wp-content/plugins/woocommerce/src/Admin/API/Reports/DataStore.php:601-608 | wp-content/plugins/woocommerce/src/Admin/API/Reports/TimeInterval.php:488-495 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:1664— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:1664-1674 | wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-order.php:152-162 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-brands.php:769— wp-content/plugins/woocommerce/includes/admin/class-wc-admin-brands.php:769-779 | wp-content/plugins/woocommerce/includes/import/class-wc-product-csv-importer.php:433-444 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/class-wc-admin-brands.php:769` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) REDACTED:295— REDACTED:295-305 | REDACTED:312-322 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-customer-download-log.php:50— wp-content/plugins/woocommerce/includes/class-wc-customer-download-log.php:50-60 | wp-content/plugins/woocommerce/includes/class-wc-customer-download.php:57-67 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-customer-download-log.php:50` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1420— wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1420-1430 | wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1434-1444 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1420` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-shortcodes.php:337— wp-content/plugins/woocommerce/includes/class-wc-shortcodes.php:337-347 | wp-content/plugins/woocommerce/includes/class-wc-shortcodes.php:387-397 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-shortcodes.php:337` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php:1173— wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php:1173-1183 | wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:3228-3238 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variable-data-store-cpt.php:683— wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variable-data-store-cpt.php:683-693 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variable-data-store-cpt.php:705-715 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/includes/gateways/cheque/class-wc-gateway-cheque.php:181— wp-content/plugins/woocommerce/includes/gateways/cheque/class-wc-gateway-cheque.php:181-191 | wp-content/plugins/woocommerce/includes/gateways/cod/class-wc-gateway-cod.php:384-394 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:266— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:266-276 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:299-309 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:727— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:727-737 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php:114-124 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:727` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php:127` calls `unset` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:739` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:840— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:840-850 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php:298-308 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:840` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-locations-v2-controller.php:63— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-locations-v2-controller.php:63-73 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zones-v2-controller.php:117-127 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Categories/DataStore.php:262— wp-content/plugins/woocommerce/src/Admin/API/Reports/Categories/DataStore.php:262-272 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php:322-332 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Categories/DataStore.php:262` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/src/Admin/Features/PaymentGatewaySuggestions/Init.php:47— wp-content/plugins/woocommerce/src/Admin/Features/PaymentGatewaySuggestions/Init.php:47-57 | wp-content/plugins/woocommerce/src/Internal/Admin/WCPayPromotion/Init.php:113-123 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/Features/PaymentGatewaySuggestions/Init.php:47` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/CustomerAccount.php:74— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/CustomerAccount.php:74-84 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/MiniCart.php:154-164 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Notes/EUVATNumber.php:50— wp-content/plugins/woocommerce/src/Internal/Admin/Notes/EUVATNumber.php:50-60 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/SellingOnlineCourses.php:72-83 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders.php:405— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders.php:405-415 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders.php:455-465 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) wp-includes/PHPMailer/PHPMailer.php:3115— wp-includes/PHPMailer/PHPMailer.php:3115-3125 | wp-includes/PHPMailer/PHPMailer.php:3152-3162 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) wp-includes/PHPMailer/PHPMailer.php:3155— wp-includes/PHPMailer/PHPMailer.php:3155-3165 | wp-includes/PHPMailer/PHPMailer.php:3228-3238 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:588— wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:588-598 | wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:612-622 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:588` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:259— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:259-269 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:502-512 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableFieldQuery.php:262— wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableFieldQuery.php:262-272 | wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableMetaQuery.php:285-295 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableFieldQuery.php` and `wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableMetaQuery.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) wp-content/plugins/woocommerce/src/Admin/RemoteSpecs/RuleProcessors/PublishAfterTimeRuleProcessor.php:55— wp-content/plugins/woocommerce/src/Admin/RemoteSpecs/RuleProcessors/PublishAfterTimeRuleProcessor.php:55-65 | wp-content/plugins/woocommerce/src/Admin/RemoteSpecs/RuleProcessors/PublishBeforeTimeRuleProcessor.php:55-65 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-code.php:62— wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-code.php:62-71 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-date.php:59-68 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-customer.php:970— wp-content/plugins/woocommerce/includes/class-wc-customer.php:970-979 | wp-content/plugins/woocommerce/includes/class-wc-customer.php:992-1001 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) wp-content/plugins/woocommerce/includes/export/abstract-wc-csv-exporter.php:190— wp-content/plugins/woocommerce/includes/export/abstract-wc-csv-exporter.php:190-199 | wp-content/plugins/woocommerce/src/Internal/Admin/Logging/FileV2/FileExporter.php:69-78 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 2) wp-content/plugins/woocommerce/includes/gateways/bacs/class-wc-gateway-bacs.php:64— wp-content/plugins/woocommerce/includes/gateways/bacs/class-wc-gateway-bacs.php:64-73 | wp-content/plugins/woocommerce/includes/gateways/cheque/class-wc-gateway-cheque.php:49-58 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:219— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:219-228 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-notes-controller.php:71-80 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-notes-controller.php` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 116 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (10 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:284— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:284-295 | wp-content/plugins/woocommerce/src/Admin/API/Taxes.php:120-129 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php` and `wp-content/plugins/woocommerce/src/Admin/API/Taxes.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:284` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php:154— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php:154-163 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:453-462 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:465` calls `remove_status_prefix` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php:166` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) wp-content/plugins/woocommerce/includes/shipping/free-shipping/class-wc-shipping-free-shipping.php:161— wp-content/plugins/woocommerce/includes/shipping/free-shipping/class-wc-shipping-free-shipping.php:161-170 | wp-content/plugins/woocommerce/includes/shipping/legacy-free-shipping/class-wc-shipping-legacy-free-shipping.php:179-188 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/shipping/free-shipping/class-wc-shipping-free-shipping.php:161` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:1714— wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:1714-1723 | wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:1737-1746 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:1714` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Controller.php:125— wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Controller.php:125-134 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Controller.php:151-160 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Controller.php:125` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) REDACTED:421— REDACTED:421-430 | REDACTED:528-537 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:421` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/FeaturedItem.php:84— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/FeaturedItem.php:84-93 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/SingleProduct.php:108-117 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/FeaturedItem.php:84` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/OrderConfirmation/Downloads.php:59— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/OrderConfirmation/Downloads.php:59-68 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/OrderConfirmation/Totals.php:65-74 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:521— wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:521-530 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php:393-402 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php` and `wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 105 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (10 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:579— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:579-588 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:608-617 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:579` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:791— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:791-800 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:819-828 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:791` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/OrderNotes/Controller.php:181— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/OrderNotes/Controller.php:181-190 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/OrderNotes/Controller.php:226-235 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Admin/NotificationEditPage.php:86— wp-content/plugins/woocommerce/src/Internal/StockNotifications/Admin/NotificationEditPage.php:86-95 | wp-content/plugins/woocommerce/src/Internal/StockNotifications/Admin/NotificationEditPage.php:99-108 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Internal/StockNotifications/Admin/NotificationEditPage.php:97` calls `set_date_cancelled`, `time`, `set_cancellation_source` and `wp-content/plugins/woocommerce/src/Internal/StockNotifications/Admin/NotificationEditPage.php:85` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) wp-includes/PHPMailer/PHPMailer.php:914— wp-includes/PHPMailer/PHPMailer.php:914-923 | wp-includes/PHPMailer/SMTP.php:290-300 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-includes/PHPMailer/PHPMailer.php:914` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) wp-includes/php-ai-client/src/Providers/OpenAiCompatibleImplementation/AbstractOpenAiCompatibleImageGenerationModel.php:251— wp-includes/php-ai-client/src/Providers/OpenAiCompatibleImplementation/AbstractOpenAiCompatibleImageGenerationModel.php:251-260 | wp-includes/php-ai-client/src/Providers/OpenAiCompatibleImplementation/AbstractOpenAiCompatibleTextGenerationModel.php:442-451 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (10 lines × 2) wp-content/plugins/woocommerce/includes/shipping/free-shipping/class-wc-shipping-free-shipping.php:54— wp-content/plugins/woocommerce/includes/shipping/free-shipping/class-wc-shipping-free-shipping.php:54-64 | wp-content/plugins/woocommerce/includes/shipping/local-pickup/class-wc-shipping-local-pickup.php:39-48 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 2) wp-content/plugins/woocommerce/src/Admin/RemoteSpecs/RuleProcessors/ComparisonOperation.php:42— wp-content/plugins/woocommerce/src/Admin/RemoteSpecs/RuleProcessors/ComparisonOperation.php:42-51 | wp-content/plugins/woocommerce/src/Admin/RemoteSpecs/RuleProcessors/ComparisonOperation.php:58-67 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-background-emailer.php:175— wp-content/plugins/woocommerce/includes/class-wc-background-emailer.php:175-186 | wp-content/plugins/woocommerce/includes/libraries/wp-background-process.php:319-330 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-background-emailer.php:175` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-post-data.php:461— wp-content/plugins/woocommerce/includes/class-wc-post-data.php:461-473 | wp-content/plugins/woocommerce/includes/class-wc-post-data.php:497-508 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-post-data.php:461` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:570— wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:570-581 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variation-data-store-cpt.php:431-442 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:1682— wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:1682-1693 | wp-content/plugins/woocommerce/includes/wc-term-functions.php:462-473 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:1682` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/includes/import/abstract-wc-product-importer.php:492— wp-content/plugins/woocommerce/includes/import/abstract-wc-product-importer.php:492-503 | wp-content/plugins/woocommerce/includes/import/abstract-wc-product-importer.php:543-554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php:403— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php:403-414 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php:500-511 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) REDACTED:508— REDACTED:508-519 | wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/Filterer.php:331-342 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/Filterer.php:344` calls `get_term_ids_sql` and `REDACTED:520` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:296— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:296-307 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Segmenter.php:390-401 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Segmenter.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:296` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Controller.php:179— wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Controller.php:179-190 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Controller.php:182-193 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Controller.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductDetails.php:227— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductDetails.php:227-238 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductDetails.php:262-273 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductDetails.php:227` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Reviews/ProductReviewAuthorName.php:26— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Reviews/ProductReviewAuthorName.php:26-37 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Reviews/ProductReviewContent.php:26-37 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/src/Blocks/Domain/Services/CheckoutFieldsAdmin.php:124— wp-content/plugins/woocommerce/src/Blocks/Domain/Services/CheckoutFieldsAdmin.php:124-135 | wp-content/plugins/woocommerce/src/Blocks/Domain/Services/CheckoutFieldsAdmin.php:147-158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:98— wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:98-109 | wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:169-180 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders.php:1472— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders.php:1472-1483 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders.php:1489-1500 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders.php:1472` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:530— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:530-541 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:624-635 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:530` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/SettingsUIRequestContext.php:377— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/SettingsUIRequestContext.php:377-388 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/SettingsUIRequestContext.php:415-426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/SettingsUIRequestContext.php:377` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZoneMethod/ShippingMethodSchema.php:125— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZoneMethod/ShippingMethodSchema.php:125-136 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZones/ShippingZoneSchema.php:195-206 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/AbstractCartRoute.php:114— wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/AbstractCartRoute.php:114-125 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Checkout.php:149-160 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/AbstractCartRoute.php:114` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Checkout.php:162` calls `get_route_error_response_from_object`, `getError`, `getCode` and `wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/AbstractCartRoute.php:127` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Agentic/CheckoutSessions.php:165— wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Agentic/CheckoutSessions.php:165-176 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Agentic/CheckoutSessionsUpdate.php:230-241 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Agentic/CheckoutSessionsComplete.php:183— wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Agentic/CheckoutSessionsComplete.php:183-194 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Agentic/CheckoutSessionsUpdate.php:150-161 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (12 lines × 2) wp-content/plugins/woocommerce/includes/abstracts/class-wc-background-process.php:140— wp-content/plugins/woocommerce/includes/abstracts/class-wc-background-process.php:140-152 | wp-content/plugins/woocommerce/includes/import/abstract-wc-product-importer.php:761-772 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-exporters.php:33— wp-content/plugins/woocommerce/includes/admin/class-wc-admin-exporters.php:33-39 | wp-content/plugins/woocommerce/includes/admin/class-wc-admin-importers.php:30-36 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/class-wc-admin-exporters.php:33` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:319— wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:319-325 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:364-370 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:319` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:363` calls `array` and `wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:318` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-auth.php:91— wp-content/plugins/woocommerce/includes/class-wc-auth.php:91-97 | wp-content/plugins/woocommerce/includes/class-wc-auth.php:98-104 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-install.php:2380— wp-content/plugins/woocommerce/includes/class-wc-install.php:2380-2386 | wp-content/plugins/woocommerce/src/Admin/ReportCSVExporter.php:91-97 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-install.php:2380` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-tracker.php:1495— wp-content/plugins/woocommerce/includes/class-wc-tracker.php:1495-1501 | wp-content/plugins/woocommerce/includes/class-wc-tracker.php:1504-1510 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-tracker.php:1495` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php:56— wp-content/plugins/woocommerce/includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php:56-62 | wp-content/plugins/woocommerce/includes/shipping/legacy-international-delivery/class-wc-shipping-legacy-international-delivery.php:27-33 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/AustraliaPostShippingProvider.php:190— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/AustraliaPostShippingProvider.php:190-196 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/RoyalMailShippingProvider.php:201-207 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/AustraliaPostShippingProvider.php` and `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/RoyalMailShippingProvider.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/AustraliaPostShippingProvider.php:190` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:233— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:233-239 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php:1041-1047 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/ProductReviews/Reviews.php:438— wp-content/plugins/woocommerce/src/Internal/Admin/ProductReviews/Reviews.php:438-444 | wp-content/plugins/woocommerce/src/Internal/Admin/ProductReviews/Reviews.php:449-455 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/ProductReviews/Reviews.php:438` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/WooCommerceProductImporter.php:687— wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/WooCommerceProductImporter.php:687-693 | wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/WooCommerceProductImporter.php:970-976 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/WooCommerceProductImporter.php:687` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateAutoApplier.php:188— wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateAutoApplier.php:188-194 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateSelectiveApplier.php:256-265 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQuery.php:423— wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQuery.php:423-429 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQuery.php:433-439 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQuery.php:423` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Onboarding/OnboardingHelper.php:87— wp-content/plugins/woocommerce/src/Internal/Admin/Onboarding/OnboardingHelper.php:87-93 | wp-content/plugins/woocommerce/src/Internal/Admin/Onboarding/OnboardingHelper.php:97-103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Onboarding/OnboardingHelper.php:87` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/includes/wc-product-functions.php:1508— wp-content/plugins/woocommerce/includes/wc-product-functions.php:1508-1514 | wp-content/plugins/woocommerce/includes/wc-product-functions.php:1598-1604 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/wc-product-functions.php:1508` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/wc-product-functions.php:1604` calls `empty` and `wp-content/plugins/woocommerce/includes/wc-product-functions.php:1514` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/includes/admin/list-tables/class-wc-admin-list-table-orders.php:683— wp-content/plugins/woocommerce/includes/admin/list-tables/class-wc-admin-list-table-orders.php:683-689 | REDACTED:510-516 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php:243— wp-content/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php:243-249 | wp-content/plugins/woocommerce/includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php:287-293 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php` and `wp-content/plugins/woocommerce/includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterCheckboxList.php:254— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterCheckboxList.php:254-260 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterChips.php:231-237 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterCheckboxList.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterChips.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZoneMethod/Controller.php:347— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZoneMethod/Controller.php:347-353 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZones/Controller.php:301-307 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZoneMethod/Controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZones/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 130 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:281— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:281-287 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-shipping-method.php:584-590 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Controller.php:271— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Controller.php:271-277 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/Controller.php:238-244 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 114 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-data.php:967— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-data.php:967-973 | wp-content/plugins/woocommerce/includes/wc-formatting-functions.php:771-777 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
TodoComment wp-includes/php-ai-client/src/Builders/PromptBuilder.php:881— // TODO: Add support for other capabilities when interfaces are available — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment wp-content/plugins/woocommerce/src/Proxies/ActionsProxy.php:39— // TODO: Add the rest of the actions and filters related methods. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/CLIRunner.php:386— // TODO: adjust for non-CPT datastores (this is only used for the progress bar, though). — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableQuery.php:206— // TODO: 'name' arg (post_name equivalent) is not yet implemented for HPOS. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment wp-content/plugins/woocommerce/src/Internal/Admin/Notes/WooCommercePayments.php:172— // TODO: Need to validate this request more strictly since we're taking install actions directly? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment wp-content/plugins/woocommerce/src/Gateways/PayPal/Request.php:1001— // TODO: The container call can be removed once we migrate this class to the `src` folder. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilters.php:125— // TODO: Remove this conditional once the fix is released in WP. https://github.com/woocommerce/gutenberg/pull/4.
TodoComment wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-controller.php:566— // TODO: Submit this caching behavior in core. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment wp-content/plugins/woocommerce/includes/legacy/class-wc-legacy-cart.php:166— // Arrays returned by reference to allow modification without notices. TODO: Remove in 4.0. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment wp-content/plugins/woocommerce/includes/legacy/class-wc-legacy-cart.php:193— // Deprecated args. TODO: Remove in 4.0. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper-api.php:66— // TODO: Check response signatures on certain endpoints. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:241— // Todo: Remove need for this. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:681— // Todo: Remove data-required — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:697— // Todo: Move from $wrapper out into $field. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment wp-content/plugins/advanced-custom-fields-pro/includes/assets.php:518— // Todo: investigate output-buffer to hide HTML. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment wp-content/plugins/advanced-custom-fields-pro/includes/locations/class-acf-location-comment.php:61— // Todo: Change to post types that support comments. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-front.php:90— // Todo: Allow message and button text to be generated by CPT settings. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-front.php:391— // Todo: Return WP_Error and show above form, keeping input values. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment wp-content/plugins/advanced-custom-fields-pro/includes/api/api-helpers.php:2615— // todo: Compare class types instead. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment wp-content/plugins/advanced-custom-fields-pro/includes/admin/admin-notices.php:59— // todo: Remove this after updating translations. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
Duplicated block (17 lines × 2) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-api-keys.php:105— wp-content/plugins/woocommerce/includes/admin/class-wc-admin-api-keys.php:105-121 | wp-content/plugins/woocommerce/includes/admin/class-wc-admin-webhooks.php:307-323 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/class-wc-admin-api-keys.php:105` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) REDACTED:1415— REDACTED:1415-1431 | wp-content/plugins/woocommerce/src/Internal/Orders/CouponsController.php:55-71 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (17 lines × 2) REDACTED:3405— REDACTED:3405-3421 | REDACTED:3477-3493 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:3405` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:86— wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:86-102 | wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:238-254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:86` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 2) wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-order.php:266— wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-order.php:266-282 | wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-order.php:297-313 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:261— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:261-277 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-coupons-v2-controller.php:296-312 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-coupons-v2-controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 133 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:261` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:640— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:640-656 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1771-1787 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 1018 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:640` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-controller.php:263— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-controller.php:263-279 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-controller.php:298-314 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-controller.php:263` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:562— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:562-578 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php:649-665 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 2) wp-content/plugins/woocommerce/src/Blocks/Domain/Services/CheckoutFieldsFrontend.php:231— wp-content/plugins/woocommerce/src/Blocks/Domain/Services/CheckoutFieldsFrontend.php:231-247 | wp-content/plugins/woocommerce/src/Blocks/Domain/Services/CheckoutFieldsFrontend.php:266-282 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/Domain/Services/CheckoutFieldsFrontend.php:231` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:104— wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:104-120 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:70-86 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (17 lines × 2) wp-content/plugins/woocommerce/src/Internal/Abilities/Domain/Traits/OrderAbilityTrait.php:141— wp-content/plugins/woocommerce/src/Internal/Abilities/Domain/Traits/OrderAbilityTrait.php:141-157 | wp-content/plugins/woocommerce/src/Internal/Abilities/Domain/Traits/ProductAbilityTrait.php:456-472 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (17 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:405— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:405-421 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:487-503 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17 lines × 2) wp-content/plugins/woocommerce/src/Internal/Orders/OrderActionsRestController.php:512— wp-content/plugins/woocommerce/src/Internal/Orders/OrderActionsRestController.php:512-528 | wp-content/plugins/woocommerce/src/Internal/Orders/OrderActionsRestController.php:645-661 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Internal/Orders/OrderActionsRestController.php:511` calls `get_param` and `wp-content/plugins/woocommerce/src/Internal/Orders/OrderActionsRestController.php:644` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17 lines × 2) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationVerifiedEmail.php:21— wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationVerifiedEmail.php:21-37 | wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationVerifyEmail.php:22-38 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationVerifiedEmail.php` and `wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationVerifyEmail.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 76 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (17 lines × 2) wp-content/plugins/woocommerce/src/StoreApi/Schemas/ExtendSchema.php:221— wp-content/plugins/woocommerce/src/StoreApi/Schemas/ExtendSchema.php:221-237 | wp-content/plugins/woocommerce/src/StoreApi/Schemas/ExtendSchema.php:255-271 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/StoreApi/Schemas/ExtendSchema.php:221` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php:177— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php:177-193 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:306-322 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php:177` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:324` calls `update_option`, `get_instance_option_key`, `apply_filters` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php:194` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:534— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:534-550 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:801-817 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×17
Members sharing a duplicated core (4 members, 50+ identical tokens) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:359— wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:359-372 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-customers.php:223-236 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-category.php:265-278 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-date.php:613-627 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:220— wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:220-259 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-coupon-data-store-cpt.php:179-219 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:323-397 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variation-data-store-cpt.php:185-279 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:219— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:219-255 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:265-281 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:291-329 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-notes-controller.php:71-107 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:279— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:279-331 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:523-579 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:167-212 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:282-327 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:678— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:678-740 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1071-1440 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:733-1170 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1003-1440 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:858— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:858-907 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1453-1520 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:656-722 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:923-992 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:255— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:255-265 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:53-59 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:69-75 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:85-91 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:103— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:103-126 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:164-190 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:200-249 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:259-285 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:99— wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:99-158 | wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:170-229 | wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:241-298 | wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:310-369 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php:295— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php:295-376 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php:355-443 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/DataStore.php:181-241 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/DataStore.php:413-523 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Controller.php:94— wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Controller.php:94-105 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Controller.php:70-91 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Controller.php:99-123 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Controller.php:68-95 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/AustraliaPostShippingProvider.php:154— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/AustraliaPostShippingProvider.php:154-216 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/CanadaPostShippingProvider.php:145-210 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/DPDShippingProvider.php:399-465 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/RoyalMailShippingProvider.php:158-227 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:935— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:935-963 | wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:308-336 | wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php:468-506 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQuery.php:504-532 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:977— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:977-1004 | wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:365-392 | wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php:520-547 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQuery.php:571-598 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Customers/Controller.php:232— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Customers/Controller.php:232-277 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/OrderNotes/Controller.php:285-313 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Controller.php:327-377 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/Controller.php:284-371 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:271— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:271-319 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:338-383 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Controller.php:297-334 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Controller.php:278-327 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:278— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:278-300 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Schema/GeneralSettingsSchema.php:325-345 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Schema/ProductSettingsSchema.php:305-322 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Schema/TaxSettingsSchema.php:270-289 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Edited copy of a member (9 corresponding lines) · ×16
Edited copy of a member (9 corresponding lines) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/CartSchema.php:90— wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/CartSchema.php:90-98 | wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/OrderSchema.php:97-105 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) wp-content/plugins/woocommerce/includes/wc-page-functions.php:20— wp-content/plugins/woocommerce/includes/wc-page-functions.php:20-28 | wp-content/plugins/woocommerce/includes/wc-page-functions.php:50-58 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:1258— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:1258-1266 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:1280-1288 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) wp-includes/php-ai-client/src/Providers/OpenAiCompatibleImplementation/AbstractOpenAiCompatibleImageGenerationModel.php:66— wp-includes/php-ai-client/src/Providers/OpenAiCompatibleImplementation/AbstractOpenAiCompatibleImageGenerationModel.php:66-74 | wp-includes/php-ai-client/src/Providers/OpenAiCompatibleImplementation/AbstractOpenAiCompatibleTextGenerationModel.php:73-81 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Frontend/ProductPageIntegration.php:148— wp-content/plugins/woocommerce/src/Internal/StockNotifications/Frontend/ProductPageIntegration.php:148-156 | wp-content/plugins/woocommerce/src/Internal/StockNotifications/Frontend/ProductPageIntegration.php:178-186 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/PaymentGatewaySuggestions/Init.php:70— wp-content/plugins/woocommerce/src/Admin/Features/PaymentGatewaySuggestions/Init.php:70-86 | wp-content/plugins/woocommerce/src/Internal/Admin/WCPayPromotion/Init.php:136-144 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsRestController.php:273— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsRestController.php:273-281 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsRestController.php:292-300 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) REDACTED:918— REDACTED:918-926 | REDACTED:936-944 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) wp-includes/php-ai-client/src/Tools/DTO/FunctionCall.php:107— wp-includes/php-ai-client/src/Tools/DTO/FunctionCall.php:107-117 | wp-includes/php-ai-client/src/Tools/DTO/FunctionResponse.php:107-115 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/Utils/BlockTemplateUtils.php:352— wp-content/plugins/woocommerce/src/Blocks/Utils/BlockTemplateUtils.php:352-364 | wp-content/plugins/woocommerce/src/Admin/Features/ProductBlockEditor/BlockTemplateUtils.php:37-45 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-reports-v1-controller.php:94— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-reports-v1-controller.php:94-102 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-controller.php:89-110 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version4/class-wc-rest-v4-controller.php:76— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version4/class-wc-rest-v4-controller.php:76-88 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/AbstractRoute.php:303-311 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:495— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:495-504 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:514-522 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/Payments.php:101— wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/Payments.php:101-109 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsController.php:235-243 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-regenerate-images-request.php:75— wp-content/plugins/woocommerce/includes/class-wc-regenerate-images-request.php:75-83 | wp-content/plugins/woocommerce/includes/class-wc-regenerate-images.php:294-302 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:282— wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:282-290 | wp-content/plugins/woocommerce/src/Internal/ProductFilters/CacheController.php:121-132 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (22 lines × 2) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper-updater.php:417— wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper-updater.php:417-438 | wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper-updater.php:453-474 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:362— wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:362-383 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variation-data-store-cpt.php:247-268 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:362` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 2) wp-content/plugins/woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-api-handler.php:105— wp-content/plugins/woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-api-handler.php:105-126 | wp-content/plugins/woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-api-handler.php:138-159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:358— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:358-379 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:883-904 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 151 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:358` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1041— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1041-1062 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1658-1679 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1041` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (22 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:493— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:493-514 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:348-369 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:493` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1832— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1832-1853 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:2102-2123 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1832` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:2050— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:2050-2071 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:2454-2475 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:2050` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:761— wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:761-782 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:795-816 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22 lines × 2) wp-content/plugins/woocommerce/src/Admin/Features/ProductBlockEditor/BlockRegistry.php:213— wp-content/plugins/woocommerce/src/Admin/Features/ProductBlockEditor/BlockRegistry.php:213-234 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php:102-123 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (22 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartForm.php:77— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartForm.php:77-98 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/Utils.php:44-65 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (22 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Utils.php:374— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Utils.php:374-395 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Utils.php:414-435 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (22 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Translations.php:98— wp-content/plugins/woocommerce/src/Internal/Admin/Translations.php:98-119 | wp-content/plugins/woocommerce/src/Internal/Admin/Translations.php:149-170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Translations.php:98` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (22 lines × 2) wp-includes/PHPMailer/PHPMailer.php:937— wp-includes/PHPMailer/PHPMailer.php:937-958 | wp-includes/PHPMailer/SMTP.php:314-335 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-includes/PHPMailer/PHPMailer.php:937` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (22 lines × 2) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductBrandSchema.php:52— wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductBrandSchema.php:52-73 | wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductCategorySchema.php:50-71 — before extracting anything, compare `wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductBrandSchema.php` and `wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductCategorySchema.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication· Edited copy of a member (18 corresponding lines) · ×14
Edited copy of a member (18 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:941— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:941-958 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/UpdateUtils.php:360-386 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductDetails.php:225— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductDetails.php:225-242 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductDetails.php:254-277 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:588— wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:588-605 | wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:612-629 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) wp-content/plugins/woocommerce/includes/wc-page-functions.php:177— wp-content/plugins/woocommerce/includes/wc-page-functions.php:177-196 | wp-content/plugins/woocommerce/includes/wc-page-functions.php:215-232 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) wp-content/plugins/woocommerce/src/Database/Migrations/MetaToCustomTableMigrator.php:786— wp-content/plugins/woocommerce/src/Database/Migrations/MetaToCustomTableMigrator.php:786-803 | wp-content/plugins/woocommerce/src/Database/Migrations/MetaToCustomTableMigrator.php:815-832 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Notes.php:200— wp-content/plugins/woocommerce/src/Admin/API/Notes.php:200-224 | wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/TaskLists.php:86-103 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:225— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:225-242 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php:1032-1049 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-refunds-controller.php:130— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-refunds-controller.php:130-157 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php:381-398 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PaymentGateway.php:655— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PaymentGateway.php:655-672 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PaymentGateway.php:814-834 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestions.php:4509— wp-content/plugins/woocommerce/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestions.php:4509-4526 | wp-content/plugins/woocommerce/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestions.php:4549-4566 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1061— wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1061-1082 | wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1091-1108 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) REDACTED:686— REDACTED:686-706 | wp-content/plugins/woocommerce/includes/class-wc-background-emailer.php:79-96 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Klarna.php:27— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Klarna.php:27-45 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Razorpay.php:28-45 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:805— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:805-823 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php:571-588 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (6 lines × 2) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:127— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:127-133 | wp-content/plugins/woocommerce/src/Internal/StockNotifications/Notification.php:58-63 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:127` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:263— wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:263-268 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:312-318 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:263` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-cart-session.php:627— wp-content/plugins/woocommerce/includes/class-wc-cart-session.php:627-632 | wp-content/plugins/woocommerce/includes/class-wc-cart.php:1280-1292 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-cart-session.php:627` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1231— wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1231-1236 | wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1298-1303 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1231` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:277— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:277-282 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Segmenter.php:162-167 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:277` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/DataStore.php:1181— wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/DataStore.php:1181-1186 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/DataStore.php:413-418 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:520— wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:520-525 | wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php:574-579 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php` and `wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 115 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:520` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (6 lines × 2) wp-includes/PHPMailer/PHPMailer.php:5317— wp-includes/PHPMailer/PHPMailer.php:5317-5322 | wp-includes/PHPMailer/PHPMailer.php:5330-5335 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) wp-includes/php-ai-client/src/Providers/OpenAiCompatibleImplementation/AbstractOpenAiCompatibleImageGenerationModel.php:68— wp-includes/php-ai-client/src/Providers/OpenAiCompatibleImplementation/AbstractOpenAiCompatibleImageGenerationModel.php:68-73 | wp-includes/php-ai-client/src/Providers/OpenAiCompatibleImplementation/AbstractOpenAiCompatibleTextGenerationModel.php:75-80 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-includes/php-ai-client/src/Providers/OpenAiCompatibleImplementation/AbstractOpenAiCompatibleImageGenerationModel.php:68` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (6 lines × 2) wp-content/plugins/woocommerce/src/Api/Utils/SchemaHandle.php:95— wp-content/plugins/woocommerce/src/Api/Utils/SchemaHandle.php:95-100 | wp-content/plugins/woocommerce/src/Api/Utils/SchemaHandle.php:113-118 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Api/Utils/SchemaHandle.php:95` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php:820— wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php:820-825 | wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:3108-3113 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php:336— wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php:336-341 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/DataStore.php:394-399 — `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/DataStore.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 35 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (6 lines × 2) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ShopperListItemSchema.php:51— wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ShopperListItemSchema.php:51-56 | wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ShopperListSchema.php:47-52 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Cart.php:259— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Cart.php:259-264 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Checkout.php:486-491 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Checkout.php:485` calls `add`, `filter_var`, `get_option` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Cart.php:258` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
jquery.flot.Plot::processData (cognitive 164) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:1030— jquery.flot.Plot::processData has cognitive complexity 164 (threshold 15). Drivers by points: if/else 31 (128 pts), loops 10 (24 pts), boolean chains 9, match/switch 1 (3 pts) (nesting depth added 113). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 12 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::axisToCanvasCoords, jquery.flot.Plot::fillInSeriesOptions, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::drawGrid (cognitive 115) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:1869— jquery.flot.Plot::drawGrid has cognitive complexity 115 (threshold 15). Drivers by points: if/else 40 (97 pts), boolean chains 13, loops 3 (5 pts) (nesting depth added 59). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 12 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::axisToCanvasCoords, jquery.flot.Plot::fillInSeriesOptions, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::drawSeriesLines::plotLineArea (cognitive 60) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:2235— jquery.flot.Plot::drawSeriesLines::plotLineArea has cognitive complexity 60 (threshold 15). Drivers by points: if/else 22 (45 pts), boolean chains 14, loops 1 (nesting depth added 23). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 12 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::axisToCanvasCoords, jquery.flot.Plot::fillInSeriesOptions, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::drawSeriesLines::plotLine (cognitive 51) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:2155— jquery.flot.Plot::drawSeriesLines::plotLine has cognitive complexity 51 (threshold 15). Drivers by points: if/else 18 (40 pts), boolean chains 10, loops 1 (nesting depth added 22). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 12 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::axisToCanvasCoords, jquery.flot.Plot::fillInSeriesOptions, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::parseOptions (cognitive 50) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:703— jquery.flot.Plot::parseOptions has cognitive complexity 50 (threshold 15). Drivers by points: if/else 25 (34 pts), boolean chains 11, loops 5 (nesting depth added 9). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 12 other methods here (jquery.flot.Plot::axisToCanvasCoords, jquery.flot.Plot::fillInSeriesOptions, jquery.flot.Plot::processData, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::setupTickGeneration (cognitive 48) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:1609— jquery.flot.Plot::setupTickGeneration has cognitive complexity 48 (threshold 15). Drivers by points: if/else 19 (34 pts), boolean chains 12, ternaries 1 (2 pts) (nesting depth added 16). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 12 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::axisToCanvasCoords, jquery.flot.Plot::fillInSeriesOptions, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::findNearbyItem (cognitive 46) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:2746— jquery.flot.Plot::findNearbyItem has cognitive complexity 46 (threshold 15). Drivers by points: if/else 11 (31 pts), loops 3 (7 pts), boolean chains 5, ternaries 1 (3 pts) (nesting depth added 26). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 12 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::axisToCanvasCoords, jquery.flot.Plot::fillInSeriesOptions, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::fillInSeriesOptions (cognitive 41) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:938— jquery.flot.Plot::fillInSeriesOptions has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (31 pts), loops 4 (6 pts), boolean chains 4 (nesting depth added 19). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 12 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::axisToCanvasCoords, jquery.flot.Plot::processData, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::insertLegend (cognitive 41) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:2634— jquery.flot.Plot::insertLegend has cognitive complexity 41 (threshold 15). Drivers by points: if/else 22 (38 pts), loops 2, boolean chains 1 (nesting depth added 16). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 12 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::axisToCanvasCoords, jquery.flot.Plot::fillInSeriesOptions, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::setRange (cognitive 29) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:1570— jquery.flot.Plot::setRange has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (22 pts), ternaries 3 (4 pts), boolean chains 3 (nesting depth added 14). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 12 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::axisToCanvasCoords, jquery.flot.Plot::fillInSeriesOptions, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::drawBar (cognitive 28) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:2471— jquery.flot.Plot::drawBar has cognitive complexity 28 (threshold 15). Drivers by points: if/else 19 (25 pts), boolean chains 3 (nesting depth added 6). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 12 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::axisToCanvasCoords, jquery.flot.Plot::fillInSeriesOptions, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::axisToCanvasCoords (cognitive 22) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:892— jquery.flot.Plot::axisToCanvasCoords has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 4, loops 2 (nesting depth added 10). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 12 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::fillInSeriesOptions, jquery.flot.Plot::processData, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::setTicks (cognitive 18) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:1749— jquery.flot.Plot::setTicks has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2, loops 1 (nesting depth added 6). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 12 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::axisToCanvasCoords, jquery.flot.Plot::fillInSeriesOptions, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 13 times rather than 13 independent problems. Splitting this body alone leaves the other 12 exactly as they are. Where these are variations on one operation, the change that clears all 13 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Duplicated block (5 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:930— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:930-934 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:171-175 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 228 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:946— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:946-950 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:187-191 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 228 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:962— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:962-966 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:203-207 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 228 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:1019— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:1019-1023 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/UpdateUtils.php:443-447 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:1019` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) wp-content/plugins/woocommerce/src/Internal/Abilities/REST/RestAbilityFactory.php:316— wp-content/plugins/woocommerce/src/Internal/Abilities/REST/RestAbilityFactory.php:316-320 | wp-content/plugins/woocommerce/src/Internal/Abilities/REST/RestAbilityFactory.php:487-491 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Abilities/REST/RestAbilityFactory.php:316` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableSearchQuery.php:167— wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableSearchQuery.php:167-174 | wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableSearchQuery.php:344-348 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 2) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/EmailActionController.php:168— wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/EmailActionController.php:168-172 | wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/EmailActionController.php:206-210 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) wp-content/plugins/woocommerce/src/StoreApi/Utilities/AgenticCheckoutUtils.php:205— wp-content/plugins/woocommerce/src/StoreApi/Utilities/AgenticCheckoutUtils.php:205-209 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/AgenticCheckoutUtils.php:281-285 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/StoreApi/Utilities/AgenticCheckoutUtils.php:205` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php:690— wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php:690-694 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/DataStore.php:530-534 — `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/DataStore.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 35 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 2) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:1402— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:1402-1406 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Fulfillments/Schema/FulfillmentSchema.php:160-164 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-deprecated-action-hooks.php:105— wp-content/plugins/woocommerce/includes/class-wc-deprecated-action-hooks.php:105-109 | wp-content/plugins/woocommerce/includes/class-wc-deprecated-filter-hooks.php:131-135 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (5 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:422— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:422-426 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:572-576 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (5 lines × 2) wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:438— wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:438-442 | wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/Filterer.php:99-103 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×12
Edited copy of a member (22 corresponding lines) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Lib/ImportSession.php:298— wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Lib/ImportSession.php:298-332 | wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Lib/ImportSession.php:521-542 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Fulfillments/Controller.php:167— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Fulfillments/Controller.php:167-188 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Fulfillments/Controller.php:198-219 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) REDACTED:269— REDACTED:269-290 | REDACTED:299-322 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:64— wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:64-85 | wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:130-156 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Reports/Categories/DataStore.php:130— wp-content/plugins/woocommerce/src/Admin/API/Reports/Categories/DataStore.php:130-151 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php:135-156 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-item-type-data-store.php:72— wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-item-type-data-store.php:72-93 | wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-item-type-data-store.php:103-127 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Reports/TimeInterval.php:580— wp-content/plugins/woocommerce/src/Admin/API/Reports/TimeInterval.php:580-601 | wp-content/plugins/woocommerce/src/Admin/API/Reports/TimeInterval.php:613-634 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-status.php:173— wp-content/plugins/woocommerce/includes/admin/class-wc-admin-status.php:173-194 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateSyncRegistry.php:239-270 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-discounts.php:736— wp-content/plugins/woocommerce/includes/class-wc-discounts.php:736-757 | wp-content/plugins/woocommerce/includes/class-wc-discounts.php:769-790 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/AbstractCartRoute.php:277— wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/AbstractCartRoute.php:277-306 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/ShopperListsNonceCheck.php:75-96 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/Blueprint/Init.php:120— wp-content/plugins/woocommerce/src/Admin/Features/Blueprint/Init.php:120-142 | wp-content/plugins/woocommerce/src/Admin/Features/Blueprint/Init.php:165-186 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:1009— wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:1009-1033 | wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:3278-3299 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×12
Edited copy of a member (14 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Reports/DataStore.php:790— wp-content/plugins/woocommerce/src/Admin/API/Reports/DataStore.php:790-803 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Segmenter.php:66-82 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-order-item-product.php:566— wp-content/plugins/woocommerce/includes/class-wc-order-item-product.php:566-579 | wp-content/plugins/woocommerce/includes/class-wc-order-item-product.php:591-605 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/FeaturedItem.php:84— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/FeaturedItem.php:84-97 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/SingleProduct.php:108-121 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:625— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:625-638 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:698-711 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/Agentic/CheckoutSessionSchema.php:402— wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/Agentic/CheckoutSessionSchema.php:402-421 | wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/Agentic/CheckoutSessionSchema.php:431-444 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/Agentic/CheckoutSessionSchema.php:565— wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/Agentic/CheckoutSessionSchema.php:565-580 | wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/Agentic/CheckoutSessionSchema.php:590-603 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) wp-content/plugins/woocommerce/includes/wccom-site/rest-api/endpoints/class-wc-rest-wccom-site-installer-controller.php:152— wp-content/plugins/woocommerce/includes/wccom-site/rest-api/endpoints/class-wc-rest-wccom-site-installer-controller.php:152-166 | wp-content/plugins/woocommerce/includes/wccom-site/rest-api/endpoints/class-wc-rest-wccom-site-installer-controller.php:177-190 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateSyncTracker.php:211— wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateSyncTracker.php:211-224 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateSyncTracker.php:241-254 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Notes/WooSubscriptionsNotes.php:205— wp-content/plugins/woocommerce/src/Internal/Admin/Notes/WooSubscriptionsNotes.php:205-218 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/WooSubscriptionsNotes.php:228-241 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) wp-content/plugins/woocommerce/includes/gateways/bacs/class-wc-gateway-bacs.php:288— wp-content/plugins/woocommerce/includes/gateways/bacs/class-wc-gateway-bacs.php:288-304 | wp-content/plugins/woocommerce/includes/gateways/cheque/class-wc-gateway-cheque.php:122-135 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) wp-content/plugins/woocommerce/includes/data-stores/class-wc-shipping-zone-data-store.php:26— wp-content/plugins/woocommerce/includes/data-stores/class-wc-shipping-zone-data-store.php:26-39 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-shipping-zone-data-store.php:49-64 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) wp-content/plugins/woocommerce/src/Internal/ProductFeed/Integrations/POSCatalog/POSProductVisibilitySync.php:52— wp-content/plugins/woocommerce/src/Internal/ProductFeed/Integrations/POSCatalog/POSProductVisibilitySync.php:52-67 | wp-content/plugins/woocommerce/src/Internal/ProductFeed/Integrations/POSCatalog/POSProductVisibilitySync.php:80-93 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×12
Edited copy of a member (15 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Caches/ProductVersionStringInvalidator.php:137— wp-content/plugins/woocommerce/src/Internal/Caches/ProductVersionStringInvalidator.php:137-155 | wp-content/plugins/woocommerce/src/Internal/Caches/ProductVersionStringInvalidator.php:228-242 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Reports/DataStore.php:625— wp-content/plugins/woocommerce/src/Admin/API/Reports/DataStore.php:625-639 | wp-content/plugins/woocommerce/src/Admin/API/Reports/TimeInterval.php:512-526 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/DataRegenerator.php:426— wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/DataRegenerator.php:426-440 | wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/DataRegenerator.php:478-494 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) REDACTED:2829— REDACTED:2829-2843 | REDACTED:2857-2871 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PaymentGateway.php:147— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PaymentGateway.php:147-161 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PaymentGateway.php:176-190 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-widget.php:85— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-widget.php:85-100 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-widget.php:112-126 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) wp-content/plugins/woocommerce/src/Admin/PluginsHelper.php:708— wp-content/plugins/woocommerce/src/Admin/PluginsHelper.php:708-722 | wp-content/plugins/woocommerce/src/Admin/PluginsHelper.php:731-745 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Reports/OrderAwareControllerTrait.php:30— wp-content/plugins/woocommerce/src/Admin/API/Reports/OrderAwareControllerTrait.php:30-49 | wp-content/plugins/woocommerce/src/Admin/API/Reports/OrderAwareControllerTrait.php:70-84 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:243— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:243-257 | wp-content/plugins/woocommerce/src/Admin/API/Notes.php:177-191 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) wp-content/plugins/woocommerce/includes/tracks/class-wc-tracks-client.php:101— wp-content/plugins/woocommerce/includes/tracks/class-wc-tracks-client.php:101-115 | wp-content/plugins/woocommerce/includes/tracks/class-wc-tracks-client.php:128-142 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/GoCardless.php:28— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/GoCardless.php:28-42 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Paytrail.php:30-44 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php:241— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php:241-255 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhook-deliveries-v1-controller.php:197-211 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×12
Edited copy of a member (11 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-install.php:487— wp-content/plugins/woocommerce/includes/class-wc-install.php:487-497 | wp-content/plugins/woocommerce/includes/class-wc-install.php:508-518 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-exporters.php:74— wp-content/plugins/woocommerce/includes/admin/class-wc-admin-exporters.php:74-84 | wp-content/plugins/woocommerce/includes/admin/class-wc-admin-importers.php:78-88 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/CustomerAccount.php:70— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/CustomerAccount.php:70-84 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/MiniCart.php:154-164 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-product-grouped.php:244— wp-content/plugins/woocommerce/includes/class-wc-product-grouped.php:244-254 | wp-content/plugins/woocommerce/includes/class-wc-product-variable.php:735-747 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) REDACTED:1258— REDACTED:1258-1269 | REDACTED:1280-1290 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php:107— wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php:107-117 | wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:2831-2850 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Platforms/Shopify/ShopifyClient.php:43— wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Platforms/Shopify/ShopifyClient.php:43-53 | wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Platforms/Shopify/ShopifyClient.php:64-74 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-order-factory.php:229— wp-content/plugins/woocommerce/includes/class-wc-order-factory.php:229-239 | wp-content/plugins/woocommerce/includes/class-wc-product-factory.php:134-146 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) wp-content/plugins/woocommerce/includes/wc-formatting-functions.php:472— wp-content/plugins/woocommerce/includes/wc-formatting-functions.php:472-482 | wp-content/plugins/woocommerce/src/Api/Infrastructure/QueryInfoExtractor.php:153-167 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:411— wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:411-424 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-code.php:36-47 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customer-downloads-v1-controller.php:69— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customer-downloads-v1-controller.php:69-79 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:323-334 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Commands/ResetCommand.php:60— wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Commands/ResetCommand.php:60-70 | wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Commands/SetupCommand.php:60-70 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (21 lines × 2) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-brands.php:148— wp-content/plugins/woocommerce/includes/admin/class-wc-admin-brands.php:148-168 | wp-content/plugins/woocommerce/includes/admin/class-wc-admin-brands.php:171-191 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (21 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:230— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:230-250 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Customers/Controller.php:435-455 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (21 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:354— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:354-374 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:645-665 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 2) wp-content/plugins/woocommerce/src/Api/Queries/Coupons/ListCoupons.php:99— wp-content/plugins/woocommerce/src/Api/Queries/Coupons/ListCoupons.php:99-119 | wp-content/plugins/woocommerce/src/Api/Queries/Products/ListProducts.php:199-219 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Api/Queries/Coupons/ListCoupons.php` and `wp-content/plugins/woocommerce/src/Api/Queries/Products/ListProducts.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Api/Queries/Coupons/ListCoupons.php:99` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Payments.php:668— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Payments.php:668-688 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Payments.php:691-711 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:917— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:917-937 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsRestController.php:352-372 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php` and `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsRestController.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 105 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (21 lines × 2) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Platforms/Shopify/ShopifyClient.php:156— wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Platforms/Shopify/ShopifyClient.php:156-176 | wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Platforms/Shopify/ShopifyClient.php:230-250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (21 lines × 2) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Fulfillments/Controller.php:229— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Fulfillments/Controller.php:229-249 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Fulfillments/Controller.php:260-280 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (21 lines × 2) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductBrandSchema.php:104— wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductBrandSchema.php:104-124 | wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductCategorySchema.php:102-122 — before extracting anything, compare `wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductBrandSchema.php` and `wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductCategorySchema.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 51 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductBrandSchema.php:104` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (21 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Exceptions/ApiException.php:35— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Exceptions/ApiException.php:35-55 | wp-content/plugins/woocommerce/src/StoreApi/Exceptions/RouteException.php:31-51 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Exceptions/ApiException.php:35` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (21 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:815— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:815-837 | wp-content/plugins/woocommerce/src/Admin/API/ProductReviews.php:33-53 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (21 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Controller.php:321— wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Controller.php:321-345 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Controller.php:371-391 — `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Controller.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 87 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (18 lines × 2) REDACTED:3314— REDACTED:3314-3331 | REDACTED:3760-3777 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:3314` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:3778` calls `absint` and `REDACTED:3332` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (18 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-customer.php:105— wp-content/plugins/woocommerce/includes/class-wc-customer.php:105-122 | wp-content/plugins/woocommerce/includes/class-wc-webhook.php:70-87 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-customer.php:105` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:406— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:406-423 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:1024-1041 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 223 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:406` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:1042` calls `array_map`, `explode` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:424` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (18 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:140— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:140-157 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:231-248 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (18 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:560— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:560-577 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:827-844 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (18 lines × 2) REDACTED:527— REDACTED:527-544 | wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/Filterer.php:196-213 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:527` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) REDACTED:161— REDACTED:161-178 | REDACTED:187-204 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Cart.php:272— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Cart.php:272-289 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Checkout.php:574-591 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Cart.php:272` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) wp-content/plugins/woocommerce/src/Internal/Abilities/Domain/OrdersQuery.php:86— wp-content/plugins/woocommerce/src/Internal/Abilities/Domain/OrdersQuery.php:86-104 | wp-content/plugins/woocommerce/src/Internal/Abilities/Domain/ProductsQuery.php:92-109 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Abilities/Domain/OrdersQuery.php:86` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:988— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:988-1005 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsRestController.php:499-516 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php` and `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsRestController.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 105 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:988` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 2) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZoneMethod/Controller.php:127— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZoneMethod/Controller.php:127-144 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZones/Controller.php:197-214 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZoneMethod/Controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZones/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 130 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZoneMethod/Controller.php:127` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:1104— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:1104-1121 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/ProductReviews.php:147-164 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php` and `wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/ProductReviews.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 231 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:2258— wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:2258-2272 | wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:2394-2408 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (15 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-rest-authentication.php:261— wp-content/plugins/woocommerce/includes/class-wc-rest-authentication.php:261-275 | wp-content/plugins/woocommerce/includes/wccom-site/class-wc-wccom-site.php:149-163 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (15 lines × 2) wp-content/plugins/woocommerce/includes/import/class-wc-product-csv-importer.php:487— wp-content/plugins/woocommerce/includes/import/class-wc-product-csv-importer.php:487-501 | wp-content/plugins/woocommerce/includes/import/class-wc-product-csv-importer.php:518-532 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (15 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:465— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:465-479 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php:312-326 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (15 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:327— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:327-341 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/ProductReviews.php:116-130 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php` and `wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/ProductReviews.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 231 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:327` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:323` calls `wc_rest_check_product_reviews_permissions` and `wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/ProductReviews.php:115` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15 lines × 2) wp-content/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php:259— wp-content/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php:259-273 | wp-content/plugins/woocommerce/includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php:303-317 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php` and `wp-content/plugins/woocommerce/includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AttributeFilter.php:25— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AttributeFilter.php:25-39 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/PriceFilter.php:27-41 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (15 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterCheckboxList.php:142— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterCheckboxList.php:142-156 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterChips.php:140-154 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterCheckboxList.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterChips.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) wp-includes/PHPMailer/PHPMailer.php:3179— wp-includes/PHPMailer/PHPMailer.php:3179-3193 | wp-includes/PHPMailer/PHPMailer.php:3221-3235 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-includes/PHPMailer/PHPMailer.php:3178` calls `endBoundary` and `wp-includes/PHPMailer/PHPMailer.php:3220` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Controller.php:154— wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Controller.php:154-168 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Controller.php:158-172 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Controller.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Onboarding/OnboardingProfile.php:40— wp-content/plugins/woocommerce/src/Internal/Admin/Onboarding/OnboardingProfile.php:40-54 | wp-content/plugins/woocommerce/src/Internal/Admin/Onboarding/OnboardingSetupWizard.php:134-148 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (15 lines × 2) wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Agentic/CheckoutSessionsComplete.php:159— wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Agentic/CheckoutSessionsComplete.php:159-173 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Agentic/CheckoutSessionsUpdate.php:126-140 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (14 lines × 2) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1461— wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1461-1474 | wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1489-1502 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1461` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:196— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:196-209 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-notes-v2-controller.php:66-79 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-notes-v2-controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (14 lines × 2) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:181— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:181-194 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Fulfillments/Controller.php:368-381 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (14 lines × 2) REDACTED:482— REDACTED:482-495 | REDACTED:592-605 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:482` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:765— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:765-778 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php:915-928 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Marketing.php:179— wp-content/plugins/woocommerce/src/Internal/Admin/Marketing.php:179-192 | wp-content/plugins/woocommerce/src/Internal/Admin/Marketing.php:195-208 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Notes/PaymentsMoreInfoNeeded.php:63— wp-content/plugins/woocommerce/src/Internal/Admin/Notes/PaymentsMoreInfoNeeded.php:63-76 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/PaymentsRemindMeLater.php:63-76 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (14 lines × 2) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Emails/Schema/EmailsSettingsSchema.php:541— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Emails/Schema/EmailsSettingsSchema.php:541-554 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/PaymentGateways/Schema/AbstractPaymentGatewaySettingsSchema.php:598-611 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Emails/Schema/EmailsSettingsSchema.php:541` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Schema/ProductSettingsSchema.php:306— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Schema/ProductSettingsSchema.php:306-319 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Schema/TaxSettingsSchema.php:271-284 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Schema/ProductSettingsSchema.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Schema/TaxSettingsSchema.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Schema/ProductSettingsSchema.php:306` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/Agentic/CheckoutSessionSchema.php:408— wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/Agentic/CheckoutSessionSchema.php:408-421 | wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/Agentic/CheckoutSessionSchema.php:431-444 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:182— wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:182-195 | wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-group-functions.php:173-186 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:520— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:520-534 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:752-765 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
jquery.flot.Plot::drawGrid (cyclomatic 59) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:1869— jquery.flot.Plot::drawGrid has cyclomatic complexity 59 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 10 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::fillInSeriesOptions, jquery.flot.Plot::processData, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 11 times rather than 11 independent problems. Splitting this body alone leaves the other 10 exactly as they are. Where these are variations on one operation, the change that clears all 11 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::processData (cyclomatic 57) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:1030— jquery.flot.Plot::processData has cyclomatic complexity 57 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 10 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::fillInSeriesOptions, jquery.flot.Plot::setRange, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 11 times rather than 11 independent problems. Splitting this body alone leaves the other 10 exactly as they are. Where these are variations on one operation, the change that clears all 11 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::drawSeriesLines::plotLineArea (cyclomatic 43) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:2235— jquery.flot.Plot::drawSeriesLines::plotLineArea has cyclomatic complexity 43 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 10 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::fillInSeriesOptions, jquery.flot.Plot::processData, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 11 times rather than 11 independent problems. Splitting this body alone leaves the other 10 exactly as they are. Where these are variations on one operation, the change that clears all 11 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::parseOptions (cyclomatic 42) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:703— jquery.flot.Plot::parseOptions has cyclomatic complexity 42 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 10 other methods here (jquery.flot.Plot::fillInSeriesOptions, jquery.flot.Plot::processData, jquery.flot.Plot::setRange, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 11 times rather than 11 independent problems. Splitting this body alone leaves the other 10 exactly as they are. Where these are variations on one operation, the change that clears all 11 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::setupTickGeneration (cyclomatic 34) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:1609— jquery.flot.Plot::setupTickGeneration has cyclomatic complexity 34 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 10 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::fillInSeriesOptions, jquery.flot.Plot::processData, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 11 times rather than 11 independent problems. Splitting this body alone leaves the other 10 exactly as they are. Where these are variations on one operation, the change that clears all 11 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::drawSeriesLines::plotLine (cyclomatic 30) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:2155— jquery.flot.Plot::drawSeriesLines::plotLine has cyclomatic complexity 30 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 10 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::fillInSeriesOptions, jquery.flot.Plot::processData, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 11 times rather than 11 independent problems. Splitting this body alone leaves the other 10 exactly as they are. Where these are variations on one operation, the change that clears all 11 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::findNearbyItem (cyclomatic 28) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:2746— jquery.flot.Plot::findNearbyItem has cyclomatic complexity 28 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 10 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::fillInSeriesOptions, jquery.flot.Plot::processData, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 11 times rather than 11 independent problems. Splitting this body alone leaves the other 10 exactly as they are. Where these are variations on one operation, the change that clears all 11 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::insertLegend (cyclomatic 24) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:2634— jquery.flot.Plot::insertLegend has cyclomatic complexity 24 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 10 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::fillInSeriesOptions, jquery.flot.Plot::processData, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 11 times rather than 11 independent problems. Splitting this body alone leaves the other 10 exactly as they are. Where these are variations on one operation, the change that clears all 11 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::drawBar (cyclomatic 22) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:2471— jquery.flot.Plot::drawBar has cyclomatic complexity 22 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 10 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::fillInSeriesOptions, jquery.flot.Plot::processData, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 11 times rather than 11 independent problems. Splitting this body alone leaves the other 10 exactly as they are. Where these are variations on one operation, the change that clears all 11 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::fillInSeriesOptions (cyclomatic 21) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:938— jquery.flot.Plot::fillInSeriesOptions has cyclomatic complexity 21 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 10 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::processData, jquery.flot.Plot::setRange, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 11 times rather than 11 independent problems. Splitting this body alone leaves the other 10 exactly as they are. Where these are variations on one operation, the change that clears all 11 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.Plot::setRange (cyclomatic 17) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:1570— jquery.flot.Plot::setRange has cyclomatic complexity 17 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 10 other methods here (jquery.flot.Plot::parseOptions, jquery.flot.Plot::fillInSeriesOptions, jquery.flot.Plot::processData, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 11 times rather than 11 independent problems. Splitting this body alone leaves the other 10 exactly as they are. Where these are variations on one operation, the change that clears all 11 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D4 · Code Duplication· Edited copy of a member (7 corresponding lines) · ×11
Edited copy of a member (7 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AbstractProductGrid.php:701— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AbstractProductGrid.php:701-707 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AllProducts.php:23-36 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:385— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:385-391 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:677-689 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) wp-content/plugins/woocommerce/includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php:56— wp-content/plugins/woocommerce/includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php:56-63 | wp-content/plugins/woocommerce/includes/shipping/legacy-international-delivery/class-wc-shipping-legacy-international-delivery.php:27-33 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:150— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:150-156 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php:84-90 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:471— wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:471-479 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php:73-79 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) wp-content/plugins/woocommerce/includes/import/abstract-wc-product-importer.php:746— wp-content/plugins/woocommerce/includes/import/abstract-wc-product-importer.php:746-752 | wp-content/plugins/woocommerce/includes/libraries/wp-background-process.php:344-352 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:377— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:377-384 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php:298-304 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:433— wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:433-444 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:305-311 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php:630— wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php:630-639 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:878-884 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/OrderNotes/Controller.php:245— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/OrderNotes/Controller.php:245-251 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZoneMethod/Controller.php:154-162 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:912— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:912-918 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:1136-1142 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (16 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:278— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:278-293 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Customers/Controller.php:478-493 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (16 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:2160— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:2160-2175 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:2589-2604 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (16 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Plugins.php:265— wp-content/plugins/woocommerce/src/Admin/API/Plugins.php:265-280 | wp-content/plugins/woocommerce/src/Admin/API/Plugins.php:379-394 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php:449— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php:449-464 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php:645-660 — `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 36 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php:449` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Segmenter.php:149— wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Segmenter.php:149-164 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Segmenter.php:152-167 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Segmenter.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Segmenter.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Segmenter.php:149` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) wp-content/plugins/woocommerce/src/Blocks/Utils/StyleAttributesUtils.php:558— wp-content/plugins/woocommerce/src/Blocks/Utils/StyleAttributesUtils.php:558-573 | wp-content/plugins/woocommerce/src/Blocks/Utils/StyleAttributesUtils.php:584-599 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) wp-content/plugins/woocommerce/src/Database/Migrations/MetaToCustomTableMigrator.php:788— wp-content/plugins/woocommerce/src/Database/Migrations/MetaToCustomTableMigrator.php:788-803 | wp-content/plugins/woocommerce/src/Database/Migrations/MetaToCustomTableMigrator.php:817-832 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Database/Migrations/MetaToCustomTableMigrator.php:788` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) wp-content/plugins/woocommerce/src/Internal/Abilities/Domain/ProductCreate.php:95— wp-content/plugins/woocommerce/src/Internal/Abilities/Domain/ProductCreate.php:95-110 | wp-content/plugins/woocommerce/src/Internal/Abilities/Domain/ProductUpdate.php:137-152 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Abilities/Domain/ProductCreate.php:95` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:950— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:950-965 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsRestController.php:385-400 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php` and `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsRestController.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 105 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 2) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:279— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:279-294 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Schema/GeneralSettingsSchema.php:326-341 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Schema/GeneralSettingsSchema.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 103 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:279` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:295` calls `sanitize_textarea_field` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Schema/GeneralSettingsSchema.php:342` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (16 lines × 2) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZoneMethod/Controller.php:314— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZoneMethod/Controller.php:314-337 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZones/Controller.php:276-291 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZoneMethod/Controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZones/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 130 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
AC3 · Page structure· Data table has no header cells · ×10
Data table has no header cells wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-field-conditional-logic.php:58— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells wp-content/plugins/advanced-custom-fields-pro/includes/admin/views/field-group-field.php:59— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells wp-content/plugins/woocommerce/includes/admin/helper/views/html-main.php:72— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells wp-content/plugins/woocommerce/includes/admin/helper/views/html-main.php:203— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells wp-content/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-download-permission.php:23— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells wp-content/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php:169— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells wp-content/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php:241— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells wp-content/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php:271— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells wp-content/plugins/woocommerce/includes/admin/meta-boxes/views/html-order-items.php:294— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells wp-content/plugins/woocommerce/includes/admin/meta-boxes/views/html-product-attribute-inner.php:13— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×10
Edited copy of a member (17 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-cart.php:2287— wp-content/plugins/woocommerce/includes/class-wc-cart.php:2287-2304 | wp-content/plugins/woocommerce/includes/wc-cart-functions.php:381-397 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) wp-includes/PHPMailer/PHPMailer.php:4373— wp-includes/PHPMailer/PHPMailer.php:4373-4399 | wp-includes/PHPMailer/PHPMailer.php:4610-4626 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:839— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:839-855 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:866-886 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) REDACTED:479— REDACTED:479-495 | REDACTED:589-605 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZoneMethod/ShippingMethodSchema.php:117— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZoneMethod/ShippingMethodSchema.php:117-136 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZones/ShippingZoneSchema.php:190-206 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:368— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:368-384 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Stock/Controller.php:94-110 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) wp-content/plugins/woocommerce/src/Internal/ShopperLists/ShopperListsController.php:123— wp-content/plugins/woocommerce/src/Internal/ShopperLists/ShopperListsController.php:123-139 | wp-content/plugins/woocommerce/src/Internal/StockNotifications/Admin/SettingsController.php:40-56 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:911— wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:911-927 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:938-954 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Affirm.php:27— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Affirm.php:27-43 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Paystack.php:27-46 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Notes/OrderMilestones.php:182— wp-content/plugins/woocommerce/src/Internal/Admin/Notes/OrderMilestones.php:182-201 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/OrderMilestones.php:211-227 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (16 corresponding lines) · ×10
Edited copy of a member (16 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Reports/TimeInterval.php:356— wp-content/plugins/woocommerce/src/Admin/API/Reports/TimeInterval.php:356-375 | wp-content/plugins/woocommerce/src/Admin/API/Reports/TimeInterval.php:446-461 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:553— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:553-568 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php:805-821 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-controller.php:405— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-controller.php:405-420 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-payment-gateways-controller.php:235-252 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) REDACTED:137— REDACTED:137-152 | REDACTED:451-470 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/CustomerEffortScoreTracks.php:484— wp-content/plugins/woocommerce/src/Internal/Admin/CustomerEffortScoreTracks.php:484-499 | wp-content/plugins/woocommerce/src/Internal/Admin/CustomerEffortScoreTracks.php:506-521 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Emails/Schema/EmailsSettingsSchema.php:359— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Emails/Schema/EmailsSettingsSchema.php:359-377 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Emails/Schema/EmailsSettingsSchema.php:389-404 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:66— wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:66-81 | wp-content/plugins/woocommerce/includes/admin/notes/class-wc-notes-run-db-update.php:74-93 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-downloads.php:234— wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-downloads.php:234-250 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-stock.php:190-205 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) wp-content/plugins/woocommerce/includes/wc-update-functions.php:659— wp-content/plugins/woocommerce/includes/wc-update-functions.php:659-674 | wp-content/plugins/woocommerce/includes/wc-update-functions.php:989-1007 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Controller.php:91— wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Controller.php:91-106 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Stock/Controller.php:288-315 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (5 corresponding lines) · ×10
Edited copy of a member (5 corresponding lines) wp-content/plugins/woocommerce/includes/emails/class-wc-email.php:651— wp-content/plugins/woocommerce/includes/emails/class-wc-email.php:651-655 | wp-content/plugins/woocommerce/includes/emails/class-wc-email.php:672-676 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-countries.php:492— wp-content/plugins/woocommerce/includes/class-wc-countries.php:492-496 | wp-content/plugins/woocommerce/includes/class-wc-countries.php:506-510 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) REDACTED:89— REDACTED:89-100 | wp-content/plugins/woocommerce/includes/admin/list-tables/class-wc-admin-list-table-coupons.php:45-49 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Cart.php:311— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Cart.php:311-315 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Checkout.php:629-633 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:261— wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:261-265 | wp-content/plugins/woocommerce/src/Admin/Features/Blueprint/RestApi.php:163-169 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) wp-includes/php-ai-client/src/Common/AbstractEnum.php:232— wp-includes/php-ai-client/src/Common/AbstractEnum.php:232-236 | wp-includes/php-ai-client/src/Providers/AbstractProvider.php:39-43 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) wp-content/plugins/woocommerce/src/Api/Infrastructure/MetadataController.php:239— wp-content/plugins/woocommerce/src/Api/Infrastructure/MetadataController.php:239-244 | wp-content/plugins/woocommerce/src/Api/Infrastructure/ResolverHelpers.php:150-154 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Notes.php:288— wp-content/plugins/woocommerce/src/Admin/API/Notes.php:288-292 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingProfile.php:168-172 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:166— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:166-170 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:171-175 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (5 corresponding lines) wp-includes/php-ai-client/src/Files/ValueObjects/MimeType.php:136— wp-includes/php-ai-client/src/Files/ValueObjects/MimeType.php:136-140 | wp-includes/php-ai-client/src/Providers/ApiBasedImplementation/AbstractApiBasedModelMetadataDirectory.php:61-65 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (20 lines × 2) REDACTED:215— REDACTED:215-234 | wp-content/plugins/woocommerce/includes/admin/class-wc-admin-webhooks-table-list.php:259-278 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (20 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:485— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:485-504 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:740-759 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 228 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:485` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (20 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1675— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1675-1694 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1752-1771 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1675` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 2) wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-twenty-three.php:24— wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-twenty-three.php:24-43 | wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-twenty-two.php:24-43 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (20 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/DataStore.php:630— wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/DataStore.php:630-649 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/DataStore.php:365-384 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (20 lines × 2) wp-content/plugins/woocommerce/src/Admin/RemoteInboxNotifications/RemoteInboxNotificationsDataSourcePoller.php:66— wp-content/plugins/woocommerce/src/Admin/RemoteInboxNotifications/RemoteInboxNotificationsDataSourcePoller.php:66-85 | wp-content/plugins/woocommerce/src/Admin/RemoteInboxNotifications/RemoteInboxNotificationsDataSourcePoller.php:205-224 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/RemoteInboxNotifications/RemoteInboxNotificationsDataSourcePoller.php:66` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (20 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartForm.php:109— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartForm.php:109-128 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/Utils.php:76-95 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (20 lines × 2) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Schema/OrderSchema.php:753— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Schema/OrderSchema.php:753-772 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/Schema/RefundSchema.php:352-371 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (20 lines × 2) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:338— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:338-357 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Controller.php:278-297 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 155 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:338` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 2) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Admin/ListTable.php:762— wp-content/plugins/woocommerce/src/Internal/StockNotifications/Admin/ListTable.php:762-781 | wp-content/plugins/woocommerce/src/Internal/StockNotifications/Admin/ListTable.php:783-802 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/StockNotifications/Admin/ListTable.php:762` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:481— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:481-499 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:762-780 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (19 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:964— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:964-982 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1579-1597 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:496— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:496-514 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:678-696 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:496` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:673` calls `add_filter`, `array` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:495` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (19 lines × 2) wp-content/plugins/woocommerce/includes/wc-stock-functions.php:165— wp-content/plugins/woocommerce/includes/wc-stock-functions.php:165-183 | wp-content/plugins/woocommerce/includes/wc-stock-functions.php:346-364 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/wc-stock-functions.php:165` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19 lines × 2) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:601— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:601-619 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:640-658 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:601` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19 lines × 2) wp-content/plugins/woocommerce/src/Blocks/AssetsController.php:483— wp-content/plugins/woocommerce/src/Blocks/AssetsController.php:483-501 | wp-content/plugins/woocommerce/src/Internal/Admin/WCAdminAssets.php:511-529 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Blocks/AssetsController.php:479` calls `update_block_settings_dependencies`, `wp_scripts`, `array` and `wp-content/plugins/woocommerce/src/Internal/Admin/WCAdminAssets.php:510` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (19 lines × 2) wp-content/plugins/woocommerce/src/Blocks/Utils/StyleAttributesUtils.php:502— wp-content/plugins/woocommerce/src/Blocks/Utils/StyleAttributesUtils.php:502-520 | wp-content/plugins/woocommerce/src/Blocks/Utils/StyleAttributesUtils.php:530-548 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:1073— wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:1073-1091 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:1093-1111 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-customer.php:526— wp-content/plugins/woocommerce/includes/class-wc-customer.php:526-544 | wp-content/plugins/woocommerce/includes/class-wc-order.php:639-657 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (19 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:375— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:375-393 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:581-606 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 228 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Swallowed exception (empty catch) wp-includes/PHPMailer/PHPMailer.php:3017— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) wp-includes/PHPMailer/POP3.php:354— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) wp-includes/PHPMailer/POP3.php:362— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) wp-content/themes/monoka/assets/font-awesome/js/free.js:14— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) wp-content/themes/monoka/assets/font-awesome/js/free.js:595— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) wp-content/themes/monoka/assets/font-awesome/js/free.js:871— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) wp-content/themes/monoka/assets/font-awesome/js/free.js:2134— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) wp-content/themes/monoka/assets/font-awesome/js/free.js:3924— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) wp-content/themes/monoka/assets/font-awesome/js/pro.js:151— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) wp-content/themes/monoka/assets/font-awesome/js/pro.js:2174— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
FunctionTooLong: jquery.flot.Plot wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:492— FunctionTooLong — Plot runs 1599 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1499 over it, 15.99× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: jquery.flexslider.$.flexslider wp-content/plugins/woocommerce/assets/js/flexslider/jquery.flexslider.js:55— FunctionTooLong — $.flexslider runs 616 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 516 over it, 6.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: jquery.prettyPhoto.$.fn.prettyPhoto REDACTED:10— FunctionTooLong — $.fn.prettyPhoto runs 533 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 433 over it, 5.33× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: jquery.nivo.slider.NivoSlider wp-content/themes/monoka/assets/js/custom-slider/jquery.nivo.slider.js:11— FunctionTooLong — NivoSlider runs 401 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 301 over it, 4.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: jquery.flot.pie.init wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.pie.js:68— FunctionTooLong — init runs 377 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 277 over it, 3.77× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: a8c-address-autocomplete-service.Object.entries().forEach() wp-content/plugins/woocommerce/assets/js/frontend/a8c-address-autocomplete-service.js:173— FunctionTooLong — Object.entries().forEach() runs 178 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 78 over it, 1.78× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: jquery.flot.time.init wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.time.js:197— FunctionTooLong — init runs 137 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 37 over it, 1.37× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: jquery.tipTip.$.fn.tipTip wp-content/plugins/woocommerce/assets/js/jquery-tiptip/jquery.tipTip.js:26— FunctionTooLong — $.fn.tipTip runs 134 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 34 over it, 1.34× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: jquery-ui-timepicker-addon.$.datepicker.parseTime wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:1187— FunctionTooLong — $.datepicker.parseTime runs 117 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 17 over it, 1.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×9
Edited copy of a member (23 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Reports/Segmenter.php:226— wp-content/plugins/woocommerce/src/Admin/API/Reports/Segmenter.php:226-277 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Segmenter.php:289-319 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-discounts.php:802— wp-content/plugins/woocommerce/includes/class-wc-discounts.php:802-824 | wp-content/plugins/woocommerce/includes/class-wc-discounts.php:969-991 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) wp-content/plugins/woocommerce/src/StoreApi/Schemas/ExtendSchema.php:221— wp-content/plugins/woocommerce/src/StoreApi/Schemas/ExtendSchema.php:221-243 | wp-content/plugins/woocommerce/src/StoreApi/Schemas/ExtendSchema.php:255-277 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/MarketingRecommendations/Init.php:109— wp-content/plugins/woocommerce/src/Admin/Features/MarketingRecommendations/Init.php:109-132 | wp-content/plugins/woocommerce/src/Admin/Features/MarketingRecommendations/Init.php:170-192 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Reviews/ProductReviewsPaginationNext.php:27— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Reviews/ProductReviewsPaginationNext.php:27-53 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Reviews/ProductReviewsPaginationPrevious.php:26-48 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) wp-content/plugins/woocommerce/includes/abstracts/class-wc-background-process.php:55— wp-content/plugins/woocommerce/includes/abstracts/class-wc-background-process.php:55-77 | wp-content/plugins/woocommerce/includes/libraries/wp-background-process.php:257-285 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZoneMethod/Controller.php:122— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZoneMethod/Controller.php:122-144 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZones/Controller.php:192-214 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-discounts.php:881— wp-content/plugins/woocommerce/includes/class-wc-discounts.php:881-903 | wp-content/plugins/woocommerce/includes/class-wc-discounts.php:915-938 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) wp-content/plugins/woocommerce/src/Api/Mutations/Coupons/DeleteCoupon.php:32— wp-content/plugins/woocommerce/src/Api/Mutations/Coupons/DeleteCoupon.php:32-58 | wp-content/plugins/woocommerce/src/Api/Mutations/Products/DeleteProduct.php:33-55 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×9
Edited copy of a member (27 corresponding lines) wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php:121— wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php:121-147 | wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php:166-213 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentUtils.php:560— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentUtils.php:560-589 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentUtils.php:628-654 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1137— wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1137-1163 | wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1258-1284 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/SettingsUIRequestContext.php:365— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/SettingsUIRequestContext.php:365-396 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/SettingsUIRequestContext.php:403-429 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) wp-content/plugins/woocommerce/src/Internal/PushNotifications/Services/NotificationProcessor.php:276— wp-content/plugins/woocommerce/src/Internal/PushNotifications/Services/NotificationProcessor.php:276-302 | wp-content/plugins/woocommerce/src/Internal/PushNotifications/Services/NotificationRetryHandler.php:141-168 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-install.php:2357— wp-content/plugins/woocommerce/includes/class-wc-install.php:2357-2389 | wp-content/plugins/woocommerce/src/Admin/ReportCSVExporter.php:71-97 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-data.php:285— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-data.php:285-311 | wp-content/plugins/woocommerce/includes/class-wc-shipping-zone.php:259-289 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) wp-content/plugins/woocommerce/src/Internal/DataStores/CustomMetaDataStore.php:172— wp-content/plugins/woocommerce/src/Internal/DataStores/CustomMetaDataStore.php:172-198 | wp-content/plugins/woocommerce/src/Internal/DataStores/CustomMetaDataStore.php:210-238 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-network-orders-v2-controller.php:57— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-network-orders-v2-controller.php:57-90 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-taxes-controller.php:74-100 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (25 corresponding lines) · ×9
Edited copy of a member (25 corresponding lines) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-api-keys.php:97— wp-content/plugins/woocommerce/includes/admin/class-wc-admin-api-keys.php:97-121 | wp-content/plugins/woocommerce/includes/admin/class-wc-admin-webhooks.php:296-323 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableSearchQuery.php:167— wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableSearchQuery.php:167-191 | wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableSearchQuery.php:203-237 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Stripe.php:76— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Stripe.php:76-100 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Stripe.php:147-171 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:335— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:335-374 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:471-495 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-brands.php:422— wp-content/plugins/woocommerce/includes/class-wc-brands.php:422-446 | wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-brand-description.php:74-101 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsController.php:202— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsController.php:202-226 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsController.php:235-261 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php:217— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php:217-241 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/UpdateUtils.php:300-324 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper-subscriptions-api.php:227— wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper-subscriptions-api.php:227-251 | wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper-subscriptions-api.php:260-284 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Controller.php:185— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Controller.php:185-212 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/Controller.php:196-220 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (12 corresponding lines) · ×9
Edited copy of a member (12 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:625— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:625-636 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:881-892 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductBrandSchema.php:83— wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductBrandSchema.php:83-94 | wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductCategorySchema.php:81-92 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) REDACTED:4176— REDACTED:4176-4188 | REDACTED:4197-4208 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) wp-content/plugins/woocommerce/src/Admin/PluginsHelper.php:428— wp-content/plugins/woocommerce/src/Admin/PluginsHelper.php:428-439 | wp-content/plugins/woocommerce/src/Admin/PluginsHelper.php:536-551 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/WooCommercePayments.php:259— wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/WooCommercePayments.php:259-270 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:553-567 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:2635— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:2635-2646 | wp-content/plugins/woocommerce/includes/class-wc-order.php:2621-2634 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-coupons-controller.php:35— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-coupons-controller.php:35-48 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-coupons-v2-controller.php:248-259 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Notes/PaymentsMoreInfoNeeded.php:42— wp-content/plugins/woocommerce/src/Internal/Admin/Notes/PaymentsMoreInfoNeeded.php:42-54 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/PaymentsRemindMeLater.php:42-53 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Schedulers/CustomersScheduler.php:133— wp-content/plugins/woocommerce/src/Internal/Admin/Schedulers/CustomersScheduler.php:133-144 | wp-content/plugins/woocommerce/src/Internal/Admin/Schedulers/OrdersScheduler.php:758-769 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (4 corresponding lines) · ×9
Edited copy of a member (4 corresponding lines) wp-content/plugins/woocommerce/includes/walkers/class-wc-product-cat-dropdown-walker.php:97— wp-content/plugins/woocommerce/includes/walkers/class-wc-product-cat-dropdown-walker.php:97-100 | wp-content/plugins/woocommerce/includes/walkers/class-wc-product-cat-list-walker.php:148-151 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php:512— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php:512-515 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/DataStore.php:673-676 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Features/ProductBlockEditor/ProductTemplates/Section.php:30— wp-content/plugins/woocommerce/src/Internal/Features/ProductBlockEditor/ProductTemplates/Section.php:30-33 | wp-content/plugins/woocommerce/src/Internal/Features/ProductBlockEditor/ProductTemplates/Subsection.php:29-32 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-customer.php:1132— wp-content/plugins/woocommerce/includes/class-wc-customer.php:1132-1135 | wp-content/plugins/woocommerce/includes/class-wc-order.php:1382-1385 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/ShippingPartnerSuggestions/ShippingPartnerSuggestionsDataSourcePoller.php:36— wp-content/plugins/woocommerce/src/Admin/Features/ShippingPartnerSuggestions/ShippingPartnerSuggestionsDataSourcePoller.php:36-39 | wp-content/plugins/woocommerce/src/Admin/RemoteInboxNotifications/RemoteInboxNotificationsDataSourcePoller.php:40-50 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-order-item-fee.php:378— wp-content/plugins/woocommerce/includes/class-wc-order-item-fee.php:378-381 | wp-content/plugins/woocommerce/includes/class-wc-order-item-product.php:616-619 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) wp-content/plugins/woocommerce/includes/data-stores/class-wc-customer-download-data-store.php:255— wp-content/plugins/woocommerce/includes/data-stores/class-wc-customer-download-data-store.php:255-270 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-customer-download-log-data-store.php:264-267 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php:266— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php:266-269 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php:264-269 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (4 corresponding lines) wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:981— wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:981-984 | wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:3251-3254 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
X19 · Unrestored process-global state· Process-global state is restored only on the happy path · ×9
Process-global state is restored only on the happy path wp-includes/PHPMailer/PHPMailer.php:2080— `mailSend` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the `sendmail_from` ini setting (changed at line 2118, put back at line 2143) — which says the change was meant to last no longer than this call. But the restore is an ordinary statement on the straight-line path, not a `finally`, so it is skipped by any exception thrown in between: PHP then keeps the overwritten value for the rest of the request — and in a CLI command, a queue worker or a long-running server (Octane, Swoole, RoadRunner, FrankenPHP) for the rest of the process's life — and every later relative path, child-process launch, date, number format, XML parse or error report in ANY class reads it. That failure is silent and remote from its cause: the function that breaks is not the function that moved the value. The durable fix is not to widen the restore but to stop mutating the global: pass the value to the operation that needs it — `cwd` and `env` to Symfony `Process` (`new Process($command, $cwd, $env)`) or `proc_open($command, $spec, $pipes, $cwd, $env)`, absolute paths instead of `chdir`, an explicit `DateTimeZone` or locale to `DateTimeImmutable`/`IntlDateFormatter`/`NumberFormatter`, an explicit encoding to the `mb_*` call, `LIBXML_NOERROR`/`libxml_get_errors` handling in one place. Where the global genuinely must move, wrap it `try`/`finally` so the restore runs on every path.
Process-global state is restored only on the happy path wp-includes/PHPMailer/PHPMailer.php:3802— `decodeHeader` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the internal multibyte encoding (changed at line 3812, put back at line 3823) — which says the change was meant to last no longer than this call. But the restore is an ordinary statement on the straight-line path, not a `finally`, so it is skipped by any exception thrown in between: PHP then keeps the overwritten value for the rest of the request — and in a CLI command, a queue worker or a long-running server (Octane, Swoole, RoadRunner, FrankenPHP) for the rest of the process's life — and every later relative path, child-process launch, date, number format, XML parse or error report in ANY class reads it. That failure is silent and remote from its cause: the function that breaks is not the function that moved the value. The durable fix is not to widen the restore but to stop mutating the global: pass the value to the operation that needs it — `cwd` and `env` to Symfony `Process` (`new Process($command, $cwd, $env)`) or `proc_open($command, $spec, $pipes, $cwd, $env)`, absolute paths instead of `chdir`, an explicit `DateTimeZone` or locale to `DateTimeImmutable`/`IntlDateFormatter`/`NumberFormatter`, an explicit encoding to the `mb_*` call, `LIBXML_NOERROR`/`libxml_get_errors` handling in one place. Where the global genuinely must move, wrap it `try`/`finally` so the restore runs on every path.
Process-global state is restored only on the happy path wp-includes/PHPMailer/POP3.php:245— `connect` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the error handler (changed at line 254, reset at line 273) — which says the change was meant to last no longer than this call. But the restore is an ordinary statement on the straight-line path, not a `finally`, so it is skipped by any exception thrown in between: PHP then keeps the overwritten value for the rest of the request — and in a CLI command, a queue worker or a long-running server (Octane, Swoole, RoadRunner, FrankenPHP) for the rest of the process's life — and every later relative path, child-process launch, date, number format, XML parse or error report in ANY class reads it. That failure is silent and remote from its cause: the function that breaks is not the function that moved the value. The durable fix is not to widen the restore but to stop mutating the global: pass the value to the operation that needs it — `cwd` and `env` to Symfony `Process` (`new Process($command, $cwd, $env)`) or `proc_open($command, $spec, $pipes, $cwd, $env)`, absolute paths instead of `chdir`, an explicit `DateTimeZone` or locale to `DateTimeImmutable`/`IntlDateFormatter`/`NumberFormatter`, an explicit encoding to the `mb_*` call, `LIBXML_NOERROR`/`libxml_get_errors` handling in one place. Where the global genuinely must move, wrap it `try`/`finally` so the restore runs on every path.
Process-global state is restored only on the happy path wp-includes/PHPMailer/SMTP.php:407— `getSMTPConnection` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the error handler (changed at line 420, reset at line 448) — which says the change was meant to last no longer than this call. But the restore is an ordinary statement on the straight-line path, not a `finally`, so it is skipped by any exception thrown in between: PHP then keeps the overwritten value for the rest of the request — and in a CLI command, a queue worker or a long-running server (Octane, Swoole, RoadRunner, FrankenPHP) for the rest of the process's life — and every later relative path, child-process launch, date, number format, XML parse or error report in ANY class reads it. That failure is silent and remote from its cause: the function that breaks is not the function that moved the value. The durable fix is not to widen the restore but to stop mutating the global: pass the value to the operation that needs it — `cwd` and `env` to Symfony `Process` (`new Process($command, $cwd, $env)`) or `proc_open($command, $spec, $pipes, $cwd, $env)`, absolute paths instead of `chdir`, an explicit `DateTimeZone` or locale to `DateTimeImmutable`/`IntlDateFormatter`/`NumberFormatter`, an explicit encoding to the `mb_*` call, `LIBXML_NOERROR`/`libxml_get_errors` handling in one place. Where the global genuinely must move, wrap it `try`/`finally` so the restore runs on every path.
Process-global state is restored only on the happy path wp-includes/PHPMailer/SMTP.php:486— `startTLS` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the error handler (changed at line 505, reset at line 513) — which says the change was meant to last no longer than this call. But the restore is an ordinary statement on the straight-line path, not a `finally`, so it is skipped by any exception thrown in between: PHP then keeps the overwritten value for the rest of the request — and in a CLI command, a queue worker or a long-running server (Octane, Swoole, RoadRunner, FrankenPHP) for the rest of the process's life — and every later relative path, child-process launch, date, number format, XML parse or error report in ANY class reads it. That failure is silent and remote from its cause: the function that breaks is not the function that moved the value. The durable fix is not to widen the restore but to stop mutating the global: pass the value to the operation that needs it — `cwd` and `env` to Symfony `Process` (`new Process($command, $cwd, $env)`) or `proc_open($command, $spec, $pipes, $cwd, $env)`, absolute paths instead of `chdir`, an explicit `DateTimeZone` or locale to `DateTimeImmutable`/`IntlDateFormatter`/`NumberFormatter`, an explicit encoding to the `mb_*` call, `LIBXML_NOERROR`/`libxml_get_errors` handling in one place. Where the global genuinely must move, wrap it `try`/`finally` so the restore runs on every path.
Process-global state is restored only on the happy path wp-includes/PHPMailer/SMTP.php:1240— `client_send` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the error handler (changed at line 1252, reset at line 1256) — which says the change was meant to last no longer than this call. But the restore is an ordinary statement on the straight-line path, not a `finally`, so it is skipped by any exception thrown in between: PHP then keeps the overwritten value for the rest of the request — and in a CLI command, a queue worker or a long-running server (Octane, Swoole, RoadRunner, FrankenPHP) for the rest of the process's life — and every later relative path, child-process launch, date, number format, XML parse or error report in ANY class reads it. That failure is silent and remote from its cause: the function that breaks is not the function that moved the value. The durable fix is not to widen the restore but to stop mutating the global: pass the value to the operation that needs it — `cwd` and `env` to Symfony `Process` (`new Process($command, $cwd, $env)`) or `proc_open($command, $spec, $pipes, $cwd, $env)`, absolute paths instead of `chdir`, an explicit `DateTimeZone` or locale to `DateTimeImmutable`/`IntlDateFormatter`/`NumberFormatter`, an explicit encoding to the `mb_*` call, `LIBXML_NOERROR`/`libxml_get_errors` handling in one place. Where the global genuinely must move, wrap it `try`/`finally` so the restore runs on every path.
Process-global state is restored only on the happy path wp-includes/PHPMailer/SMTP.php:1340— `get_lines` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the error handler (changed at line 1357, reset at line 1361) — which says the change was meant to last no longer than this call. But the restore is an ordinary statement on the straight-line path, not a `finally`, so it is skipped by any exception thrown in between: PHP then keeps the overwritten value for the rest of the request — and in a CLI command, a queue worker or a long-running server (Octane, Swoole, RoadRunner, FrankenPHP) for the rest of the process's life — and every later relative path, child-process launch, date, number format, XML parse or error report in ANY class reads it. That failure is silent and remote from its cause: the function that breaks is not the function that moved the value. The durable fix is not to widen the restore but to stop mutating the global: pass the value to the operation that needs it — `cwd` and `env` to Symfony `Process` (`new Process($command, $cwd, $env)`) or `proc_open($command, $spec, $pipes, $cwd, $env)`, absolute paths instead of `chdir`, an explicit `DateTimeZone` or locale to `DateTimeImmutable`/`IntlDateFormatter`/`NumberFormatter`, an explicit encoding to the `mb_*` call, `LIBXML_NOERROR`/`libxml_get_errors` handling in one place. Where the global genuinely must move, wrap it `try`/`finally` so the restore runs on every path.
Process-global state is restored only on the happy path wp-content/plugins/woocommerce/src/Admin/API/Reports/TimeInterval.php:328— `next_week_start` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the default timezone (changed at line 335, put back at line 337) — which says the change was meant to last no longer than this call. But the restore is an ordinary statement on the straight-line path, not a `finally`, so it is skipped by any exception thrown in between: PHP then keeps the overwritten value for the rest of the request — and in a CLI command, a queue worker or a long-running server (Octane, Swoole, RoadRunner, FrankenPHP) for the rest of the process's life — and every later relative path, child-process launch, date, number format, XML parse or error report in ANY class reads it. That failure is silent and remote from its cause: the function that breaks is not the function that moved the value. The durable fix is not to widen the restore but to stop mutating the global: pass the value to the operation that needs it — `cwd` and `env` to Symfony `Process` (`new Process($command, $cwd, $env)`) or `proc_open($command, $spec, $pipes, $cwd, $env)`, absolute paths instead of `chdir`, an explicit `DateTimeZone` or locale to `DateTimeImmutable`/`IntlDateFormatter`/`NumberFormatter`, an explicit encoding to the `mb_*` call, `LIBXML_NOERROR`/`libxml_get_errors` handling in one place. Where the global genuinely must move, wrap it `try`/`finally` so the restore runs on every path.
Process-global state is restored only on the happy path wp-content/plugins/woocommerce/includes/wc-formatting-functions.php:741— `wc_string_to_timestamp` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the default timezone (changed at line 747, put back at line 755) — which says the change was meant to last no longer than this call. But the restore is an ordinary statement on the straight-line path, not a `finally`, so it is skipped by any exception thrown in between: PHP then keeps the overwritten value for the rest of the request — and in a CLI command, a queue worker or a long-running server (Octane, Swoole, RoadRunner, FrankenPHP) for the rest of the process's life — and every later relative path, child-process launch, date, number format, XML parse or error report in ANY class reads it. That failure is silent and remote from its cause: the function that breaks is not the function that moved the value. The durable fix is not to widen the restore but to stop mutating the global: pass the value to the operation that needs it — `cwd` and `env` to Symfony `Process` (`new Process($command, $cwd, $env)`) or `proc_open($command, $spec, $pipes, $cwd, $env)`, absolute paths instead of `chdir`, an explicit `DateTimeZone` or locale to `DateTimeImmutable`/`IntlDateFormatter`/`NumberFormatter`, an explicit encoding to the `mb_*` call, `LIBXML_NOERROR`/`libxml_get_errors` handling in one place. Where the global genuinely must move, wrap it `try`/`finally` so the restore runs on every path.
X27 · Collection changed while being enumerated· Collection is structurally changed while it is being enumerated · ×9
Collection is structurally changed while it is being enumerated wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:377— line 377 walks `$preload_settings` by value, so the walk is the snapshot taken when the loop began, and line 379 changes that same collection with `$preload_settings = …` before the next iteration: the loop carries on over the old value while the body now works on the new one. PHP raises nothing, so the loop completes over a different set than the code meant.
Collection is structurally changed while it is being enumerated wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php:169— line 169 walks `$preload_settings` by value, so the walk is the snapshot taken when the loop began, and line 171 changes that same collection with `$preload_settings = …` before the next iteration: the loop carries on over the old value while the body now works on the new one. PHP raises nothing, so the loop completes over a different set than the code meant.
Collection is structurally changed while it is being enumerated wp-content/plugins/woocommerce/src/Api/Pagination/Connection.php:97— line 97 walks `$edges` by value, so the walk is the snapshot taken when the loop began, and line 99 changes that same collection with `$edges = …` before the next iteration: the loop carries on over the old value while the body now works on the new one. PHP raises nothing, so the loop completes over a different set than the code meant.
Collection is structurally changed while it is being enumerated wp-content/plugins/woocommerce/includes/wc-core-functions.php:999— line 999 walks `$page_ids` by value, so the walk is the snapshot taken when the loop began, and line 1000 changes that same collection with `$page_ids = …` before the next iteration: the loop carries on over the old value while the body now works on the new one. PHP raises nothing, so the loop completes over a different set than the code meant.
Collection is structurally changed while it is being enumerated wp-content/plugins/woocommerce/includes/wc-core-functions.php:1328— line 1328 walks `$results` by value, so the walk is the snapshot taken when the loop began, and line 1337 changes that same collection with `$results[] = …` before the next iteration: the added element is never visited by this loop, so whatever it was added for is not done here. PHP raises nothing, so the loop completes over a different set than the code meant.
Collection is structurally changed while it is being enumerated wp-content/plugins/woocommerce/includes/wc-product-functions.php:1222— line 1222 walks `$product_cats` by value, so the walk is the snapshot taken when the loop began, and line 1223 changes that same collection with `$product_cats = …` before the next iteration: the loop carries on over the old value while the body now works on the new one. PHP raises nothing, so the loop completes over a different set than the code meant.
Collection is structurally changed while it is being enumerated wp-content/plugins/woocommerce/includes/wc-term-functions.php:502— line 502 walks `$term_ids` by value, so the walk is the snapshot taken when the loop began, and line 503 changes that same collection with `$term_ids = …` before the next iteration: the loop carries on over the old value while the body now works on the new one. PHP raises nothing, so the loop completes over a different set than the code meant.
Collection is structurally changed while it is being enumerated wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-products.php:296— line 296 walks `$terms` by value, so the walk is the snapshot taken when the loop began, and line 299 changes that same collection with `$terms[] = …` before the next iteration: the added element is never visited by this loop, so whatever it was added for is not done here. PHP raises nothing, so the loop completes over a different set than the code meant.
Collection is structurally changed while it is being enumerated wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-products.php:340— line 340 walks `$categories` by value, so the walk is the snapshot taken when the loop began, and line 343 changes that same collection with `$categories[] = …` before the next iteration: the added element is never visited by this loop, so whatever it was added for is not done here. PHP raises nothing, so the loop completes over a different set than the code meant.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×8
Edited copy of a member (20 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-product-attribute.php:77— wp-content/plugins/woocommerce/includes/class-wc-product-attribute.php:77-97 | wp-content/plugins/woocommerce/includes/class-wc-product-attribute.php:106-125 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentUtils.php:599— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentUtils.php:599-618 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentUtils.php:664-689 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-discounts.php:74— wp-content/plugins/woocommerce/includes/class-wc-discounts.php:74-93 | wp-content/plugins/woocommerce/includes/class-wc-discounts.php:103-127 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1461— wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1461-1480 | wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1489-1508 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) wp-content/plugins/woocommerce/src/Admin/PageController.php:557— wp-content/plugins/woocommerce/src/Admin/PageController.php:557-576 | wp-content/plugins/woocommerce/src/Internal/Admin/Homescreen.php:245-267 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ClassicTemplate.php:111— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ClassicTemplate.php:111-130 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductImageGallery.php:56-82 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) wp-content/plugins/advanced-custom-fields-pro/includes/locations.php:176— wp-content/plugins/advanced-custom-fields-pro/includes/locations.php:176-195 | wp-content/plugins/advanced-custom-fields-pro/includes/locations.php:208-227 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Airwallex.php:90— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Airwallex.php:90-109 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/AmazonPay.php:132-151 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (19 corresponding lines) · ×8
Edited copy of a member (19 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-reviews-v2-controller.php:120— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-reviews-v2-controller.php:120-138 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:709-741 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) wp-content/plugins/woocommerce/src/Api/Mutations/Coupons/CreateCoupon.php:29— wp-content/plugins/woocommerce/src/Api/Mutations/Coupons/CreateCoupon.php:29-47 | wp-content/plugins/woocommerce/src/Api/Mutations/Coupons/UpdateCoupon.php:31-57 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) wp-content/plugins/woocommerce/includes/gateways/cheque/class-wc-gateway-cheque.php:181— wp-content/plugins/woocommerce/includes/gateways/cheque/class-wc-gateway-cheque.php:181-199 | wp-content/plugins/woocommerce/includes/gateways/cod/class-wc-gateway-cod.php:384-402 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php:835— wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php:835-853 | wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:3123-3145 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:341— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:341-365 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:550-568 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/AfterpayClearpay.php:28— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/AfterpayClearpay.php:28-46 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Monei.php:28-46 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) REDACTED:213— REDACTED:213-231 | REDACTED:240-260 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) wp-content/plugins/woocommerce/src/Internal/PushNotifications/Notifications/NewOrderNotification.php:98— wp-content/plugins/woocommerce/src/Internal/PushNotifications/Notifications/NewOrderNotification.php:98-116 | wp-content/plugins/woocommerce/src/Internal/PushNotifications/Notifications/NewReviewNotification.php:42-61 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (6 corresponding lines) · ×8
Edited copy of a member (6 corresponding lines) wp-content/plugins/woocommerce/includes/data-stores/class-wc-payment-token-data-store.php:185— wp-content/plugins/woocommerce/includes/data-stores/class-wc-payment-token-data-store.php:185-190 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:550-555 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-product-variation.php:106— wp-content/plugins/woocommerce/includes/class-wc-product-variation.php:106-114 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php:2085-2090 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Logging/OrderLogsCleanupHelper.php:61— wp-content/plugins/woocommerce/src/Internal/Logging/OrderLogsCleanupHelper.php:61-66 | wp-content/plugins/woocommerce/src/Internal/Logging/OrderLogsDeletionProcessor.php:63-69 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) wp-content/plugins/woocommerce/src/Internal/PushNotifications/Notifications/NewOrderNotification.php:135— wp-content/plugins/woocommerce/src/Internal/PushNotifications/Notifications/NewOrderNotification.php:135-140 | wp-content/plugins/woocommerce/src/Internal/PushNotifications/Notifications/StockNotification.php:278-283 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) wp-content/plugins/woocommerce/includes/import/abstract-wc-product-importer.php:784— wp-content/plugins/woocommerce/includes/import/abstract-wc-product-importer.php:784-789 | wp-content/plugins/woocommerce/includes/libraries/wp-background-process.php:385-392 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) wp-content/plugins/woocommerce/src/Internal/PushNotifications/Notifications/NewOrderNotification.php:149— wp-content/plugins/woocommerce/src/Internal/PushNotifications/Notifications/NewOrderNotification.php:149-154 | wp-content/plugins/woocommerce/src/Internal/PushNotifications/Notifications/StockNotification.php:292-297 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) wp-includes/php-ai-client/src/Tools/DTO/FunctionCall.php:49— wp-includes/php-ai-client/src/Tools/DTO/FunctionCall.php:49-54 | wp-includes/php-ai-client/src/Tools/DTO/FunctionResponse.php:49-54 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/Utils.php:179— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/Utils.php:179-185 | wp-content/plugins/woocommerce/src/Internal/Abilities/REST/RestAbilityFactory.php:339-344 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (12 lines × 3) wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-order.php:141— wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-order.php:141-152 | wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-order.php:190-201 | wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-order.php:229-240 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-order.php:141` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:676— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:676-687 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:944-955 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/UpdateUtils.php:363-374 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 228 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:956` calls `maybe_set_item_meta_data` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:689` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1455— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1455-1466 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:458-469 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:304-315 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 1094 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1455` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1491— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1491-1502 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:502-513 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:357-368 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 1094 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1491` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:514` calls `wc_get_product`, `get_parent_id` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1503` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 3) wp-content/plugins/woocommerce/src/Blocks/Templates/ProductBrandTemplate.php:58— wp-content/plugins/woocommerce/src/Blocks/Templates/ProductBrandTemplate.php:58-69 | wp-content/plugins/woocommerce/src/Blocks/Templates/ProductCategoryTemplate.php:58-69 | wp-content/plugins/woocommerce/src/Blocks/Templates/ProductTagTemplate.php:58-69 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/Templates/ProductBrandTemplate.php` and `wp-content/plugins/woocommerce/src/Blocks/Templates/ProductCategoryTemplate.php` as WHOLE FILES: 85% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 3) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:280— wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:280-291 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:332-343 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:372-398 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:280` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12 lines × 3) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php:475— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php:475-486 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php:671-683 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/DataStore.php:323-335 — `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 36 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (12 lines × 3) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:140— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:140-151 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Controller.php:154-165 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:136-147 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 105 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×7
Edited copy of a member (29 corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:579— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:579-619 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:630-658 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) wp-content/plugins/woocommerce/src/Database/Migrations/MetaToMetaTableMigrator.php:205— wp-content/plugins/woocommerce/src/Database/Migrations/MetaToMetaTableMigrator.php:205-233 | wp-content/plugins/woocommerce/src/Database/Migrations/MetaToMetaTableMigrator.php:244-272 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Utils.php:367— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Utils.php:367-395 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Utils.php:407-435 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:261— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:261-293 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Customers/Controller.php:465-493 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Abilities/Domain/Traits/OrderAbilityTrait.php:141— wp-content/plugins/woocommerce/src/Internal/Abilities/Domain/Traits/OrderAbilityTrait.php:141-169 | wp-content/plugins/woocommerce/src/Internal/Abilities/Domain/Traits/ProductAbilityTrait.php:456-484 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-payment-gateways-controller.php:74— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-payment-gateways-controller.php:74-102 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/PaymentGateways/Schema/AbstractPaymentGatewaySettingsSchema.php:484-512 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:214— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:214-242 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Segmenter.php:182-250 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (21 corresponding lines) · ×7
Edited copy of a member (21 corresponding lines) wp-content/plugins/woocommerce/includes/gateways/bacs/class-wc-gateway-bacs.php:60— wp-content/plugins/woocommerce/includes/gateways/bacs/class-wc-gateway-bacs.php:60-96 | wp-content/plugins/woocommerce/includes/gateways/cheque/class-wc-gateway-cheque.php:45-65 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-customer.php:102— wp-content/plugins/woocommerce/includes/class-wc-customer.php:102-128 | wp-content/plugins/woocommerce/includes/class-wc-webhook.php:67-87 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) wp-content/plugins/woocommerce/includes/import/class-wc-product-csv-importer.php:481— wp-content/plugins/woocommerce/includes/import/class-wc-product-csv-importer.php:481-501 | wp-content/plugins/woocommerce/includes/import/class-wc-product-csv-importer.php:512-532 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) wp-content/plugins/woocommerce/includes/wc-core-functions.php:751— wp-content/plugins/woocommerce/includes/wc-core-functions.php:751-776 | wp-content/plugins/woocommerce/src/Utilities/ArrayUtil.php:47-67 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/Domain/Services/CheckoutFieldsFrontend.php:227— wp-content/plugins/woocommerce/src/Blocks/Domain/Services/CheckoutFieldsFrontend.php:227-247 | wp-content/plugins/woocommerce/src/Blocks/Domain/Services/CheckoutFieldsFrontend.php:262-282 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) wp-content/plugins/woocommerce/includes/emails/class-wc-email.php:1141— wp-content/plugins/woocommerce/includes/emails/class-wc-email.php:1141-1179 | wp-content/plugins/woocommerce/includes/emails/class-wc-email.php:1195-1215 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/Utils/StyleAttributesUtils.php:373— wp-content/plugins/woocommerce/src/Blocks/Utils/StyleAttributesUtils.php:373-393 | wp-content/plugins/woocommerce/src/Blocks/Utils/StyleAttributesUtils.php:662-684 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×7
Edited copy of a member (10 corresponding lines) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:3475— wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:3475-3485 | wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:3497-3506 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-https.php:89— wp-content/plugins/woocommerce/includes/class-wc-https.php:89-98 | wp-content/plugins/woocommerce/includes/class-wc-https.php:105-118 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/Utils/CartCheckoutUtils.php:447— wp-content/plugins/woocommerce/src/Blocks/Utils/CartCheckoutUtils.php:447-459 | wp-content/plugins/woocommerce/src/Blocks/Utils/CartCheckoutUtils.php:504-513 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:519— wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:519-530 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php:393-402 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/PaymentGatewaySuggestions.php:109— wp-content/plugins/woocommerce/src/Admin/API/PaymentGatewaySuggestions.php:109-118 | wp-content/plugins/woocommerce/src/Admin/API/ShippingPartnerSuggestions.php:97-106 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:451— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:451-461 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php:312-321 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/CartItemsByKey.php:87— wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/CartItemsByKey.php:87-96 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/CartItemsByKey.php:124-133 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (31 lines × 2) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:617— wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:617-647 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variable-data-store-cpt.php:85-115 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variable-data-store-cpt.php:118` calls `update_attributes` and `wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:648` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (31 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:535— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:535-565 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:398-428 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 148 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:535` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (31 lines × 2) wp-content/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php:190— wp-content/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php:190-220 | wp-content/plugins/woocommerce/includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php:218-248 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php` and `wp-content/plugins/woocommerce/includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php:187` calls `WC`, `shipping`, `get_shipping_classes` and `wp-content/plugins/woocommerce/includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php:215` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (31 lines × 2) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Platforms/Shopify/ShopifyMapper.php:421— wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Platforms/Shopify/ShopifyMapper.php:421-451 | wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Platforms/Shopify/ShopifyMapper.php:520-550 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (31 lines × 2) wp-includes/PHPMailer/PHPMailer.php:3118— wp-includes/PHPMailer/PHPMailer.php:3118-3148 | wp-includes/PHPMailer/PHPMailer.php:3186-3216 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-includes/PHPMailer/PHPMailer.php:3118` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (31 lines × 2) wp-content/plugins/woocommerce/src/StoreApi/Exceptions/InvalidCartException.php:41— wp-content/plugins/woocommerce/src/StoreApi/Exceptions/InvalidCartException.php:41-71 | wp-content/plugins/woocommerce/src/StoreApi/Exceptions/InvalidStockLevelsInCartException.php:41-71 — before extracting anything, compare `wp-content/plugins/woocommerce/src/StoreApi/Exceptions/InvalidCartException.php` and `wp-content/plugins/woocommerce/src/StoreApi/Exceptions/InvalidStockLevelsInCartException.php` as WHOLE FILES: 90% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/StoreApi/Exceptions/InvalidCartException.php:41` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (31 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:90— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:90-122 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php:833-863 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (23 lines × 2) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-widget.php:340— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-widget.php:340-362 | REDACTED:239-261 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-widget.php:340` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-widget.php:365` calls `is_shop`, `remove_query_arg` and `REDACTED:262` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (23 lines × 2) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:454— wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:454-476 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-customers.php:302-324 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:454` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:233— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:233-255 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-notes-controller.php:85-107 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-notes-controller.php` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 116 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (23 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:801— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:801-823 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php:255-277 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 72 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:801` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23 lines × 2) wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-nineteen.php:24— wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-nineteen.php:24-46 | wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-twenty.php:24-46 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (23 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Payments.php:398— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Payments.php:398-420 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:1631-1653 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (23 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/SavedForLater.php:398— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/SavedForLater.php:398-420 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Wishlist.php:259-281 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/SavedForLater.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Wishlist.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 134 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (5 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:224— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:224-228 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:299-303 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-notes-controller.php:76-80 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-notes-controller.php` as WHOLE FILES: this scan already matched 8 separate duplicated blocks between them, totalling at least 116 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 3) wp-includes/php-ai-client/src/Providers/Http/Exception/ClientException.php:56— wp-includes/php-ai-client/src/Providers/Http/Exception/ClientException.php:56-60 | wp-includes/php-ai-client/src/Providers/Http/Exception/RedirectException.php:34-38 | wp-includes/php-ai-client/src/Providers/Http/Exception/ServerException.php:34-38 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (5 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:609— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:609-613 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:865-869 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/UpdateUtils.php:137-141 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 228 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 3) wp-content/plugins/woocommerce/includes/shipping/legacy-free-shipping/class-wc-shipping-legacy-free-shipping.php:43— wp-content/plugins/woocommerce/includes/shipping/legacy-free-shipping/class-wc-shipping-legacy-free-shipping.php:43-47 | wp-content/plugins/woocommerce/includes/shipping/legacy-local-delivery/class-wc-shipping-legacy-local-delivery.php:43-47 | wp-content/plugins/woocommerce/includes/shipping/legacy-local-pickup/class-wc-shipping-legacy-local-pickup.php:34-38 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (5 lines × 3) wp-content/plugins/woocommerce/src/Admin/API/AnalyticsImports.php:77— wp-content/plugins/woocommerce/src/Admin/API/AnalyticsImports.php:77-85 | wp-content/plugins/woocommerce/src/Admin/API/MarketingRecommendations.php:76-80 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingPlugins.php:241-249 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (5 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-continents-controller.php:199— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-continents-controller.php:199-203 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-countries-controller.php:146-150 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-currencies-controller.php:142-146 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-continents-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-countries-controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 104 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 3) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationEmail.php:235— wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationEmail.php:235-239 | wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationVerifiedEmail.php:205-209 | wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationVerifyEmail.php:229-233 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationEmail.php` and `wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationVerifiedEmail.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×6
Members sharing a duplicated core (6 members, 50+ identical tokens) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:147— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:147-156 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:180-189 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:199-208 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:152-161 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:185-194 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:204-213 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-eleven.php:21— wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-eleven.php:21-38 | wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-fifteen.php:22-39 | wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-fourteen.php:22-39 | wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-sixteen.php:21-38 | wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-ten.php:21-38 | wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-thirteen.php:22-39 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/DataStore.php:150— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/DataStore.php:150-228 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/DataStore.php:91-158 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/DataStore.php:337-446 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/DataStore.php:156-239 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/Stats/DataStore.php:171-251 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/DataStore.php:176-262 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterActive.php:27— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterActive.php:27-108 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:143-267 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterPrice.php:100-186 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterRating.php:87-170 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterStatus.php:101-172 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterTaxonomy.php:186-309 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) wp-content/plugins/woocommerce/src/Blocks/Templates/ProductAttributeTemplate.php:51— wp-content/plugins/woocommerce/src/Blocks/Templates/ProductAttributeTemplate.php:51-65 | wp-content/plugins/woocommerce/src/Blocks/Templates/ProductBrandTemplate.php:58-69 | wp-content/plugins/woocommerce/src/Blocks/Templates/ProductCatalogTemplate.php:52-61 | wp-content/plugins/woocommerce/src/Blocks/Templates/ProductCategoryTemplate.php:58-69 | wp-content/plugins/woocommerce/src/Blocks/Templates/ProductSearchResultsTemplate.php:51-60 | wp-content/plugins/woocommerce/src/Blocks/Templates/ProductTagTemplate.php:58-69 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
Members sharing a duplicated core (6 members, 50+ identical tokens) wp-content/plugins/woocommerce/src/Internal/Admin/Notes/EditProductsOnTheMove.php:36— wp-content/plugins/woocommerce/src/Internal/Admin/Notes/EditProductsOnTheMove.php:36-69 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/GivingFeedbackNotes.php:36-53 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/MagentoMigration.php:84-98 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/ManageOrdersOnTheGo.php:36-62 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/PerformanceOnMobile.php:36-66 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/ScheduledUpdatesPromotion.php:75-98 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×6
Edited copy of a member (13 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:390— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:390-403 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php:354-366 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/OrderConfirmation/BillingAddress.php:30— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/OrderConfirmation/BillingAddress.php:30-42 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/OrderConfirmation/ShippingAddress.php:30-42 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) wp-content/plugins/woocommerce/includes/wc-formatting-functions.php:1409— wp-content/plugins/woocommerce/includes/wc-formatting-functions.php:1409-1421 | wp-content/plugins/woocommerce/includes/wc-formatting-functions.php:1435-1447 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Task.php:399— wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Task.php:399-411 | wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/TaskList.php:342-365 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/AdditionalPayments.php:118— wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/AdditionalPayments.php:118-130 | wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/Payments.php:353-366 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) wp-content/plugins/woocommerce/includes/wc-stock-functions.php:105— wp-content/plugins/woocommerce/includes/wc-stock-functions.php:105-117 | wp-content/plugins/woocommerce/includes/wc-stock-functions.php:136-148 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (3 corresponding lines) · ×6
Edited copy of a member (3 corresponding lines) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-exporters.php:104— wp-content/plugins/woocommerce/includes/admin/class-wc-admin-exporters.php:104-113 | wp-content/plugins/woocommerce/includes/admin/class-wc-admin-importers.php:108-110 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/Controller.php:415— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/Controller.php:415-417 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php:426-429 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-exporters.php:65— wp-content/plugins/woocommerce/includes/admin/class-wc-admin-exporters.php:65-67 | wp-content/plugins/woocommerce/includes/admin/class-wc-admin-importers.php:69-71 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/FeaturedItem.php:47— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/FeaturedItem.php:47-49 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/SingleProduct.php:44-47 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterStatus.php:86— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterStatus.php:86-88 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/StockFilter.php:24-26 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (3 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterCheckboxList.php:270— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterCheckboxList.php:270-272 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterChips.php:247-249 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (7 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:490— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:490-496 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:745-751 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php:138-144 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 228 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:490` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1453— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1453-1459 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:656-662 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:923-929 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 599 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1453` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Controller.php:56— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Controller.php:56-62 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Controller.php:44-50 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/Stats/Controller.php:74-80 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Controller.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/Stats/Controller.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 3) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:295— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:295-301 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Segmenter.php:389-395 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Segmenter.php:178-184 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Segmenter.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:295` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:302` calls `get_segment_selections_order_level` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Segmenter.php:185` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 3) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php:78— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php:78-85 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductSKU.php:53-60 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductStockIndicator.php:81-87 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (7 lines × 3) wp-content/plugins/woocommerce/src/Internal/Caches/OrdersVersionStringInvalidator.php:41— wp-content/plugins/woocommerce/src/Internal/Caches/OrdersVersionStringInvalidator.php:41-47 | wp-content/plugins/woocommerce/src/Internal/Caches/ProductVersionStringInvalidator.php:40-46 | wp-content/plugins/woocommerce/src/Internal/Caches/TaxRateVersionStringInvalidator.php:35-41 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Internal/Caches/OrdersVersionStringInvalidator.php:22` calls `array` and `wp-content/plugins/woocommerce/src/Internal/Caches/TaxRateVersionStringInvalidator.php:16` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Complex function apply (cyclomatic 40, cognitive 74) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:4565— apply has cyclomatic complexity 40 and cognitive complexity 74; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function apply (cyclomatic 40, cognitive 74) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:4565— apply has cyclomatic complexity 40 and cognitive complexity 74; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function apply (cyclomatic 40, cognitive 74) wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:4565— apply has cyclomatic complexity 40 and cognitive complexity 74; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function apply (cyclomatic 40, cognitive 74) wp-content/plugins/woocommerce/assets/js/select2/select2.js:4565— apply has cyclomatic complexity 40 and cognitive complexity 74; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function apply (cyclomatic 40, cognitive 74) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:4705— apply has cyclomatic complexity 40 and cognitive complexity 74; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function apply (cyclomatic 40, cognitive 74) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:4689— apply has cyclomatic complexity 40 and cognitive complexity 74; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
AC3 · Page structure· Page without a main landmark · ×5
Page without a main landmark wp-content/plugins/woocommerce/assets/js/dompurify/purify.js:822— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark wp-content/plugins/woocommerce/src/Internal/ReceiptRendering/Templates/order-receipt.php:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark wp-content/plugins/woocommerce/templates/auth/header.php:22— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark wp-content/themes/monoka/header.php:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark wp-content/themes/monoka/page-test-code.php:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
(anonymous) (cyclomatic 17) wp-content/plugins/woocommerce/assets/js/frontend/password-strength-meter.js:2— (anonymous) has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 4 function items inside it that branch (checkPasswordStrength, strengthMeter, includeMeter, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 17) wp-content/themes/monoka/assets/font-awesome/js/pro.js:2529— (anonymous) has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
(anonymous) (cyclomatic 17) REDACTED:1— (anonymous) has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 17 function items inside it that branch (x::E, x, x::f, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 17) REDACTED:1— (anonymous) has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to 6 function items inside it that branch (A::C, A::C::c, a function literal at line 1, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 17) REDACTED:2— (anonymous) has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 17 function items inside it that branch (V::E, V, V::y, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D4 · Code Duplication· Edited copy of a member (28 corresponding lines) · ×5
Edited copy of a member (28 corresponding lines) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/AbstractSchema.php:169— wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/AbstractSchema.php:169-203 | wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/AbstractSchema.php:221-248 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:311— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:311-340 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:838-865 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/EmailActionController.php:142— wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/EmailActionController.php:142-188 | wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/EmailActionController.php:199-226 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:18— wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:18-45 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:182-214 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/MercadoPago.php:113— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/MercadoPago.php:113-140 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/MercadoPago.php:154-183 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (26 corresponding lines) · ×5
Edited copy of a member (26 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-post-data.php:461— wp-content/plugins/woocommerce/includes/class-wc-post-data.php:461-486 | wp-content/plugins/woocommerce/includes/class-wc-post-data.php:497-524 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:95— wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:95-120 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:55-86 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:184— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:184-209 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-notes-v2-controller.php:36-79 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsManager.php:241— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsManager.php:241-266 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsManager.php:280-311 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/OrderNotes/Controller.php:323— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/OrderNotes/Controller.php:323-348 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/Controller.php:381-406 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (24 corresponding lines) · ×5
Edited copy of a member (24 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Reports/GenericController.php:186— wp-content/plugins/woocommerce/src/Admin/API/Reports/GenericController.php:186-210 | wp-content/plugins/woocommerce/src/Admin/API/Reports/GenericStatsController.php:221-244 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) wp-content/plugins/woocommerce/src/Gateways/PayPal/TransactAccountManager.php:224— wp-content/plugins/woocommerce/src/Gateways/PayPal/TransactAccountManager.php:224-248 | wp-content/plugins/woocommerce/src/Gateways/PayPal/TransactAccountManager.php:292-315 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PaymentGateway.php:574— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PaymentGateway.php:574-603 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PaymentGateway.php:619-642 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) wp-content/plugins/advanced-custom-fields-pro/includes/acf-meta-functions.php:168— wp-content/plugins/advanced-custom-fields-pro/includes/acf-meta-functions.php:168-193 | wp-content/plugins/advanced-custom-fields-pro/includes/acf-meta-functions.php:212-235 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:395— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:395-423 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php:491-514 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 4+ corresponding lines) · ×5
Edited copies of one member (3 members, 4+ corresponding lines) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:719— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:719-722 | wp-content/plugins/woocommerce/includes/class-wc-order-item-fee.php:148-151 | wp-content/plugins/woocommerce/includes/class-wc-order-item-product.php:80-83 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 4+ corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:133— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:133-137 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-reviews-v2-controller.php:67-70 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:138-142 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 4+ corresponding lines) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/OrderNotes/Controller.php:200— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/OrderNotes/Controller.php:200-203 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Controller.php:507-510 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/Controller.php:439-442 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 4+ corresponding lines) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/OrderNotes/Controller.php:213— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/OrderNotes/Controller.php:213-216 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Controller.php:533-536 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/Controller.php:465-468 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 4+ corresponding lines) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-taxonomies.php:469— wp-content/plugins/woocommerce/includes/admin/class-wc-admin-taxonomies.php:469-472 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductGalleryLargeImage.php:256-259 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductTemplate.php:203-206 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (17–18 lines × 2) wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:443— wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:443-459 | wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:580-597 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:443` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (17–18 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-structured-data.php:339— wp-content/plugins/woocommerce/includes/class-wc-structured-data.php:339-355 | wp-content/plugins/woocommerce/includes/class-wc-structured-data.php:386-403 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-structured-data.php:339` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–18 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php:257— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php:257-273 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-payment-gateways-controller.php:36-53 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-payment-gateways-controller.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (17–18 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:103— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:103-120 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:259-275 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:103` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–18 lines × 2) wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:139— wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:139-156 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:198-214 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:608— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:608-626 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1721-1739 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:465-477 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 1018 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:608` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (13 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:1367— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:1367-1379 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:632-644 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:899-911 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 389 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 3) REDACTED:479— REDACTED:479-491 | REDACTED:504-516 | REDACTED:589-601 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:479` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 3) wp-content/plugins/woocommerce/src/Gateways/PayPal/WebhookHandler.php:138— wp-content/plugins/woocommerce/src/Gateways/PayPal/WebhookHandler.php:138-150 | wp-content/plugins/woocommerce/src/Gateways/PayPal/WebhookHandler.php:175-187 | wp-content/plugins/woocommerce/src/Gateways/PayPal/WebhookHandler.php:207-219 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (13 lines × 3) wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:24— wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:24-36 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:131-143 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:188-200 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:124— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:124-134 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingProfile.php:49-96 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:132-159 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/OnboardingProfile.php` and `wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 298 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:124` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:467— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:467-477 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:811-821 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php:265-275 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 228 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:467` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:352— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:352-362 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Schema/OrderSchema.php:799-809 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/Schema/RefundSchema.php:424-434 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (11 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:215— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:215-225 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:834-844 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1104-1114 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 389 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:215` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 3) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/HandlerRegistry.php:163— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/HandlerRegistry.php:163-173 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/HandlerRegistry.php:248-258 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/HandlerRegistry.php:330-340 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/HandlerRegistry.php:163` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 3) REDACTED:2060— REDACTED:2060-2068 | REDACTED:2131-2139 | REDACTED:2228-2236 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-tax-classes-v1-controller.php:156— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-tax-classes-v1-controller.php:156-164 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-locations-v2-controller.php:63-72 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zones-v2-controller.php:117-126 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (9 lines × 3) wp-content/plugins/woocommerce/src/Blocks/Templates/ProductAttributeTemplate.php:57— wp-content/plugins/woocommerce/src/Blocks/Templates/ProductAttributeTemplate.php:57-65 | wp-content/plugins/woocommerce/src/Blocks/Templates/ProductCatalogTemplate.php:53-61 | wp-content/plugins/woocommerce/src/Blocks/Templates/ProductSearchResultsTemplate.php:52-60 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/Templates/ProductAttributeTemplate.php:57` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:625— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:625-633 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:881-889 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/UpdateUtils.php:336-344 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 228 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:625` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 3) wp-content/plugins/woocommerce/includes/class-wc-query.php:1052— wp-content/plugins/woocommerce/includes/class-wc-query.php:1052-1060 | wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:511-519 | wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php:565-573 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php` and `wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 115 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/class-wc-query.php:1048` calls `is_string` and `wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php:564` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
AC3 · Page structure· Heading level jumps from h1 to h3 · ×4
Heading level jumps from h1 to h3 wp-content/plugins/advanced-custom-fields-pro/pro/admin/views/html-settings-updates.php:16— Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
Heading level jumps from h1 to h3 wp-content/plugins/woocommerce/src/Internal/ReceiptRendering/Templates/order-receipt.php:13— Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
Heading level jumps from h1 to h3 wp-content/themes/monoka/page-sell-well.php:41— Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
Heading level jumps from h1 to h3 wp-content/themes/monoka/page.php:41— Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
D4 · Code Duplication· Edited copy of a member (46 corresponding lines) · ×4
Edited copy of a member (46 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1512— wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1512-1560 | wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1570-1615 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (46 corresponding lines) wp-content/plugins/woocommerce/includes/gateways/cod/class-wc-gateway-cod.php:244— wp-content/plugins/woocommerce/includes/gateways/cod/class-wc-gateway-cod.php:244-289 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/PaymentGateways/Schema/CodGatewaySettingsSchema.php:109-156 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (46 corresponding lines) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:733— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:733-778 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:790-839 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (46 corresponding lines) wp-includes/PHPMailer/PHPMailer.php:913— wp-includes/PHPMailer/PHPMailer.php:913-958 | wp-includes/PHPMailer/SMTP.php:289-335 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (56 corresponding lines) · ×4
Edited copy of a member (56 corresponding lines) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableFieldQuery.php:282— wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableFieldQuery.php:282-337 | wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableMetaQuery.php:602-660 — These two members are one piece of code written twice and then edited apart: 56 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (56 corresponding lines) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/BillingAddressSchema.php:95— wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/BillingAddressSchema.php:95-151 | wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ShippingAddressSchema.php:36-91 — These two members are one piece of code written twice and then edited apart: 56 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (56 corresponding lines) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/PlatformRegistry.php:112— wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/PlatformRegistry.php:112-171 | wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/PlatformRegistry.php:185-240 — These two members are one piece of code written twice and then edited apart: 56 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (56 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:2592— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:2592-2651 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:2077-2132 — These two members are one piece of code written twice and then edited apart: 56 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (39 corresponding lines) · ×4
Edited copy of a member (39 corresponding lines) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableFieldQuery.php:107— wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableFieldQuery.php:107-152 | wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableMetaQuery.php:223-261 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (39 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:278— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:278-320 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterStatus.php:181-219 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (39 corresponding lines) wp-includes/PHPMailer/PHPMailer.php:3452— wp-includes/PHPMailer/PHPMailer.php:3452-3490 | wp-includes/PHPMailer/PHPMailer.php:4055-4095 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (39 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:500— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:500-542 | wp-content/plugins/woocommerce/src/Internal/Admin/Suggestions/Incentives/WooPayments.php:300-338 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (35 corresponding lines) · ×4
Edited copy of a member (35 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:988— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:988-1022 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsRestController.php:499-533 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (35 corresponding lines) REDACTED:1301— REDACTED:1301-1335 | REDACTED:1346-1384 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (35 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:210— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:210-250 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Customers/Controller.php:421-455 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (35 corresponding lines) wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:395— wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:395-430 | wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-group-functions.php:359-393 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (32 corresponding lines) · ×4
Edited copy of a member (32 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:200— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:200-236 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:246-277 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (32 corresponding lines) wp-includes/PHPMailer/PHPMailer.php:3991— wp-includes/PHPMailer/PHPMailer.php:3991-4022 | wp-includes/PHPMailer/PHPMailer.php:4125-4156 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (32 corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/DataStore/FulfillmentsDataStore.php:431— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/DataStore/FulfillmentsDataStore.php:431-462 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/DataStore/FulfillmentsDataStore.php:477-511 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (32 corresponding lines) wp-content/plugins/woocommerce/src/Api/Infrastructure/GraphQLControllerBase.php:740— wp-content/plugins/woocommerce/src/Api/Infrastructure/GraphQLControllerBase.php:740-771 | wp-content/plugins/woocommerce/src/Api/Infrastructure/GraphQLControllerBase.php:793-827 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (34 corresponding lines) · ×4
Edited copy of a member (34 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-discounts.php:836— wp-content/plugins/woocommerce/includes/class-wc-discounts.php:836-869 | wp-content/plugins/woocommerce/includes/class-wc-discounts.php:1003-1039 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (34 corresponding lines) wp-content/plugins/advanced-custom-fields-pro/includes/api/api-helpers.php:672— wp-content/plugins/advanced-custom-fields-pro/includes/api/api-helpers.php:672-721 | wp-content/plugins/advanced-custom-fields-pro/includes/api/api-term.php:92-125 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (34 corresponding lines) wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php:1202— wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php:1202-1235 | wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php:1321-1358 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (34 corresponding lines) wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php:113— wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php:113-146 | wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php:814-847 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (1 corresponding lines) · ×4
Edited copy of a member (1 corresponding lines) wp-includes/php-ai-client/src/Providers/Models/DTO/RequiredOption.php:77— wp-includes/php-ai-client/src/Providers/Models/DTO/RequiredOption.php:77-77 | wp-includes/php-ai-client/src/Providers/Models/DTO/SupportedOption.php:157-157 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (1 corresponding lines) wp-includes/php-ai-client/src/Tools/DTO/FunctionCall.php:96— wp-includes/php-ai-client/src/Tools/DTO/FunctionCall.php:96-96 | wp-includes/php-ai-client/src/Tools/DTO/FunctionResponse.php:96-96 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (1 corresponding lines) wp-includes/php-ai-client/src/Providers/Http/DTO/Request.php:316— wp-includes/php-ai-client/src/Providers/Http/DTO/Request.php:316-316 | wp-includes/php-ai-client/src/Providers/Http/DTO/Response.php:184-184 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (1 corresponding lines) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-api-keys.php:46— wp-content/plugins/woocommerce/includes/admin/class-wc-admin-api-keys.php:46-46 | wp-content/plugins/woocommerce/includes/admin/class-wc-admin-webhooks.php:48-48 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (2 corresponding lines) · ×4
Edited copy of a member (2 corresponding lines) wp-includes/php-ai-client/src/Providers/Models/DTO/ModelMetadata.php:146— wp-includes/php-ai-client/src/Providers/Models/DTO/ModelMetadata.php:146-147 | wp-includes/php-ai-client/src/Providers/Models/DTO/ModelRequirements.php:312-313 — These two members are one piece of code written twice and then edited apart: 2 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (2 corresponding lines) wp-includes/php-ai-client/src/Providers/Models/DTO/RequiredOption.php:97— wp-includes/php-ai-client/src/Providers/Models/DTO/RequiredOption.php:97-98 | wp-includes/php-ai-client/src/Providers/Models/DTO/SupportedOption.php:183-184 — These two members are one piece of code written twice and then edited apart: 2 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (2 corresponding lines) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-integration.php:82— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-integration.php:82-83 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-payment-gateway.php:248-249 — These two members are one piece of code written twice and then edited apart: 2 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (2 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/OrderConfirmation/BillingAddress.php:53— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/OrderConfirmation/BillingAddress.php:53-54 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/OrderConfirmation/ShippingAddress.php:53-54 — These two members are one piece of code written twice and then edited apart: 2 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 9+ corresponding lines) · ×4
Edited copies of one member (4 members, 9+ corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Task.php:250— wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Task.php:250-262 | wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Task.php:271-279 | wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Task.php:370-380 | wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Task.php:583-592 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 9+ corresponding lines) wp-includes/php-ai-client/src/Results/DTO/GenerativeAiResult.php:189— wp-includes/php-ai-client/src/Results/DTO/GenerativeAiResult.php:189-197 | wp-includes/php-ai-client/src/Results/DTO/GenerativeAiResult.php:211-219 | wp-includes/php-ai-client/src/Results/DTO/GenerativeAiResult.php:289-301 | wp-includes/php-ai-client/src/Results/DTO/GenerativeAiResult.php:312-324 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 9+ corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-continents-controller.php:179— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-continents-controller.php:179-188 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-countries-controller.php:126-135 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-currencies-controller.php:124-132 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/ProductAttributes.php:65-74 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 9+ corresponding lines) wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-item-coupon-data-store.php:34— wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-item-coupon-data-store.php:34-42 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-item-fee-data-store.php:34-45 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-item-product-data-store.php:34-47 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-item-tax-data-store.php:35-47 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Duplicated block (33 lines × 2) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-importers.php:195— wp-content/plugins/woocommerce/includes/admin/class-wc-admin-importers.php:195-227 | wp-content/plugins/woocommerce/src/Internal/Integrations/WPPostsImporter.php:51-83 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/class-wc-admin-importers.php:195` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (33 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:307— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:307-339 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/CollectionQuery.php:206-238 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:307` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (33 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1981— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1981-2013 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:2384-2416 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (33 lines × 2) wp-content/plugins/woocommerce/src/Internal/PushNotifications/Notifications/NewOrderNotification.php:44— wp-content/plugins/woocommerce/src/Internal/PushNotifications/Notifications/NewOrderNotification.php:44-77 | wp-content/plugins/woocommerce/src/Internal/PushNotifications/Notifications/NewReviewNotification.php:74-106 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (32 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:165— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:165-196 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:361-392 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:165` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:161` calls `empty`, `is_array`, `array_filter` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:360` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (32 lines × 2) wp-content/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php:87— wp-content/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php:87-118 | wp-content/plugins/woocommerce/includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php:126-157 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php` and `wp-content/plugins/woocommerce/includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (32 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Segmenter.php:304— wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Segmenter.php:304-335 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/Stats/Segmenter.php:87-118 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (32 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:230— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:230-261 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterTaxonomy.php:272-303 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:230` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:227` calls `get_empty_visual` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterTaxonomy.php:269` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (26 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:673— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:673-698 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1804-1829 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 1018 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (26 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-payment-gateways-controller.php:74— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-payment-gateways-controller.php:74-99 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/PaymentGateways/Schema/AbstractPaymentGatewaySettingsSchema.php:484-509 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-payment-gateways-controller.php:74` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (26 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:2073— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:2073-2098 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:2485-2510 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:2073` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (26 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Segmenter.php:53— wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Segmenter.php:53-78 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Segmenter.php:52-79 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Segmenter.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Segmenter.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (25 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1651— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1651-1675 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php:421-445 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1651` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (25 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:130— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:130-157 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:214-238 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Notes/WooSubscriptionsNotes.php:291— wp-content/plugins/woocommerce/src/Internal/Admin/Notes/WooSubscriptionsNotes.php:291-315 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/WooSubscriptionsNotes.php:352-376 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Internal/Admin/Notes/WooSubscriptionsNotes.php:377` calls `set_content`, `set_content_data` and `wp-content/plugins/woocommerce/src/Internal/Admin/Notes/WooSubscriptionsNotes.php:316` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (25 lines × 2) wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:555— wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:555-579 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:582-606 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (19 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-report-sales-v1-controller.php:201— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-report-sales-v1-controller.php:201-221 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php:567-585 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-webhooks-v2-controller.php:42-62 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-webhooks-v2-controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:440— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:440-458 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:1108-1126 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:433-451 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 223 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:440` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 3) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:223— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:223-241 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Schema/GeneralSettingsSchema.php:228-246 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Schema/ProductSettingsSchema.php:224-242 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Schema/GeneralSettingsSchema.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 103 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (19 lines × 3) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AllReviews.php:23— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AllReviews.php:23-41 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ReviewsByCategory.php:23-41 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ReviewsByProduct.php:23-41 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AllReviews.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ReviewsByCategory.php` as WHOLE FILES: 88% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AllReviews.php:23` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (16 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:237— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:237-252 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:309-324 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-notes-controller.php:89-104 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 120 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1528— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1528-1543 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:542-557 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:405-420 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 1094 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1528` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 3) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:173— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:173-188 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Controller.php:187-202 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Controller.php:153-168 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 105 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:173` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 3) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:344— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:344-359 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Controller.php:297-312 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Controller.php:284-299 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 190 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:344` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14–15 lines × 2) wp-content/plugins/woocommerce/includes/admin/class-wc-admin.php:279— wp-content/plugins/woocommerce/includes/admin/class-wc-admin.php:279-292 | wp-content/plugins/woocommerce/includes/admin/class-wc-admin.php:349-363 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/class-wc-admin.php:279` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–15 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:256— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:256-270 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Segmenter.php:147-160 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:256` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:271` calls `get_segment_selections_order_level` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Segmenter.php:161` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14–15 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestions.php:3156— wp-content/plugins/woocommerce/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestions.php:3156-3170 | wp-content/plugins/woocommerce/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestions.php:3189-3202 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestions.php:3156` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–15 lines × 2) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-admin-report.php:271— wp-content/plugins/woocommerce/includes/admin/reports/class-wc-admin-report.php:271-285 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-admin-report.php:319-332 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/reports/class-wc-admin-report.php:271` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-tax-classes-v1-controller.php:158— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-tax-classes-v1-controller.php:158-167 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php:127-136 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-methods-v2-controller.php:107-116 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-methods-v2-controller.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 133 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-tax-classes-v1-controller.php:158` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (10 lines × 3) wp-content/plugins/woocommerce/src/Api/Queries/Coupons/ListCoupons.php:115— wp-content/plugins/woocommerce/src/Api/Queries/Coupons/ListCoupons.php:115-124 | wp-content/plugins/woocommerce/src/Api/Queries/Products/ListProducts.php:215-224 | wp-content/plugins/woocommerce/src/Api/Utils/Products/ProductMapper.php:509-518 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Api/Queries/Coupons/ListCoupons.php` and `wp-content/plugins/woocommerce/src/Api/Queries/Products/ListProducts.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (10 lines × 3) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/AustraliaPostShippingProvider.php:129— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/AustraliaPostShippingProvider.php:129-138 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/CanadaPostShippingProvider.php:120-129 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/RoyalMailShippingProvider.php:133-142 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/AustraliaPostShippingProvider.php` and `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/CanadaPostShippingProvider.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 3) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Controller.php:101— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Controller.php:101-110 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:392-401 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Controller.php:371-380 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 84 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (7 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:392— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:392-400 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:289-296 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php:274-280 | wp-content/plugins/woocommerce/src/Admin/API/Taxes.php:122-130 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:392` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 4) wp-content/plugins/woocommerce/src/Internal/Admin/Notes/LaunchChecklist.php:52— wp-content/plugins/woocommerce/src/Internal/Admin/Notes/LaunchChecklist.php:52-58 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/MobileApp.php:45-51 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/PaymentsMoreInfoNeeded.php:72-78 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/RealTimeOrderAlerts.php:49-55 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Notes/LaunchChecklist.php:52` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:334— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:334-340 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php:323-329 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:859-865 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:770-776 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:324` calls `add_post_meta_fields` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:849` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:259— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:259-265 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:53-59 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:69-75 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:85-91 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:255` calls `check_variation_parent`, `WP_Error`, `__` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:68` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:460— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:460-465 | wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-products.php:201-206 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:597-602 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/Controller.php:52— wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/Controller.php:52-57 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Controller.php:66-71 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Controller.php:69-74 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/Controller.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Controller.php` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 295 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 3) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:280— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:280-285 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:305-310 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:393-398 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:280` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 3) wp-content/plugins/woocommerce/includes/class-wc-order-item-fee.php:256— wp-content/plugins/woocommerce/includes/class-wc-order-item-fee.php:256-261 | wp-content/plugins/woocommerce/includes/class-wc-order-item-shipping.php:238-243 | wp-content/plugins/woocommerce/includes/class-wc-order-item-tax.php:168-173 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/class-wc-order-item-fee.php` and `wp-content/plugins/woocommerce/includes/class-wc-order-item-shipping.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/class-wc-order-item-shipping.php:228` calls `get_method_title` and `wp-content/plugins/woocommerce/includes/class-wc-order-item-fee.php:255` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (29 lines × 2) wp-content/plugins/woocommerce/src/Admin/Features/PaymentGatewaySuggestions/PaymentGatewaySuggestionsDataSourcePoller.php:36— wp-content/plugins/woocommerce/src/Admin/Features/PaymentGatewaySuggestions/PaymentGatewaySuggestionsDataSourcePoller.php:36-64 | wp-content/plugins/woocommerce/src/Internal/Admin/WCPayPromotion/WCPayPromotionDataSourcePoller.php:33-61 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/Features/PaymentGatewaySuggestions/PaymentGatewaySuggestionsDataSourcePoller.php:36` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (29 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-refunds-controller.php:167— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-refunds-controller.php:167-195 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php:408-436 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (29 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Controller.php:144— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Controller.php:144-174 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/Stats/Controller.php:188-216 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Controller.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/Stats/Controller.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 57 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (29 lines × 2) wp-content/plugins/woocommerce/src/Admin/RemoteInboxNotifications/SpecRunner.php:114— wp-content/plugins/woocommerce/src/Admin/RemoteInboxNotifications/SpecRunner.php:114-142 | wp-content/plugins/woocommerce/src/Admin/RemoteInboxNotifications/SpecRunner.php:154-182 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Complex function normalize (cyclomatic 32, cognitive 63) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:65— normalize has cyclomatic complexity 32 and cognitive complexity 63; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function normalize (cyclomatic 32, cognitive 63) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:65— normalize has cyclomatic complexity 32 and cognitive complexity 63; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function normalize (cyclomatic 32, cognitive 63) wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:65— normalize has cyclomatic complexity 32 and cognitive complexity 63; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function normalize (cyclomatic 32, cognitive 63) wp-content/plugins/woocommerce/assets/js/select2/select2.js:65— normalize has cyclomatic complexity 32 and cognitive complexity 63; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
(anonymous) (cyclomatic 16) wp-content/plugins/woocommerce/assets/js/frontend/woocommerce.js:2— (anonymous) has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 66, a function literal at line 9, a function literal at line 81, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 16) REDACTED:1— (anonymous) has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 3 function items inside it that branch (a, c, A). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 16) REDACTED:2— (anonymous) has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 3 function items inside it that branch (a, c, A). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
jquery.flot.pie.init::combine (cognitive 26) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.pie.js:162— jquery.flot.pie.init::combine has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 4, loops 4 (nesting depth added 8). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 2 other methods here (jquery.flot.pie.init::draw, jquery.flot.pie.init::findNearbySlice) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.pie.init::draw (cognitive 18) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.pie.js:249— jquery.flot.pie.init::draw has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3, loops 1 (nesting depth added 3). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 2 other methods here (jquery.flot.pie.init::combine, jquery.flot.pie.init::findNearbySlice) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery.flot.pie.init::findNearbySlice (cognitive 16) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.pie.js:571— jquery.flot.pie.init::findNearbySlice has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 1, ternaries 1 (nesting depth added 9). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This shape REPEATS in the file: 2 other methods here (jquery.flot.pie.init::combine, jquery.flot.pie.init::draw) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
(anonymous) (cognitive 18) wp-content/plugins/woocommerce/assets/js/frontend/woocommerce.js:2— (anonymous) has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 4 (nesting depth added 1). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 134, a function literal at line 9, a function literal at line 66, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cognitive 18) wp-content/themes/monoka/assets/font-awesome/js/pro.js:2529— (anonymous) has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 11, if/else 4 (5 pts), boolean chains 2 (nesting depth added 1). Of this number, 12 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
(anonymous) (cognitive 18) REDACTED:1— (anonymous) has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 6, loops 4 (6 pts), if/else 3, ternaries 3 (nesting depth added 2). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to 6 function items inside it that branch (A::C, a function literal at line 1, A::C::c, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D4 · Code Duplication· Edited copy of a member (33 corresponding lines) · ×3
Edited copy of a member (33 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php:281— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php:281-342 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-refunds-controller.php:42-89 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (33 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:491— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:491-523 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:667-712 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (33 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PayPal.php:96— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PayPal.php:96-129 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PayPal.php:141-173 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Members sharing a duplicated core (7 members, 50+ identical tokens) · ×3
Members sharing a duplicated core (7 members, 50+ identical tokens) wp-content/plugins/woocommerce/includes/admin/notes/class-wc-notes-refund-returns.php:81— wp-content/plugins/woocommerce/includes/admin/notes/class-wc-notes-refund-returns.php:81-94 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/CustomizeStoreWithBlocks.php:37-84 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/CustomizingProductCatalog.php:38-82 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/FirstProduct.php:37-85 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/MigrateFromShopify.php:37-77 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/OnboardingPayments.php:36-66 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/OnlineClothingStore.php:54-96 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
Members sharing a duplicated core (7 members, 50+ identical tokens) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:174— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:174-182 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:192-200 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:210-218 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zones-controller-base.php:60-68 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zones-controller-base.php:78-86 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zones-controller-base.php:96-104 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zones-controller-base.php:114-122 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
Members sharing a duplicated core (7 members, 50+ identical tokens) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-report-coupons-totals-controller.php:84— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-report-coupons-totals-controller.php:84-106 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-report-customers-totals-controller.php:95-117 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-report-orders-totals-controller.php:70-92 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-report-products-totals-controller.php:74-96 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-report-reviews-totals-controller.php:73-95 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Stats/Controller.php:109-127 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Stock/Stats/Controller.php:57-77 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×3
Members sharing a duplicated core (5 members, 50+ identical tokens) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:146— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:146-226 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:343-467 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:949-1158 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:223-481 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:338-618 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) wp-content/plugins/woocommerce/src/Internal/EmailEditor/EmailApiController.php:414— wp-content/plugins/woocommerce/src/Internal/EmailEditor/EmailApiController.php:414-437 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/EmailApiController.php:503-541 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/EmailApiController.php:676-699 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/EmailApiController.php:791-822 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/EmailApiController.php:840-868 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
Members sharing a duplicated core (5 members, 50+ identical tokens) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:146— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:146-213 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Schema/EmailSettingsSchema.php:149-247 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Schema/GeneralSettingsSchema.php:146-218 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Schema/ProductSettingsSchema.php:148-214 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Schema/TaxSettingsSchema.php:146-218 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Edited copy of a member (51 corresponding lines) · ×3
Edited copy of a member (51 corresponding lines) REDACTED:493— REDACTED:493-549 | wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/Filterer.php:167-217 — These two members are one piece of code written twice and then edited apart: 51 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (51 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/DataStore.php:334— wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/DataStore.php:334-384 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/DataStore.php:281-344 — These two members are one piece of code written twice and then edited apart: 51 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (51 corresponding lines) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/Agentic/CheckoutSessionSchema.php:728— wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/Agentic/CheckoutSessionSchema.php:728-778 | wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/Agentic/CheckoutSessionSchema.php:788-838 — These two members are one piece of code written twice and then edited apart: 51 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (50 corresponding lines) · ×3
Edited copy of a member (50 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:383— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:383-432 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:622-681 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (50 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Plugins.php:243— wp-content/plugins/woocommerce/src/Admin/API/Plugins.php:243-294 | wp-content/plugins/woocommerce/src/Admin/API/Plugins.php:358-407 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (50 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-tracker.php:1370— wp-content/plugins/woocommerce/includes/class-wc-tracker.php:1370-1422 | wp-content/plugins/woocommerce/includes/class-wc-tracker.php:1432-1481 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (31 corresponding lines) · ×3
Edited copy of a member (31 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:479— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:479-509 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:761-805 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:391— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:391-421 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:473-503 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) wp-content/plugins/woocommerce/src/Internal/PushNotifications/DataStores/PushTokensDataStore.php:54— wp-content/plugins/woocommerce/src/Internal/PushNotifications/DataStores/PushTokensDataStore.php:54-84 | wp-content/plugins/woocommerce/src/Internal/PushNotifications/DataStores/PushTokensDataStore.php:146-177 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (30 corresponding lines) · ×3
Edited copy of a member (30 corresponding lines) wp-content/plugins/woocommerce/includes/wccom-site/installation/installation-steps/class-wc-wccom-site-installation-step-activate-product.php:58— wp-content/plugins/woocommerce/includes/wccom-site/installation/installation-steps/class-wc-wccom-site-installation-step-activate-product.php:58-98 | wp-content/plugins/woocommerce/includes/wccom-site/installation/installation-steps/class-wc-wccom-site-installation-step-activate-product.php:110-139 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) wp-content/plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:57— wp-content/plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:57-94 | wp-content/plugins/advanced-custom-fields-pro/includes/acf-value-functions.php:117-146 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:460— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:460-490 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php:709-738 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 18+ corresponding lines) · ×3
Edited copies of one member (3 members, 18+ corresponding lines) wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-nineteen.php:24— wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-nineteen.php:24-52 | wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-seventeen.php:22-39 | wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-twenty.php:24-49 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 18+ corresponding lines) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:132— wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:132-153 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-code.php:54-71 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-date.php:51-68 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 18+ corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Payfast.php:28— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Payfast.php:28-45 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Payoneer.php:56-73 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Paytrail.php:56-76 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (8 corresponding lines) · ×3
Edited copy of a member (8 corresponding lines) wp-content/plugins/woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-ipn-handler.php:296— wp-content/plugins/woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-ipn-handler.php:296-307 | wp-content/plugins/woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-ipn-handler.php:318-325 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:1384— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:1384-1391 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Fulfillments/Schema/FulfillmentSchema.php:178-185 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) wp-includes/php-ai-client/src/Providers/Models/DTO/ModelMetadata.php:64— wp-includes/php-ai-client/src/Providers/Models/DTO/ModelMetadata.php:64-73 | wp-includes/php-ai-client/src/Providers/Models/DTO/ModelRequirements.php:53-60 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 1+ corresponding lines) · ×3
Edited copies of one member (3 members, 1+ corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-order-refund.php:85— wp-content/plugins/woocommerce/includes/class-wc-order-refund.php:85-85 | wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:402-402 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-refund-data-store-cpt.php:149-153 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 1+ corresponding lines) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationEmail.php:87— wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationEmail.php:87-87 | wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationVerifiedEmail.php:89-89 | wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationVerifyEmail.php:90-90 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 1+ corresponding lines) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-data.php:331— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-data.php:331-331 | wp-content/plugins/woocommerce/includes/class-wc-order.php:532-536 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Fulfillment.php:554-554 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (48 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:234— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:234-281 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:349-396 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:234` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (48 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/HandlerRegistry.php:216— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/HandlerRegistry.php:216-263 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/HandlerRegistry.php:298-345 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/HandlerRegistry.php:216` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/HandlerRegistry.php:354` calls `array` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/HandlerRegistry.php:265` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (48 lines × 2) wp-content/plugins/woocommerce/src/Blocks/Templates/CartTemplate.php:24— wp-content/plugins/woocommerce/src/Blocks/Templates/CartTemplate.php:24-71 | wp-content/plugins/woocommerce/src/Blocks/Templates/CheckoutTemplate.php:24-71 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/Templates/CartTemplate.php:24` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (30 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1451— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1451-1480 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:454-483 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 1094 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (30 lines × 2) REDACTED:566— REDACTED:566-595 | REDACTED:704-733 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:566` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (30 lines × 2) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentOrderNotes.php:56— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentOrderNotes.php:56-85 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentOrderNotes.php:124-153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentOrderNotes.php:56` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (28 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:350— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:350-377 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:378-405 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 608 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (28 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:454— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:454-481 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:591-618 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (28 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:587— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:587-614 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php:797-824 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (27 lines × 2) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1747— wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1747-1773 | wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1920-1946 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (27 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:511— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:511-537 | wp-content/plugins/woocommerce/src/Internal/Admin/Suggestions/Incentives/WooPayments.php:307-333 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (27 lines × 2) wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/StoreTagsProvider.php:35— wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/StoreTagsProvider.php:35-61 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/StoreTagsProvider.php:81-107 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/StoreTagsProvider.php:35` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20–22 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Controller.php:99— wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Controller.php:99-118 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Controller.php:68-89 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Controller.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Controller.php` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 300 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Controller.php:99` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20–22 lines × 2) wp-content/plugins/woocommerce/src/Admin/PluginsHelper.php:929— wp-content/plugins/woocommerce/src/Admin/PluginsHelper.php:929-950 | wp-content/plugins/woocommerce/src/Admin/PluginsHelper.php:1010-1029 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/PluginsHelper.php:929` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20–22 lines × 2) wp-content/plugins/woocommerce/src/Internal/ProductFilters/FilterData.php:254— wp-content/plugins/woocommerce/src/Internal/ProductFilters/FilterData.php:254-275 | wp-content/plugins/woocommerce/src/Internal/ProductFilters/FilterData.php:322-341 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/ProductFilters/FilterData.php:254` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Internal/ProductFilters/FilterData.php:343` calls `is_taxonomy_hierarchical`, `get_hierarchical_taxonomy_counts` and `wp-content/plugins/woocommerce/src/Internal/ProductFilters/FilterData.php:276` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (21 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:270— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:270-290 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:340-360 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-attributes-controller.php:72-92 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-attributes-controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:270` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (21 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1263— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1263-1283 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:935-955 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1205-1225 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 599 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1263` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21 lines × 3) wp-content/plugins/woocommerce/src/Admin/Features/MarketingRecommendations/MarketingRecommendationsDataSourcePoller.php:36— wp-content/plugins/woocommerce/src/Admin/Features/MarketingRecommendations/MarketingRecommendationsDataSourcePoller.php:36-56 | wp-content/plugins/woocommerce/src/Admin/Features/MarketingRecommendations/MiscRecommendationsDataSourcePoller.php:44-64 | wp-content/plugins/woocommerce/src/Internal/Admin/RemoteFreeExtensions/RemoteFreeExtensionsDataSourcePoller.php:32-52 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/Features/MarketingRecommendations/MarketingRecommendationsDataSourcePoller.php:36` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Admin/Features/MarketingRecommendations/MarketingRecommendationsDataSourcePoller.php:23` calls `array` and `wp-content/plugins/woocommerce/src/Admin/Features/MarketingRecommendations/MiscRecommendationsDataSourcePoller.php:31` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (19 lines × 5) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:481— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:481-499 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1251-1269 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:336-354 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:923-941 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1193-1211 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 1018 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:502` calls `isset`, `set_tax_class` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1270` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (19 lines × 5) wp-content/plugins/woocommerce/src/Internal/EmailEditor/EmailApiController.php:414— wp-content/plugins/woocommerce/src/Internal/EmailEditor/EmailApiController.php:414-432 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/EmailApiController.php:503-521 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/EmailApiController.php:676-694 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/EmailApiController.php:791-809 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/EmailApiController.php:840-858 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (19 lines × 5) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:25— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:25-93 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-paypal-buttons-controller.php:56-74 | wp-content/plugins/woocommerce/src/Admin/API/AnalyticsImports.php:43-67 | wp-content/plugins/woocommerce/src/Admin/API/MarketingOverview.php:41-73 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingThemes.php:37-61 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times.
Duplicated block (15 lines × 3) REDACTED:1235— REDACTED:1235-1249 | REDACTED:1301-1315 | REDACTED:1346-1360 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1235` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:173— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:173-187 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:211-225 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:268-282 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (15 lines × 3) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:309— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:309-323 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:462-476 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:508-522 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:309` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1020— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1020-1033 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1506-1519 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:518-531 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1637-1650 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 1094 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 4) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Customers/Controller.php:256— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Customers/Controller.php:256-269 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/OrderNotes/Controller.php:297-310 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Controller.php:338-351 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/Controller.php:350-363 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Customers/Controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 107 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (14 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-continents-controller.php:215— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-continents-controller.php:215-230 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-countries-controller.php:162-179 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-currencies-controller.php:168-181 | wp-content/plugins/woocommerce/src/Admin/API/DataDownloadIPs.php:97-110 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-continents-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-countries-controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 104 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-continents-controller.php:240` calls `strtolower` and `wp-content/plugins/woocommerce/src/Admin/API/DataDownloadIPs.php:120` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12–13 lines × 2) wp-content/plugins/woocommerce/includes/admin/notes/class-wc-notes-run-db-update.php:188— wp-content/plugins/woocommerce/includes/admin/notes/class-wc-notes-run-db-update.php:188-200 | wp-content/plugins/woocommerce/includes/admin/notes/class-wc-notes-run-db-update.php:270-281 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12–13 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Segmenter.php:94— wp-content/plugins/woocommerce/src/Admin/API/Reports/Segmenter.php:94-105 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Segmenter.php:289-301 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Segmenter.php:94` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12–13 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Reviews/ProductReviewsPaginationNext.php:63— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Reviews/ProductReviewsPaginationNext.php:63-74 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Reviews/ProductReviewsPaginationPrevious.php:58-70 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10–11 lines × 2) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-post-types.php:434— wp-content/plugins/woocommerce/includes/admin/class-wc-admin-post-types.php:434-444 | wp-content/plugins/woocommerce/includes/admin/class-wc-admin-post-types.php:563-572 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/class-wc-admin-post-types.php:434` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 2) wp-content/plugins/woocommerce/includes/wc-update-functions.php:1329— wp-content/plugins/woocommerce/includes/wc-update-functions.php:1329-1338 | wp-content/plugins/woocommerce/includes/wc-update-functions.php:1342-1352 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/wc-update-functions.php:1342` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10–11 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/DataStore.php:602— wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/DataStore.php:602-611 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/DataStore.php:353-363 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/DataStore.php:602` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/DataStore.php:600` calls `get_var` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/DataStore.php:352` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-report-sales-v1-controller.php:158— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-report-sales-v1-controller.php:158-162 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-report-sales-v1-controller.php:170-174 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-report-sales-v1-controller.php:181-185 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-report-sales-v1-controller.php:192-196 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-coupons-v2-controller.php:220— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-coupons-v2-controller.php:220-224 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-customers-v2-controller.php:105-109 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php:209-215 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-refunds-controller.php:101-107 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-refunds-controller.php:99` calls `is_null`, `wc_get_price_decimals`, `absint` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-coupons-v2-controller.php:219` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 4) wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php:786— wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php:786-790 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php:802-806 | wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:3074-3078 | wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:3090-3094 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (25 lines × 2 locations) REDACTED:2374— REDACTED:2374 · REDACTED:2518 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (25 lines × 2 locations) wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js:381— wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js:381 · wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js:914 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (25 lines × 2 locations) wp-content/plugins/woocommerce/assets/js/frontend/address-autocomplete.js:225— wp-content/plugins/woocommerce/assets/js/frontend/address-autocomplete.js:225 · wp-content/plugins/woocommerce/assets/js/frontend/address-autocomplete.js:281 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
AC1 · Text alternatives· <embed> without a text alternative · ×2
<embed> without a text alternative REDACTED:88— An <embed> has no fallback-content mechanism, so it needs an aria-label/aria-labelledby/title to be described.
<embed> without a text alternative REDACTED:89— An <embed> has no fallback-content mechanism, so it needs an aria-label/aria-labelledby/title to be described.
Empty <h2> heading REDACTED:7144— An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative.
Empty <h2> heading REDACTED:7161— An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative.
(anonymous) (cyclomatic 39) wp-content/plugins/woocommerce/assets/js/admin/wc-enhanced-select.js:2— (anonymous) has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 2 of the 39 points are its own statements and the rest belongs to 50 function items inside it that branch (a function literal at line 309, a function literal at line 203, a function literal at line 266, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 39) wp-content/plugins/woocommerce/assets/js/frontend/cart-fragments.js:2— (anonymous) has cyclomatic complexity 39 (threshold 15). Of this number, 27 points are the body's own statements and 12 belong to 14 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous) (cyclomatic 33) wp-content/plugins/woocommerce/assets/js/admin/settings-views-html-settings-tax.js:7— (anonymous) has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 2 of the 33 points are its own statements and the rest belongs to 33 function items inside it that branch (updateModelOnChange, render, updateUrl, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 33) wp-content/plugins/woocommerce/assets/js/gateways/paypal.js:1— (anonymous) has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 1 of the 33 points is its own statement and the rest belongs to 9 function items inside it that branch (renderButtons::manageCartForProductPageOrder, renderButtons::createOrder, renderButtons, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 22) wp-content/themes/monoka/assets/js/cart.js:2— (anonymous) has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 2 of the 22 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 42, submitCartForm, a function literal at line 22, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 22) REDACTED:2— (anonymous) has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 13 function items inside it that branch (a function literal at line 2, a function literal at line 2, a function literal at line 2, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 20) wp-content/plugins/woocommerce/assets/js/frontend/address-i18n.js:2— (anonymous) has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 54, field_is_required, a function literal at line 33, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 20) wp-content/plugins/woocommerce/assets/js/frontend/geolocation.js:2— (anonymous) has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 104, a function literal at line 45, success, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cognitive 47) wp-content/plugins/woocommerce/assets/js/frontend/cart-fragments.js:2— (anonymous) has cognitive complexity 47 (threshold 15). Drivers by points: if/else 21 (34 pts), boolean chains 10, error handling 2 (3 pts) (nesting depth added 14). Of this number, 30 points are the body's own statements and 17 belong to 14 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous) (cognitive 47) wp-content/plugins/woocommerce/assets/js/frontend/cart.js:2— (anonymous) has cognitive complexity 47 (threshold 15). Drivers by points: if/else 30 (38 pts), boolean chains 6, error handling 1 (2 pts), ternaries 1 (nesting depth added 9). Most of this is not in the body itself: 1 of the 47 points is its own statement and the rest belongs to 51 function items inside it that branch (update_wc_div, cart_submit, show_coupon_error, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cognitive 27) wp-content/plugins/woocommerce/assets/js/admin/term-ordering.js:4— (anonymous) has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 9, ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 3 of the 27 points are its own statements and the rest belongs to 9 function items inside it that branch (update, a function literal at line 36, a function literal at line 127, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cognitive 27) wp-content/plugins/woocommerce/assets/js/frontend/a8c-address-autocomplete-service.js:173— (anonymous) has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 6, error handling 3, match/switch 1 (nesting depth added 3). None of this is in the body itself: all 27 points belong to 15 function items inside it that branch (handleApiError, a function literal at line 299, canSearch, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cognitive 23) wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-providers.js:3— (anonymous) has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 3, ternaries 1 (nesting depth added 4). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 21 function items inside it that branch (a function literal at line 27, onLoadBackboneModal, onConfigureShippingProviderSubmitted, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cognitive 23) wp-content/plugins/woocommerce/assets/js/frontend/geolocation.js:2— (anonymous) has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 6 (nesting depth added 3). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 104, a function literal at line 45, get_geo_hash, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cognitive 16) REDACTED:1— (anonymous) has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, ternaries 5, if/else 1. None of this is in the body itself: all 16 points belong to 17 function items inside it that branch (x::E, x, x::f, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cognitive 16) REDACTED:2— (anonymous) has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, ternaries 5, if/else 1. None of this is in the body itself: all 16 points belong to 17 function items inside it that branch (V::E, V, V::y, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D4 · Code Duplication· Edited copy of a member (45 corresponding lines) · ×2
Edited copy of a member (45 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-setting-options-v2-controller.php:164— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-setting-options-v2-controller.php:164-208 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-setting-options-controller.php:75-132 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (45 corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentOrderNotes.php:41— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentOrderNotes.php:41-85 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentOrderNotes.php:101-153 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (48 corresponding lines) · ×2
Edited copy of a member (48 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1015— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1015-1062 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1631-1679 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (48 corresponding lines) wp-content/plugins/woocommerce/includes/wc-stock-functions.php:165— wp-content/plugins/woocommerce/includes/wc-stock-functions.php:165-221 | wp-content/plugins/woocommerce/includes/wc-stock-functions.php:346-393 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (41 corresponding lines) · ×2
Edited copy of a member (41 corresponding lines) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Emails/Schema/EmailsSettingsSchema.php:579— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Emails/Schema/EmailsSettingsSchema.php:579-630 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/PaymentGateways/Schema/AbstractPaymentGatewaySettingsSchema.php:648-688 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (41 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:267— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:267-307 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-attributes-controller.php:62-109 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (36 corresponding lines) · ×2
Edited copy of a member (36 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-order-item-fee.php:195— wp-content/plugins/woocommerce/includes/class-wc-order-item-fee.php:195-230 | wp-content/plugins/woocommerce/includes/class-wc-order-item-shipping.php:140-178 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (36 corresponding lines) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-brands.php:816— wp-content/plugins/woocommerce/includes/admin/class-wc-admin-brands.php:816-851 | wp-content/plugins/woocommerce/includes/export/abstract-wc-csv-exporter.php:429-467 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (40 corresponding lines) · ×2
Edited copy of a member (40 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Translations.php:76— wp-content/plugins/woocommerce/src/Internal/Admin/Translations.php:76-119 | wp-content/plugins/woocommerce/src/Internal/Admin/Translations.php:131-170 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (40 corresponding lines) wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:124— wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:124-165 | wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-group-functions.php:117-156 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 36+ corresponding lines) · ×2
Edited copies of one member (3 members, 36+ corresponding lines) wp-content/plugins/woocommerce/includes/abstracts/class-wc-background-process.php:96— wp-content/plugins/woocommerce/includes/abstracts/class-wc-background-process.php:96-131 | wp-content/plugins/woocommerce/includes/class-wc-background-emailer.php:148-186 | wp-content/plugins/woocommerce/includes/libraries/wp-background-process.php:295-332 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 36 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 36+ corresponding lines) wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-group-functions.php:624— wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-group-functions.php:624-659 | wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-group-functions.php:676-711 | wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-group-functions.php:728-763 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 36 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (37 corresponding lines) · ×2
Edited copy of a member (37 corresponding lines) wp-content/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php:77— wp-content/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php:77-118 | wp-content/plugins/woocommerce/includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php:121-157 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (37 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-post-data.php:1024— wp-content/plugins/woocommerce/includes/class-wc-post-data.php:1024-1065 | wp-content/plugins/woocommerce/includes/class-wc-post-data.php:1079-1115 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 25+ corresponding lines) · ×2
Edited copies of one member (3 members, 25+ corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/PaymentGatewaySuggestions/Init.php:37— wp-content/plugins/woocommerce/src/Admin/Features/PaymentGatewaySuggestions/Init.php:37-61 | wp-content/plugins/woocommerce/src/Internal/Admin/RemoteFreeExtensions/Init.php:33-65 | wp-content/plugins/woocommerce/src/Internal/Admin/WCPayPromotion/Init.php:103-127 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 25+ corresponding lines) wp-content/plugins/woocommerce/includes/gateways/bacs/class-wc-gateway-bacs.php:395— wp-content/plugins/woocommerce/includes/gateways/bacs/class-wc-gateway-bacs.php:395-420 | wp-content/plugins/woocommerce/includes/gateways/cheque/class-wc-gateway-cheque.php:146-171 | wp-content/plugins/woocommerce/includes/gateways/cod/class-wc-gateway-cod.php:312-336 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 15+ corresponding lines) · ×2
Edited copies of one member (4 members, 15+ corresponding lines) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php:134— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php:134-148 | wp-content/plugins/woocommerce/includes/class-wc-customer-download-log.php:42-60 | wp-content/plugins/woocommerce/includes/class-wc-customer-download.php:49-67 | wp-content/plugins/woocommerce/src/Internal/StockNotifications/Notification.php:58-75 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 15+ corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/HelioPay.php:30— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/HelioPay.php:30-46 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Payoneer.php:30-44 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Razorpay.php:59-75 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Stripe.php:32-50 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 12+ corresponding lines) · ×2
Edited copies of one member (3 members, 12+ corresponding lines) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Customers/Controller.php:211— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Customers/Controller.php:211-222 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Controller.php:295-317 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/Controller.php:254-274 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 12+ corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Notes.php:151— wp-content/plugins/woocommerce/src/Admin/API/Notes.php:151-167 | wp-content/plugins/woocommerce/src/Admin/API/Notes.php:302-313 | wp-content/plugins/woocommerce/src/Admin/API/Notes.php:323-335 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 13+ corresponding lines) · ×2
Edited copies of one member (3 members, 13+ corresponding lines) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:2088— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:2088-2100 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:2112-2124 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:2136-2148 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 13+ corresponding lines) wp-content/plugins/woocommerce/src/Internal/PushNotifications/Validators/PushTokenValidator.php:132— wp-content/plugins/woocommerce/src/Internal/PushNotifications/Validators/PushTokenValidator.php:132-144 | wp-content/plugins/woocommerce/src/Internal/PushNotifications/Validators/PushTokenValidator.php:157-169 | wp-content/plugins/woocommerce/src/Internal/PushNotifications/Validators/PushTokenValidator.php:416-430 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 12+ corresponding lines) · ×2
Edited copies of one member (4 members, 12+ corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:280— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:280-291 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:305-316 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:393-404 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:579-594 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Edited copies of one member (4 members, 12+ corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-order.php:2260— wp-content/plugins/woocommerce/includes/class-wc-order.php:2260-2271 | wp-content/plugins/woocommerce/includes/class-wc-order.php:2281-2292 | wp-content/plugins/woocommerce/includes/class-wc-order.php:2302-2317 | wp-content/plugins/woocommerce/includes/class-wc-order.php:2327-2338 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 19+ corresponding lines) · ×2
Edited copies of one member (3 members, 19+ corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:1164— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:1164-1183 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:1194-1215 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:1283-1301 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 19+ corresponding lines) wp-content/plugins/woocommerce/src/Gateways/PayPal/Notices.php:135— wp-content/plugins/woocommerce/src/Gateways/PayPal/Notices.php:135-153 | wp-content/plugins/woocommerce/src/Gateways/PayPal/Notices.php:164-188 | wp-content/plugins/woocommerce/src/Gateways/PayPal/Notices.php:198-222 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 11+ corresponding lines) · ×2
Edited copies of one member (3 members, 11+ corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:702— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:702-712 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:725-735 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:748-759 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/PaymentGatewaySuggestions/Init.php:100— wp-content/plugins/woocommerce/src/Admin/Features/PaymentGatewaySuggestions/Init.php:100-110 | wp-content/plugins/woocommerce/src/Admin/Features/ShippingPartnerSuggestions/ShippingPartnerSuggestions.php:84-109 | wp-content/plugins/woocommerce/src/Internal/Admin/RemoteFreeExtensions/Init.php:79-89 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 9+ corresponding lines) · ×2
Edited copies of one member (3 members, 9+ corresponding lines) wp-content/plugins/woocommerce/includes/wc-attribute-functions.php:100— wp-content/plugins/woocommerce/includes/wc-attribute-functions.php:100-108 | wp-content/plugins/woocommerce/includes/wc-attribute-functions.php:122-130 | wp-content/plugins/woocommerce/includes/wc-attribute-functions.php:771-780 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 9+ corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:317— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:317-325 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:265-273 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-setting-options-v2-controller.php:118-126 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (37–39 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-categories-v1-controller.php:55— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-categories-v1-controller.php:55-91 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-categories-v2-controller.php:37-75 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-categories-controller.php:37-75 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-categories-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-categories-controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 105 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (37–39 lines × 3) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:982— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:982-1020 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:1121-1157 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:1234-1270 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:982` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (39 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:269— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:269-307 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-attributes-controller.php:71-109 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-attributes-controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 75 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (39 lines × 2) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/PaymentGateways/Schema/ChequeGatewaySettingsSchema.php:36— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/PaymentGateways/Schema/ChequeGatewaySettingsSchema.php:36-74 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/PaymentGateways/Schema/CodGatewaySettingsSchema.php:45-93 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (35–37 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Segmenter.php:96— wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Segmenter.php:96-130 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Segmenter.php:97-133 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Segmenter.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Segmenter.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (35–37 lines × 2) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Emails/Schema/EmailsSettingsSchema.php:596— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Emails/Schema/EmailsSettingsSchema.php:596-630 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/PaymentGateways/Schema/AbstractPaymentGatewaySettingsSchema.php:652-688 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Emails/Schema/EmailsSettingsSchema.php:596` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (36 lines × 2) wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:479— wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:479-514 | wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:617-652 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:662` calls `apply_filters`, `get_option` and `wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:515` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (36 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-post-data.php:1030— wp-content/plugins/woocommerce/includes/class-wc-post-data.php:1030-1065 | wp-content/plugins/woocommerce/includes/class-wc-post-data.php:1080-1115 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-post-data.php:1030` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (35 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:588— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:588-622 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:855-889 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:588` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (35 lines × 2) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/PlatformRegistry.php:112— wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/PlatformRegistry.php:112-146 | wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/PlatformRegistry.php:185-219 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (26–35 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:329— wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:329-363 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php:132-157 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php` and `wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 105 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:329` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php:159` calls `wp_prime_option_caches` and `wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:364` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (26–35 lines × 2) wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-checkout.php:129— wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-checkout.php:129-154 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/OrderController.php:716-750 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-checkout.php:129` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (30–31 lines × 2) wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:395— wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:395-425 | wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-group-functions.php:359-388 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:395` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (30–31 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:623— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:623-653 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php:976-1005 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (25–27 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php:561— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php:561-585 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-webhooks-v2-controller.php:36-62 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-webhooks-v2-controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (25–27 lines × 2) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/CanadaPostShippingProvider.php:173— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/CanadaPostShippingProvider.php:173-197 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/RoyalMailShippingProvider.php:181-207 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/CanadaPostShippingProvider.php` and `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/RoyalMailShippingProvider.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 70 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/CanadaPostShippingProvider.php:173` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (26 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:949— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:949-974 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:223-248 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:338-363 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 389 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (26 lines × 3) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationEmail.php:200— wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationEmail.php:200-225 | wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationVerifiedEmail.php:170-195 | wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationVerifyEmail.php:194-219 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationEmail.php` and `wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationVerifiedEmail.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (25 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1340— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1340-1364 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1391-1415 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1101-1125 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1371-1395 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1340` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (25 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:412— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:412-436 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:1043-1067 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:405-429 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:519-543 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 223 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:412` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (24–25 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1015— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1015-1038 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1631-1655 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1015` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (24–25 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:399— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:399-423 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php:491-514 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:395` calls `empty`, `array` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php:490` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (24 lines × 4) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:940— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:940-963 | wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:313-336 | wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php:483-506 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQuery.php:509-532 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php` and `wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 115 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (24 lines × 4) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:176— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:176-199 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Schema/GeneralSettingsSchema.php:181-204 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Schema/ProductSettingsSchema.php:183-206 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Schema/TaxSettingsSchema.php:181-204 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Schema/GeneralSettingsSchema.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 103 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:176` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Schema/GeneralSettingsSchema.php:180` calls `in_array`, `array` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:175` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (24 lines × 2) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper-updater.php:79— wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper-updater.php:79-105 | wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper-updater.php:150-173 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (24 lines × 2) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-most-stocked.php:26— wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-most-stocked.php:26-49 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-out-of-stock.php:33-56 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (23–24 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-order-item-fee.php:200— wp-content/plugins/woocommerce/includes/class-wc-order-item-fee.php:200-223 | wp-content/plugins/woocommerce/includes/class-wc-order-item-shipping.php:145-167 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/class-wc-order-item-fee.php` and `wp-content/plugins/woocommerce/includes/class-wc-order-item-shipping.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-order-item-shipping.php:145` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/class-wc-order-item-shipping.php:167` calls `array_map`, `elseif`, `empty` and `wp-content/plugins/woocommerce/includes/class-wc-order-item-fee.php:223` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (23–24 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Segmenter.php:227— wp-content/plugins/woocommerce/src/Admin/API/Reports/Segmenter.php:227-250 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Segmenter.php:295-317 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22–24 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/DataStore.php:107— wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/DataStore.php:107-128 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/DataStore.php:168-191 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/DataStore.php:107` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22–24 lines × 2) wp-content/plugins/woocommerce/src/Blocks/Utils/StyleAttributesUtils.php:275— wp-content/plugins/woocommerce/src/Blocks/Utils/StyleAttributesUtils.php:275-298 | wp-content/plugins/woocommerce/src/Blocks/Utils/StyleAttributesUtils.php:308-329 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (22–23 lines × 2) wp-content/plugins/woocommerce/includes/data-stores/class-wc-customer-data-store.php:391— wp-content/plugins/woocommerce/includes/data-stores/class-wc-customer-data-store.php:391-413 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-customer-data-store.php:452-473 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/data-stores/class-wc-customer-data-store.php:391` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/data-stores/class-wc-customer-data-store.php:388` calls `implode`, `array_map`, `array_keys` and `wp-content/plugins/woocommerce/includes/data-stores/class-wc-customer-data-store.php:449` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (22–23 lines × 2) wp-content/plugins/woocommerce/src/Gateways/PayPal/TransactAccountManager.php:259— wp-content/plugins/woocommerce/src/Gateways/PayPal/TransactAccountManager.php:259-281 | wp-content/plugins/woocommerce/src/Gateways/PayPal/TransactAccountManager.php:326-347 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (20–23 lines × 2) wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:64— wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:64-83 | wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:130-152 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (20–23 lines × 2) wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:24— wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:24-43 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:188-210 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (20–21 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-cart.php:1170— wp-content/plugins/woocommerce/includes/class-wc-cart.php:1170-1190 | wp-content/plugins/woocommerce/src/Internal/StockNotifications/Frontend/SignupService.php:431-450 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (20–21 lines × 2) wp-content/plugins/woocommerce/src/Api/Queries/Coupons/ListCoupons.php:70— wp-content/plugins/woocommerce/src/Api/Queries/Coupons/ListCoupons.php:70-90 | wp-content/plugins/woocommerce/src/Api/Queries/Products/ListProducts.php:158-177 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Api/Queries/Coupons/ListCoupons.php` and `wp-content/plugins/woocommerce/src/Api/Queries/Products/ListProducts.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 52 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Api/Queries/Products/ListProducts.php:186` calls `connection_node_info` and `wp-content/plugins/woocommerce/src/Api/Queries/Coupons/ListCoupons.php:93` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (18 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:324— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:324-341 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/CollectionQuery.php:223-240 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/CollectionQuery.php:119-136 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/CollectionQuery.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/CollectionQuery.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 2 separate duplicated blocks between them, totalling at least 49 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (18 lines × 3) wp-content/plugins/woocommerce/src/Internal/ProductFilters/FilterData.php:64— wp-content/plugins/woocommerce/src/Internal/ProductFilters/FilterData.php:64-81 | wp-content/plugins/woocommerce/src/Internal/ProductFilters/FilterData.php:129-146 | wp-content/plugins/woocommerce/src/Internal/ProductFilters/FilterData.php:194-211 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/ProductFilters/FilterData.php:64` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–18 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:1088— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:1088-1105 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/UpdateUtils.php:239-253 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:1088` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (15–18 lines × 2) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:309— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:309-323 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:462-479 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:309` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (15–17 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1546— wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1546-1560 | wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1599-1615 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1546` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15–17 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php:419— wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php:419-433 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/DataStore.php:491-507 — `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/DataStore.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 35 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php:419` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (16–17 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:228— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:228-244 | wp-content/plugins/woocommerce/src/Admin/API/Taxes.php:58-73 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php` and `wp-content/plugins/woocommerce/src/Admin/API/Taxes.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 71 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (16–17 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/DataStore.php:359— wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/DataStore.php:359-374 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/DataStore.php:315-331 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/DataStore.php:359` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/DataStore.php:334` calls `include_extended_info` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/DataStore.php:376` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (16 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:678— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:678-693 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1071-1086 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:733-748 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1003-1018 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (16 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:440— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:440-455 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:1108-1123 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:433-448 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:561-577 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 223 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:440` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:279— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:279-293 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:523-537 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:167-181 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:282-296 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (15 lines × 4) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:168— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:168-182 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Controller.php:182-196 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Controller.php:156-170 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Controller.php:148-162 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 105 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:168` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attribute-terms-v1-controller.php:140— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attribute-terms-v1-controller.php:140-153 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php:258-273 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-payment-gateways-controller.php:37-53 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (14 lines × 3) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Eway.php:29— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Eway.php:29-42 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PayUIndia.php:29-42 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Paytrail.php:62-76 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/Eway.php:29` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1222— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1222-1232 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1273-1283 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:945-955 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1215-1225 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1222` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 4) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/AustraliaPostShippingProvider.php:154— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/AustraliaPostShippingProvider.php:154-164 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/CanadaPostShippingProvider.php:145-155 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/DPDShippingProvider.php:399-409 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/RoyalMailShippingProvider.php:158-168 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/AustraliaPostShippingProvider.php` and `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/CanadaPostShippingProvider.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (9 lines × 4) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:514— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:514-522 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:557-565 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:750-758 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:808-816 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:748` calls `get_option` and `wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:512` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 4) wp-content/plugins/woocommerce/src/Admin/RemoteSpecs/RuleProcessors/BaseLocationCountryRuleProcessor.php:60— wp-content/plugins/woocommerce/src/Admin/RemoteSpecs/RuleProcessors/BaseLocationCountryRuleProcessor.php:60-68 | wp-content/plugins/woocommerce/src/Admin/RemoteSpecs/RuleProcessors/BaseLocationStateRuleProcessor.php:45-53 | wp-content/plugins/woocommerce/src/Admin/RemoteSpecs/RuleProcessors/OrderCountRuleProcessor.php:59-67 | wp-content/plugins/woocommerce/src/Admin/RemoteSpecs/RuleProcessors/ProductCountRuleProcessor.php:70-78 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 3) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:288— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:288-295 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterStatus.php:191-198 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterTaxonomy.php:390-398 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterStatus.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:288` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 3) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:181— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:181-188 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:182-189 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Controller.php:161-168 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 184 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:181` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 8) wp-content/plugins/woocommerce/src/Admin/API/Reports/Categories/Controller.php:59— wp-content/plugins/woocommerce/src/Admin/API/Reports/Categories/Controller.php:59-63 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Controller.php:56-60 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Controller.php:44-48 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/Controller.php:44-48 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Controller.php:56-60 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Controller.php:72-76 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Controller.php:59-63 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/Stats/Controller.php:74-78 — there are 8 copies across 7 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 8 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 8) wp-content/plugins/woocommerce/src/Internal/Admin/Notes/InstallJPAndWCSPlugins.php:54— wp-content/plugins/woocommerce/src/Internal/Admin/Notes/InstallJPAndWCSPlugins.php:54-61 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/LaunchChecklist.php:52-56 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/MobileApp.php:45-49 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/PaymentsMoreInfoNeeded.php:72-76 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/PaymentsRemindMeLater.php:72-76 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/PersonalizeStore.php:55-59 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/RealTimeOrderAlerts.php:49-53 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/TrackingOptIn.php:68-72 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 8 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Notes/InstallJPAndWCSPlugins.php:54` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (43 lines × 2) wp-content/plugins/woocommerce/src/Blocks/Payments/Integrations/BankTransfer.php:33— wp-content/plugins/woocommerce/src/Blocks/Payments/Integrations/BankTransfer.php:33-75 | wp-content/plugins/woocommerce/src/Blocks/Payments/Integrations/Cheque.php:34-76 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/Payments/Integrations/BankTransfer.php:33` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (43 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Marketing.php:42— wp-content/plugins/woocommerce/src/Admin/API/Marketing.php:42-94 | wp-content/plugins/woocommerce/src/Internal/Admin/EmailPreview/EmailPreviewRestController.php:63-105 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (33 lines × 2 locations) wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:165— wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:165 · wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:207 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (33 lines × 2 locations) wp-content/plugins/woocommerce/assets/js/admin/wc-recent-reviews-widget-async.js:4— wp-content/plugins/woocommerce/assets/js/admin/wc-recent-reviews-widget-async.js:4 · wp-content/plugins/woocommerce/assets/js/admin/wc-status-widget-async.js:4 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
Duplicated block (29 lines × 2 locations) REDACTED:1507— REDACTED:1507 · REDACTED:1606 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (29 lines × 2 locations) wp-content/themes/monoka/assets/js/owl-setup.js:2— wp-content/themes/monoka/assets/js/owl-setup.js:2 · wp-content/themes/monoka/assets/js/owl-setup.js:39 — all 2 copies are in the same file, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (24 lines × 2 locations) REDACTED:522— REDACTED:522 · REDACTED:548 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (24 lines × 2 locations) wp-content/plugins/woocommerce/assets/js/frontend/checkout.js:328— wp-content/plugins/woocommerce/assets/js/frontend/checkout.js:328 · wp-content/plugins/woocommerce/assets/js/frontend/checkout.js:365 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Complex function normalize (cyclomatic 32, cognitive 59) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:77— normalize has cyclomatic complexity 32 and cognitive complexity 59; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function normalize (cyclomatic 32, cognitive 59) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:77— normalize has cyclomatic complexity 32 and cognitive complexity 59; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
AC1 · Text alternatives· <canvas> without a text alternative · ×1
<canvas> without a text alternative wp-content/plugins/woocommerce/assets/js/jquery-qrcode/jquery.qrcode.js:1265— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
Empty <h3> heading REDACTED:3759— An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative.
AC4 · Keyboard semantics· Link used as a button (placeholder href) · ×1
Link used as a button (placeholder href) wp-content/plugins/woocommerce/assets/js/admin/marketplace-suggestions.js:71— An <a href="#"> (or javascript:) with a click handler is a button dressed as a link — it announces the wrong role and stops working without JS. Use a <button> for an action.
AC4 · Keyboard semantics· Anchor without href · ×1
Anchor without href wp-content/plugins/woocommerce/assets/js/frontend/checkout.js:1092— An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
AC4 · Keyboard semantics· Modal dialog does not manage focus · ×1
Modal dialog does not manage focus wp-content/plugins/woocommerce/templates/single-product/photoswipe.php:23— This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
jquery.flexslider.$.flexslider (cyclomatic 331) wp-content/plugins/woocommerce/assets/js/flexslider/jquery.flexslider.js:55— jquery.flexslider.$.flexslider has cyclomatic complexity 331 (threshold 15). Of this number, 87 points are the body's own statements and 244 belong to 41 function literals inside it that branch. This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
(anonymous) (cyclomatic 156) wp-content/plugins/woocommerce/assets/js/frontend/checkout.js:2— (anonymous) has cyclomatic complexity 156 (threshold 15). Most of this is not in the body itself: 2 of the 156 points are its own statements and the rest belongs to 69 function items inside it that branch (validate_field, update_checkout_action::success, queue_update_checkout, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
jquery.prettyPhoto.$.fn.prettyPhoto (cyclomatic 133) REDACTED:10— jquery.prettyPhoto.$.fn.prettyPhoto has cyclomatic complexity 133 (threshold 15). Most of this is not in the body itself: 10 of the 133 points are its own statements and the rest belongs to 25 function items inside it that branch (a function literal at line 230, a function literal at line 180, _fitToViewport, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 121) wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:3— (anonymous) has cyclomatic complexity 121 (threshold 15). Most of this is not in the body itself: 3 of the 121 points are its own statements and the rest belongs to 126 function items inside it that branch (a function literal at line 1451, a function literal at line 1403, change_country, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 109) wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product.js:2— (anonymous) has cyclomatic complexity 109 (threshold 15). Most of this is not in the body itself: 6 of the 109 points are its own statements and the rest belongs to 91 function items inside it that branch (a function literal at line 965, show_and_hide_controls, a function literal at line 489, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_REST_Products_Controller.prepare_object_for_database (cyclomatic 105) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:732— WC_REST_Products_Controller.prepare_object_for_database has cyclomatic complexity 105 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Controller.prepare_object_for_database (cyclomatic 105) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1002— Controller.prepare_object_for_database has cyclomatic complexity 105 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_REST_Products_V2_Controller.prepare_object_for_database (cyclomatic 93) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1070— WC_REST_Products_V2_Controller.prepare_object_for_database has cyclomatic complexity 93 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous) (cyclomatic 80) wp-content/plugins/woocommerce/assets/js/frontend/single-product.js:2— (anonymous) has cyclomatic complexity 80 (threshold 15). Most of this is not in the body itself: 2 of the 80 points are its own statements and the rest belongs to 37 function items inside it that branch (a function literal at line 47, ProductGallery, a function literal at line 11, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 79) wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js:164— (anonymous) has cyclomatic complexity 79 (threshold 15). Most of this is not in the body itself: 1 of the 79 points is its own statement and the rest belongs to 60 function items inside it that branch (a function literal at line 697, a function literal at line 767, onCloseConfigureShippingMethod, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_REST_Products_V2_Controller.get_product_data (cyclomatic 75) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:816— WC_REST_Products_V2_Controller.get_product_data has cyclomatic complexity 75 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
WC_REST_Products_V1_Controller.set_product_meta (cyclomatic 73) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1089— WC_REST_Products_V1_Controller.set_product_meta has cyclomatic complexity 73 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Geo_IP._setup_segments (cyclomatic 70) wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1211— WC_Geo_IP._setup_segments has cyclomatic complexity 70 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WC_Meta_Box_Order_Data.output (cyclomatic 68) wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:192— WC_Meta_Box_Order_Data.output has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous) (cyclomatic 68) wp-content/plugins/woocommerce/assets/js/admin/variation-gallery.js:9— (anonymous) has cyclomatic complexity 68 (threshold 15). Most of this is not in the body itself: 4 of the 68 points are its own statements and the rest belongs to 51 function items inside it that branch (updateLegacyPreview, pickAttachmentDisplayUrl, pickAttachmentThumbnailUrl, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_Admin_Report.get_order_report_data (cyclomatic 62) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-admin-report.php:95— WC_Admin_Report.get_order_report_data has cyclomatic complexity 62 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
jquery.flot.time.init (cyclomatic 58) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.time.js:197— jquery.flot.time.init has cyclomatic complexity 58 (threshold 15). Most of this is not in the body itself: 1 of the 58 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 204, 199, 358). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
(anonymous) (cyclomatic 56) wp-content/plugins/woocommerce/assets/js/admin/marketplace-suggestions.js:3— (anonymous) has cyclomatic complexity 56 (threshold 15). Most of this is not in the body itself: 5 of the 56 points are its own statements and the rest belongs to 29 function items inside it that branch (a function literal at line 392, displaySuggestions, a function literal at line 449, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
ProductQuery.prepare_objects_query (cyclomatic 54) wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQuery.php:26— ProductQuery.prepare_objects_query has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous) (cyclomatic 54) REDACTED:3— (anonymous) has cyclomatic complexity 54 (threshold 15). Most of this is not in the body itself: 8 of the 54 points are its own statements and the rest belongs to 38 function items inside it that branch (a function literal at line 429, a function literal at line 148, a function literal at line 111, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_Structured_Data.generate_product_data (cyclomatic 53) wp-content/plugins/woocommerce/includes/class-wc-structured-data.php:192— WC_Structured_Data.generate_product_data has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_injectTimePicker (cyclomatic 53) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:373— _injectTimePicker has cyclomatic complexity 53 (threshold 15). Of this number, 41 points are the body's own statements and 12 belong to 6 function literals inside it that branch. This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
WC_REST_Product_Variations_Controller.prepare_object_for_database (cyclomatic 52) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:200— WC_REST_Product_Variations_Controller.prepare_object_for_database has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_limitMinMaxDateTime (cyclomatic 52) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:586— _limitMinMaxDateTime has cyclomatic complexity 52 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
AddToCartWithOptions.render (cyclomatic 51) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/AddToCartWithOptions.php:191— AddToCartWithOptions.render has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
jquery.tipTip.$.fn.tipTip (cyclomatic 50) wp-content/plugins/woocommerce/assets/js/jquery-tiptip/jquery.tipTip.js:26— jquery.tipTip.$.fn.tipTip has cyclomatic complexity 50 (threshold 15). Most of this is not in the body itself: 2 of the 50 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 106, 55, 74, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
WC_Meta_Box_Product_Data.save (cyclomatic 48) REDACTED:333— WC_Meta_Box_Product_Data.save has cyclomatic complexity 48 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_REST_Product_Variations_V2_Controller.prepare_object_for_database (cyclomatic 48) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:378— WC_REST_Product_Variations_V2_Controller.prepare_object_for_database has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Controller.prepare_objects_query (cyclomatic 48) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:337— Controller.prepare_objects_query has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_newInst (cyclomatic 48) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:169— _newInst has cyclomatic complexity 48 (threshold 15). Of this number, 43 points are the body's own statements and 5 belong to 7 function items inside it that branch. This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
WC_AJAX.shipping_providers_save_changes (cyclomatic 47) REDACTED:3889— WC_AJAX.shipping_providers_save_changes has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Cart.add_to_cart (cyclomatic 46) wp-content/plugins/woocommerce/includes/class-wc-cart.php:1137— WC_Cart.add_to_cart has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
HandlerRegistry.register_core_collections (cyclomatic 46) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/HandlerRegistry.php:51— HandlerRegistry.register_core_collections has cyclomatic complexity 46 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ProductButton.render (cyclomatic 45) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductButton.php:74— ProductButton.render has cyclomatic complexity 45 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
jquery.nivo.slider.NivoSlider::nivoRun (cyclomatic 45) wp-content/themes/monoka/assets/js/custom-slider/jquery.nivo.slider.js:289— jquery.nivo.slider.NivoSlider::nivoRun has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous) (cyclomatic 45) wp-content/plugins/woocommerce/assets/js/admin/settings.js:3— (anonymous) has cyclomatic complexity 45 (threshold 15). Most of this is not in the body itself: 1 of the 45 points is its own statement and the rest belongs to 34 function items inside it that branch (settings_scroll_to_active_tab, a function literal at line 219, a function literal at line 159, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_Form_Handler.save_account_details (cyclomatic 44) wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:237— WC_Form_Handler.save_account_details has cyclomatic complexity 44 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_REST_Products_V1_Controller.save_variations_data (cyclomatic 44) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1377— WC_REST_Products_V1_Controller.save_variations_data has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Abstract_Legacy_Product.__get (cyclomatic 43) wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-product.php:69— WC_Abstract_Legacy_Product.__get has cyclomatic complexity 43 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
ShopifyMapper.map_variable_product_data (cyclomatic 43) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Platforms/Shopify/ShopifyMapper.php:481— ShopifyMapper.map_variable_product_data has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_onTimeChange (cyclomatic 43) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:779— _onTimeChange has cyclomatic complexity 43 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
(anonymous) (cyclomatic 43) wp-content/themes/monoka/assets/font-awesome/js/pro.js:5— (anonymous) has cyclomatic complexity 43 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Meta_Box_Product_Data.save_variations (cyclomatic 42) REDACTED:462— WC_Meta_Box_Product_Data.save_variations has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Form_Handler.update_cart_action (cyclomatic 42) wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:635— WC_Form_Handler.update_cart_action has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Product_CSV_Importer.expand_data (cyclomatic 42) wp-content/plugins/woocommerce/includes/import/class-wc-product-csv-importer.php:877— WC_Product_CSV_Importer.expand_data has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_REST_Products_Controller.prepare_objects_query (cyclomatic 42) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:222— WC_REST_Products_Controller.prepare_objects_query has cyclomatic complexity 42 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Checkout.validate_posted_data (cyclomatic 40) wp-content/plugins/woocommerce/includes/class-wc-checkout.php:839— WC_Checkout.validate_posted_data has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Product_Data_Store_CPT.get_wp_query_args (cyclomatic 40) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:2174— WC_Product_Data_Store_CPT.get_wp_query_args has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Shortcode_Checkout.order_pay (cyclomatic 40) wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-checkout.php:81— WC_Shortcode_Checkout.order_pay has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
jquery.flot.stack.init::stackData (cyclomatic 40) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.stack.js:57— jquery.flot.stack.init::stackData has cyclomatic complexity 40 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
WC_Frontend_Scripts.load_scripts (cyclomatic 39) wp-content/plugins/woocommerce/includes/class-wc-frontend-scripts.php:475— WC_Frontend_Scripts.load_scripts has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Order_Data_Store_CPT.update_post_meta (cyclomatic 39) wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php:253— WC_Order_Data_Store_CPT.update_post_meta has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WooPaymentsService.get_onboarding_step_status (cyclomatic 39) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:219— WooPaymentsService.get_onboarding_step_status has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Data_Store_WP.parse_date_for_wp_query (cyclomatic 38) wp-content/plugins/woocommerce/includes/data-stores/class-wc-data-store-wp.php:342— WC_Data_Store_WP.parse_date_for_wp_query has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WCEmailTemplateSelectiveApplier.merge (cyclomatic 38) wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateSelectiveApplier.php:478— WCEmailTemplateSelectiveApplier.merge has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PHPMailer.preSend (cyclomatic 38) wp-includes/PHPMailer/PHPMailer.php:1687— PHPMailer.preSend has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous) (cyclomatic 38) wp-content/plugins/woocommerce/assets/js/frontend/cart.js:2— (anonymous) has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 2 of the 38 points are its own statements and the rest belongs to 51 function items inside it that branch (update_wc_div, cart_submit, show_coupon_error, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
wc-order-functions.wc_create_refund (cyclomatic 37) wp-content/plugins/woocommerce/includes/wc-order-functions.php:559— wc-order-functions.wc_create_refund has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Admin_Post_Types.bulk_edit_save (cyclomatic 36) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-post-types.php:528— WC_Admin_Post_Types.bulk_edit_save has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Meta_Box_Order_Data.save (cyclomatic 36) wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:686— WC_Meta_Box_Order_Data.save has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Admin_Post_Types.quick_edit_save (cyclomatic 35) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-post-types.php:395— WC_Admin_Post_Types.quick_edit_save has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PHPMailer.smtpConnect (cyclomatic 34) wp-includes/PHPMailer/PHPMailer.php:2320— PHPMailer.smtpConnect has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
jquery-ui-timepicker-addon.$.datepicker._optionDatepicker (cyclomatic 34) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:1822— jquery-ui-timepicker-addon.$.datepicker._optionDatepicker has cyclomatic complexity 34 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
wc-admin-functions.wc_save_order_items (cyclomatic 33) wp-content/plugins/woocommerce/includes/admin/wc-admin-functions.php:304— wc-admin-functions.wc_save_order_items has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_AJAX.update_order_review (cyclomatic 33) REDACTED:396— WC_AJAX.update_order_review has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_REST_Product_Variations_Controller.prepare_objects_query (cyclomatic 33) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:948— WC_REST_Product_Variations_Controller.prepare_objects_query has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SMTP.authenticate (cyclomatic 33) wp-includes/PHPMailer/SMTP.php:531— SMTP.authenticate has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Form_Handler.save_address (cyclomatic 32) wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:83— WC_Form_Handler.save_address has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Product_Variable_Data_Store_CPT.read_price_data (cyclomatic 32) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variable-data-store-cpt.php:318— WC_Product_Variable_Data_Store_CPT.read_price_data has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DataStore.add_sql_query_params (cyclomatic 32) wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/DataStore.php:336— DataStore.add_sql_query_params has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PHPMailer.createBody (cyclomatic 32) wp-includes/PHPMailer/PHPMailer.php:3042— PHPMailer.createBody has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous) (cyclomatic 32) wp-content/plugins/woocommerce/assets/js/admin/wc-setup.js:5— (anonymous) has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 1 of the 32 points is its own statement and the rest belongs to 30 function items inside it that branch (updatePluginInfo, a function literal at line 119, addPlugins, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_Order_Data_Store_CPT.get_wp_query_args (cyclomatic 31) wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php:920— WC_Order_Data_Store_CPT.get_wp_query_args has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DataStore.add_sql_query_params (cyclomatic 31) wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/DataStore.php:124— DataStore.add_sql_query_params has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
(anonymous) (cyclomatic 31) wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zones.js:3— (anonymous) has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 3 of the 31 points are its own statements and the rest belongs to 26 function items inside it that branch (discardChanges, onDeleteRow, a function literal at line 252, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_Coupon.get_coupon_error (cyclomatic 30) REDACTED:1104— WC_Coupon.get_coupon_error has cyclomatic complexity 30 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
WC_REST_System_Status_Tools_V2_Controller.execute_tool (cyclomatic 30) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php:459— WC_REST_System_Status_Tools_V2_Controller.execute_tool has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
wc-template-functions.wc_template_redirect (cyclomatic 30) REDACTED:27— wc-template-functions.wc_template_redirect has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
OrderMilestoneEasterEgg.handle_admin_enqueue_scripts (cyclomatic 30) wp-content/plugins/woocommerce/src/Internal/Admin/OrderMilestoneEasterEgg.php:109— OrderMilestoneEasterEgg.handle_admin_enqueue_scripts has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Reviews.handle_reply_to_review (cyclomatic 30) wp-content/plugins/woocommerce/src/Internal/Admin/ProductReviews/Reviews.php:250— Reviews.handle_reply_to_review has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PaymentsExtensionSuggestions.with_country_details (cyclomatic 30) wp-content/plugins/woocommerce/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestions.php:3153— PaymentsExtensionSuggestions.with_country_details has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SubmissionHandler.process_rows (cyclomatic 30) wp-content/plugins/woocommerce/src/Internal/OrderReviews/SubmissionHandler.php:123— SubmissionHandler.process_rows has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
jquery.flot.time.formatDate (cyclomatic 30) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.time.js:31— jquery.flot.time.formatDate has cyclomatic complexity 30 (threshold 15). Of this number, 28 points are the body's own statements and 2 belong to one function item inside it that branches. This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
WC_Abstract_Legacy_Order.__get (cyclomatic 29) wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-order.php:410— WC_Abstract_Legacy_Order.__get has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
wc-attribute-functions.wc_create_attribute (cyclomatic 29) wp-content/plugins/woocommerce/includes/wc-attribute-functions.php:495— wc-attribute-functions.wc_create_attribute has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
wc-template-functions.wc_get_product_class (cyclomatic 29) REDACTED:654— wc-template-functions.wc_get_product_class has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ProductFilterChips.render (cyclomatic 29) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterChips.php:46— ProductFilterChips.render has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SettingsUISchema.from_legacy_settings (cyclomatic 29) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/SettingsUISchema.php:38— SettingsUISchema.from_legacy_settings has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ShopifyMapper.map_simple_product_data (cyclomatic 29) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Platforms/Shopify/ShopifyMapper.php:401— ShopifyMapper.map_simple_product_data has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LookupDataStore.create_data_for_product_cpt_core (cyclomatic 29) wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/LookupDataStore.php:847— LookupDataStore.create_data_for_product_cpt_core has cyclomatic complexity 29 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
CollectionQuery.get_query_args (cyclomatic 29) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/CollectionQuery.php:190— CollectionQuery.get_query_args has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
acf.EventManager (cyclomatic 29) REDACTED:2573— acf.EventManager has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 1 of the 29 points is its own statement and the rest belongs to 10 function items inside it that branch (_removeHook, _runHook, addAction, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 29) wp-content/plugins/woocommerce/assets/js/admin/reports.js:1— (anonymous) has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 2 of the 29 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 13, a function literal at line 79, a function literal at line 164, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_Helper.render_helper_output (cyclomatic 28) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:164— WC_Helper.render_helper_output has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Cart_Session.get_cart_from_session (cyclomatic 28) wp-content/plugins/woocommerce/includes/class-wc-cart-session.php:98— WC_Cart_Session.get_cart_from_session has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ReviewsListTable.handle_row_actions (cyclomatic 28) wp-content/plugins/woocommerce/src/Internal/Admin/ProductReviews/ReviewsListTable.php:413— ReviewsListTable.handle_row_actions has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
initAjaxSubmit (cyclomatic 28) wp-content/plugins/woocommerce/assets/js/frontend/order-review.js:276— initAjaxSubmit has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 2 of the 28 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 314, 336, 282, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
WC_Product_Data_Store_CPT.update_post_meta (cyclomatic 27) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:705— WC_Product_Data_Store_CPT.update_post_meta has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Legacy_Coupon.__get (cyclomatic 27) wp-content/plugins/woocommerce/includes/legacy/class-wc-legacy-coupon.php:60— WC_Legacy_Coupon.__get has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
AmazonLogisticsShippingProvider.try_parse_tracking_number (cyclomatic 27) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/AmazonLogisticsShippingProvider.php:94— AmazonLogisticsShippingProvider.try_parse_tracking_number has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MiniCart.render_experimental_iapi_mini_cart (cyclomatic 27) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/MiniCart.php:503— MiniCart.render_experimental_iapi_mini_cart has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Payments.maybe_track_provider_state_change (cyclomatic 27) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Payments.php:587— Payments.maybe_track_provider_state_change has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PaymentsProviders.get_extension_suggestions (cyclomatic 27) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders.php:653— PaymentsProviders.get_extension_suggestions has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
jquery.zoom.$.fn.zoom (cyclomatic 27) wp-content/plugins/woocommerce/assets/js/zoom/jquery.zoom.js:83— jquery.zoom.$.fn.zoom has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 1 of the 27 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 84, 118, 121, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
(anonymous) (cyclomatic 27) wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart.js:2— (anonymous) has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 2 of the 27 points are its own statements and the rest belongs to 21 function items inside it that branch (updateButton, onAddToCart::success, onAddToCart, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_Checkout.get_posted_data (cyclomatic 26) wp-content/plugins/woocommerce/includes/class-wc-checkout.php:761— WC_Checkout.get_posted_data has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Shortcodes.product_page (cyclomatic 26) wp-content/plugins/woocommerce/includes/class-wc-shortcodes.php:506— WC_Shortcodes.product_page has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Product_Data_Store_CPT.search_products (cyclomatic 26) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:1973— WC_Product_Data_Store_CPT.search_products has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MobileAppQRLogin.exchange_token (cyclomatic 26) wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:953— MobileAppQRLogin.exchange_token has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MobileAppQRLogin.get_status (cyclomatic 26) wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:1234— MobileAppQRLogin.get_status has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Checkout.enqueue_data (cyclomatic 26) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Checkout.php:419— Checkout.enqueue_data has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous) (cyclomatic 26) wp-content/plugins/woocommerce/assets/js/admin/term-ordering.js:4— (anonymous) has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 4 of the 26 points are its own statements and the rest belongs to 9 function items inside it that branch (update, a function literal at line 36, wc_add_missing_sort_handles, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
api-helpers.acf_validate_attachment (cyclomatic 25) wp-content/plugins/advanced-custom-fields-pro/includes/api/api-helpers.php:3511— api-helpers.acf_validate_attachment has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Admin_Setup_Wizard.display_service_item (cyclomatic 25) REDACTED:1656— WC_Admin_Setup_Wizard.display_service_item has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Cart_Session.populate_cart_from_order (cyclomatic 25) wp-content/plugins/woocommerce/includes/class-wc-cart-session.php:560— WC_Cart_Session.populate_cart_from_order has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Checkout.process_customer (cyclomatic 25) wp-content/plugins/woocommerce/includes/class-wc-checkout.php:1166— WC_Checkout.process_customer has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Query.get_catalog_ordering_args (cyclomatic 25) wp-content/plugins/woocommerce/includes/class-wc-query.php:675— WC_Query.get_catalog_ordering_args has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_REST_Orders_V1_Controller.prepare_item_for_response (cyclomatic 25) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:132— WC_REST_Orders_V1_Controller.prepare_item_for_response has cyclomatic complexity 25 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
WC_REST_System_Status_V2_Controller.get_pages (cyclomatic 25) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php:1519— WC_REST_System_Status_V2_Controller.get_pages has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_REST_Orders_Controller.save_object (cyclomatic 25) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php:253— WC_REST_Orders_Controller.save_object has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FulfillmentsManager.update_fulfillments_after_refund (cyclomatic 25) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsManager.php:321— FulfillmentsManager.update_fulfillments_after_refund has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FileController.get_files (cyclomatic 25) wp-content/plugins/woocommerce/src/Internal/Admin/Logging/FileV2/FileController.php:203— FileController.get_files has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Settings.add_component_settings (cyclomatic 25) wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php:121— Settings.add_component_settings has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_updateDateTime (cyclomatic 25) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:918— _updateDateTime has cyclomatic complexity 25 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
WC_Query.pre_get_posts (cyclomatic 24) wp-content/plugins/woocommerce/includes/class-wc-query.php:326— WC_Query.pre_get_posts has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Product_CSV_Importer.import (cyclomatic 24) wp-content/plugins/woocommerce/includes/import/class-wc-product-csv-importer.php:1143— WC_Product_CSV_Importer.import has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_REST_System_Status_V2_Controller.get_environment_info_per_fields (cyclomatic 24) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php:926— WC_REST_System_Status_V2_Controller.get_environment_info_per_fields has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
wc-order-functions.wc_get_order_types (cyclomatic 24) wp-content/plugins/woocommerce/includes/wc-order-functions.php:228— wc-order-functions.wc_get_order_types has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
wc-update-functions.wc_update_200_line_items (cyclomatic 24) wp-content/plugins/woocommerce/includes/wc-update-functions.php:246— wc-update-functions.wc_update_200_line_items has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Segmenter.set_all_segments (cyclomatic 24) wp-content/plugins/woocommerce/src/Admin/API/Reports/Segmenter.php:327— Segmenter.set_all_segments has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProductReviewForm.render (cyclomatic 24) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Reviews/ProductReviewForm.php:29— ProductReviewForm.render has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WooCommerceProductImporter.sync_variations (cyclomatic 24) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/WooCommerceProductImporter.php:722— WooCommerceProductImporter.sync_variations has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RestApiCache.get_cached_response (cyclomatic 24) wp-content/plugins/woocommerce/src/Internal/Traits/RestApiCache.php:1337— RestApiCache.get_cached_response has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
wp-login.login_header (cyclomatic 24) REDACTED:41— wp-login.login_header has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
add-to-cart-variation.VariationForm.onUpdateAttributes (cyclomatic 24) wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart-variation.js:495— add-to-cart-variation.VariationForm.onUpdateAttributes has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 2 of the 24 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 505, 622). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
debounce (cyclomatic 24) wp-content/plugins/woocommerce/assets/js/frontend/a8c-address-autocomplete-service.js:23— debounce has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 6 of the 24 points are its own statements and the rest belongs to 11 function items inside it that branch (shouldInvoke, debounced, cancel, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_AJAX.refund_line_items (cyclomatic 23) REDACTED:2370— WC_AJAX.refund_line_items has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Autoloader.autoload (cyclomatic 23) wp-content/plugins/woocommerce/includes/class-wc-autoloader.php:69— WC_Autoloader.autoload has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Webhook_Data_Store.search_webhooks (cyclomatic 23) wp-content/plugins/woocommerce/includes/data-stores/class-wc-webhook-data-store.php:238— WC_Webhook_Data_Store.search_webhooks has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_REST_Orders_V2_Controller.get_order_item_data (cyclomatic 23) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:216— WC_REST_Orders_V2_Controller.get_order_item_data has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Shipping_Legacy_Free_Shipping.is_available (cyclomatic 23) wp-content/plugins/woocommerce/includes/shipping/legacy-free-shipping/class-wc-shipping-legacy-free-shipping.php:162— WC_Shipping_Legacy_Free_Shipping.is_available has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FedExShippingProvider.try_parse_tracking_number (cyclomatic 23) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/FedExShippingProvider.php:95— FedExShippingProvider.try_parse_tracking_number has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BlockHooksTrait.register_hooked_block (cyclomatic 23) wp-content/plugins/woocommerce/src/Blocks/Utils/BlockHooksTrait.php:20— BlockHooksTrait.register_hooked_block has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PaymentsProviders.enhance_payment_gateway_details (cyclomatic 23) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders.php:1297— PaymentsProviders.enhance_payment_gateway_details has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OrdersTableQuery.process_date_args (cyclomatic 23) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableQuery.php:463— OrdersTableQuery.process_date_args has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OrderTagsProvider.register_tags (cyclomatic 23) wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:23— OrderTagsProvider.register_tags has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
UpdateUtils.update_order_from_request (cyclomatic 23) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/UpdateUtils.php:63— UpdateUtils.update_order_from_request has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SignupService.signup (cyclomatic 23) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Frontend/SignupService.php:88— SignupService.signup has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PHPMailer.createHeader (cyclomatic 23) wp-includes/PHPMailer/PHPMailer.php:2846— PHPMailer.createHeader has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
api-template.have_rows (cyclomatic 22) wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php:370— api-template.have_rows has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
wc-meta-box-functions.woocommerce_wp_text_input (cyclomatic 22) wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php:23— wc-meta-box-functions.woocommerce_wp_text_input has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_REST_Orders_V1_Controller.prepare_item_for_database (cyclomatic 22) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:461— WC_REST_Orders_V1_Controller.prepare_item_for_database has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_REST_Report_Sales_V1_Controller.prepare_item_for_response (cyclomatic 22) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-report-sales-v1-controller.php:96— WC_REST_Report_Sales_V1_Controller.prepare_item_for_response has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_REST_Orders_V2_Controller.prepare_object_for_database (cyclomatic 22) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:725— WC_REST_Orders_V2_Controller.prepare_object_for_database has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_REST_Products_V2_Controller.prepare_objects_query (cyclomatic 22) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:342— WC_REST_Products_V2_Controller.prepare_objects_query has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_REST_Product_Reviews_Controller.create_item (cyclomatic 22) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:378— WC_REST_Product_Reviews_Controller.create_item has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
wc-product-functions.wc_get_formatted_variation (cyclomatic 22) wp-content/plugins/woocommerce/includes/wc-product-functions.php:502— wc-product-functions.wc_get_formatted_variation has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
wc-user-functions.wc_customer_bought_product (cyclomatic 22) wp-content/plugins/woocommerce/includes/wc-user-functions.php:405— wc-user-functions.wc_customer_bought_product has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Widget_Brand_Nav.layered_nav_list (cyclomatic 22) REDACTED:395— WC_Widget_Brand_Nav.layered_nav_list has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Widget_Product_Categories.widget (cyclomatic 22) wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-product-categories.php:97— WC_Widget_Product_Categories.widget has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CheckoutFields.validate_options (cyclomatic 22) wp-content/plugins/woocommerce/src/Blocks/Domain/Services/CheckoutFields.php:380— CheckoutFields.validate_options has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CLIRunner.verify_cot_data (cyclomatic 22) wp-content/plugins/woocommerce/src/Database/Migrations/CustomOrderTable/CLIRunner.php:349— CLIRunner.verify_cot_data has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RestAbilityFactory.relax_output_schema_for_wc_quirks (cyclomatic 22) wp-content/plugins/woocommerce/src/Internal/Abilities/REST/RestAbilityFactory.php:470— RestAbilityFactory.relax_output_schema_for_wc_quirks has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OrdersTableQuery.build_query (cyclomatic 22) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableQuery.php:789— OrdersTableQuery.build_query has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
StockNotificationsDataStore.query (cyclomatic 22) wp-content/plugins/woocommerce/src/Internal/DataStores/StockNotifications/StockNotificationsDataStore.php:417— StockNotificationsDataStore.query has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AbstractAddressSchema.validate_callback (cyclomatic 22) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/AbstractAddressSchema.php:163— AbstractAddressSchema.validate_callback has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PHPMailer.msgHTML (cyclomatic 22) wp-includes/PHPMailer/PHPMailer.php:4660— PHPMailer.msgHTML has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ModelConfig.toArray (cyclomatic 22) wp-includes/php-ai-client/src/Providers/Models/DTO/ModelConfig.php:735— ModelConfig.toArray has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (ModelConfig.fromArray) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ModelConfig.fromArray (cyclomatic 22) wp-includes/php-ai-client/src/Providers/Models/DTO/ModelConfig.php:812— ModelConfig.fromArray has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (ModelConfig.toArray) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
cart.document.addEventListener("DOMContentLoaded") (cyclomatic 22) wp-content/themes/monoka/assets/js/cart.js:2— cart.document.addEventListener("DOMContentLoaded") has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 2 of the 22 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 42, submitCartForm). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_AJAX.json_search_products (cyclomatic 21) REDACTED:1788— WC_AJAX.json_search_products has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Form_Handler.pay_action (cyclomatic 21) wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:417— WC_Form_Handler.pay_action has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_REST_Orders_V2_Controller.get_formatted_item_data (cyclomatic 21) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:373— WC_REST_Orders_V2_Controller.get_formatted_item_data has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
WC_REST_Orders_Controller.prepare_object_for_database (cyclomatic 21) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php:112— WC_REST_Orders_Controller.prepare_object_for_database has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_REST_Product_Reviews_Controller.update_item (cyclomatic 21) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:531— WC_REST_Product_Reviews_Controller.update_item has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Product_Collection_Block_Tracking.parse_blocks_track_data (cyclomatic 21) wp-content/plugins/woocommerce/includes/tracks/events/class-wc-product-collection-block-tracking.php:105— WC_Product_Collection_Block_Tracking.parse_blocks_track_data has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Product_Collection_Block_Tracking.get_query_filters_usage_data (cyclomatic 21) wp-content/plugins/woocommerce/includes/tracks/events/class-wc-product-collection-block-tracking.php:241— WC_Product_Collection_Block_Tracking.get_query_filters_usage_data has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Products_Tracking.track_product_published (cyclomatic 21) wp-content/plugins/woocommerce/includes/tracks/events/class-wc-products-tracking.php:329— WC_Products_Tracking.track_product_published has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Widget_Layered_Nav_Filters.widget (cyclomatic 21) REDACTED:42— WC_Widget_Layered_Nav_Filters.widget has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Widget_Layered_Nav.layered_nav_list (cyclomatic 21) REDACTED:392— WC_Widget_Layered_Nav.layered_nav_list has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Connection.slice (cyclomatic 21) wp-content/plugins/woocommerce/src/Api/Pagination/Connection.php:71— Connection.slice has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Dropdown.render (cyclomatic 21) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Dropdown.php:44— Dropdown.render has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProductFilterTaxonomy.render (cyclomatic 21) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterTaxonomy.php:184— ProductFilterTaxonomy.render has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProductSpecifications.render (cyclomatic 21) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductSpecifications.php:36— ProductSpecifications.render has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OrdersQuery.execute (cyclomatic 21) wp-content/plugins/woocommerce/src/Internal/Abilities/Domain/OrdersQuery.php:76— OrdersQuery.execute has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WooPayments.get_details (cyclomatic 21) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:46— WooPayments.get_details has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WCEmailTemplateChangeSummary.diff_records (cyclomatic 21) wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:473— WCEmailTemplateChangeSummary.diff_records has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ListTable.prepare_items (cyclomatic 21) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Admin/ListTable.php:324— ListTable.prepare_items has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
URL.process_path (cyclomatic 21) wp-content/plugins/woocommerce/src/Internal/Utilities/URL.php:141— URL.process_path has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PHPMailer.wrapText (cyclomatic 21) wp-includes/PHPMailer/PHPMailer.php:2678— PHPMailer.wrapText has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ModelRequirements.toRequiredOptions (cyclomatic 21) wp-includes/php-ai-client/src/Providers/Models/DTO/ModelRequirements.php:194— ModelRequirements.toRequiredOptions has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
wc-shipping-zone-methods.isValidFormattedNumber (cyclomatic 21) wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js:14— wc-shipping-zone-methods.isValidFormattedNumber has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 62). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
address-autocomplete-common.registerAddressAutocompleteProvider (cyclomatic 21) wp-content/plugins/woocommerce/assets/js/frontend/utils/address-autocomplete-common.js:51— address-autocomplete-common.registerAddressAutocompleteProvider has cyclomatic complexity 21 (threshold 15). Of this number, 18 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
renderPostScreen (cyclomatic 21) REDACTED:7082— renderPostScreen has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 5 function items inside it that branch (a function literal at line 7128, sortMetabox, copyEvents, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 21) wp-content/plugins/woocommerce/assets/js/frontend/country-select.js:2— (anonymous) has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 3 of the 21 points are its own statements and the rest belongs to 16 function items inside it that branch (a function literal at line 90, a function literal at line 57, a function literal at line 175, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
acf-wp-functions.acf_decode_post_id (cyclomatic 20) wp-content/plugins/advanced-custom-fields-pro/includes/acf-wp-functions.php:119— acf-wp-functions.acf_decode_post_id has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
WC_Helper._get_return_notices (cyclomatic 20) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:605— WC_Helper._get_return_notices has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Admin_List_Table_Orders.get_order_preview_item_html (cyclomatic 20) wp-content/plugins/woocommerce/includes/admin/list-tables/class-wc-admin-list-table-orders.php:237— WC_Admin_List_Table_Orders.get_order_preview_item_html has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_AJAX.shipping_zone_methods_save_changes (cyclomatic 20) REDACTED:3534— WC_AJAX.shipping_zone_methods_save_changes has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Cart.show_shipping (cyclomatic 20) wp-content/plugins/woocommerce/includes/class-wc-cart.php:1795— WC_Cart.show_shipping has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Product_Importer.set_product_data (cyclomatic 20) wp-content/plugins/woocommerce/includes/import/abstract-wc-product-importer.php:351— WC_Product_Importer.set_product_data has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_REST_Orders_V2_Controller.save_object (cyclomatic 20) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:800— WC_REST_Orders_V2_Controller.save_object has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
wc-user-functions.wc_customer_has_capability (cyclomatic 20) wp-content/plugins/woocommerce/includes/wc-user-functions.php:610— wc-user-functions.wc_customer_has_capability has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MobileAppQRLogin.approve_token (cyclomatic 20) wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:1655— MobileAppQRLogin.approve_token has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DataStore.update_intervals_sql_params (cyclomatic 20) wp-content/plugins/woocommerce/src/Admin/API/Reports/DataStore.php:653— DataStore.update_intervals_sql_params has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DataStore.sync_order_products (cyclomatic 20) wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php:453— DataStore.sync_order_products has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ListProducts.execute (cyclomatic 20) wp-content/plugins/woocommerce/src/Api/Queries/Products/ListProducts.php:45— ListProducts.execute has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BlockTemplatesController.add_db_templates_with_woo_slug (cyclomatic 20) wp-content/plugins/woocommerce/src/Blocks/BlockTemplatesController.php:248— BlockTemplatesController.add_db_templates_with_woo_slug has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AddToCartForm.render (cyclomatic 20) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartForm.php:170— AddToCartForm.render has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ProductStockIndicator.render (cyclomatic 20) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductStockIndicator.php:78— ProductStockIndicator.render has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PatternRegistry.register_block_pattern (cyclomatic 20) wp-content/plugins/woocommerce/src/Blocks/Patterns/PatternRegistry.php:42— PatternRegistry.register_block_pattern has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Request.capture_authorized_payment (cyclomatic 20) wp-content/plugins/woocommerce/src/Gateways/PayPal/Request.php:318— Request.capture_authorized_payment has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Loader.add_component_settings (cyclomatic 20) wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:318— Loader.add_component_settings has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Payments.process_payment_provider_states (cyclomatic 20) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Payments.php:428— Payments.process_payment_provider_states has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OrderSchema.get_item_response (cyclomatic 20) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Schema/OrderSchema.php:597— OrderSchema.get_item_response has cyclomatic complexity 20 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
ProductCollectionData.get_route_response (cyclomatic 20) wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/ProductCollectionData.php:69— ProductCollectionData.get_route_response has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PHPMailer.DKIM_Add (cyclomatic 20) wp-includes/PHPMailer/PHPMailer.php:5263— PHPMailer.DKIM_Add has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
fetchSvg (cyclomatic 20) wp-content/themes/monoka/assets/font-awesome/js/pro.js:1350— fetchSvg has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 1364, 1400, 1383, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
WC_Admin_Webhooks.save (cyclomatic 19) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-webhooks.php:54— WC_Admin_Webhooks.save has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Product_CSV_Importer_Controller.dispatch_ajax (cyclomatic 19) wp-content/plugins/woocommerce/includes/admin/importers/class-wc-product-csv-importer-controller.php:323— WC_Product_CSV_Importer_Controller.dispatch_ajax has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Report_Coupon_Usage.coupons_widget (cyclomatic 19) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:175— WC_Report_Coupon_Usage.coupons_widget has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Settings_Emails.email_notification_setting (cyclomatic 19) wp-content/plugins/woocommerce/includes/admin/settings/class-wc-settings-emails.php:467— WC_Settings_Emails.email_notification_setting has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Settings_Payment_Gateways.suppress_admin_notices (cyclomatic 19) wp-content/plugins/woocommerce/includes/admin/settings/class-wc-settings-payment-gateways.php:378— WC_Settings_Payment_Gateways.suppress_admin_notices has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
wc-meta-box-functions.woocommerce_wp_checkbox (cyclomatic 19) wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php:165— wc-meta-box-functions.woocommerce_wp_checkbox has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_AJAX.remove_order_item (cyclomatic 19) REDACTED:1465— WC_AJAX.remove_order_item has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Download_Handler.download_product (cyclomatic 19) REDACTED:38— WC_Download_Handler.download_product has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Form_Handler.process_registration (cyclomatic 19) wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:1182— WC_Form_Handler.process_registration has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Frontend_Scripts.get_script_data (cyclomatic 19) wp-content/plugins/woocommerce/includes/class-wc-frontend-scripts.php:609— WC_Frontend_Scripts.get_script_data has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
WC_Shipping.calculate_shipping_for_package (cyclomatic 19) wp-content/plugins/woocommerce/includes/class-wc-shipping.php:311— WC_Shipping.calculate_shipping_for_package has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_REST_Controller.batch_items (cyclomatic 19) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-controller.php:209— WC_REST_Controller.batch_items has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
wc-core-functions._wc_delete_transients (cyclomatic 19) wp-content/plugins/woocommerce/includes/wc-core-functions.php:2579— wc-core-functions._wc_delete_transients has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
wc-product-functions.wc_get_related_products (cyclomatic 19) wp-content/plugins/woocommerce/includes/wc-product-functions.php:1402— wc-product-functions.wc_get_related_products has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Widget_Brand_Nav.get_page_base_url (cyclomatic 19) REDACTED:215— WC_Widget_Brand_Nav.get_page_base_url has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DataStore.get_attribute_subqueries (cyclomatic 19) wp-content/plugins/woocommerce/src/Admin/API/Reports/DataStore.php:1457— DataStore.get_attribute_subqueries has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProductFilterCheckboxList.render (cyclomatic 19) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterCheckboxList.php:37— ProductFilterCheckboxList.render has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AbilitiesLoader.register_abilities (cyclomatic 19) wp-content/plugins/woocommerce/src/Internal/Abilities/AbilitiesLoader.php:92— AbilitiesLoader.register_abilities has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RestAbilityFactory.sanitize_schema (cyclomatic 19) wp-content/plugins/woocommerce/src/Internal/Abilities/REST/RestAbilityFactory.php:285— RestAbilityFactory.sanitize_schema has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WooPaymentsService.standardize_onboarding_step_details (cyclomatic 19) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:2027— WooPaymentsService.standardize_onboarding_step_details has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SettingsUISchema.get_group_actions (cyclomatic 19) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/SettingsUISchema.php:403— SettingsUISchema.get_group_actions has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LegacyDataHandler.backfill_order_to_datastore (cyclomatic 19) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/LegacyDataHandler.php:354— LegacyDataHandler.backfill_order_to_datastore has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OrdersTableMetaQuery.sanitize_meta_query (cyclomatic 19) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableMetaQuery.php:222— OrdersTableMetaQuery.sanitize_meta_query has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OrdersTableMetaQuery.generate_where_for_clause_key (cyclomatic 19) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableMetaQuery.php:508— OrdersTableMetaQuery.generate_where_for_clause_key has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
WCEmailTemplateChangeSummary.diff_records_three_way (cyclomatic 19) wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:701— WCEmailTemplateChangeSummary.diff_records_three_way has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Controller.validate_setting_value (cyclomatic 19) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Controller.php:300— Controller.validate_setting_value has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Checkout.validate_callback (cyclomatic 19) wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Checkout.php:232— Checkout.validate_callback has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AbstractDataTransferObject.convertEmptyArraysToObjects (cyclomatic 19) wp-includes/php-ai-client/src/Common/AbstractDataTransferObject.php:93— AbstractDataTransferObject.convertEmptyArraysToObjects has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
observe (cyclomatic 19) wp-content/themes/monoka/assets/font-awesome/js/pro.js:1619— observe has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 5 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1635, 1633). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
(anonymous) (cyclomatic 19) REDACTED:1— (anonymous) has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 5 function items inside it that branch (i, a function literal at line 1, C, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_Admin_Post_Types.set_new_price (cyclomatic 18) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-post-types.php:910— WC_Admin_Post_Types.set_new_price has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Admin_List_Table_Products.query_filters (cyclomatic 18) REDACTED:525— WC_Admin_List_Table_Products.query_filters has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Report_Customer_List.column_default (cyclomatic 18) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-customer-list.php:86— WC_Report_Customer_List.column_default has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Settings_Advanced.save (cyclomatic 18) wp-content/plugins/woocommerce/includes/admin/settings/class-wc-settings-advanced.php:561— WC_Settings_Advanced.save has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Auth.auth_endpoint (cyclomatic 18) wp-content/plugins/woocommerce/includes/class-wc-auth.php:314— WC_Auth.auth_endpoint has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Checkout.create_order (cyclomatic 18) wp-content/plugins/woocommerce/includes/class-wc-checkout.php:375— WC_Checkout.create_order has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Order_Factory.get_orders (cyclomatic 18) wp-content/plugins/woocommerce/includes/class-wc-order-factory.php:81— WC_Order_Factory.get_orders has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Regenerate_Images_Request.filter_image_sizes_to_only_missing_thumbnails (cyclomatic 18) wp-content/plugins/woocommerce/includes/class-wc-regenerate-images-request.php:171— WC_Regenerate_Images_Request.filter_image_sizes_to_only_missing_thumbnails has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Regenerate_Images.maybe_resize_image (cyclomatic 18) wp-content/plugins/woocommerce/includes/class-wc-regenerate-images.php:201— WC_Regenerate_Images.maybe_resize_image has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Tax.sort_rates_callback (cyclomatic 18) wp-content/plugins/woocommerce/includes/class-wc-tax.php:305— WC_Tax.sort_rates_callback has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Product_Variable_Data_Store_CPT.validate_prices_data (cyclomatic 18) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variable-data-store-cpt.php:1042— WC_Product_Variable_Data_Store_CPT.validate_prices_data has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_REST_Products_V1_Controller.delete_item (cyclomatic 18) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1642— WC_REST_Products_V1_Controller.delete_item has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_REST_Product_Reviews_Controller.get_items (cyclomatic 18) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:236— WC_REST_Product_Reviews_Controller.get_items has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
wc-product-functions.wc_product_post_type_link (cyclomatic 18) wp-content/plugins/woocommerce/includes/wc-product-functions.php:260— wc-product-functions.wc_product_post_type_link has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
wc-template-functions.wc_get_formatted_cart_item_data (cyclomatic 18) REDACTED:4503— wc-template-functions.wc_get_formatted_cart_item_data has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
wc-term-functions._wc_term_recount (cyclomatic 18) wp-content/plugins/woocommerce/includes/wc-term-functions.php:416— wc-term-functions._wc_term_recount has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Widget_Brand_Nav.widget (cyclomatic 18) REDACTED:84— WC_Widget_Brand_Nav.widget has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Orders.get_formatted_item_data (cyclomatic 18) wp-content/plugins/woocommerce/src/Admin/API/Orders.php:185— Orders.get_formatted_item_data has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TimeInterval.next_quarter_start (cyclomatic 18) wp-content/plugins/woocommerce/src/Admin/API/Reports/TimeInterval.php:385— TimeInterval.next_quarter_start has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CanadaPostShippingProvider.try_parse_tracking_number (cyclomatic 18) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/CanadaPostShippingProvider.php:140— CanadaPostShippingProvider.try_parse_tracking_number has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RoyalMailShippingProvider.try_parse_tracking_number (cyclomatic 18) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/RoyalMailShippingProvider.php:153— RoyalMailShippingProvider.try_parse_tracking_number has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InstalledExtensions.get_data (cyclomatic 18) REDACTED:20— InstalledExtensions.get_data has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SchemaHandle.get_all_metadata (cyclomatic 18) wp-content/plugins/woocommerce/src/Api/Utils/SchemaHandle.php:79— SchemaHandle.get_all_metadata has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CheckoutExpressPaymentBlock.sync_express_payment_attrs (cyclomatic 18) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/CheckoutExpressPaymentBlock.php:53— CheckoutExpressPaymentBlock.sync_express_payment_attrs has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Utils.parse_frontend_location_context (cyclomatic 18) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/Utils.php:100— Utils.parse_frontend_location_context has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProductFilterAttribute.render (cyclomatic 18) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:142— ProductFilterAttribute.render has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PaymentGateway.get_provider_links (cyclomatic 18) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PaymentGateway.php:276— PaymentGateway.get_provider_links has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SubmissionHandler.handle (cyclomatic 18) wp-content/plugins/woocommerce/src/Internal/OrderReviews/SubmissionHandler.php:59— SubmissionHandler.handle has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
OrderActionsRestController.send_email (cyclomatic 18) wp-content/plugins/woocommerce/src/Internal/Orders/OrderActionsRestController.php:502— OrderActionsRestController.send_email has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PushTokensDataStore.get_by_token_or_device_id (cyclomatic 18) wp-content/plugins/woocommerce/src/Internal/PushNotifications/DataStores/PushTokensDataStore.php:210— PushTokensDataStore.get_by_token_or_device_id has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
PushTokenValidator.validate_token (cyclomatic 18) wp-content/plugins/woocommerce/src/Internal/PushNotifications/Validators/PushTokenValidator.php:342— PushTokenValidator.validate_token has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AbstractPaymentGatewaySettingsSchema.sanitize_field_value (cyclomatic 18) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/PaymentGateways/Schema/AbstractPaymentGatewaySettingsSchema.php:593— AbstractPaymentGatewaySettingsSchema.sanitize_field_value has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
PHPMailer.sendmailSend (cyclomatic 18) wp-includes/PHPMailer/PHPMailer.php:1888— PHPMailer.sendmailSend has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
jquery-ui-timepicker-addon.$.datepicker.parseTime::strictParse (cyclomatic 18) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:1192— jquery-ui-timepicker-addon.$.datepicker.parseTime::strictParse has cyclomatic complexity 18 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages. This is NOT this file's highest cyclomatic complexity: jquery-ui-timepicker-addon.$.datepicker.formatTime (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
Autoplay (cyclomatic 18) REDACTED:2618— Autoplay has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 2659, 2672, 2687, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
(anonymous) (cyclomatic 18) wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-providers.js:3— (anonymous) has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 21 function items inside it that branch (a function literal at line 27, a function literal at line 143, onLoadBackboneModal, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
replaceForPosition (cyclomatic 18) wp-content/themes/monoka/assets/font-awesome/js/pro.js:2227— replaceForPosition has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 2229, 2282, 2236, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
acf-wp-functions.acf_get_object_type (cyclomatic 17) wp-content/plugins/advanced-custom-fields-pro/includes/acf-wp-functions.php:13— acf-wp-functions.acf_get_object_type has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Abstract_Order.update_taxes (cyclomatic 17) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:1920— WC_Abstract_Order.update_taxes has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Admin_Attributes.add_attribute (cyclomatic 17) REDACTED:298— WC_Admin_Attributes.add_attribute has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Helper.get_subscriptions (cyclomatic 17) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1889— WC_Helper.get_subscriptions has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Report_Sales_By_Product.products_widget (cyclomatic 17) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:221— WC_Report_Sales_By_Product.products_widget has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Report_Stock.column_default (cyclomatic 17) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-stock.php:80— WC_Report_Stock.column_default has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Deprecated_Action_Hooks.trigger_hook (cyclomatic 17) wp-content/plugins/woocommerce/includes/class-wc-deprecated-action-hooks.php:119— WC_Deprecated_Action_Hooks.trigger_hook has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Order_Item.get_formatted_meta_data (cyclomatic 17) wp-content/plugins/woocommerce/includes/class-wc-order-item.php:335— WC_Order_Item.get_formatted_meta_data has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Post_Types.register_post_types (cyclomatic 17) wp-content/plugins/woocommerce/includes/class-wc-post-types.php:320— WC_Post_Types.register_post_types has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Product_Variable.get_available_variation (cyclomatic 17) wp-content/plugins/woocommerce/includes/class-wc-product-variable.php:413— WC_Product_Variable.get_available_variation has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Regenerate_Images_Request.task (cyclomatic 17) wp-content/plugins/woocommerce/includes/class-wc-regenerate-images-request.php:92— WC_Regenerate_Images_Request.task has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_REST_Taxes_V1_Controller.create_or_update_tax (cyclomatic 17) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:348— WC_REST_Taxes_V1_Controller.create_or_update_tax has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_REST_Products_V2_Controller.delete_item (cyclomatic 17) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1699— WC_REST_Products_V2_Controller.delete_item has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
wc-update-functions.wc_update_240_shipping_methods (cyclomatic 17) wp-content/plugins/woocommerce/includes/wc-update-functions.php:770— wc-update-functions.wc_update_240_shipping_methods has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Controller.consolidate_customer_id_filters (cyclomatic 17) wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Controller.php:120— Controller.consolidate_customer_id_filters has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DataStore.update (cyclomatic 17) wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/DataStore.php:529— DataStore.update has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TimeInterval.get_timeframe_dates (cyclomatic 17) wp-content/plugins/woocommerce/src/Admin/API/Reports/TimeInterval.php:644— TimeInterval.get_timeframe_dates has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
PageController.get_current_screen_id (cyclomatic 17) wp-content/plugins/woocommerce/src/Admin/PageController.php:261— PageController.get_current_screen_id has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GraphQLControllerBase.process_request (cyclomatic 17) wp-content/plugins/woocommerce/src/Api/Infrastructure/GraphQLControllerBase.php:378— GraphQLControllerBase.process_request has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ReserveStock.reserve_stock_for_order (cyclomatic 17) wp-content/plugins/woocommerce/src/Checkout/Helpers/ReserveStock.php:73— ReserveStock.reserve_stock_for_order has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Request.authorize_or_capture_payment (cyclomatic 17) wp-content/plugins/woocommerce/src/Gateways/PayPal/Request.php:222— Request.authorize_or_capture_payment has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
RestAbilityFactory.sanitize_args_to_schema (cyclomatic 17) wp-content/plugins/woocommerce/src/Internal/Abilities/REST/RestAbilityFactory.php:215— RestAbilityFactory.sanitize_args_to_schema has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PageController.is_order_screen (cyclomatic 17) wp-content/plugins/woocommerce/src/Internal/Admin/Orders/PageController.php:510— PageController.is_order_screen has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Reviews.get_bulk_action_notice_messages (cyclomatic 17) wp-content/plugins/woocommerce/src/Internal/Admin/ProductReviews/Reviews.php:421— Reviews.get_bulk_action_notice_messages has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WooPaymentsService.sanitize_onboarding_step_error (cyclomatic 17) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:734— WooPaymentsService.sanitize_onboarding_step_error has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WooPaymentsService.disable_test_account (cyclomatic 17) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:1491— WooPaymentsService.disable_test_account has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WcPayWelcomePage.get_active_payments_task_slug (cyclomatic 17) wp-content/plugins/woocommerce/src/Internal/Admin/WcPayWelcomePage.php:162— WcPayWelcomePage.get_active_payments_task_slug has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WooCommerceProductImporter.set_product_taxonomies (cyclomatic 17) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/WooCommerceProductImporter.php:904— WooCommerceProductImporter.set_product_taxonomies has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WooCommerceProductImporter.handle_product_images (cyclomatic 17) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/WooCommerceProductImporter.php:990— WooCommerceProductImporter.handle_product_images has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OrdersTableDataStore.update (cyclomatic 17) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:2899— OrdersTableDataStore.update has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WCEmailTemplateChangeSummary.summarize (cyclomatic 17) wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:136— WCEmailTemplateChangeSummary.summarize has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ReceiptRenderingEngine.get_order_data (cyclomatic 17) wp-content/plugins/woocommerce/src/Internal/ReceiptRendering/ReceiptRenderingEngine.php:279— ReceiptRenderingEngine.get_order_data has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Controller.check_permission_for_fulfillments (cyclomatic 17) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Fulfillments/Controller.php:308— Controller.check_permission_for_fulfillments has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Controller.get_product_data (cyclomatic 17) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:2453— Controller.get_product_data has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EmailSettingsSchema.get_item_response (cyclomatic 17) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Schema/EmailSettingsSchema.php:148— EmailSettingsSchema.get_item_response has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Controller.validate_setting_value (cyclomatic 17) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:258— Controller.validate_setting_value has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
NotificationCreatePage.process_create_form (cyclomatic 17) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Admin/NotificationCreatePage.php:27— NotificationCreatePage.process_create_form has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
OrderAttributionMeta.get_origin_label (cyclomatic 17) wp-content/plugins/woocommerce/src/Internal/Traits/OrderAttributionMeta.php:276— OrderAttributionMeta.get_origin_label has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PHPMailer.encodeHeader (cyclomatic 17) wp-includes/PHPMailer/PHPMailer.php:3706— PHPMailer.encodeHeader has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SMTP.get_lines (cyclomatic 17) wp-includes/PHPMailer/SMTP.php:1340— SMTP.get_lines has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
jquery.flexslider.$.fn.flexslider (cyclomatic 17) wp-content/plugins/woocommerce/assets/js/flexslider/jquery.flexslider.js:1114— jquery.flexslider.$.fn.flexslider has cyclomatic complexity 17 (threshold 15). Of this number, 10 points are the body's own statements and 7 belong to one function literal inside it that branches. This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
jquery.flot.pie.init::combine (cyclomatic 17) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.pie.js:162— jquery.flot.pie.init::combine has cyclomatic complexity 17 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
free.icon (cyclomatic 17) wp-content/themes/monoka/assets/font-awesome/js/free.js:4267— free.icon has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: free.observe (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
pro.icon (cyclomatic 17) wp-content/themes/monoka/assets/font-awesome/js/pro.js:2529— pro.icon has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: pro.observe (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
Lazy (cyclomatic 17) REDACTED:1883— Lazy has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 1905, 1920). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
WC_Shipping_Method.add_rate (cyclomatic 16) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-shipping-method.php:291— WC_Shipping_Method.add_rate has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Widget.get_current_page_url (cyclomatic 16) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-widget.php:324— WC_Widget.get_current_page_url has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Admin_Meta_Boxes.save_meta_boxes (cyclomatic 16) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-meta-boxes.php:214— WC_Admin_Meta_Boxes.save_meta_boxes has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Meta_Box_Coupon_Data.output (cyclomatic 16) wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-coupon-data.php:27— WC_Meta_Box_Coupon_Data.output has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Report_Downloads.column_default (cyclomatic 16) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-downloads.php:138— WC_Report_Downloads.column_default has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
wc-meta-box-functions.woocommerce_wp_textarea_input (cyclomatic 16) wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php:120— wc-meta-box-functions.woocommerce_wp_textarea_input has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Checkout.process_checkout (cyclomatic 16) wp-content/plugins/woocommerce/includes/class-wc-checkout.php:1284— WC_Checkout.process_checkout has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Coupon.is_valid_for_product (cyclomatic 16) REDACTED:1007— WC_Coupon.is_valid_for_product has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Form_Handler.process_login (cyclomatic 16) wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:1035— WC_Form_Handler.process_login has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Geo_IP._common_get_record (cyclomatic 16) wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1378— WC_Geo_IP._common_get_record has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Order_Factory.get_order_item (cyclomatic 16) wp-content/plugins/woocommerce/includes/class-wc-order-factory.php:172— WC_Order_Factory.get_order_item has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
WC_Product_Data_Store_CPT.find_matching_product_variation (cyclomatic 16) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:1459— WC_Product_Data_Store_CPT.find_matching_product_variation has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Product_Variable_Data_Store_CPT.read_variation_attributes (cyclomatic 16) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variable-data-store-cpt.php:234— WC_Product_Variable_Data_Store_CPT.read_variation_attributes has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Product_Importer.process_item (cyclomatic 16) wp-content/plugins/woocommerce/includes/import/abstract-wc-product-importer.php:227— WC_Product_Importer.process_item has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
wc-admin-update-functions.wc_admin_update_270_delete_report_downloads (cyclomatic 16) wp-content/plugins/woocommerce/includes/react-admin/wc-admin-update-functions.php:110— wc-admin-update-functions.wc_admin_update_270_delete_report_downloads has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_REST_Controller.get_fields_for_response (cyclomatic 16) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-controller.php:563— WC_REST_Controller.get_fields_for_response has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_REST_Product_Reviews_Controller.prepare_item_for_response (cyclomatic 16) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:691— WC_REST_Product_Reviews_Controller.prepare_item_for_response has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_REST_Terms_Controller.get_items (cyclomatic 16) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php:278— WC_REST_Terms_Controller.get_items has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WC_Shipping_Free_Shipping.is_available (cyclomatic 16) wp-content/plugins/woocommerce/includes/shipping/free-shipping/class-wc-shipping-free-shipping.php:160— WC_Shipping_Free_Shipping.is_available has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
wc-product-functions.wc_get_price_including_tax (cyclomatic 16) wp-content/plugins/woocommerce/includes/wc-product-functions.php:1501— wc-product-functions.wc_get_price_including_tax has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: wc-product-functions.wc_update_product_lookup_tables_column (cyclomatic 17) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
wc-template-functions.wc_product_post_class (cyclomatic 16) REDACTED:555— wc-template-functions.wc_product_post_class has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
wc-update-functions.wc_update_200_taxrates (cyclomatic 16) wp-content/plugins/woocommerce/includes/wc-update-functions.php:147— wc-update-functions.wc_update_200_taxrates has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
UPSShippingProvider.try_parse_tracking_number (cyclomatic 16) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/UPSShippingProvider.php:114— UPSShippingProvider.try_parse_tracking_number has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RemoteInboxNotificationsDataSourcePoller.validate_spec (cyclomatic 16) wp-content/plugins/woocommerce/src/Admin/RemoteInboxNotifications/RemoteInboxNotificationsDataSourcePoller.php:61— RemoteInboxNotificationsDataSourcePoller.validate_spec has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ResolverHelpers.authorize_method_shape_is_valid (cyclomatic 16) wp-content/plugins/woocommerce/src/Api/Infrastructure/ResolverHelpers.php:379— ResolverHelpers.authorize_method_shape_is_valid has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Controller.disable_enhanced_pagination (cyclomatic 16) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/Controller.php:144— Controller.disable_enhanced_pagination has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProductFilterAttribute.get_default_product_attribute (cyclomatic 16) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:328— ProductFilterAttribute.get_default_product_attribute has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ProductImage.render_image (cyclomatic 16) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductImage.php:135— ProductImage.render_image has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AbstractAutomatticAddressProvider.load_jwt (cyclomatic 16) wp-content/plugins/woocommerce/src/Internal/AddressProvider/AbstractAutomatticAddressProvider.php:61— AbstractAutomatticAddressProvider.load_jwt has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
AddressProviderController.get_registered_providers (cyclomatic 16) wp-content/plugins/woocommerce/src/Internal/AddressProvider/AddressProviderController.php:58— AddressProviderController.get_registered_providers has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Homescreen.maybe_set_default_shipping_options_on_home (cyclomatic 16) wp-content/plugins/woocommerce/src/Internal/Admin/Homescreen.php:77— Homescreen.maybe_set_default_shipping_options_on_home has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Payments.get_payment_providers (cyclomatic 16) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Payments.php:78— Payments.get_payment_providers has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WooPayments.get_onboarding_url (cyclomatic 16) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:418— WooPayments.get_onboarding_url has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SettingsUISchema.transform_legacy_field (cyclomatic 16) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/SettingsUISchema.php:147— SettingsUISchema.transform_legacy_field has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WooCommerceProductImporter.set_basic_product_properties (cyclomatic 16) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/WooCommerceProductImporter.php:460— WooCommerceProductImporter.set_basic_product_properties has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ComingSoonRequestHandler.experimental_filter_theme_json_theme (cyclomatic 16) wp-content/plugins/woocommerce/src/Internal/ComingSoon/ComingSoonRequestHandler.php:192— ComingSoonRequestHandler.experimental_filter_theme_json_theme has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WCEmailTemplateAutoApplier.apply_to_post (cyclomatic 16) wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateAutoApplier.php:93— WCEmailTemplateAutoApplier.apply_to_post has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Controller.create_item (cyclomatic 16) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/Controller.php:283— Controller.create_item has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DataUtils.validate_line_items (cyclomatic 16) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/DataUtils.php:171— DataUtils.validate_line_items has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EmailsSettingsSchema.get_field_default_value (cyclomatic 16) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Emails/Schema/EmailsSettingsSchema.php:321— EmailsSettingsSchema.get_field_default_value has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EmailsSettingsSchema.sanitize_field_value (cyclomatic 16) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Emails/Schema/EmailsSettingsSchema.php:526— EmailsSettingsSchema.sanitize_field_value has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
URL.get_parent_url (cyclomatic 16) wp-content/plugins/woocommerce/src/Internal/Utilities/URL.php:254— URL.get_parent_url has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
OrderController.get_failed_order_stock_error (cyclomatic 16) wp-content/plugins/woocommerce/src/StoreApi/Utilities/OrderController.php:712— OrderController.get_failed_order_stock_error has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ArrayUtil.deep_compute_or_compare_array_diff (cyclomatic 16) wp-content/plugins/woocommerce/src/Utilities/ArrayUtil.php:248— ArrayUtil.deep_compute_or_compare_array_diff has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PHPMailer.smtpSend (cyclomatic 16) wp-includes/PHPMailer/PHPMailer.php:2227— PHPMailer.smtpSend has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PHPMailer.setLanguage (cyclomatic 16) wp-includes/PHPMailer/PHPMailer.php:2490— PHPMailer.setLanguage has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ErrorMessageExtractor.extractFromResponseData (cyclomatic 16) wp-includes/php-ai-client/src/Providers/Http/Util/ErrorMessageExtractor.php:30— ErrorMessageExtractor.extractFromResponseData has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ModelRequirements.fromPromptData (cyclomatic 16) wp-includes/php-ai-client/src/Providers/Models/DTO/ModelRequirements.php:133— ModelRequirements.fromPromptData has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AbstractOpenAiCompatibleTextGenerationModel.prepareGenerateTextParams (cyclomatic 16) wp-includes/php-ai-client/src/Providers/OpenAiCompatibleImplementation/AbstractOpenAiCompatibleTextGenerationModel.php:92— AbstractOpenAiCompatibleTextGenerationModel.prepareGenerateTextParams has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ProviderRegistry.createDefaultProviderRequestAuthentication (cyclomatic 16) wp-includes/php-ai-client/src/Providers/ProviderRegistry.php:418— ProviderRegistry.createDefaultProviderRequestAuthentication has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
free.makeInlineSvgAbstract (cyclomatic 16) wp-content/themes/monoka/assets/font-awesome/js/free.js:2918— free.makeInlineSvgAbstract has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: free.observe (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
pro.makeInlineSvgAbstract (cyclomatic 16) wp-content/themes/monoka/assets/font-awesome/js/pro.js:975— pro.makeInlineSvgAbstract has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: pro.observe (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
findIcon (cyclomatic 16) wp-content/themes/monoka/assets/font-awesome/js/pro.js:2022— findIcon has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 2023, 2050). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
HackComment wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-customizer.php:402— // hack customizer function to remove bug caused by WYSIWYG field using aunique ID — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
WC_REST_Products_Controller.prepare_object_for_database (cognitive 197) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:732— WC_REST_Products_Controller.prepare_object_for_database has cognitive complexity 197 (threshold 15). Drivers by points: if/else 80 (140 pts), ternaries 10 (36 pts), boolean chains 11, loops 4 (10 pts) (nesting depth added 92). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Controller.prepare_object_for_database (cognitive 197) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1002— Controller.prepare_object_for_database has cognitive complexity 197 (threshold 15). Drivers by points: if/else 80 (140 pts), ternaries 10 (36 pts), boolean chains 11, loops 4 (10 pts) (nesting depth added 92). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous) (cognitive 180) wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:3— (anonymous) has cognitive complexity 180 (threshold 15). Drivers by points: if/else 105 (139 pts), boolean chains 21, ternaries 11 (20 pts) (nesting depth added 43). Most of this is not in the body itself: 2 of the 180 points are its own statements and the rest belongs to 126 function items inside it that branch (a function literal at line 1451, a function literal at line 1403, change_country, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_REST_Products_V2_Controller.prepare_object_for_database (cognitive 169) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1070— WC_REST_Products_V2_Controller.prepare_object_for_database has cognitive complexity 169 (threshold 15). Drivers by points: if/else 66 (112 pts), ternaries 11 (38 pts), boolean chains 11, loops 3 (8 pts) (nesting depth added 78). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_injectTimePicker (cognitive 147) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:373— _injectTimePicker has cognitive complexity 147 (threshold 15). Drivers by points: ternaries 21 (65 pts), if/else 24 (58 pts), loops 4 (14 pts), boolean chains 10 (nesting depth added 88). Of this number, 105 points are the body's own statements and 42 belong to 6 function literals inside it that branch. This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
WC_REST_Products_V1_Controller.set_product_meta (cognitive 141) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1089— WC_REST_Products_V1_Controller.set_product_meta has cognitive complexity 141 (threshold 15). Drivers by points: if/else 51 (94 pts), ternaries 7 (29 pts), boolean chains 10, loops 3 (8 pts) (nesting depth added 70). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_Structured_Data.generate_product_data (cognitive 138) wp-content/plugins/woocommerce/includes/class-wc-structured-data.php:192— WC_Structured_Data.generate_product_data has cognitive complexity 138 (threshold 15). Drivers by points: if/else 38 (94 pts), ternaries 7 (24 pts), loops 3 (11 pts), boolean chains 9 (nesting depth added 81). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_Meta_Box_Order_Data.output (cognitive 128) wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:192— WC_Meta_Box_Order_Data.output has cognitive complexity 128 (threshold 15). Drivers by points: if/else 50 (98 pts), boolean chains 11, loops 6 (10 pts), match/switch 2 (5 pts), ternaries 3 (4 pts) (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Admin_Report.get_order_report_data (cognitive 126) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-admin-report.php:95— WC_Admin_Report.get_order_report_data has cognitive complexity 126 (threshold 15). Drivers by points: if/else 43 (90 pts), ternaries 7 (18 pts), loops 5 (8 pts), boolean chains 6, match/switch 2 (4 pts) (nesting depth added 63). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
(anonymous) (cognitive 126) wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product.js:2— (anonymous) has cognitive complexity 126 (threshold 15). Drivers by points: if/else 77 (88 pts), boolean chains 20, ternaries 12 (16 pts), error handling 1, match/switch 1 (nesting depth added 15). Most of this is not in the body itself: 6 of the 126 points are its own statements and the rest belongs to 91 function items inside it that branch (a function literal at line 965, show_and_hide_controls, a function literal at line 1329, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
_limitMinMaxDateTime (cognitive 120) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:586— _limitMinMaxDateTime has cognitive complexity 120 (threshold 15). Drivers by points: if/else 47 (102 pts), boolean chains 18 (nesting depth added 55). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
WC_Product_Variable_Data_Store_CPT.read_price_data (cognitive 119) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variable-data-store-cpt.php:318— WC_Product_Variable_Data_Store_CPT.read_price_data has cognitive complexity 119 (threshold 15). Drivers by points: if/else 16 (61 pts), ternaries 8 (46 pts), boolean chains 6, loops 2 (6 pts) (nesting depth added 87). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
(anonymous) (cognitive 118) wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js:164— (anonymous) has cognitive complexity 118 (threshold 15). Drivers by points: if/else 53 (80 pts), boolean chains 19, ternaries 9 (16 pts), error handling 2 (3 pts) (nesting depth added 35). None of this is in the body itself: all 118 points belong to 60 function items inside it that branch (onSaveResponse, a function literal at line 767, a function literal at line 560, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_Meta_Box_Product_Data.save_variations (cognitive 117) REDACTED:462— WC_Meta_Box_Product_Data.save_variations has cognitive complexity 117 (threshold 15). Drivers by points: ternaries 25 (74 pts), if/else 13 (38 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 75). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Geo_IP._setup_segments (cognitive 104) wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1211— WC_Geo_IP._setup_segments has cognitive complexity 104 (threshold 15). Drivers by points: boolean chains 50, if/else 14 (40 pts), loops 4 (14 pts) (nesting depth added 36). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WC_Shortcode_Checkout.order_pay (cognitive 101) wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-checkout.php:81— WC_Shortcode_Checkout.order_pay has cognitive complexity 101 (threshold 15). Drivers by points: if/else 22 (67 pts), ternaries 6 (15 pts), boolean chains 10, loops 2 (7 pts), error handling 1 (2 pts) (nesting depth added 60). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_REST_Products_V1_Controller.save_variations_data (cognitive 99) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1377— WC_REST_Products_V1_Controller.save_variations_data has cognitive complexity 99 (threshold 15). Drivers by points: if/else 30 (74 pts), ternaries 5 (15 pts), boolean chains 6, loops 2 (4 pts) (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-admin-functions.wc_save_order_items (cognitive 96) wp-content/plugins/woocommerce/includes/admin/wc-admin-functions.php:304— wc-admin-functions.wc_save_order_items has cognitive complexity 96 (threshold 15). Drivers by points: if/else 18 (56 pts), loops 6 (18 pts), ternaries 4 (18 pts), boolean chains 4 (nesting depth added 64). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ShopifyMapper.map_variable_product_data (cognitive 95) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Platforms/Shopify/ShopifyMapper.php:481— ShopifyMapper.map_variable_product_data has cognitive complexity 95 (threshold 15). Drivers by points: if/else 16 (48 pts), boolean chains 19, ternaries 5 (19 pts), loops 3 (9 pts) (nesting depth added 52). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ProductQuery.prepare_objects_query (cognitive 95) wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQuery.php:26— ProductQuery.prepare_objects_query has cognitive complexity 95 (threshold 15). Drivers by points: if/else 31 (43 pts), ternaries 15 (39 pts), boolean chains 7, loops 4 (6 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_AJAX.shipping_providers_save_changes (cognitive 91) REDACTED:3889— WC_AJAX.shipping_providers_save_changes has cognitive complexity 91 (threshold 15). Drivers by points: if/else 34 (72 pts), boolean chains 11, loops 3 (4 pts), ternaries 1 (4 pts) (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
jquery.prettyPhoto.$.fn.prettyPhoto (cognitive 91) REDACTED:10— jquery.prettyPhoto.$.fn.prettyPhoto has cognitive complexity 91 (threshold 15). Drivers by points: if/else 46 (63 pts), boolean chains 18, loops 2 (4 pts), match/switch 1 (4 pts), ternaries 2 (nesting depth added 22). Most of this is not in the body itself: 9 of the 91 points are its own statements and the rest belongs to 25 function items inside it that branch (_fitToViewport, _build_overlay, a function literal at line 114, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_Checkout.validate_posted_data (cognitive 90) wp-content/plugins/woocommerce/includes/class-wc-checkout.php:839— WC_Checkout.validate_posted_data has cognitive complexity 90 (threshold 15). Drivers by points: if/else 14 (49 pts), boolean chains 16, ternaries 4 (14 pts), match/switch 2 (8 pts), loops 2 (3 pts) (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
jquery.flexslider.$.flexslider (cognitive 86) wp-content/plugins/woocommerce/assets/js/flexslider/jquery.flexslider.js:55— jquery.flexslider.$.flexslider has cognitive complexity 86 (threshold 15). Drivers by points: boolean chains 85, if/else 1. This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
WC_Cart.add_to_cart (cognitive 83) wp-content/plugins/woocommerce/includes/class-wc-cart.php:1137— WC_Cart.add_to_cart has cognitive complexity 83 (threshold 15). Drivers by points: if/else 30 (56 pts), ternaries 5 (13 pts), boolean chains 9, loops 2 (4 pts), error handling 1 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous) (cognitive 83) REDACTED:3— (anonymous) has cognitive complexity 83 (threshold 15). Drivers by points: if/else 55 (69 pts), boolean chains 13, ternaries 1 (nesting depth added 14). Most of this is not in the body itself: 13 of the 83 points are its own statements and the rest belongs to 38 function items inside it that branch (a function literal at line 429, a function literal at line 148, a function literal at line 111, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_REST_Product_Variations_Controller.prepare_object_for_database (cognitive 82) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:200— WC_REST_Product_Variations_Controller.prepare_object_for_database has cognitive complexity 82 (threshold 15). Drivers by points: if/else 42 (62 pts), ternaries 5 (11 pts), boolean chains 5, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AddToCartWithOptions.render (cognitive 80) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/AddToCartWithOptions.php:191— AddToCartWithOptions.render has cognitive complexity 80 (threshold 15). Drivers by points: if/else 23 (48 pts), ternaries 6 (14 pts), boolean chains 12, loops 2 (6 pts) (nesting depth added 37). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_REST_Product_Variations_V2_Controller.prepare_object_for_database (cognitive 76) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:378— WC_REST_Product_Variations_V2_Controller.prepare_object_for_database has cognitive complexity 76 (threshold 15). Drivers by points: if/else 39 (58 pts), ternaries 5 (11 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
jquery.tipTip.$.fn.tipTip (cognitive 74) wp-content/plugins/woocommerce/assets/js/jquery-tiptip/jquery.tipTip.js:26— jquery.tipTip.$.fn.tipTip has cognitive complexity 74 (threshold 15). Drivers by points: if/else 31 (53 pts), boolean chains 19, ternaries 1 (2 pts) (nesting depth added 23). Most of this is not in the body itself: 2 of the 74 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 106, 55, 74, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
WC_Form_Handler.save_address (cognitive 71) wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:83— WC_Form_Handler.save_address has cognitive complexity 71 (threshold 15). Drivers by points: if/else 19 (43 pts), match/switch 2 (12 pts), boolean chains 5, loops 2 (5 pts), ternaries 2 (4 pts), error handling 1 (2 pts) (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
jquery.flot.stack.init::stackData (cognitive 71) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.stack.js:57— jquery.flot.stack.init::stackData has cognitive complexity 71 (threshold 15). Drivers by points: if/else 16 (34 pts), loops 8 (27 pts), boolean chains 8, ternaries 2 (nesting depth added 37). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
wc-order-functions.wc_create_refund (cognitive 70) wp-content/plugins/woocommerce/includes/wc-order-functions.php:559— wc-order-functions.wc_create_refund has cognitive complexity 70 (threshold 15). Drivers by points: if/else 21 (43 pts), loops 3 (10 pts), boolean chains 9, ternaries 3 (7 pts), error handling 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
add-to-cart-variation.VariationForm.onUpdateAttributes (cognitive 69) wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart-variation.js:495— add-to-cart-variation.VariationForm.onUpdateAttributes has cognitive complexity 69 (threshold 15). Drivers by points: if/else 18 (54 pts), loops 3 (12 pts), boolean chains 3 (nesting depth added 45). Most of this is not in the body itself: 1 of the 69 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 505, 622). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
(anonymous) (cognitive 69) wp-content/plugins/woocommerce/assets/js/admin/reports.js:1— (anonymous) has cognitive complexity 69 (threshold 15). Drivers by points: if/else 20 (43 pts), loops 8 (21 pts), boolean chains 4, ternaries 1 (nesting depth added 36). Most of this is not in the body itself: 1 of the 69 points is its own statement and the rest belongs to 10 function items inside it that branch (a function literal at line 13, a function literal at line 79, a function literal at line 164, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_Form_Handler.update_cart_action (cognitive 67) wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:635— WC_Form_Handler.update_cart_action has cognitive complexity 67 (threshold 15). Drivers by points: if/else 17 (41 pts), boolean chains 18, ternaries 2 (5 pts), loops 1 (3 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_CSV_Importer.expand_data (cognitive 66) wp-content/plugins/woocommerce/includes/import/class-wc-product-csv-importer.php:877— WC_Product_CSV_Importer.expand_data has cognitive complexity 66 (threshold 15). Drivers by points: if/else 27 (48 pts), ternaries 4 (12 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-update-functions.wc_update_200_line_items (cognitive 65) wp-content/plugins/woocommerce/includes/wc-update-functions.php:246— wc-update-functions.wc_update_200_line_items has cognitive complexity 65 (threshold 15). Drivers by points: if/else 9 (31 pts), ternaries 5 (17 pts), loops 5 (12 pts), boolean chains 5 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Controller.prepare_objects_query (cognitive 64) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:337— Controller.prepare_objects_query has cognitive complexity 64 (threshold 15). Drivers by points: if/else 36 (46 pts), boolean chains 9, ternaries 4 (8 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous) (cognitive 64) wp-content/plugins/woocommerce/assets/js/admin/variation-gallery.js:9— (anonymous) has cognitive complexity 64 (threshold 15). Drivers by points: if/else 32, boolean chains 30, ternaries 2. Most of this is not in the body itself: 3 of the 64 points are its own statements and the rest belongs to 51 function items inside it that branch (updateLegacyPreview, pickAttachmentDisplayUrl, getCachedAttachmentUrl, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
jquery.flot.Canvas.render (cognitive 62) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:167— jquery.flot.Canvas.render has cognitive complexity 62 (threshold 15). Drivers by points: if/else 8 (46 pts), loops 4 (16 pts) (nesting depth added 50). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
WC_Order_Data_Store_CPT.update_post_meta (cognitive 61) wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php:253— WC_Order_Data_Store_CPT.update_post_meta has cognitive complexity 61 (threshold 15). Drivers by points: if/else 15 (28 pts), ternaries 8 (21 pts), boolean chains 6, loops 3 (4 pts), match/switch 1 (2 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
jquery-ui-timepicker-addon.$.datepicker._optionDatepicker (cognitive 61) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:1822— jquery-ui-timepicker-addon.$.datepicker._optionDatepicker has cognitive complexity 61 (threshold 15). Drivers by points: if/else 26 (49 pts), boolean chains 7, loops 2 (5 pts) (nesting depth added 26). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
WCEmailTemplateSelectiveApplier.merge (cognitive 59) wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateSelectiveApplier.php:478— WCEmailTemplateSelectiveApplier.merge has cognitive complexity 59 (threshold 15). Drivers by points: if/else 19 (38 pts), loops 8 (11 pts), boolean chains 10 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SMTP.authenticate (cognitive 59) wp-includes/PHPMailer/SMTP.php:531— SMTP.authenticate has cognitive complexity 59 (threshold 15). Drivers by points: if/else 22 (49 pts), loops 1 (3 pts), boolean chains 2, error handling 1 (2 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Admin_Post_Types.quick_edit_save (cognitive 58) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-post-types.php:395— WC_Admin_Post_Types.quick_edit_save has cognitive complexity 58 (threshold 15). Drivers by points: if/else 23 (36 pts), ternaries 7 (14 pts), boolean chains 7, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_newInst (cognitive 58) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:169— _newInst has cognitive complexity 58 (threshold 15). Drivers by points: if/else 20 (26 pts), ternaries 13, boolean chains 11, error handling 1 (4 pts), loops 3 (4 pts) (nesting depth added 10). Of this number, 53 points are the body's own statements and 5 belong to 7 function items inside it that branch. This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
(anonymous) (cognitive 58) wp-content/plugins/woocommerce/assets/js/admin/marketplace-suggestions.js:3— (anonymous) has cognitive complexity 58 (threshold 15). Drivers by points: if/else 29 (34 pts), boolean chains 20, loops 2, ternaries 2 (nesting depth added 5). Most of this is not in the body itself: 4 of the 58 points are its own statements and the rest belongs to 29 function items inside it that branch (a function literal at line 392, renderLinkout, a function literal at line 449, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_Form_Handler.pay_action (cognitive 57) wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:417— WC_Form_Handler.pay_action has cognitive complexity 57 (threshold 15). Drivers by points: if/else 10 (29 pts), ternaries 6 (20 pts), boolean chains 4, error handling 1 (4 pts) (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_Product_Importer.set_product_data (cognitive 56) wp-content/plugins/woocommerce/includes/import/abstract-wc-product-importer.php:351— WC_Product_Importer.set_product_data has cognitive complexity 56 (threshold 15). Drivers by points: if/else 15 (44 pts), loops 2 (6 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PHPMailer.wrapText (cognitive 56) wp-includes/PHPMailer/PHPMailer.php:2678— PHPMailer.wrapText has cognitive complexity 56 (threshold 15). Drivers by points: if/else 15 (47 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_Meta_Box_Order_Data.save (cognitive 55) wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-data.php:686— WC_Meta_Box_Order_Data.save has cognitive complexity 55 (threshold 15). Drivers by points: if/else 23 (38 pts), boolean chains 9, loops 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HandlerRegistry.register_core_collections (cognitive 55) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/HandlerRegistry.php:51— HandlerRegistry.register_core_collections has cognitive complexity 55 (threshold 15). Drivers by points: if/else 27 (37 pts), boolean chains 12, ternaries 6 (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
jquery.nivo.slider.NivoSlider::nivoRun (cognitive 55) wp-content/themes/monoka/assets/js/custom-slider/jquery.nivo.slider.js:289— jquery.nivo.slider.NivoSlider::nivoRun has cognitive complexity 55 (threshold 15). Drivers by points: if/else 30 (41 pts), boolean chains 9, loops 2 (5 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (jquery.nivo.slider.NivoSlider) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
(anonymous) (cognitive 55) wp-content/plugins/woocommerce/assets/js/admin/settings.js:3— (anonymous) has cognitive complexity 55 (threshold 15). Drivers by points: if/else 34 (41 pts), boolean chains 12, loops 1, ternaries 1 (nesting depth added 7). None of this is in the body itself: all 55 points belong to 34 function items inside it that branch (a function literal at line 219, settings_scroll_to_active_tab, a function literal at line 159, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_Meta_Box_Product_Data.save (cognitive 54) REDACTED:333— WC_Meta_Box_Product_Data.save has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 31 (34 pts), if/else 11 (14 pts), boolean chains 6 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
WC_Product_CSV_Exporter.prepare_attributes_for_export (cognitive 54) wp-content/plugins/woocommerce/includes/export/class-wc-product-csv-exporter.php:693— WC_Product_CSV_Exporter.prepare_attributes_for_export has cognitive complexity 54 (threshold 15). Drivers by points: if/else 11 (30 pts), ternaries 2 (12 pts), loops 2 (9 pts), boolean chains 3 (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DataStore.update_intervals_sql_params (cognitive 54) wp-content/plugins/woocommerce/src/Admin/API/Reports/DataStore.php:653— DataStore.update_intervals_sql_params has cognitive complexity 54 (threshold 15). Drivers by points: if/else 15 (39 pts), loops 4 (12 pts), ternaries 1 (3 pts) (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WooCommerceProductImporter.sync_variations (cognitive 54) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/WooCommerceProductImporter.php:722— WooCommerceProductImporter.sync_variations has cognitive complexity 54 (threshold 15). Drivers by points: if/else 21 (45 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PHPMailer.smtpConnect (cognitive 54) wp-includes/PHPMailer/PHPMailer.php:2320— PHPMailer.smtpConnect has cognitive complexity 54 (threshold 15). Drivers by points: if/else 19 (38 pts), boolean chains 12, error handling 1 (3 pts), loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Products_Controller.prepare_objects_query (cognitive 53) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:222— WC_REST_Products_Controller.prepare_objects_query has cognitive complexity 53 (threshold 15). Drivers by points: if/else 31 (38 pts), ternaries 4 (8 pts), boolean chains 6, loops 1 (nesting depth added 11). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
wc-update-functions.wc_update_240_shipping_methods (cognitive 53) wp-content/plugins/woocommerce/includes/wc-update-functions.php:770— wc-update-functions.wc_update_240_shipping_methods has cognitive complexity 53 (threshold 15). Drivers by points: if/else 6 (21 pts), ternaries 4 (16 pts), loops 5 (15 pts), boolean chains 1 (nesting depth added 37). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PaymentsExtensionSuggestions.with_country_details (cognitive 53) wp-content/plugins/woocommerce/src/Internal/Admin/Suggestions/PaymentsExtensionSuggestions.php:3153— PaymentsExtensionSuggestions.with_country_details has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (36 pts), boolean chains 11, loops 3 (6 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SubmissionHandler.process_rows (cognitive 53) wp-content/plugins/woocommerce/src/Internal/OrderReviews/SubmissionHandler.php:123— SubmissionHandler.process_rows has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 12 (26 pts), if/else 9 (19 pts), boolean chains 7, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Data_Store_WP.parse_date_for_wp_query (cognitive 52) wp-content/plugins/woocommerce/includes/data-stores/class-wc-data-store-wp.php:342— WC_Data_Store_WP.parse_date_for_wp_query has cognitive complexity 52 (threshold 15). Drivers by points: if/else 16 (26 pts), ternaries 5 (11 pts), boolean chains 10, loops 1 (2 pts), match/switch 1 (2 pts), error handling 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ShopifyMapper.map_simple_product_data (cognitive 52) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Platforms/Shopify/ShopifyMapper.php:401— ShopifyMapper.map_simple_product_data has cognitive complexity 52 (threshold 15). Drivers by points: if/else 12 (23 pts), ternaries 6 (17 pts), boolean chains 12 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Order_Data_Store_CPT.get_wp_query_args (cognitive 51) wp-content/plugins/woocommerce/includes/data-stores/class-wc-order-data-store-cpt.php:920— WC_Order_Data_Store_CPT.get_wp_query_args has cognitive complexity 51 (threshold 15). Drivers by points: if/else 23 (33 pts), ternaries 3 (9 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Orders_V2_Controller.prepare_object_for_database (cognitive 51) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:725— WC_REST_Orders_V2_Controller.prepare_object_for_database has cognitive complexity 51 (threshold 15). Drivers by points: if/else 7 (28 pts), loops 3 (11 pts), ternaries 2 (7 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WooPaymentsService.get_onboarding_step_status (cognitive 51) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:219— WooPaymentsService.get_onboarding_step_status has cognitive complexity 51 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 14, match/switch 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_onTimeChange (cognitive 51) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:779— _onTimeChange has cognitive complexity 51 (threshold 15). Drivers by points: if/else 26 (34 pts), boolean chains 10, ternaries 7 (nesting depth added 8). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
WC_Admin_Post_Types.bulk_edit_save (cognitive 50) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-post-types.php:528— WC_Admin_Post_Types.bulk_edit_save has cognitive complexity 50 (threshold 15). Drivers by points: if/else 26 (36 pts), ternaries 5 (6 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_AJAX.update_order_review (cognitive 50) REDACTED:396— WC_AJAX.update_order_review has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 22 (34 pts), if/else 9 (11 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Frontend_Scripts.load_scripts (cognitive 50) wp-content/plugins/woocommerce/includes/class-wc-frontend-scripts.php:475— WC_Frontend_Scripts.load_scripts has cognitive complexity 50 (threshold 15). Drivers by points: if/else 22 (32 pts), boolean chains 16, loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-core-functions._wc_delete_transients (cognitive 49) wp-content/plugins/woocommerce/includes/wc-core-functions.php:2579— wc-core-functions._wc_delete_transients has cognitive complexity 49 (threshold 15). Drivers by points: if/else 13 (31 pts), loops 5 (15 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MiniCart.render_experimental_iapi_mini_cart (cognitive 49) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/MiniCart.php:503— MiniCart.render_experimental_iapi_mini_cart has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 11 (22 pts), if/else 8 (18 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SettingsUISchema.from_legacy_settings (cognitive 49) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/SettingsUISchema.php:38— SettingsUISchema.from_legacy_settings has cognitive complexity 49 (threshold 15). Drivers by points: if/else 11 (23 pts), ternaries 6 (15 pts), boolean chains 9, loops 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Admin_Setup_Wizard.display_service_item (cognitive 48) REDACTED:1656— WC_Admin_Setup_Wizard.display_service_item has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 8 (21 pts), if/else 11 (20 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Controller.batch_items (cognitive 48) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-controller.php:209— WC_REST_Controller.batch_items has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (36 pts), loops 4 (9 pts), ternaries 1 (3 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Product_Variations_Controller.prepare_objects_query (cognitive 48) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:948— WC_REST_Product_Variations_Controller.prepare_objects_query has cognitive complexity 48 (threshold 15). Drivers by points: if/else 23 (32 pts), boolean chains 6, ternaries 3 (6 pts), loops 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Form_Handler.save_account_details (cognitive 47) wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:237— WC_Form_Handler.save_account_details has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 12, ternaries 7, error handling 2 (4 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
WC_Product_Data_Store_CPT.get_wp_query_args (cognitive 47) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:2174— WC_Product_Data_Store_CPT.get_wp_query_args has cognitive complexity 47 (threshold 15). Drivers by points: if/else 22 (28 pts), boolean chains 7, loops 5 (7 pts), ternaries 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_Variable_Data_Store_CPT.read_variation_attributes (cognitive 47) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variable-data-store-cpt.php:234— WC_Product_Variable_Data_Store_CPT.read_variation_attributes has cognitive complexity 47 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 3 (12 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_REST_Orders_V1_Controller.prepare_item_for_response (cognitive 47) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:132— WC_REST_Orders_V1_Controller.prepare_item_for_response has cognitive complexity 47 (threshold 15). Drivers by points: loops 12 (24 pts), ternaries 7 (12 pts), if/else 5 (11 pts) (nesting depth added 23). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
wc-product-functions.wc_product_post_type_link (cognitive 47) wp-content/plugins/woocommerce/includes/wc-product-functions.php:260— wc-product-functions.wc_product_post_type_link has cognitive complexity 47 (threshold 15). Drivers by points: if/else 11 (27 pts), ternaries 3 (10 pts), loops 2 (7 pts), boolean chains 3 (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
wc-update-functions.wc_update_200_taxrates (cognitive 47) wp-content/plugins/woocommerce/includes/wc-update-functions.php:147— wc-update-functions.wc_update_200_taxrates has cognitive complexity 47 (threshold 15). Drivers by points: ternaries 5 (19 pts), loops 5 (15 pts), if/else 5 (13 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PHPMailer.preSend (cognitive 47) wp-includes/PHPMailer/PHPMailer.php:1687— PHPMailer.preSend has cognitive complexity 47 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 19, loops 2, error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Admin_List_Table_Orders.get_order_preview_item_html (cognitive 46) wp-content/plugins/woocommerce/includes/admin/list-tables/class-wc-admin-list-table-orders.php:237— WC_Admin_List_Table_Orders.get_order_preview_item_html has cognitive complexity 46 (threshold 15). Drivers by points: if/else 8 (27 pts), loops 6 (12 pts), ternaries 2 (4 pts), match/switch 1 (3 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Widget_Layered_Nav_Filters.widget (cognitive 46) REDACTED:42— WC_Widget_Layered_Nav_Filters.widget has cognitive complexity 46 (threshold 15). Drivers by points: if/else 8 (20 pts), ternaries 5 (12 pts), loops 3 (10 pts), boolean chains 4 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrderController.get_failed_order_stock_error (cognitive 46) wp-content/plugins/woocommerce/src/StoreApi/Utilities/OrderController.php:712— OrderController.get_failed_order_stock_error has cognitive complexity 46 (threshold 15). Drivers by points: if/else 9 (34 pts), loops 2 (5 pts), ternaries 1 (4 pts), boolean chains 3 (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PHPMailer.msgHTML (cognitive 45) wp-includes/PHPMailer/PHPMailer.php:4660— PHPMailer.msgHTML has cognitive complexity 45 (threshold 15). Drivers by points: if/else 13 (36 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Settings_Emails.email_notification_setting (cognitive 44) wp-content/plugins/woocommerce/includes/admin/settings/class-wc-settings-emails.php:467— WC_Settings_Emails.email_notification_setting has cognitive complexity 44 (threshold 15). Drivers by points: if/else 6 (22 pts), ternaries 3 (14 pts), loops 3 (4 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataStore.add_sql_query_params (cognitive 44) wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/DataStore.php:336— DataStore.add_sql_query_params has cognitive complexity 44 (threshold 15). Drivers by points: if/else 21 (30 pts), ternaries 4 (8 pts), boolean chains 4, loops 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SchemaHandle.get_all_metadata (cognitive 44) wp-content/plugins/woocommerce/src/Api/Utils/SchemaHandle.php:79— SchemaHandle.get_all_metadata has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (27 pts), loops 5 (14 pts), boolean chains 3 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProductButton.render (cognitive 44) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductButton.php:74— ProductButton.render has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 21, boolean chains 12, if/else 10 (11 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PHPMailer.createBody (cognitive 44) wp-includes/PHPMailer/PHPMailer.php:3042— PHPMailer.createBody has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (31 pts), loops 2 (6 pts), boolean chains 4, error handling 1 (2 pts), match/switch 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Cart_Session.populate_cart_from_order (cognitive 43) wp-content/plugins/woocommerce/includes/class-wc-cart-session.php:560— WC_Cart_Session.populate_cart_from_order has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (25 pts), ternaries 3 (8 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_Data_Store_CPT.update_post_meta (cognitive 43) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:705— WC_Product_Data_Store_CPT.update_post_meta has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (24 pts), ternaries 5 (13 pts), loops 3 (4 pts), match/switch 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Orders_V1_Controller.prepare_item_for_database (cognitive 43) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:461— WC_REST_Orders_V1_Controller.prepare_item_for_database has cognitive complexity 43 (threshold 15). Drivers by points: if/else 9 (29 pts), loops 2 (6 pts), boolean chains 4, match/switch 1 (3 pts), ternaries 1 (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
wc-product-functions.wc_get_formatted_variation (cognitive 43) wp-content/plugins/woocommerce/includes/wc-product-functions.php:502— wc-product-functions.wc_get_formatted_variation has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 6, loops 2 (5 pts), ternaries 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataStore.get_attribute_subqueries (cognitive 43) wp-content/plugins/woocommerce/src/Admin/API/Reports/DataStore.php:1457— DataStore.get_attribute_subqueries has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (31 pts), boolean chains 5, loops 3 (4 pts), ternaries 1 (3 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LookupDataStore.create_data_for_product_cpt_core (cognitive 43) wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/LookupDataStore.php:847— LookupDataStore.create_data_for_product_cpt_core has cognitive complexity 43 (threshold 15). Drivers by points: loops 13 (24 pts), if/else 7 (10 pts), boolean chains 5, ternaries 4 (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
ProductCollectionData.get_route_response (cognitive 43) wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/ProductCollectionData.php:69— ProductCollectionData.get_route_response has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 7 (19 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CLIRunner.verify_cot_data (cognitive 42) wp-content/plugins/woocommerce/src/Database/Migrations/CustomOrderTable/CLIRunner.php:349— CLIRunner.verify_cot_data has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (27 pts), ternaries 5 (10 pts), boolean chains 4, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous) (cognitive 42) wp-content/plugins/woocommerce/assets/js/admin/wc-enhanced-select.js:2— (anonymous) has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 17 (19 pts), if/else 15 (17 pts), boolean chains 5, error handling 1 (nesting depth added 4). Most of this is not in the body itself: 1 of the 42 points is its own statement and the rest belongs to 50 function items inside it that branch (a function literal at line 309, a function literal at line 203, a function literal at line 266, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_Query.pre_get_posts (cognitive 41) wp-content/plugins/woocommerce/includes/class-wc-query.php:326— WC_Query.pre_get_posts has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (28 pts), ternaries 2 (7 pts), boolean chains 6 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_Abstract_Legacy_Product.sync_attributes (cognitive 41) wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-product.php:575— WC_Abstract_Legacy_Product.sync_attributes has cognitive complexity 41 (threshold 15). Drivers by points: if/else 7 (25 pts), loops 4 (16 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Products_V1_Controller.save_default_attributes (cognitive 41) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1014— WC_REST_Products_V1_Controller.save_default_attributes has cognitive complexity 41 (threshold 15). Drivers by points: if/else 9 (31 pts), ternaries 1 (5 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_REST_Products_V2_Controller.save_default_attributes (cognitive 41) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1630— WC_REST_Products_V2_Controller.save_default_attributes has cognitive complexity 41 (threshold 15). Drivers by points: if/else 9 (31 pts), ternaries 1 (5 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
wc-attribute-functions.wc_create_attribute (cognitive 41) wp-content/plugins/woocommerce/includes/wc-attribute-functions.php:495— wc-attribute-functions.wc_create_attribute has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 10, ternaries 3 (4 pts), loops 1 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-user-functions.wc_customer_bought_product (cognitive 41) wp-content/plugins/woocommerce/includes/wc-user-functions.php:405— wc-user-functions.wc_customer_bought_product has cognitive complexity 41 (threshold 15). Drivers by points: if/else 18 (34 pts), boolean chains 7 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BlockHooksTrait.register_hooked_block (cognitive 41) wp-content/plugins/woocommerce/src/Blocks/Utils/BlockHooksTrait.php:20— BlockHooksTrait.register_hooked_block has cognitive complexity 41 (threshold 15). Drivers by points: if/else 9 (24 pts), boolean chains 10, ternaries 2 (5 pts), loops 1 (2 pts) (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Reviews.handle_reply_to_review (cognitive 41) wp-content/plugins/woocommerce/src/Internal/Admin/ProductReviews/Reviews.php:250— Reviews.handle_reply_to_review has cognitive complexity 41 (threshold 15). Drivers by points: if/else 20 (30 pts), ternaries 4 (6 pts), boolean chains 5 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Settings.add_component_settings (cognitive 41) wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php:121— Settings.add_component_settings has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 4 (9 pts), ternaries 5 (9 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PHPMailer.attachAll (cognitive 41) wp-includes/PHPMailer/PHPMailer.php:3514— PHPMailer.attachAll has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (38 pts), boolean chains 2, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PHPMailer.DKIM_Add (cognitive 41) wp-includes/PHPMailer/PHPMailer.php:5263— PHPMailer.DKIM_Add has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (33 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous) (cognitive 41) wp-content/themes/monoka/assets/font-awesome/js/pro.js:5— (anonymous) has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 12, ternaries 5 (6 pts), error handling 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
WC_Helper.render_helper_output (cognitive 40) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:164— WC_Helper.render_helper_output has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Checkout.get_posted_data (cognitive 40) wp-content/plugins/woocommerce/includes/class-wc-checkout.php:761— WC_Checkout.get_posted_data has cognitive complexity 40 (threshold 15). Drivers by points: if/else 6 (15 pts), ternaries 5 (9 pts), boolean chains 7, loops 3 (5 pts), match/switch 1 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_System_Status_V2_Controller.get_pages (cognitive 40) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php:1519— WC_REST_System_Status_V2_Controller.get_pages has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (29 pts), ternaries 2 (6 pts), boolean chains 4, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Orders_Controller.prepare_object_for_database (cognitive 40) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php:112— WC_REST_Orders_Controller.prepare_object_for_database has cognitive complexity 40 (threshold 15). Drivers by points: if/else 7 (28 pts), loops 2 (6 pts), match/switch 1 (3 pts), boolean chains 2, ternaries 1 (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
wc-template-functions.wc_get_formatted_cart_item_data (cognitive 40) REDACTED:4503— wc-template-functions.wc_get_formatted_cart_item_data has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 3 (8 pts), ternaries 2 (6 pts), boolean chains 4 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FulfillmentsManager.update_fulfillments_after_refund (cognitive 40) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsManager.php:321— FulfillmentsManager.update_fulfillments_after_refund has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 5, loops 3 (4 pts), error handling 1, ternaries 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parseTime::strictParse (cognitive 40) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:1192— parseTime::strictParse has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (28 pts), ternaries 2 (8 pts), boolean chains 4 (nesting depth added 20). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
WC_Admin_Setup_Wizard.wc_setup_activate_get_feature_list_str (cognitive 39) REDACTED:2063— WC_Admin_Setup_Wizard.wc_setup_activate_get_feature_list_str has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (34 pts), boolean chains 5 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_REST_Products_Controller.set_product_images (cognitive 39) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:655— WC_REST_Products_Controller.set_product_images has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (31 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
CollectionQuery.get_query_args (cognitive 39) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/CollectionQuery.php:190— CollectionQuery.get_query_args has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (18 pts), ternaries 7 (16 pts), loops 1 (2 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Controller.set_product_images (cognitive 39) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:922— Controller.set_product_images has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (31 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
wp-login.login_header (cognitive 39) REDACTED:41— wp-login.login_header has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (26 pts), loops 3 (9 pts), boolean chains 3, ternaries 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous) (cognitive 39) wp-content/plugins/woocommerce/assets/js/admin/settings-views-html-settings-tax.js:7— (anonymous) has cognitive complexity 39 (threshold 15). Drivers by points: if/else 24 (26 pts), boolean chains 7, ternaries 6 (nesting depth added 2). Most of this is not in the body itself: 1 of the 39 points is its own statement and the rest belongs to 33 function items inside it that branch (updateModelOnChange, render, updateUrl, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_Query.get_layered_nav_chosen_attributes (cognitive 38) wp-content/plugins/woocommerce/includes/class-wc-query.php:1040— WC_Query.get_layered_nav_chosen_attributes has cognitive complexity 38 (threshold 15). Drivers by points: if/else 5 (17 pts), ternaries 3 (15 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_Customer_Data_Store_Session.read (cognitive 38) wp-content/plugins/woocommerce/includes/data-stores/class-wc-customer-data-store-session.php:107— WC_Customer_Data_Store_Session.read has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (27 pts), loops 2 (8 pts), boolean chains 3 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DataStore.sync_order_products (cognitive 38) wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php:453— DataStore.sync_order_products has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (23 pts), ternaries 3 (8 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProductFilterChips.render (cognitive 38) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterChips.php:46— ProductFilterChips.render has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (21 pts), ternaries 6 (10 pts), boolean chains 6, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PaymentsProviders.get_extension_suggestions (cognitive 38) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders.php:653— PaymentsProviders.get_extension_suggestions has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 15, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ComingSoonRequestHandler.experimental_filter_theme_json_theme (cognitive 38) wp-content/plugins/woocommerce/src/Internal/ComingSoon/ComingSoonRequestHandler.php:192— ComingSoonRequestHandler.experimental_filter_theme_json_theme has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 4 (12 pts), boolean chains 3 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WCEmailTemplateChangeSummary.diff_records (cognitive 38) wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:473— WCEmailTemplateChangeSummary.diff_records has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 8 (9 pts), ternaries 1 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Controller.get_product_data (cognitive 38) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:2453— Controller.get_product_data has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (30 pts), ternaries 2 (6 pts), boolean chains 2 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DataUtils.validate_line_items (cognitive 38) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/DataUtils.php:171— DataUtils.validate_line_items has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (30 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Checkout.validate_callback (cognitive 38) wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Checkout.php:232— Checkout.validate_callback has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 4 (10 pts), boolean chains 4 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous) (cognitive 38) wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zones.js:3— (anonymous) has cognitive complexity 38 (threshold 15). Drivers by points: if/else 23 (26 pts), boolean chains 10, ternaries 1 (2 pts) (nesting depth added 4). Most of this is not in the body itself: 2 of the 38 points are its own statements and the rest belongs to 26 function items inside it that branch (discardChanges, save, onSaveResponse, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_REST_Products_V1_Controller.set_product_images (cognitive 37) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:857— WC_REST_Products_V1_Controller.set_product_images has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (30 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_REST_Products_V2_Controller.set_product_images (cognitive 37) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1452— WC_REST_Products_V2_Controller.set_product_images has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (27 pts), ternaries 3 (7 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
wc-order-functions.wc_get_order_types (cognitive 37) wp-content/plugins/woocommerce/includes/wc-order-functions.php:228— wc-order-functions.wc_get_order_types has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 7 (14 pts), match/switch 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProductSpecifications.render (cognitive 37) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductSpecifications.php:36— ProductSpecifications.render has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (20 pts), loops 4 (11 pts), boolean chains 3, ternaries 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RestAbilityFactory.relax_output_schema_for_wc_quirks (cognitive 37) wp-content/plugins/woocommerce/src/Internal/Abilities/REST/RestAbilityFactory.php:470— RestAbilityFactory.relax_output_schema_for_wc_quirks has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 4 (9 pts), boolean chains 7 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrderMilestoneEasterEgg.handle_admin_enqueue_scripts (cognitive 37) wp-content/plugins/woocommerce/src/Internal/Admin/OrderMilestoneEasterEgg.php:109— OrderMilestoneEasterEgg.handle_admin_enqueue_scripts has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 9, ternaries 6 (7 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
OrdersTableQuery.process_date_args (cognitive 37) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableQuery.php:463— OrdersTableQuery.process_date_args has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 6, ternaries 2 (5 pts), loops 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AbstractDataTransferObject.convertEmptyArraysToObjects (cognitive 37) wp-includes/php-ai-client/src/Common/AbstractDataTransferObject.php:93— AbstractDataTransferObject.convertEmptyArraysToObjects has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 4 (12 pts), boolean chains 7 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_updateDateTime (cognitive 37) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:918— _updateDateTime has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (19 pts), ternaries 5 (10 pts), boolean chains 8 (nesting depth added 11). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
WC_Checkout.process_customer (cognitive 36) wp-content/plugins/woocommerce/includes/class-wc-checkout.php:1166— WC_Checkout.process_customer has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 9, ternaries 4 (8 pts), loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Countries.country_dropdown_options (cognitive 36) wp-content/plugins/woocommerce/includes/class-wc-countries.php:553— WC_Countries.country_dropdown_options has cognitive complexity 36 (threshold 15). Drivers by points: if/else 6 (18 pts), ternaries 2 (9 pts), loops 2 (6 pts), boolean chains 3 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Install.create_options (cognitive 36) wp-content/plugins/woocommerce/includes/class-wc-install.php:1197— WC_Install.create_options has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 3 (16 pts), if/else 4 (12 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Shipping.calculate_shipping_for_package (cognitive 36) wp-content/plugins/woocommerce/includes/class-wc-shipping.php:311— WC_Shipping.calculate_shipping_for_package has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 6, loops 3 (6 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Report_Sales_V1_Controller.prepare_item_for_response (cognitive 36) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-report-sales-v1-controller.php:96— WC_REST_Report_Sales_V1_Controller.prepare_item_for_response has cognitive complexity 36 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 6 (12 pts), loops 7 (8 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_Collection_Block_Tracking.parse_blocks_track_data (cognitive 36) wp-content/plugins/woocommerce/includes/tracks/events/class-wc-product-collection-block-tracking.php:105— WC_Product_Collection_Block_Tracking.parse_blocks_track_data has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (19 pts), ternaries 3 (9 pts), boolean chains 7, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-product-functions.wc_get_price_including_tax (cognitive 36) wp-content/plugins/woocommerce/includes/wc-product-functions.php:1501— wc-product-functions.wc_get_price_including_tax has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (27 pts), ternaries 3 (6 pts), boolean chains 3 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_Widget_Layered_Nav.layered_nav_list (cognitive 36) REDACTED:392— WC_Widget_Layered_Nav.layered_nav_list has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (20 pts), ternaries 4 (8 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataStore.include_extended_info (cognitive 36) wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/DataStore.php:244— DataStore.include_extended_info has cognitive complexity 36 (threshold 15). Drivers by points: if/else 5 (15 pts), ternaries 3 (11 pts), loops 3 (8 pts), boolean chains 2 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
renderPostScreen (cognitive 36) REDACTED:7082— renderPostScreen has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (26 pts), loops 5 (8 pts), boolean chains 2 (nesting depth added 14). None of this is in the body itself: all 36 points belong to 5 function items inside it that branch (a function literal at line 7128, sortMetabox, copyEvents, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_Shipping_Method.get_taxes_per_item (cognitive 35) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-shipping-method.php:386— WC_Shipping_Method.get_taxes_per_item has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 4 (16 pts), if/else 5 (10 pts), loops 3 (8 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Report_Coupon_Usage.coupons_widget (cognitive 35) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:175— WC_Report_Coupon_Usage.coupons_widget has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 8 (18 pts), if/else 8, loops 3 (6 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Cart_Session.get_cart_from_session (cognitive 35) wp-content/plugins/woocommerce/includes/class-wc-cart-session.php:98— WC_Cart_Session.get_cart_from_session has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 10, ternaries 3 (6 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Install.background_installer (cognitive 35) wp-content/plugins/woocommerce/includes/class-wc-install.php:2545— WC_Install.background_installer has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (24 pts), error handling 2 (6 pts), ternaries 2 (5 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-template-functions.wc_get_product_class (cognitive 35) REDACTED:654— wc-template-functions.wc_get_product_class has cognitive complexity 35 (threshold 15). Drivers by points: if/else 22 (25 pts), boolean chains 4, ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
WC_Widget_Brand_Nav.layered_nav_list (cognitive 35) REDACTED:395— WC_Widget_Brand_Nav.layered_nav_list has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 7 (12 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReviewsListTable.handle_row_actions (cognitive 35) wp-content/plugins/woocommerce/src/Internal/Admin/ProductReviews/ReviewsListTable.php:413— ReviewsListTable.handle_row_actions has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 13, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
PaymentsProviders.enhance_payment_gateway_details (cognitive 35) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders.php:1297— PaymentsProviders.enhance_payment_gateway_details has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (28 pts), boolean chains 6, ternaries 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PaymentGateway.get_provider_links (cognitive 35) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PaymentGateway.php:276— PaymentGateway.get_provider_links has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (20 pts), boolean chains 7, ternaries 1 (4 pts), loops 1 (3 pts), error handling 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WooCommerceProductImporter.handle_product_images (cognitive 35) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/WooCommerceProductImporter.php:990— WooCommerceProductImporter.handle_product_images has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (29 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrdersTableMetaQuery.sanitize_meta_query (cognitive 35) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableMetaQuery.php:222— OrdersTableMetaQuery.sanitize_meta_query has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 5 (14 pts), boolean chains 4, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RestApiCache.get_cached_response (cognitive 35) wp-content/plugins/woocommerce/src/Internal/Traits/RestApiCache.php:1337— RestApiCache.get_cached_response has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (24 pts), loops 3 (5 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
jquery.flot.Canvas.removeText (cognitive 35) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.js:461— jquery.flot.Canvas.removeText has cognitive complexity 35 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 4 (17 pts), boolean chains 1 (nesting depth added 24). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
(anonymous) (cognitive 35) wp-content/plugins/woocommerce/assets/js/admin/wc-setup.js:5— (anonymous) has cognitive complexity 35 (threshold 15). Drivers by points: if/else 20, boolean chains 9, ternaries 2 (4 pts), loops 2 (nesting depth added 2). None of this is in the body itself: all 35 points belong to 30 function items inside it that branch (addPlugins, a function literal at line 85, a function literal at line 119, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
initAjaxSubmit (cognitive 35) wp-content/plugins/woocommerce/assets/js/frontend/order-review.js:276— initAjaxSubmit has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 7, error handling 2 (nesting depth added 9). Most of this is not in the body itself: 1 of the 35 points is its own statement and the rest belongs to 9 function literals inside it that branch (lines 314, 336, 282, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
WC_Admin_Attributes.add_attribute (cognitive 34) REDACTED:298— WC_Admin_Attributes.add_attribute has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (21 pts), ternaries 2 (6 pts), loops 2 (4 pts), match/switch 1 (3 pts) (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_AJAX.shipping_zone_methods_save_changes (cognitive 34) REDACTED:3534— WC_AJAX.shipping_zone_methods_save_changes has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 3 (6 pts), match/switch 1 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Coupon.get_coupon_error (cognitive 34) REDACTED:1104— WC_Coupon.get_coupon_error has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 3 (11 pts), boolean chains 4, match/switch 1 (nesting depth added 18). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
WC_Product_Variable_Data_Store_CPT.read_attributes (cognitive 34) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variable-data-store-cpt.php:36— WC_Product_Variable_Data_Store_CPT.read_attributes has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 2 (8 pts), boolean chains 3 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_Product_Variable_Data_Store_CPT.validate_prices_data (cognitive 34) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variable-data-store-cpt.php:1042— WC_Product_Variable_Data_Store_CPT.validate_prices_data has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 4 (8 pts), boolean chains 4 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Orders_Controller.save_object (cognitive 34) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php:253— WC_REST_Orders_Controller.save_object has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 10, error handling 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-template-functions.wc_template_redirect (cognitive 34) REDACTED:27— wc-template-functions.wc_template_redirect has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 19, if/else 11 (15 pts) (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DataStore.add_sql_query_params (cognitive 34) wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/DataStore.php:124— DataStore.add_sql_query_params has cognitive complexity 34 (threshold 15). Drivers by points: if/else 21 (22 pts), boolean chains 6, ternaries 3 (4 pts), loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DataStore.include_extended_info (cognitive 34) wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php:249— DataStore.include_extended_info has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (26 pts), loops 2 (4 pts), ternaries 1 (4 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProductReviewForm.render (cognitive 34) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Reviews/ProductReviewForm.php:29— ProductReviewForm.render has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (17 pts), ternaries 8 (16 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Loader.add_component_settings (cognitive 34) wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:318— Loader.add_component_settings has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 4 (9 pts), ternaries 5 (9 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_Data_Store_CPT.search_products (cognitive 33) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:1973— WC_Product_Data_Store_CPT.search_products has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 4, loops 2 (3 pts), ternaries 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_CSV_Importer.import (cognitive 33) wp-content/plugins/woocommerce/includes/import/class-wc-product-csv-importer.php:1143— WC_Product_CSV_Importer.import has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 10, ternaries 3 (7 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Orders_V2_Controller.get_order_item_data (cognitive 33) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:216— WC_REST_Orders_V2_Controller.get_order_item_data has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 6 (13 pts), if/else 9 (12 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Products_V2_Controller.delete_item (cognitive 33) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1699— WC_REST_Products_V2_Controller.delete_item has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 2 (6 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Shipping_Legacy_Free_Shipping.is_available (cognitive 33) wp-content/plugins/woocommerce/includes/shipping/legacy-free-shipping/class-wc-shipping-legacy-free-shipping.php:162— WC_Shipping_Legacy_Free_Shipping.is_available has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 4, loops 1 (3 pts), match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MobileAppQRLogin.get_status (cognitive 33) wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:1234— MobileAppQRLogin.get_status has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 9 (16 pts), if/else 10 (11 pts), boolean chains 6 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous) (cognitive 33) wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart.js:2— (anonymous) has cognitive complexity 33 (threshold 15). Drivers by points: if/else 20 (28 pts), boolean chains 3, ternaries 2 (nesting depth added 8). Most of this is not in the body itself: 1 of the 33 points is its own statement and the rest belongs to 21 function items inside it that branch (updateButton, onAddToCart, onAddToCart::success, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
api-helpers.acf_validate_attachment (cognitive 32) wp-content/plugins/advanced-custom-fields-pro/includes/api/api-helpers.php:3511— api-helpers.acf_validate_attachment has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 8 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Admin_Importers.post_importer_compatibility (cognitive 32) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-importers.php:175— WC_Admin_Importers.post_importer_compatibility has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (23 pts), loops 2 (6 pts), boolean chains 3 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_AJAX.json_search_products (cognitive 32) REDACTED:1788— WC_AJAX.json_search_products has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 2 (3 pts), boolean chains 2, ternaries 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Abstract_WC_Order_Data_Store_CPT.update_order_meta_from_object (cognitive 32) wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:886— Abstract_WC_Order_Data_Store_CPT.update_order_meta_from_object has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 3 (5 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Segmenter.set_all_segments (cognitive 32) wp-content/plugins/woocommerce/src/Admin/API/Reports/Segmenter.php:327— Segmenter.set_all_segments has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 4 (9 pts), boolean chains 4 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Checkout.enqueue_data (cognitive 32) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Checkout.php:419— Checkout.enqueue_data has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 9, ternaries 3 (5 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProductFilterCheckboxList.render (cognitive 32) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterCheckboxList.php:37— ProductFilterCheckboxList.render has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (24 pts), ternaries 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MetaToMetaTableMigrator.classify_update_insert_records (cognitive 32) wp-content/plugins/woocommerce/src/Database/Migrations/MetaToMetaTableMigrator.php:380— MetaToMetaTableMigrator.classify_update_insert_records has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (28 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous) (cognitive 32) wp-content/plugins/woocommerce/assets/js/gateways/paypal.js:1— (anonymous) has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 7, error handling 4, ternaries 3 (nesting depth added 1). None of this is in the body itself: all 32 points belong to 9 function items inside it that branch (renderButtons::manageCartForProductPageOrder, renderButtons::createOrder, renderButtons, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
api-template.have_rows (cognitive 31) wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php:370— api-template.have_rows has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 6 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Form_Handler.process_registration (cognitive 31) wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:1182— WC_Form_Handler.process_registration has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (17 pts), ternaries 4 (6 pts), boolean chains 3, loops 1 (3 pts), error handling 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Order_Factory.get_orders (cognitive 31) wp-content/plugins/woocommerce/includes/class-wc-order-factory.php:81— WC_Order_Factory.get_orders has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 5 (8 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Gateway_Paypal_PDT_Handler.check_response_for_order (cognitive 31) wp-content/plugins/woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-pdt-handler.php:121— WC_Gateway_Paypal_PDT_Handler.check_response_for_order has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (29 pts), ternaries 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_Importer.set_variation_data (cognitive 31) wp-content/plugins/woocommerce/includes/import/abstract-wc-product-importer.php:465— WC_Product_Importer.set_variation_data has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (24 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Products_V1_Controller.delete_item (cognitive 31) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1642— WC_REST_Products_V1_Controller.delete_item has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 2 (6 pts), boolean chains 4 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-cart-functions.wc_get_default_shipping_method_for_package (cognitive 31) wp-content/plugins/woocommerce/includes/wc-cart-functions.php:497— wc-cart-functions.wc_get_default_shipping_method_for_package has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 3 (8 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Widget_Product_Categories.widget (cognitive 31) wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-product-categories.php:97— WC_Widget_Product_Categories.widget has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 9 (11 pts), loops 1 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RestAbilityFactory.sanitize_schema (cognitive 31) wp-content/plugins/woocommerce/src/Internal/Abilities/REST/RestAbilityFactory.php:285— RestAbilityFactory.sanitize_schema has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 6, loops 2 (5 pts), ternaries 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ArrayUtil.deep_compute_or_compare_array_diff (cognitive 31) wp-content/plugins/woocommerce/src/Utilities/ArrayUtil.php:248— ArrayUtil.deep_compute_or_compare_array_diff has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (26 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PHPMailer.sendmailSend (cognitive 31) wp-includes/PHPMailer/PHPMailer.php:1888— PHPMailer.sendmailSend has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 3 (6 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProviderRegistry.createDefaultProviderRequestAuthentication (cognitive 31) wp-includes/php-ai-client/src/Providers/ProviderRegistry.php:418— ProviderRegistry.createDefaultProviderRequestAuthentication has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (23 pts), match/switch 1 (4 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_doKeyPress (cognitive 31) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:1481— _doKeyPress has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 9 (27 pts), if/else 2 (3 pts), boolean chains 1 (nesting depth added 19). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
WC_Product_CSV_Importer_Controller.dispatch_ajax (cognitive 30) wp-content/plugins/woocommerce/includes/admin/importers/class-wc-product-csv-importer-controller.php:323— WC_Product_CSV_Importer_Controller.dispatch_ajax has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 15 (25 pts), if/else 4, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Admin_List_Table_Products.query_filters (cognitive 30) REDACTED:525— WC_Admin_List_Table_Products.query_filters has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 5 (14 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Report_Sales_By_Category.get_main_chart (cognitive 30) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-category.php:283— WC_Report_Sales_By_Category.get_main_chart has cognitive complexity 30 (threshold 15). Drivers by points: loops 5 (14 pts), if/else 3 (7 pts), ternaries 2 (5 pts), match/switch 1 (4 pts) (nesting depth added 19). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
WC_Cart.show_shipping (cognitive 30) wp-content/plugins/woocommerce/includes/class-wc-cart.php:1795— WC_Cart.show_shipping has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 11 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Email.admin_options (cognitive 30) wp-content/plugins/woocommerce/includes/emails/class-wc-email.php:1568— WC_Email.admin_options has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (26 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Products_V2_Controller.prepare_objects_query (cognitive 30) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:342— WC_REST_Products_V2_Controller.prepare_objects_query has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (17 pts), ternaries 5 (10 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_System_Status_V2_Controller.get_environment_info_per_fields (cognitive 30) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php:926— WC_REST_System_Status_V2_Controller.get_environment_info_per_fields has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 9, ternaries 5 (7 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_System_Status_V2_Controller.get_theme_info (cognitive 30) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php:1321— WC_REST_System_Status_V2_Controller.get_theme_info has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (23 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
wc-product-functions.wc_get_product_variation_attributes (cognitive 30) wp-content/plugins/woocommerce/includes/wc-product-functions.php:1160— wc-product-functions.wc_get_product_variation_attributes has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 4 (9 pts), boolean chains 2, ternaries 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-user-functions.wc_customer_has_capability (cognitive 30) wp-content/plugins/woocommerce/includes/wc-user-functions.php:610— wc-user-functions.wc_customer_has_capability has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 6, ternaries 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MobileAppQRLogin.exchange_token (cognitive 30) wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:953— MobileAppQRLogin.exchange_token has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (18 pts), ternaries 6 (9 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
FedExShippingProvider.try_parse_tracking_number (cognitive 30) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/FedExShippingProvider.php:95— FedExShippingProvider.try_parse_tracking_number has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 12 (17 pts), if/else 6 (9 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BlockTemplatesController.add_db_templates_with_woo_slug (cognitive 30) wp-content/plugins/woocommerce/src/Blocks/BlockTemplatesController.php:248— BlockTemplatesController.add_db_templates_with_woo_slug has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 8, loops 2 (4 pts), ternaries 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BlockTemplatesRegistry.init (cognitive 30) wp-content/plugins/woocommerce/src/Blocks/BlockTemplatesRegistry.php:45— BlockTemplatesRegistry.init has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 2 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ProductFilterTaxonomy.render (cognitive 30) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterTaxonomy.php:184— ProductFilterTaxonomy.render has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 7, ternaries 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AbilitiesLoader.register_abilities (cognitive 30) wp-content/plugins/woocommerce/src/Internal/Abilities/AbilitiesLoader.php:92— AbilitiesLoader.register_abilities has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 7, ternaries 1 (3 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FileController.search_within_files (cognitive 30) wp-content/plugins/woocommerce/src/Internal/Admin/Logging/FileV2/FileController.php:571— FileController.search_within_files has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 2 (5 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WooPayments.get_details (cognitive 30) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:46— WooPayments.get_details has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 8, error handling 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NotificationPreferencesService.sanitize_value (cognitive 30) wp-content/plugins/woocommerce/src/Internal/PushNotifications/Services/NotificationPreferencesService.php:162— NotificationPreferencesService.sanitize_value has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 4 (12 pts), boolean chains 3, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EmailSettingsSchema.get_item_response (cognitive 30) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Schema/EmailSettingsSchema.php:148— EmailSettingsSchema.get_item_response has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 4, ternaries 2 (4 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Abstract_Order.update_taxes (cognitive 29) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:1920— WC_Abstract_Order.update_taxes has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 6 (14 pts), loops 6 (8 pts), if/else 2 (5 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Meta_Box_Product_Data.prepare_attributes (cognitive 29) REDACTED:234— WC_Meta_Box_Product_Data.prepare_attributes has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 4 (11 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_Data_Store_CPT.update_attributes (cognitive 29) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:1043— WC_Product_Data_Store_CPT.update_attributes has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (13 pts), ternaries 3 (12 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_REST_System_Status_Tools_V2_Controller.execute_tool (cognitive 29) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php:459— WC_REST_System_Status_Tools_V2_Controller.execute_tool has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (22 pts), error handling 1 (3 pts), loops 1 (3 pts), match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PageController.get_current_screen_id (cognitive 29) wp-content/plugins/woocommerce/src/Admin/PageController.php:261— PageController.get_current_screen_id has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PatternRegistry.register_block_pattern (cognitive 29) wp-content/plugins/woocommerce/src/Blocks/Patterns/PatternRegistry.php:42— PatternRegistry.register_block_pattern has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (21 pts), loops 4 (5 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Payments.process_payment_provider_states (cognitive 29) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Payments.php:428— Payments.process_payment_provider_states has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 8, loops 3 (5 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrdersTableQuery.build_query (cognitive 29) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableQuery.php:789— OrdersTableQuery.build_query has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 11 (18 pts), if/else 8 (9 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WCEmailTemplateChangeSummary.diff_records_three_way (cognitive 29) wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:701— WCEmailTemplateChangeSummary.diff_records_three_way has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 5, boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous) (cognitive 29) wp-content/plugins/woocommerce/assets/js/frontend/country-select.js:2— (anonymous) has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 5 (nesting depth added 9). Most of this is not in the body itself: 2 of the 29 points are its own statements and the rest belongs to 16 function items inside it that branch (a function literal at line 90, a function literal at line 57, a function literal at line 175, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
replaceForPosition (cognitive 29) wp-content/themes/monoka/assets/font-awesome/js/pro.js:2227— replaceForPosition has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (3 pts) (nesting depth added 11). None of this is in the body itself: all 29 points belong to 4 function literals inside it that branch (lines 2229, 2282, 2236, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
WC_Report_Sales_By_Product.products_widget (cognitive 28) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:221— WC_Report_Sales_By_Product.products_widget has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 9 (15 pts), if/else 7, loops 3 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_AJAX.grant_access_to_download (cognitive 28) REDACTED:998— WC_AJAX.grant_access_to_download has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_AJAX.json_search_categories_tree (cognitive 28) REDACTED:2059— WC_AJAX.json_search_categories_tree has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 2 (6 pts), ternaries 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Autoloader.autoload (cognitive 28) wp-content/plugins/woocommerce/includes/class-wc-autoloader.php:69— WC_Autoloader.autoload has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 2 (7 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Query.get_catalog_ordering_args (cognitive 28) wp-content/plugins/woocommerce/includes/class-wc-query.php:675— WC_Query.get_catalog_ordering_args has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 8 (13 pts), boolean chains 1, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Webhook_Data_Store.search_webhooks (cognitive 28) wp-content/plugins/woocommerce/includes/data-stores/class-wc-webhook-data-store.php:238— WC_Webhook_Data_Store.search_webhooks has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 12 (17 pts), if/else 9, boolean chains 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
WC_REST_Products_V2_Controller.get_product_data (cognitive 28) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:816— WC_REST_Products_V2_Controller.get_product_data has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 9 (25 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Products_Controller.get_product_data (cognitive 28) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:2049— WC_REST_Products_Controller.get_product_data has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (26 pts), boolean chains 2 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
wc-user-functions.wc_get_customer_available_downloads (cognitive 28) wp-content/plugins/woocommerce/includes/wc-user-functions.php:771— wc-user-functions.wc_get_customer_available_downloads has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 4, ternaries 1 (3 pts), loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OnboardingTasks.sideload_homepage_images (cognitive 28) wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:596— OnboardingTasks.sideload_homepage_images has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 6 (10 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Controller.get_analytics_report_data (cognitive 28) wp-content/plugins/woocommerce/src/Admin/API/Reports/PerformanceIndicators/Controller.php:119— Controller.get_analytics_report_data has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 2 (8 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Utils.parse_frontend_location_context (cognitive 28) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/Utils.php:100— Utils.parse_frontend_location_context has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 3 (9 pts), boolean chains 7, loops 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AbstractAddressSchema.validate_callback (cognitive 28) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/AbstractAddressSchema.php:163— AbstractAddressSchema.validate_callback has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 6, ternaries 2 (3 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PHPMailer.setLanguage (cognitive 28) wp-includes/PHPMailer/PHPMailer.php:2490— PHPMailer.setLanguage has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Settings_Advanced.save (cognitive 27) wp-content/plugins/woocommerce/includes/admin/settings/class-wc-settings-advanced.php:561— WC_Settings_Advanced.save has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 7, ternaries 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_AJAX.remove_order_item (cognitive 27) REDACTED:1465— WC_AJAX.remove_order_item has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 5, boolean chains 2, loops 1 (2 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Form_Handler.process_login (cognitive 27) wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:1035— WC_Form_Handler.process_login has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 4, ternaries 1 (3 pts), error handling 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Geolocation.geolocate_via_api (cognitive 27) wp-content/plugins/woocommerce/includes/class-wc-geolocation.php:286— WC_Geolocation.geolocate_via_api has cognitive complexity 27 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 2 (10 pts), match/switch 1 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Privacy_Erasers.remove_order_personal_data (cognitive 27) wp-content/plugins/woocommerce/includes/class-wc-privacy-erasers.php:218— WC_Privacy_Erasers.remove_order_personal_data has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 2 (6 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Shipping_Zone.get_shipping_methods (cognitive 27) wp-content/plugins/woocommerce/includes/class-wc-shipping-zone.php:159— WC_Shipping_Zone.get_shipping_methods has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (17 pts), ternaries 2 (8 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Tracker.extract_group_key (cognitive 27) wp-content/plugins/woocommerce/includes/class-wc-tracker.php:692— WC_Tracker.extract_group_key has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 3 (7 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Controller.consolidate_customer_id_filters (cognitive 27) wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Controller.php:120— Controller.consolidate_customer_id_filters has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 6 (13 pts), if/else 6 (10 pts), boolean chains 2, loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AmazonLogisticsShippingProvider.try_parse_tracking_number (cognitive 27) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/AmazonLogisticsShippingProvider.php:94— AmazonLogisticsShippingProvider.try_parse_tracking_number has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 22, if/else 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Connection.slice (cognitive 27) wp-content/plugins/woocommerce/src/Api/Pagination/Connection.php:71— Connection.slice has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5, loops 2 (4 pts), ternaries 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Dropdown.render (cognitive 27) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Dropdown.php:44— Dropdown.render has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 7 (9 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CheckoutFields.validate_options (cognitive 27) wp-content/plugins/woocommerce/src/Blocks/Domain/Services/CheckoutFields.php:380— CheckoutFields.validate_options has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 5, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RestAbilityFactory.sanitize_args_to_schema (cognitive 27) wp-content/plugins/woocommerce/src/Internal/Abilities/REST/RestAbilityFactory.php:215— RestAbilityFactory.sanitize_args_to_schema has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 3, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WooPaymentsService.standardize_onboarding_step_details (cognitive 27) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:2027— WooPaymentsService.standardize_onboarding_step_details has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProductsController.simulate_import_batch (cognitive 27) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/ProductsController.php:725— ProductsController.simulate_import_batch has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (5 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SignupService.signup (cognitive 27) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Frontend/SignupService.php:88— SignupService.signup has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (20 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
a8c-address-autocomplete-service.Object.entries().forEach() (cognitive 27) wp-content/plugins/woocommerce/assets/js/frontend/a8c-address-autocomplete-service.js:173— a8c-address-autocomplete-service.Object.entries().forEach() has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 6, error handling 3, match/switch 1 (nesting depth added 3). Most of this is not in the body itself: 4 of the 27 points are its own statements and the rest belongs to 6 function items inside it that branch (handleApiError, a function literal at line 299, a function literal at line 348, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
api-helpers.acf_get_grouped_posts (cognitive 26) wp-content/plugins/advanced-custom-fields-pro/includes/api/api-helpers.php:1459— api-helpers.acf_get_grouped_posts has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Abstract_Order.set_coupon_discount_amounts (cognitive 26) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:1564— WC_Abstract_Order.set_coupon_discount_amounts has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (5 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Meta_Box_Product_Data.prepare_set_attributes (cognitive 26) REDACTED:298— WC_Meta_Box_Product_Data.prepare_set_attributes has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 2 (10 pts), loops 1 (2 pts) (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_Admin_Report.prepare_chart_data (cognitive 26) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-admin-report.php:466— WC_Admin_Report.prepare_chart_data has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3 (5 pts), ternaries 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Settings_Payment_Gateways.suppress_admin_notices (cognitive 26) wp-content/plugins/woocommerce/includes/admin/settings/class-wc-settings-payment-gateways.php:378— WC_Settings_Payment_Gateways.suppress_admin_notices has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Cart_Totals.get_fees_from_cart (cognitive 26) wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php:274— WC_Cart_Totals.get_fees_from_cart has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 2 (6 pts) (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_Cart.check_customer_coupons (cognitive 26) wp-content/plugins/woocommerce/includes/class-wc-cart.php:1908— WC_Cart.check_customer_coupons has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (18 pts), boolean chains 4, ternaries 1 (3 pts), loops 1 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_Emails.order_meta (cognitive 26) wp-content/plugins/woocommerce/includes/class-wc-emails.php:632— WC_Emails.order_meta has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 3 (8 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Shortcodes.product_page (cognitive 26) wp-content/plugins/woocommerce/includes/class-wc-shortcodes.php:506— WC_Shortcodes.product_page has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11, boolean chains 10, loops 2 (3 pts), ternaries 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Tax.sort_rates_callback (cognitive 26) wp-content/plugins/woocommerce/includes/class-wc-tax.php:305— WC_Tax.sort_rates_callback has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 6 (11 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_Data_Store_CPT.find_matching_product_variation (cognitive 26) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:1459— WC_Product_Data_Store_CPT.find_matching_product_variation has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 4 (5 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_CSV_Importer.read_file (cognitive 26) wp-content/plugins/woocommerce/includes/import/class-wc-product-csv-importer.php:99— WC_Product_CSV_Importer.read_file has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Product_Reviews_Controller.update_item (cognitive 26) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:531— WC_REST_Product_Reviews_Controller.update_item has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Terms_Controller.get_items (cognitive 26) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php:278— WC_REST_Terms_Controller.get_items has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-core-functions.wc_array_cartesian (cognitive 26) wp-content/plugins/woocommerce/includes/wc-core-functions.php:1306— wc-core-functions.wc_array_cartesian has cognitive complexity 26 (threshold 15). Drivers by points: loops 8 (17 pts), if/else 4 (9 pts) (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
wc-term-functions._wc_term_recount (cognitive 26) wp-content/plugins/woocommerce/includes/wc-term-functions.php:416— wc-term-functions._wc_term_recount has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 2 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Widget_Layered_Nav.layered_nav_dropdown (cognitive 26) REDACTED:239— WC_Widget_Layered_Nav.layered_nav_dropdown has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 4 (9 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CustomAttributeTraits.get_custom_attributes (cognitive 26) wp-content/plugins/woocommerce/src/Admin/API/CustomAttributeTraits.php:45— CustomAttributeTraits.get_custom_attributes has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SingleProductTemplate.replace_first_single_product_template_block_with_password_form (cognitive 26) wp-content/plugins/woocommerce/src/Blocks/Templates/SingleProductTemplate.php:161— SingleProductTemplate.replace_first_single_product_template_block_with_password_form has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Payments.maybe_track_provider_state_change (cognitive 26) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Payments.php:587— Payments.maybe_track_provider_state_change has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 11, if/else 8 (11 pts), ternaries 2 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ShippingZoneService.update_shipping_zone (cognitive 26) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZones/ShippingZoneService.php:77— ShippingZoneService.update_shipping_zone has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (21 pts), ternaries 1 (3 pts), loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelRequirements.fromPromptData (cognitive 26) wp-includes/php-ai-client/src/Providers/Models/DTO/ModelRequirements.php:133— ModelRequirements.fromPromptData has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
jquery-ui-timepicker-addon.$.datepicker._updateAlternate (cognitive 26) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:1516— jquery-ui-timepicker-addon.$.datepicker._updateAlternate has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 4 (12 pts), boolean chains 2 (nesting depth added 14). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
jquery.nivo.slider.NivoSlider (cognitive 26) wp-content/themes/monoka/assets/js/custom-slider/jquery.nivo.slider.js:11— jquery.nivo.slider.NivoSlider has cognitive complexity 26 (threshold 15). Drivers by points: if/else 83 (129 pts), boolean chains 15, loops 7 (12 pts), ternaries 3 (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (jquery.nivo.slider.NivoSlider::nivoRun) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
onFindVariation (cognitive 26) wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart-variation.js:258— onFindVariation has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 1, ternaries 1 (nesting depth added 13). Of this number, 18 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
fetchSvg (cognitive 26) wp-content/themes/monoka/assets/font-awesome/js/pro.js:1350— fetchSvg has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 5, ternaries 4, error handling 1 (3 pts) (nesting depth added 5). Most of this is not in the body itself: 7 of the 26 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 1364, 1400, 1383, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
api-term.acf_get_grouped_terms (cognitive 25) wp-content/plugins/advanced-custom-fields-pro/includes/api/api-term.php:169— api-term.acf_get_grouped_terms has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Report_Taxes_By_Date.get_main_chart (cognitive 25) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-date.php:74— WC_Report_Taxes_By_Date.get_main_chart has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 7 (15 pts), loops 5 (6 pts), if/else 3 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Form_Handler.add_payment_method_action (cognitive 25) wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:509— WC_Form_Handler.add_payment_method_action has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Regenerate_Images_Request.filter_image_sizes_to_only_missing_thumbnails (cognitive 25) wp-content/plugins/woocommerce/includes/class-wc-regenerate-images-request.php:171— WC_Regenerate_Images_Request.filter_image_sizes_to_only_missing_thumbnails has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 5, loops 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Coupons_V1_Controller.prepare_item_for_database (cognitive 25) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:239— WC_REST_Coupons_V1_Controller.prepare_item_for_database has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 2 (5 pts), match/switch 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Product_Categories_V1_Controller.update_term_meta_fields (cognitive 25) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-categories-v1-controller.php:114— WC_REST_Product_Categories_V1_Controller.update_term_meta_fields has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (18 pts), ternaries 2 (5 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Product_Categories_Controller.update_term_meta_fields (cognitive 25) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-categories-controller.php:222— WC_REST_Product_Categories_Controller.update_term_meta_fields has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (18 pts), ternaries 2 (5 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Orders.get_formatted_item_data (cognitive 25) wp-content/plugins/woocommerce/src/Admin/API/Orders.php:185— Orders.get_formatted_item_data has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 5, ternaries 3 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CanadaPostShippingProvider.try_parse_tracking_number (cognitive 25) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/CanadaPostShippingProvider.php:140— CanadaPostShippingProvider.try_parse_tracking_number has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PaymentsProviders.enhance_extension_suggestion (cognitive 25) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders.php:1435— PaymentsProviders.enhance_extension_suggestion has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 2 (5 pts), match/switch 1 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SettingsUISchema.get_group_actions (cognitive 25) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/SettingsUISchema.php:403— SettingsUISchema.get_group_actions has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 9, ternaries 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrdersTableFieldQuery.sanitize_query (cognitive 25) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableFieldQuery.php:106— OrdersTableFieldQuery.sanitize_query has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 2 (5 pts), boolean chains 3, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WCEmailTemplateSelectiveApplier.migrate_woo_email_content_namespace (cognitive 25) wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateSelectiveApplier.php:674— WCEmailTemplateSelectiveApplier.migrate_woo_email_content_namespace has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrderSchema.get_item_response (cognitive 25) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Schema/OrderSchema.php:597— OrderSchema.get_item_response has cognitive complexity 25 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 9, boolean chains 2, ternaries 2 (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
cart.document.addEventListener("DOMContentLoaded") (cognitive 25) wp-content/themes/monoka/assets/js/cart.js:2— cart.document.addEventListener("DOMContentLoaded") has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 7, ternaries 2 (nesting depth added 2). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 2 function items inside it that branch (a function literal at line 42, submitCartForm). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cognitive 25) wp-content/themes/monoka/assets/js/cart.js:2— (anonymous) has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 7, ternaries 2 (nesting depth added 2). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 5 function items inside it that branch (a function literal at line 42, submitCartForm, a function literal at line 22, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
debounce (cognitive 25) wp-content/plugins/woocommerce/assets/js/frontend/a8c-address-autocomplete-service.js:23— debounce has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 5 (7 pts), boolean chains 5 (nesting depth added 4). Most of this is not in the body itself: 7 of the 25 points are its own statements and the rest belongs to 11 function items inside it that branch (debounced, cancel, shouldInvoke, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
api-helpers.acf_get_grouped_users (cognitive 24) wp-content/plugins/advanced-custom-fields-pro/includes/api/api-helpers.php:1807— api-helpers.acf_get_grouped_users has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
upgrades.acf_upgrade_500_field (cognitive 24) wp-content/plugins/advanced-custom-fields-pro/includes/upgrades.php:296— upgrades.acf_upgrade_500_field has cognitive complexity 24 (threshold 15). Drivers by points: loops 4 (13 pts), if/else 6 (11 pts) (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
WC_Abstract_Order.hold_applied_coupons (cognitive 24) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:1199— WC_Abstract_Order.hold_applied_coupons has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), ternaries 1 (4 pts), boolean chains 1, error handling 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Admin_Setup_Wizard.wc_setup_activate (cognitive 24) REDACTED:2090— WC_Admin_Setup_Wizard.wc_setup_activate has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 2 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Admin_Status.output_plugins_info (cognitive 24) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-status.php:417— WC_Admin_Status.output_plugins_info has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (20 pts), boolean chains 3, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Admin_Webhooks.save (cognitive 24) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-webhooks.php:54— WC_Admin_Webhooks.save has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 6 (8 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
WC_AJAX.shipping_classes_save_changes (cognitive 24) REDACTED:3759— WC_AJAX.shipping_classes_save_changes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (20 pts), ternaries 1 (3 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Checkout.validate_checkout (cognitive 24) wp-content/plugins/woocommerce/includes/class-wc-checkout.php:946— WC_Checkout.validate_checkout has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3, loops 1 (3 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Orders_V2_Controller.save_object (cognitive 24) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:800— WC_REST_Orders_V2_Controller.save_object has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 8, error handling 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Shipping_Zone_Methods_V2_Controller.update_fields (cognitive 24) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:297— WC_REST_Shipping_Zone_Methods_V2_Controller.update_fields has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (19 pts), ternaries 1 (3 pts), loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Product_Reviews_Controller.create_item (cognitive 24) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:378— WC_REST_Product_Reviews_Controller.create_item has cognitive complexity 24 (threshold 15). Drivers by points: if/else 18 (20 pts), boolean chains 2, ternaries 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
WC_Product_Collection_Block_Tracking.get_query_filters_usage_data (cognitive 24) wp-content/plugins/woocommerce/includes/tracks/events/class-wc-product-collection-block-tracking.php:241— WC_Product_Collection_Block_Tracking.get_query_filters_usage_data has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
wc-product-functions.wc_get_related_products (cognitive 24) wp-content/plugins/woocommerce/includes/wc-product-functions.php:1402— wc-product-functions.wc_get_related_products has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 6 (8 pts), boolean chains 6 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
WC_Widget_Brand_Nav.get_page_base_url (cognitive 24) REDACTED:215— WC_Widget_Brand_Nav.get_page_base_url has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AustraliaPostShippingProvider.try_parse_tracking_number (cognitive 24) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/AustraliaPostShippingProvider.php:149— AustraliaPostShippingProvider.try_parse_tracking_number has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RoyalMailShippingProvider.try_parse_tracking_number (cognitive 24) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/RoyalMailShippingProvider.php:153— RoyalMailShippingProvider.try_parse_tracking_number has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SingleProductTemplate.render_block_template (cognitive 24) wp-content/plugins/woocommerce/src/Blocks/Templates/SingleProductTemplate.php:51— SingleProductTemplate.render_block_template has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, loops 1 (3 pts), ternaries 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Request.capture_authorized_payment (cognitive 24) wp-content/plugins/woocommerce/src/Gateways/PayPal/Request.php:318— Request.capture_authorized_payment has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 3 (6 pts), boolean chains 4, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrdersQuery.execute (cognitive 24) wp-content/plugins/woocommerce/src/Internal/Abilities/Domain/OrdersQuery.php:76— OrdersQuery.execute has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, loops 3, ternaries 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AddressProviderController.get_registered_providers (cognitive 24) wp-content/plugins/woocommerce/src/Internal/AddressProvider/AddressProviderController.php:58— AddressProviderController.get_registered_providers has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FileController.get_files (cognitive 24) wp-content/plugins/woocommerce/src/Internal/Admin/Logging/FileV2/FileController.php:203— FileController.get_files has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, if/else 6 (8 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Payments.get_payment_providers (cognitive 24) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Payments.php:78— Payments.get_payment_providers has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 3 (4 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PaymentsProviders.enhance_order_map (cognitive 24) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders.php:1054— PaymentsProviders.enhance_order_map has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WooPaymentsService.sanitize_onboarding_step_error (cognitive 24) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:734— WooPaymentsService.sanitize_onboarding_step_error has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3, loops 2 (3 pts), ternaries 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrdersTableDataStore.get_diff_meta_data_between_orders (cognitive 24) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:1669— OrdersTableDataStore.get_diff_meta_data_between_orders has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (8 pts), boolean chains 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
URL.process_path (cognitive 24) wp-content/plugins/woocommerce/src/Internal/Utilities/URL.php:141— URL.process_path has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 11, if/else 5 (10 pts), ternaries 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous) (cognitive 24) wp-content/plugins/woocommerce/assets/js/frontend/address-i18n.js:2— (anonymous) has cognitive complexity 24 (threshold 15). Drivers by points: if/else 20 (22 pts), boolean chains 2 (nesting depth added 2). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to 6 function items inside it that branch (a function literal at line 54, field_is_required, a function literal at line 33, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_Cart.apply_coupon (cognitive 23) wp-content/plugins/woocommerce/includes/class-wc-cart.php:2008— WC_Cart.apply_coupon has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Order_Item_Meta.get_formatted_legacy (cognitive 23) wp-content/plugins/woocommerce/includes/class-wc-order-item-meta.php:170— WC_Order_Item_Meta.get_formatted_legacy has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Regenerate_Images.maybe_resize_image (cognitive 23) wp-content/plugins/woocommerce/includes/class-wc-regenerate-images.php:201— WC_Regenerate_Images.maybe_resize_image has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 8 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_Data_Store_CPT.handle_updated_props (cognitive 23) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:852— WC_Product_Data_Store_CPT.handle_updated_props has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_CSV_Exporter.format_term_ids (cognitive 23) wp-content/plugins/woocommerce/includes/export/abstract-wc-csv-exporter.php:428— WC_CSV_Exporter.format_term_ids has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (7 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Abstract_Legacy_Product.__get (cognitive 23) wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-product.php:69— WC_Abstract_Legacy_Product.__get has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 9 (18 pts), if/else 3 (4 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Setting_Options_Controller.get_group_settings (cognitive 23) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-setting-options-controller.php:74— WC_REST_Setting_Options_Controller.get_group_settings has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (9 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Shipping_Flat_Rate.calculate_shipping (cognitive 23) wp-content/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php:163— WC_Shipping_Flat_Rate.calculate_shipping has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 2 (7 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-formatting-functions.wc_array_merge_recursive_numeric (cognitive 23) wp-content/plugins/woocommerce/includes/wc-formatting-functions.php:1509— wc-formatting-functions.wc_array_merge_recursive_numeric has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Widget_Brand_Nav.layered_nav_dropdown (cognitive 23) REDACTED:312— WC_Widget_Brand_Nav.layered_nav_dropdown has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 2 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataStore.build_location_filter_clause (cognitive 23) wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/DataStore.php:1120— DataStore.build_location_filter_clause has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 3 (5 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RemoteInboxNotificationsDataSourcePoller.validate_spec (cognitive 23) wp-content/plugins/woocommerce/src/Admin/RemoteInboxNotifications/RemoteInboxNotificationsDataSourcePoller.php:61— RemoteInboxNotificationsDataSourcePoller.validate_spec has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GraphQLControllerBase.process_request (cognitive 23) wp-content/plugins/woocommerce/src/Api/Infrastructure/GraphQLControllerBase.php:378— GraphQLControllerBase.process_request has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 2 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Main.extract_namespace_from_php_source (cognitive 23) wp-content/plugins/woocommerce/src/Api/Infrastructure/Main.php:351— Main.extract_namespace_from_php_source has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (15 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReserveStock.reserve_stock_for_order (cognitive 23) wp-content/plugins/woocommerce/src/Checkout/Helpers/ReserveStock.php:73— ReserveStock.reserve_stock_for_order has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2 (3 pts), boolean chains 2, error handling 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CLIRunner.enable (cognitive 23) wp-content/plugins/woocommerce/src/Database/Migrations/CustomOrderTable/CLIRunner.php:754— CLIRunner.enable has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RestAbilityFactory.normalize_type (cognitive 23) wp-content/plugins/woocommerce/src/Internal/Abilities/REST/RestAbilityFactory.php:357— RestAbilityFactory.normalize_type has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LogHandlerFileV2.determine_source (cognitive 23) wp-content/plugins/woocommerce/src/Internal/Admin/Logging/LogHandlerFileV2.php:119— LogHandlerFileV2.determine_source has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LegacyDataHandler.backfill_order_to_datastore (cognitive 23) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/LegacyDataHandler.php:354— LegacyDataHandler.backfill_order_to_datastore has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 2 (5 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QueryClauses.add_taxonomy_clauses (cognitive 23) wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php:321— QueryClauses.add_taxonomy_clauses has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (5 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReceiptRenderingEngine.get_order_data (cognitive 23) wp-content/plugins/woocommerce/src/Internal/ReceiptRendering/ReceiptRenderingEngine.php:279— ReceiptRenderingEngine.get_order_data has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 6 (9 pts), loops 3, boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AbstractSchema.get_recursive_validate_callback (cognitive 23) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/AbstractSchema.php:160— AbstractSchema.get_recursive_validate_callback has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 3 (7 pts), boolean chains 3, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PHPMailer.createHeader (cognitive 23) wp-includes/PHPMailer/PHPMailer.php:2846— PHPMailer.createHeader has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 5, loops 2 (4 pts), ternaries 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SMTP.parseHelloFields (cognitive 23) wp-includes/PHPMailer/SMTP.php:944— SMTP.parseHelloFields has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), ternaries 1 (5 pts), match/switch 1 (4 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SMTP.get_lines (cognitive 23) wp-includes/PHPMailer/SMTP.php:1340— SMTP.get_lines has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 7, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
onFoundVariation (cognitive 23) wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart-variation.js:340— onFoundVariation has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (16 pts), ternaries 2 (6 pts), boolean chains 1 (nesting depth added 5). Of this number, 21 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
WC_Report_Sales_By_Date.query_report_data (cognitive 22) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-date.php:49— WC_Report_Sales_By_Date.query_report_data has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 8 (17 pts), loops 3, if/else 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_AJAX.refund_line_items (cognitive 22) REDACTED:2370— WC_AJAX.refund_line_items has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 7, boolean chains 5, if/else 5, loops 4, error handling 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Checkout.process_checkout (cognitive 22) wp-content/plugins/woocommerce/includes/class-wc-checkout.php:1284— WC_Checkout.process_checkout has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 2 (3 pts), boolean chains 2, error handling 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Download_Handler.download_product (cognitive 22) REDACTED:38— WC_Download_Handler.download_product has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 6 (8 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
WC_Order.needs_processing (cognitive 22) wp-content/plugins/woocommerce/includes/class-wc-order.php:1870— WC_Order.needs_processing has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (18 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_Post_Types.register_taxonomies (cognitive 22) wp-content/plugins/woocommerce/includes/class-wc-post-types.php:40— WC_Post_Types.register_taxonomies has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (8 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-admin-update-functions.wc_admin_update_270_delete_report_downloads (cognitive 22) wp-content/plugins/woocommerce/includes/react-admin/wc-admin-update-functions.php:110— wc-admin-update-functions.wc_admin_update_270_delete_report_downloads has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3, loops 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Order_Refunds_V1_Controller.prepare_item_for_response (cognitive 22) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php:123— WC_REST_Order_Refunds_V1_Controller.prepare_item_for_response has cognitive complexity 22 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 4 (6 pts), ternaries 4 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Products_V1_Controller.get_attributes (cognitive 22) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:400— WC_REST_Products_V1_Controller.get_attributes has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (4 pts), ternaries 1 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Coupons_V2_Controller.prepare_object_for_database (cognitive 22) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-coupons-v2-controller.php:279— WC_REST_Coupons_V2_Controller.prepare_object_for_database has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), ternaries 2 (5 pts), match/switch 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Payment_Gateways_V2_Controller.update_item (cognitive 22) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php:162— WC_REST_Payment_Gateways_V2_Controller.update_item has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Payment_Gateways_V2_Controller.get_settings (cognitive 22) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php:293— WC_REST_Payment_Gateways_V2_Controller.get_settings has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 4 (8 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Products_V2_Controller.get_attributes (cognitive 22) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:699— WC_REST_Products_V2_Controller.get_attributes has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (7 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Product_Reviews_Controller.get_items (cognitive 22) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:236— WC_REST_Product_Reviews_Controller.get_items has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 3, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Shipping_Free_Shipping.is_available (cognitive 22) wp-content/plugins/woocommerce/includes/shipping/free-shipping/class-wc-shipping-free-shipping.php:160— WC_Shipping_Free_Shipping.is_available has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, loops 1 (3 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-core-functions.wc_postcode_location_matcher (cognitive 22) wp-content/plugins/woocommerce/includes/wc-core-functions.php:1597— wc-core-functions.wc_postcode_location_matcher has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), ternaries 2 (7 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-order-functions.wc_delete_shop_order_transients (cognitive 22) wp-content/plugins/woocommerce/includes/wc-order-functions.php:502— wc-order-functions.wc_delete_shop_order_transients has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 4 (7 pts), loops 1 (4 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Widget_Brand_Nav.widget (cognitive 22) REDACTED:84— WC_Widget_Brand_Nav.widget has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, ternaries 3, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ResolverHelpers.authorize_method_shape_is_valid (cognitive 22) wp-content/plugins/woocommerce/src/Api/Infrastructure/ResolverHelpers.php:379— ResolverHelpers.authorize_method_shape_is_valid has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 6, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UpdateProduct.execute (cognitive 22) wp-content/plugins/woocommerce/src/Api/Mutations/Products/UpdateProduct.php:29— UpdateProduct.execute has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 2 (7 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ComingSoon.enqueue_block_assets (cognitive 22) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ComingSoon.php:70— ComingSoon.enqueue_block_assets has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (6 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Controller.disable_enhanced_pagination (cognitive 22) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/Controller.php:144— Controller.disable_enhanced_pagination has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QueryFilters.get_chosen_attributes (cognitive 22) wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:498— QueryFilters.get_chosen_attributes has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 3 (9 pts), boolean chains 3, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Events.get_note_from_db (cognitive 22) wp-content/plugins/woocommerce/src/Internal/Admin/Events.php:158— Events.get_note_from_db has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (5 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WooCommerceProductImporter.set_product_taxonomies (cognitive 22) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/WooCommerceProductImporter.php:904— WooCommerceProductImporter.set_product_taxonomies has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 5, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrdersTableQuery.get_field_mapping_info (cognitive 22) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableQuery.php:1503— OrdersTableQuery.get_field_mapping_info has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 3 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrderTagsProvider.register_tags (cognitive 22) wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:23— OrderTagsProvider.register_tags has cognitive complexity 22 (threshold 15). Drivers by points: if/else 18, boolean chains 2, loops 1, ternaries 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
FeaturesController.add_feature_settings (cognitive 22) REDACTED:1357— FeaturesController.add_feature_settings has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (3 pts), boolean chains 2, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Controller.check_permission_for_fulfillments (cognitive 22) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Fulfillments/Controller.php:308— Controller.check_permission_for_fulfillments has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (11 pts), error handling 2 (6 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
CartController.parse_variation_data (cognitive 22) wp-content/plugins/woocommerce/src/StoreApi/Utilities/CartController.php:1261— CartController.parse_variation_data has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 2, ternaries 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CartController.sanitize_variation_data (cognitive 22) wp-content/plugins/woocommerce/src/StoreApi/Utilities/CartController.php:1409— CartController.sanitize_variation_data has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 4 (8 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PHPMailer.smtpSend (cognitive 22) wp-includes/PHPMailer/PHPMailer.php:2227— PHPMailer.smtpSend has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (14 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SMTP.data (cognitive 22) wp-includes/PHPMailer/SMTP.php:805— SMTP.data has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-shipping-zone-methods.isValidFormattedNumber (cognitive 22) wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js:14— wc-shipping-zone-methods.isValidFormattedNumber has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 6 (nesting depth added 4). Most of this is not in the body itself: 8 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 62). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
free.replaceForPosition (cognitive 22) wp-content/themes/monoka/assets/font-awesome/js/free.js:3977— free.replaceForPosition has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 7). None of this is in the body itself: all 22 points belong to 2 function literals inside it that branch (lines 3979, 4020). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
observe (cognitive 22) wp-content/themes/monoka/assets/font-awesome/js/pro.js:1619— observe has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 3, ternaries 1 (nesting depth added 6). Most of this is not in the body itself: 4 of the 22 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1635, 1633). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
WC_Report_Customer_List.column_default (cognitive 21) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-customer-list.php:86— WC_Report_Customer_List.column_default has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 2 (4 pts), loops 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
WC_Settings_Emails.email_notification_setting_block_emails (cognitive 21) wp-content/plugins/woocommerce/includes/admin/settings/class-wc-settings-emails.php:593— WC_Settings_Emails.email_notification_setting_block_emails has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-meta-box-functions.woocommerce_wp_text_input (cognitive 21) wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php:23— wc-meta-box-functions.woocommerce_wp_text_input has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 9 (10 pts), if/else 6 (7 pts), loops 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
WC_Checkout.create_order (cognitive 21) wp-content/plugins/woocommerce/includes/class-wc-checkout.php:375— WC_Checkout.create_order has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, ternaries 3, error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Download_Handler.get_download_range (cognitive 21) REDACTED:408— WC_Download_Handler.get_download_range has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (8 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Geo_IP._geoip_seek_country_v6 (cognitive 21) wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1508— WC_Geo_IP._geoip_seek_country_v6 has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (WC_Geo_IP._geoip_seek_country) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
WC_Geo_IP._geoip_seek_country (cognitive 21) wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1569— WC_Geo_IP._geoip_seek_country has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (WC_Geo_IP._geoip_seek_country_v6) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
WC_Order_Item.get_formatted_meta_data (cognitive 21) wp-content/plugins/woocommerce/includes/class-wc-order-item.php:335— WC_Order_Item.get_formatted_meta_data has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (9 pts), ternaries 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Order.get_formatted_order_total (cognitive 21) wp-content/plugins/woocommerce/includes/class-wc-order.php:218— WC_Order.get_formatted_order_total has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 2 (7 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Order.get_downloadable_items (cognitive 21) wp-content/plugins/woocommerce/includes/class-wc-order.php:1799— WC_Order.get_downloadable_items has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (5 pts), ternaries 1 (5 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Post_Types.register_post_types (cognitive 21) wp-content/plugins/woocommerce/includes/class-wc-post-types.php:320— WC_Post_Types.register_post_types has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 5 (8 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Query.get_tax_query (cognitive 21) wp-content/plugins/woocommerce/includes/class-wc-query.php:895— WC_Query.get_tax_query has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 2 (4 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-order-step-logger-functions.wc_log_order_step (cognitive 21) wp-content/plugins/woocommerce/includes/wc-order-step-logger-functions.php:30— wc-order-step-logger-functions.wc_log_order_step has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 3, boolean chains 1, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-page-functions.wc_nav_menu_item_classes (cognitive 21) wp-content/plugins/woocommerce/includes/wc-page-functions.php:246— wc-page-functions.wc_nav_menu_item_classes has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-update-functions.wc_update_200_permalinks (cognitive 21) wp-content/plugins/woocommerce/includes/wc-update-functions.php:79— wc-update-functions.wc_update_200_permalinks has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 4 (8 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataStore.include_extended_info (cognitive 21) wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/DataStore.php:369— DataStore.include_extended_info has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 2 (4 pts), loops 3, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Downloads.render_order_download_row (cognitive 21) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/OrderConfirmation/Downloads.php:123— Downloads.render_order_download_row has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 1 (4 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProductFilterAttribute.render (cognitive 21) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:142— ProductFilterAttribute.render has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 4, ternaries 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ProductRating.render (cognitive 21) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php:77— ProductRating.render has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Request.get_authorization_id_for_capture (cognitive 21) wp-content/plugins/woocommerce/src/Gateways/PayPal/Request.php:521— Request.get_authorization_id_for_capture has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 2 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WooCommerceProductImporter.set_basic_product_properties (cognitive 21) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/WooCommerceProductImporter.php:460— WooCommerceProductImporter.set_basic_product_properties has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (17 pts), loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
StockNotificationsDataStore.query (cognitive 21) wp-content/plugins/woocommerce/src/Internal/DataStores/StockNotifications/StockNotificationsDataStore.php:417— StockNotificationsDataStore.query has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12, ternaries 5, boolean chains 2, loops 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ItemEligibility.preload_for_items (cognitive 21) wp-content/plugins/woocommerce/src/Internal/OrderReviews/ItemEligibility.php:158— ItemEligibility.preload_for_items has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GeneralSettingsSchema.get_item_response (cognitive 21) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Schema/GeneralSettingsSchema.php:145— GeneralSettingsSchema.get_item_response has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TaxSettingsSchema.get_item_response (cognitive 21) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Schema/TaxSettingsSchema.php:145— TaxSettingsSchema.get_item_response has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SignupService.parse_user_data (cognitive 21) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Frontend/SignupService.php:329— SignupService.parse_user_data has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelConfig.toArray (cognitive 21) wp-includes/php-ai-client/src/Providers/Models/DTO/ModelConfig.php:735— ModelConfig.toArray has cognitive complexity 21 (threshold 15). Drivers by points: if/else 21. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (ModelConfig.fromArray) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ModelConfig.fromArray (cognitive 21) wp-includes/php-ai-client/src/Providers/Models/DTO/ModelConfig.php:812— ModelConfig.fromArray has cognitive complexity 21 (threshold 15). Drivers by points: if/else 21. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (ModelConfig.toArray) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
jquery-ui-timepicker-addon.$.datepicker._getDateDatepicker (cognitive 21) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:1727— jquery-ui-timepicker-addon.$.datepicker._getDateDatepicker has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 4 (nesting depth added 8). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
acf.buildObject (cognitive 21) REDACTED:738— acf.buildObject has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
acf.EventManager::_removeHook (cognitive 21) REDACTED:2701— acf.EventManager::_removeHook has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
jquery.flexslider.$.fn.flexslider (cognitive 21) wp-content/plugins/woocommerce/assets/js/flexslider/jquery.flexslider.js:1114— jquery.flexslider.$.fn.flexslider has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, match/switch 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 9). Most of this is not in the body itself: 8 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 1118). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
Lazy (cognitive 21) REDACTED:1883— Lazy has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (8 pts), loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 5). None of this is in the body itself: all 21 points belong to 2 function literals inside it that branch (lines 1905, 1920). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
(anonymous) (cognitive 21) REDACTED:2— (anonymous) has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 8 (10 pts), boolean chains 9, error handling 1, if/else 1 (nesting depth added 2). None of this is in the body itself: all 21 points belong to 13 function items inside it that branch (a function literal at line 2, a function literal at line 2, a function literal at line 2, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_Shipping_Method.add_rate (cognitive 20) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-shipping-method.php:291— WC_Shipping_Method.add_rate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, loops 2 (4 pts), ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
WC_Widget.update (cognitive 20) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-widget.php:189— WC_Widget.update has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 2 (6 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Brands_Admin.parse_brands_field (cognitive 20) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-brands.php:756— WC_Brands_Admin.parse_brands_field has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 3 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Admin_Duplicate_Product.product_duplicate (cognitive 20) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-duplicate-product.php:133— WC_Admin_Duplicate_Product.product_duplicate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Admin_Permalink_Settings.settings_save (cognitive 20) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-permalink-settings.php:167— WC_Admin_Permalink_Settings.settings_save has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Report_Downloads.column_default (cognitive 20) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-downloads.php:138— WC_Report_Downloads.column_default has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, error handling 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Report_Sales_By_Category.output_report (cognitive 20) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-category.php:114— WC_Report_Sales_By_Category.output_report has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 3 (4 pts), match/switch 1 (4 pts), loops 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Report_Stock.column_default (cognitive 20) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-stock.php:80— WC_Report_Stock.column_default has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 1 (2 pts), ternaries 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Cart_Totals.calculate_item_subtotals (cognitive 20) wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php:717— WC_Cart_Totals.calculate_item_subtotals has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_Variable_Data_Store_CPT.get_price_hash (cognitive 20) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variable-data-store-cpt.php:599— WC_Product_Variable_Data_Store_CPT.get_price_hash has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (8 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Email.get_headers (cognitive 20) wp-content/plugins/woocommerce/includes/emails/class-wc-email.php:684— WC_Email.get_headers has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 6, ternaries 1 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_CSV_Exporter.prepare_data_to_export (cognitive 20) wp-content/plugins/woocommerce/includes/export/class-wc-product-csv-exporter.php:190— WC_Product_CSV_Exporter.prepare_data_to_export has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_CSV_Importer.parse_categories_field (cognitive 20) wp-content/plugins/woocommerce/includes/import/class-wc-product-csv-importer.php:427— WC_Product_CSV_Importer.parse_categories_field has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Payment_Gateways_Controller.get_settings (cognitive 20) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-payment-gateways-controller.php:73— WC_REST_Payment_Gateways_Controller.get_settings has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 3 (6 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Products_Tracking.track_product_published (cognitive 20) wp-content/plugins/woocommerce/includes/tracks/events/class-wc-products-tracking.php:329— WC_Products_Tracking.track_product_published has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 16, boolean chains 3, if/else 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
wc-core-functions.wc_get_template_part (cognitive 20) wp-content/plugins/woocommerce/includes/wc-core-functions.php:248— wc-core-functions.wc_get_template_part has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 3 (10 pts) (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
wc-core-functions.wc_get_theme_support (cognitive 20) wp-content/plugins/woocommerce/includes/wc-core-functions.php:750— wc-core-functions.wc_get_theme_support has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 1 (4 pts), boolean chains 1, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-template-functions.wc_display_product_attributes (cognitive 20) REDACTED:4228— wc-template-functions.wc_display_product_attributes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (7 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-update-functions.wc_update_210_file_paths (cognitive 20) wp-content/plugins/woocommerce/includes/wc-update-functions.php:502— wc-update-functions.wc_update_210_file_paths has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (6 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MobileAppQRLogin.approve_token (cognitive 20) wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:1655— MobileAppQRLogin.approve_token has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9, ternaries 6 (7 pts), boolean chains 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DataStore.update (cognitive 20) wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/DataStore.php:529— DataStore.update has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 7, ternaries 3 (4 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ListProducts.execute (cognitive 20) wp-content/plugins/woocommerce/src/Api/Queries/Products/ListProducts.php:45— ListProducts.execute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 5, match/switch 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Api.verify_payment_methods_dependencies (cognitive 20) wp-content/plugins/woocommerce/src/Blocks/Payments/Api.php:126— Api.verify_payment_methods_dependencies has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CLIRunner.cleanup_post_data (cognitive 20) wp-content/plugins/woocommerce/src/Database/Migrations/CustomOrderTable/CLIRunner.php:943— CLIRunner.cleanup_post_data has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 3, error handling 1 (3 pts), loops 2 (3 pts), ternaries 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProductsController.process_batch (cognitive 20) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/ProductsController.php:642— ProductsController.process_batch has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProductsController.display_saved_arguments (cognitive 20) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/ProductsController.php:1007— ProductsController.display_saved_arguments has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 1 (4 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WooCommerceProductImporter.setup_attributes (cognitive 20) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/WooCommerceProductImporter.php:618— WooCommerceProductImporter.setup_attributes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UpdateUtils.update_order_from_request (cognitive 20) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/UpdateUtils.php:63— UpdateUtils.update_order_from_request has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 7, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Controller.validate_setting_value (cognitive 20) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Controller.php:300— Controller.validate_setting_value has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 7, match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
EmailsSettingsSchema.get_values (cognitive 20) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Emails/Schema/EmailsSettingsSchema.php:260— EmailsSettingsSchema.get_values has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Controller.get_items (cognitive 20) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/OfflinePaymentMethods/Controller.php:119— Controller.get_items has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 2 (4 pts), boolean chains 2, error handling 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AbstractPaymentGatewaySettingsSchema.get_settings (cognitive 20) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/PaymentGateways/Schema/AbstractPaymentGatewaySettingsSchema.php:483— AbstractPaymentGatewaySettingsSchema.get_settings has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 3 (6 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProductSettingsSchema.get_item_response (cognitive 20) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Schema/ProductSettingsSchema.php:147— ProductSettingsSchema.get_item_response has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NotificationCreatePage.process_create_form (cognitive 20) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Admin/NotificationCreatePage.php:27— NotificationCreatePage.process_create_form has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PluginInstaller.install_plugin_core (cognitive 20) wp-content/plugins/woocommerce/src/Internal/Utilities/PluginInstaller.php:106— PluginInstaller.install_plugin_core has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrderItemSchema.get_variation_data_from_order_item (cognitive 20) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/OrderItemSchema.php:147— OrderItemSchema.get_variation_data_from_order_item has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModelRequirements.toRequiredOptions (cognitive 20) wp-includes/php-ai-client/src/Providers/Models/DTO/ModelRequirements.php:194— ModelRequirements.toRequiredOptions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 19, loops 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
free.handleThenable (cognitive 20) wp-content/themes/monoka/assets/font-awesome/js/free.js:2370— free.handleThenable has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 2, error handling 1 (nesting depth added 9). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 2383, 2393). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
pro.handleThenable (cognitive 20) wp-content/themes/monoka/assets/font-awesome/js/pro.js:427— pro.handleThenable has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 2, error handling 1 (nesting depth added 9). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 440, 450). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
(anonymous) (cognitive 20) wp-content/plugins/woocommerce/assets/js/admin/quick-edit.js:3— (anonymous) has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 2, ternaries 1 (nesting depth added 1). None of this is in the body itself: all 20 points belong to 5 function literals inside it that branch (lines 7, 128, 154, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
acf-wp-functions.acf_get_object_type (cognitive 19) wp-content/plugins/advanced-custom-fields-pro/includes/acf-wp-functions.php:13— acf-wp-functions.acf_get_object_type has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Data.update_meta_data (cognitive 19) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-data.php:519— WC_Data.update_meta_data has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2 (5 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Abstract_Order.get_subtotal_to_display (cognitive 19) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:2245— WC_Abstract_Order.get_subtotal_to_display has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (5 pts), boolean chains 2, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Widget.get_current_page_url (cognitive 19) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-widget.php:324— WC_Widget.get_current_page_url has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Admin_Post_Types.set_new_price (cognitive 19) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-post-types.php:910— WC_Admin_Post_Types.set_new_price has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, match/switch 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Admin_Status.get_latest_theme_version (cognitive 19) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-status.php:252— WC_Admin_Status.get_latest_theme_version has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 1 (4 pts), boolean chains 2 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_Helper_Updater.get_translations_update_data (cognitive 19) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper-updater.php:499— WC_Helper_Updater.get_translations_update_data has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Meta_Box_Coupon_Data.output (cognitive 19) wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-coupon-data.php:27— WC_Meta_Box_Coupon_Data.output has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 5 (7 pts), ternaries 5 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
WC_Meta_Box_Order_Downloads.output (cognitive 19) wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-downloads.php:23— WC_Meta_Box_Order_Downloads.output has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, ternaries 1 (3 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Plugin_Updates.get_untested_plugins (cognitive 19) wp-content/plugins/woocommerce/includes/admin/plugin-updates/class-wc-plugin-updates.php:156— WC_Plugin_Updates.get_untested_plugins has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-meta-box-functions.woocommerce_wp_checkbox (cognitive 19) wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php:165— wc-meta-box-functions.woocommerce_wp_checkbox has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 8, if/else 6, boolean chains 3, loops 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_AJAX.json_search_categories (cognitive 19) REDACTED:2002— WC_AJAX.json_search_categories has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (6 pts), ternaries 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_AJAX.toggle_gateway_enabled (cognitive 19) REDACTED:4122— WC_AJAX.toggle_gateway_enabled has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Auth.auth_endpoint (cognitive 19) wp-content/plugins/woocommerce/includes/class-wc-auth.php:314— WC_Auth.auth_endpoint has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 7, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Background_Emailer.handle (cognitive 19) wp-content/plugins/woocommerce/includes/class-wc-background-emailer.php:147— WC_Background_Emailer.handle has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Download_Handler.readfile_chunked (cognitive 19) REDACTED:620— WC_Download_Handler.readfile_chunked has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Order_Item_Meta.get_formatted (cognitive 19) wp-content/plugins/woocommerce/includes/class-wc-order-item-meta.php:126— WC_Order_Item_Meta.get_formatted has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Order.status_transition (cognitive 19) wp-content/plugins/woocommerce/includes/class-wc-order.php:432— WC_Order.status_transition has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_Regenerate_Images_Request.task (cognitive 19) wp-content/plugins/woocommerce/includes/class-wc-regenerate-images-request.php:92— WC_Regenerate_Images_Request.task has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Tax.calc_exclusive_tax (cognitive 19) wp-content/plugins/woocommerce/includes/class-wc-tax.php:181— WC_Tax.calc_exclusive_tax has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Abstract_WC_Order_Data_Store_CPT.prime_order_item_caches_for_orders (cognitive 19) wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:582— Abstract_WC_Order_Data_Store_CPT.prime_order_item_caches_for_orders has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Abstract_WC_Order_Data_Store_CPT.prime_refund_caches_for_orders (cognitive 19) wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:699— Abstract_WC_Order_Data_Store_CPT.prime_refund_caches_for_orders has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 4 (5 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Data_Store_WP.get_wp_query_args (cognitive 19) wp-content/plugins/woocommerce/includes/data-stores/class-wc-data-store-wp.php:275— WC_Data_Store_WP.get_wp_query_args has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 1 (4 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Abstract_Legacy_Order.update_product (cognitive 19) wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-order.php:139— WC_Abstract_Legacy_Order.update_product has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Controller.get_fields_for_response (cognitive 19) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-controller.php:563— WC_REST_Controller.get_fields_for_response has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
WC_Shipping_Legacy_Flat_Rate.get_extra_cost (cognitive 19) wp-content/plugins/woocommerce/includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php:383— WC_Shipping_Legacy_Flat_Rate.get_extra_cost has cognitive complexity 19 (threshold 15). Drivers by points: loops 3 (10 pts), if/else 3 (6 pts), match/switch 2 (3 pts) (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
wc-core-functions.wc_get_image_size (cognitive 19) wp-content/plugins/woocommerce/includes/wc-core-functions.php:797— wc-core-functions.wc_get_image_size has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 5 (8 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-product-functions.wc_scheduled_sales (cognitive 19) wp-content/plugins/woocommerce/includes/wc-product-functions.php:829— wc-product-functions.wc_scheduled_sales has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (6 pts), loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-template-functions.wc_query_string_form_fields (cognitive 19) REDACTED:790— wc-template-functions.wc_query_string_form_fields has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (4 pts), ternaries 1 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrderFulfillmentsRestController.update_fulfillment (cognitive 19) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/OrderFulfillmentsRestController.php:378— OrderFulfillmentsRestController.update_fulfillment has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 1 (3 pts), boolean chains 2, error handling 2, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DHLShippingProvider.try_parse_tracking_number (cognitive 19) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/DHLShippingProvider.php:108— DHLShippingProvider.try_parse_tracking_number has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (9 pts), if/else 3 (6 pts), boolean chains 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeprecatedOptions.update_deprecated_options (cognitive 19) wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/DeprecatedOptions.php:65— DeprecatedOptions.update_deprecated_options has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 2 (4 pts), match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
PageController.get_breadcrumbs (cognitive 19) wp-content/plugins/woocommerce/src/Admin/PageController.php:171— PageController.get_breadcrumbs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 2 (5 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PluginsHelper.install_plugins (cognitive 19) wp-content/plugins/woocommerce/src/Admin/PluginsHelper.php:231— PluginsHelper.install_plugins has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (7 pts), ternaries 1 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AddToCartForm.render (cognitive 19) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartForm.php:170— AddToCartForm.render has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 8, ternaries 3. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ProductStockIndicator.render (cognitive 19) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductStockIndicator.php:78— ProductStockIndicator.render has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 7, ternaries 3. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Request.authorize_or_capture_payment (cognitive 19) wp-content/plugins/woocommerce/src/Gateways/PayPal/Request.php:222— Request.authorize_or_capture_payment has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 4, ternaries 2 (3 pts), error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
PageController.handle_list_table_bulk_actions (cognitive 19) wp-content/plugins/woocommerce/src/Internal/Admin/Logging/PageController.php:588— PageController.handle_list_table_bulk_actions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), match/switch 1 (2 pts), boolean chains 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PageController.is_order_screen (cognitive 19) wp-content/plugins/woocommerce/src/Internal/Admin/Orders/PageController.php:510— PageController.is_order_screen has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (8 pts), match/switch 2 (6 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ReviewsUtil.comments_clauses_without_product_reviews (cognitive 19) wp-content/plugins/woocommerce/src/Internal/Admin/ProductReviews/ReviewsUtil.php:46— ReviewsUtil.comments_clauses_without_product_reviews has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (3 pts), boolean chains 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PaymentGateway.standardize_recommended_payment_method (cognitive 19) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PaymentGateway.php:1066— PaymentGateway.standardize_recommended_payment_method has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WcPayWelcomePage.get_active_payments_task_slug (cognitive 19) wp-content/plugins/woocommerce/src/Internal/Admin/WcPayWelcomePage.php:162— WcPayWelcomePage.get_active_payments_task_slug has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 9 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrdersTableDataStore.set_order_props_from_data (cognitive 19) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:1763— OrdersTableDataStore.set_order_props_from_data has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (12 pts), error handling 1 (3 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StockNotificationsDataStore.update (cognitive 19) wp-content/plugins/woocommerce/src/Internal/DataStores/StockNotifications/StockNotificationsDataStore.php:264— StockNotificationsDataStore.update has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 6 (9 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WCEmailTemplateChangeSummary.lcs_matches (cognitive 19) wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:920— WCEmailTemplateChangeSummary.lcs_matches has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RemoteLogger.is_third_party_error (cognitive 19) wp-content/plugins/woocommerce/src/Internal/Logging/RemoteLogger.php:320— RemoteLogger.is_third_party_error has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QueryClauses.add_attribute_clauses (cognitive 19) wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php:207— QueryClauses.add_attribute_clauses has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 3, boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QueryClauses.get_chosen_attributes (cognitive 19) wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php:556— QueryClauses.get_chosen_attributes has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 3 (6 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PushTokensDataStore.get_by_token_or_device_id (cognitive 19) wp-content/plugins/woocommerce/src/Internal/PushNotifications/DataStores/PushTokensDataStore.php:210— PushTokensDataStore.get_by_token_or_device_id has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 12, if/else 3 (4 pts), error handling 1 (2 pts), loops 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
AccountSettingsSchema.get_item_response (cognitive 19) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:145— AccountSettingsSchema.get_item_response has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EmailsSettingsSchema.validate_field_value (cognitive 19) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Emails/Schema/EmailsSettingsSchema.php:578— EmailsSettingsSchema.validate_field_value has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, loops 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Controller.validate_setting_value (cognitive 19) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:258— Controller.validate_setting_value has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
ListTable.prepare_items (cognitive 19) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Admin/ListTable.php:324— ListTable.prepare_items has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, ternaries 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PHPMailer.parseAddresses (cognitive 19) wp-includes/PHPMailer/PHPMailer.php:1299— PHPMailer.parseAddresses has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 1 (4 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PHPMailer.mailSend (cognitive 19) wp-includes/PHPMailer/PHPMailer.php:2080— PHPMailer.mailSend has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PHPMailer.encodeHeader (cognitive 19) wp-includes/PHPMailer/PHPMailer.php:3706— PHPMailer.encodeHeader has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2, match/switch 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wp-signup.show_blog_form (cognitive 19) wp-signup.php:120— wp-signup.show_blog_form has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
(anonymous) (cognitive 19) wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-classes.js:3— (anonymous) has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 2, ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 19 function items inside it that branch (onSaveResponse, onConfigureShippingClassSubmitted, a function literal at line 139, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
WC_Admin_Setup_Wizard.shipping_method_selection_form (cognitive 18) REDACTED:913— WC_Admin_Setup_Wizard.shipping_method_selection_form has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (10 pts), loops 4 (5 pts), if/else 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Helper_Updater.transient_update_plugins (cognitive 18) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper-updater.php:75— WC_Helper_Updater.transient_update_plugins has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Helper_Updater.get_updates_count (cognitive 18) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper-updater.php:714— WC_Helper_Updater.get_updates_count has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Helper._get_return_notices (cognitive 18) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:605— WC_Helper._get_return_notices has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 7 (13 pts), boolean chains 2, if/else 1 (2 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Tax_Rate_Importer.import (cognitive 18) REDACTED:136— WC_Tax_Rate_Importer.import has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 3 (10 pts), if/else 4 (5 pts), loops 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_AJAX.tax_rates_save_changes (cognitive 18) REDACTED:3229— WC_AJAX.tax_rates_save_changes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Cache_Helper.geolocation_ajax_redirect (cognitive 18) wp-content/plugins/woocommerce/includes/class-wc-cache-helper.php:194— WC_Cache_Helper.geolocation_ajax_redirect has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 7, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Cart_Totals.calculate_discounts (cognitive 18) wp-content/plugins/woocommerce/includes/class-wc-cart-totals.php:773— WC_Cart_Totals.calculate_discounts has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Discounts.validate_coupon_excluded_product_categories (cognitive 18) wp-content/plugins/woocommerce/includes/class-wc-discounts.php:1002— WC_Discounts.validate_coupon_excluded_product_categories has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Geo_IP._common_get_record (cognitive 18) wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1378— WC_Geo_IP._common_get_record has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), loops 6 (8 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Order_Item_Product.set_taxes (cognitive 18) wp-content/plugins/woocommerce/includes/class-wc-order-item-product.php:177— WC_Order_Item_Product.set_taxes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Privacy_Exporters.get_order_personal_data (cognitive 18) wp-content/plugins/woocommerce/includes/class-wc-privacy-exporters.php:246— WC_Privacy_Exporters.get_order_personal_data has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (6 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_Variation_Data_Store_CPT.update (cognitive 18) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variation-data-store-cpt.php:184— WC_Product_Variation_Data_Store_CPT.update has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 3 (6 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_Importer.process_item (cognitive 18) wp-content/plugins/woocommerce/includes/import/abstract-wc-product-importer.php:227— WC_Product_Importer.process_item has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
WP_Background_Process.handle (cognitive 18) wp-content/plugins/woocommerce/includes/libraries/wp-background-process.php:294— WP_Background_Process.handle has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Products_V1_Controller.query_args (cognitive 18) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:144— WC_REST_Products_V1_Controller.query_args has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Shortcode_Products.set_attributes_query_args (cognitive 18) wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-products.php:286— WC_Shortcode_Products.set_attributes_query_args has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 2 (4 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-product-functions.wc_get_price_excluding_tax (cognitive 18) wp-content/plugins/woocommerce/includes/wc-product-functions.php:1588— wc-product-functions.wc_get_price_excluding_tax has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 3 (4 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Controller.format_data_value (cognitive 18) wp-content/plugins/woocommerce/src/Admin/API/Reports/PerformanceIndicators/Controller.php:547— Controller.format_data_value has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DPDShippingProvider.try_parse_tracking_number (cognitive 18) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/DPDShippingProvider.php:394— DPDShippingProvider.try_parse_tracking_number has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EvriHermesShippingProvider.try_parse_tracking_number (cognitive 18) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/EvriHermesShippingProvider.php:100— EvriHermesShippingProvider.try_parse_tracking_number has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UPSShippingProvider.try_parse_tracking_number (cognitive 18) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/UPSShippingProvider.php:114— UPSShippingProvider.try_parse_tracking_number has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (8 pts), boolean chains 5, if/else 3 (4 pts), loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LaunchYourStore.save_site_visibility_options (cognitive 18) wp-content/plugins/woocommerce/src/Admin/Features/LaunchYourStore.php:37— LaunchYourStore.save_site_visibility_options has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 2 (6 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
OrderTraits.get_item_shipping_tax_amount (cognitive 18) wp-content/plugins/woocommerce/src/Admin/Overrides/OrderTraits.php:62— OrderTraits.get_item_shipping_tax_amount has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 3 (7 pts), loops 2 (6 pts), if/else 3 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MiniCart.append_script_and_deps_src (cognitive 18) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/MiniCart.php:392— MiniCart.append_script_and_deps_src has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, loops 1 (2 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProductDetails.validate_hooked_blocks (cognitive 18) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductDetails.php:360— ProductDetails.validate_hooked_blocks has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ShippingController.show_local_pickup_details (cognitive 18) wp-content/plugins/woocommerce/src/Blocks/Shipping/ShippingController.php:95— ShippingController.show_local_pickup_details has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProductsQuery.execute (cognitive 18) wp-content/plugins/woocommerce/src/Internal/Abilities/Domain/ProductsQuery.php:76— ProductsQuery.execute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, ternaries 3, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Reviews.get_bulk_action_notice_messages (cognitive 18) wp-content/plugins/woocommerce/src/Internal/Admin/ProductReviews/Reviews.php:421— Reviews.get_bulk_action_notice_messages has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (11 pts), if/else 7 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Payments.maybe_track_providers_state_change (cognitive 18) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Payments.php:542— Payments.maybe_track_providers_state_change has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PaymentsController.store_has_providers_with_incentive (cognitive 18) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsController.php:251— PaymentsController.store_has_providers_with_incentive has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, error handling 1, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WooPaymentsService.onboarding_test_account_init (cognitive 18) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:952— WooPaymentsService.onboarding_test_account_init has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, loops 1 (2 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WCAdminAssets.register_scripts (cognitive 18) wp-content/plugins/woocommerce/src/Internal/Admin/WCAdminAssets.php:309— WCAdminAssets.register_scripts has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (7 pts), if/else 3 (5 pts), error handling 2 (4 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProductsController.migrate_products (cognitive 18) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/ProductsController.php:119— ProductsController.migrate_products has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
WCEmailTemplateChangeSummary.summarize (cognitive 18) wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:136— WCEmailTemplateChangeSummary.summarize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 5, error handling 1, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
OrderActionsRestController.send_email (cognitive 18) wp-content/plugins/woocommerce/src/Internal/Orders/OrderActionsRestController.php:502— OrderActionsRestController.send_email has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 1 (2 pts), loops 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PushTokenValidator.validate_token (cognitive 18) wp-content/plugins/woocommerce/src/Internal/PushNotifications/Validators/PushTokenValidator.php:342— PushTokenValidator.validate_token has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 8 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Controller.add_embed_context_to_schema_property (cognitive 18) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:2207— Controller.add_embed_context_to_schema_property has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Controller.update_item (cognitive 18) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Controller.php:174— Controller.update_item has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, loops 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
GeneralSettingsSchema.get_field_options (cognitive 18) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Schema/GeneralSettingsSchema.php:255— GeneralSettingsSchema.get_field_options has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (8 pts), boolean chains 1, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
OrderAttributionMeta.get_origin_label (cognitive 18) wp-content/plugins/woocommerce/src/Internal/Traits/OrderAttributionMeta.php:276— OrderAttributionMeta.get_origin_label has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
jquery.flot.time.formatDate (cognitive 18) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.time.js:31— jquery.flot.time.formatDate has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), match/switch 1 (3 pts), loops 1, ternaries 1 (nesting depth added 5). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
jquery.qrcode.QRCode.createBytes (cognitive 18) wp-content/plugins/woocommerce/assets/js/jquery-qrcode/jquery.qrcode.js:413— jquery.qrcode.QRCode.createBytes has cognitive complexity 18 (threshold 15). Drivers by points: loops 8 (12 pts), if/else 2 (6 pts) (nesting depth added 8). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
js.cookie.init (cognitive 18) wp-content/plugins/woocommerce/assets/js/js-cookie/js.cookie.js:44— js.cookie.init has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 2, error handling 1 (2 pts), loops 2, ternaries 2 (nesting depth added 4). None of this is in the body itself: all 18 points belong to 2 function items inside it that branch (get, set). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
free.icon (cognitive 18) wp-content/themes/monoka/assets/font-awesome/js/free.js:4267— free.icon has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 11, if/else 4 (5 pts), boolean chains 2 (nesting depth added 1). Of this number, 12 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
pro.icon (cognitive 18) wp-content/themes/monoka/assets/font-awesome/js/pro.js:2529— pro.icon has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 11, if/else 4 (5 pts), boolean chains 2 (nesting depth added 1). Of this number, 12 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
closest (cognitive 18) REDACTED:896— closest has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 2 (6 pts), boolean chains 3 (nesting depth added 6). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 904). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
Autoplay (cognitive 18) REDACTED:2618— Autoplay has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 6 (nesting depth added 1). None of this is in the body itself: all 18 points belong to 8 function literals inside it that branch (lines 2659, 2672, 2687, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
acf-field-group-functions.acf_get_field_group_visibility (cognitive 17) wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-group-functions.php:436— acf-field-group-functions.acf_get_field_group_visibility has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (5 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Abstract_Order.get_items (cognitive 17) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:950— WC_Abstract_Order.get_items has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (9 pts), ternaries 1 (5 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_Admin_Status.scan_template_files (cognitive 17) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-status.php:213— WC_Admin_Status.scan_template_files has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (7 pts), ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Helper.get_local_woo_plugins (cognitive 17) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1616— WC_Helper.get_local_woo_plugins has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Report_Downloads.output_report (cognitive 17) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-downloads.php:59— WC_Report_Downloads.output_report has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 1 (2 pts), match/switch 1 (2 pts), loops 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Brands.output_product_brand (cognitive 17) wp-content/plugins/woocommerce/includes/class-wc-brands.php:536— WC_Brands.output_product_brand has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 2 (6 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Brands.output_product_brand_list (cognitive 17) wp-content/plugins/woocommerce/includes/class-wc-brands.php:601— WC_Brands.output_product_brand_list has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (4 pts), ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Form_Handler.add_to_cart_handler_variable (cognitive 17) wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:982— WC_Form_Handler.add_to_cart_handler_variable has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, ternaries 3 (4 pts), loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Install.create_terms (cognitive 17) wp-content/plugins/woocommerce/includes/class-wc-install.php:1564— WC_Install.create_terms has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_Attribute.get_terms (cognitive 17) wp-content/plugins/woocommerce/includes/class-wc-product-attribute.php:76— WC_Product_Attribute.get_terms has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 1 (4 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (WC_Product_Attribute.get_slugs) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
WC_Product_Attribute.get_slugs (cognitive 17) wp-content/plugins/woocommerce/includes/class-wc-product-attribute.php:105— WC_Product_Attribute.get_slugs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 1 (4 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (WC_Product_Attribute.get_terms) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
WC_Product_Grouped.get_price_html (cognitive 17) wp-content/plugins/woocommerce/includes/class-wc-product-grouped.php:93— WC_Product_Grouped.get_price_html has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Shortcodes.product_categories (cognitive 17) wp-content/plugins/woocommerce/includes/class-wc-shortcodes.php:155— WC_Shortcodes.product_categories has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 2 (4 pts), boolean chains 3, ternaries 2 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Template_Loader.get_template_loader_files (cognitive 17) wp-content/plugins/woocommerce/includes/class-wc-template-loader.php:198— WC_Template_Loader.get_template_loader_files has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Customer_Data_Store.update_user_meta (cognitive 17) wp-content/plugins/woocommerce/includes/data-stores/class-wc-customer-data-store.php:259— WC_Customer_Data_Store.update_user_meta has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3, boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_Data_Store_CPT.get_data_for_lookup_table (cognitive 17) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:2477— WC_Product_Data_Store_CPT.get_data_for_lookup_table has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 3 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Gateway_BACS.bank_details (cognitive 17) wp-content/plugins/woocommerce/includes/gateways/bacs/class-wc-gateway-bacs.php:312— WC_Gateway_BACS.bank_details has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (5 pts), ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_CSV_Importer.set_parsed_data (cognitive 17) wp-content/plugins/woocommerce/includes/import/class-wc-product-csv-importer.php:1055— WC_Product_CSV_Importer.set_parsed_data has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Taxes_V1_Controller.create_or_update_tax (cognitive 17) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:348— WC_REST_Taxes_V1_Controller.create_or_update_tax has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (6 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Webhooks_V1_Controller.update_item (cognitive 17) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php:390— WC_REST_Webhooks_V1_Controller.update_item has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
WC_REST_Orders_V2_Controller.get_formatted_item_data (cognitive 17) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:373— WC_REST_Orders_V2_Controller.get_formatted_item_data has cognitive complexity 17 (threshold 15). Drivers by points: loops 6 (8 pts), ternaries 1 (4 pts), if/else 1 (2 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
WC_Shortcode_Order_Tracking.output (cognitive 17) wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-order-tracking.php:33— WC_Shortcode_Order_Tracking.output has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-cart-functions.wc_clear_cart_after_payment (cognitive 17) wp-content/plugins/woocommerce/includes/wc-cart-functions.php:175— wc-cart-functions.wc_clear_cart_after_payment has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-order-functions.wc_downloadable_product_permissions (cognitive 17) wp-content/plugins/woocommerce/includes/wc-order-functions.php:465— wc-order-functions.wc_downloadable_product_permissions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (6 pts), loops 2 (6 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-order-functions.wc_update_coupon_usage_counts (cognitive 17) wp-content/plugins/woocommerce/includes/wc-order-functions.php:1008— wc-order-functions.wc_update_coupon_usage_counts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataStore.include_extended_info (cognitive 17) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php:183— DataStore.include_extended_info has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataStore.add_time_period_sql_params (cognitive 17) wp-content/plugins/woocommerce/src/Admin/API/Reports/DataStore.php:917— DataStore.add_time_period_sql_params has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InstalledExtensions.get_data (cognitive 17) REDACTED:20— InstalledExtensions.get_data has cognitive complexity 17 (threshold 15). Drivers by points: if/else 17. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SettingsSectionRegistry.is_reserved_checkout_section_id (cognitive 17) wp-content/plugins/woocommerce/src/Admin/Settings/SettingsSectionRegistry.php:201— SettingsSectionRegistry.is_reserved_checkout_section_id has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MetadataController.get_value_scalar (cognitive 17) wp-content/plugins/woocommerce/src/Api/Infrastructure/MetadataController.php:354— MetadataController.get_value_scalar has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SchemaHandle.find_metadata (cognitive 17) wp-content/plugins/woocommerce/src/Api/Utils/SchemaHandle.php:152— SchemaHandle.find_metadata has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CheckoutExpressPaymentBlock.sync_express_payment_attrs (cognitive 17) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/CheckoutExpressPaymentBlock.php:53— CheckoutExpressPaymentBlock.sync_express_payment_attrs has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 7, error handling 1, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ProductFilterAttribute.get_default_product_attribute (cognitive 17) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:328— ProductFilterAttribute.get_default_product_attribute has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (7 pts), loops 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
SingleProductTemplate.update_single_product_content (cognitive 17) wp-content/plugins/woocommerce/src/Blocks/Templates/SingleProductTemplate.php:114— SingleProductTemplate.update_single_product_content has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 3 (nesting depth added 8). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ProductAbilityTrait.prepare_product_field_value (cognitive 17) wp-content/plugins/woocommerce/src/Internal/Abilities/Domain/Traits/ProductAbilityTrait.php:595— ProductAbilityTrait.prepare_product_field_value has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AbstractAutomatticAddressProvider.load_jwt (cognitive 17) wp-content/plugins/woocommerce/src/Internal/AddressProvider/AbstractAutomatticAddressProvider.php:61— AbstractAutomatticAddressProvider.load_jwt has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 6, ternaries 1 (2 pts), error handling 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
OnboardingSetupWizard.do_admin_redirects (cognitive 17) wp-content/plugins/woocommerce/src/Internal/Admin/Onboarding/OnboardingSetupWizard.php:88— OnboardingSetupWizard.do_admin_redirects has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 7, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PaymentsProviders.get_payment_gateway_provider_instance (cognitive 17) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders.php:361— PaymentsProviders.get_payment_gateway_provider_instance has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WooPaymentsService.disable_test_account (cognitive 17) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:1491— WooPaymentsService.disable_test_account has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6, ternaries 4 (6 pts), boolean chains 4, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Utils.order_map_move_at_order (cognitive 17) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/Utils.php:61— Utils.order_map_move_at_order has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProductsCommand.handle_count_request (cognitive 17) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Commands/ProductsCommand.php:158— ProductsCommand.handle_count_request has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProductsController.execute_migration_loop (cognitive 17) wp-content/plugins/woocommerce/src/Internal/CLI/Migrator/Core/ProductsController.php:238— ProductsController.execute_migration_loop has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 2, error handling 1 (2 pts), ternaries 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrdersTableDataStore.get_post_orders_for_ids (cognitive 17) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:1556— OrdersTableDataStore.get_post_orders_for_ids has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 4 (5 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrdersTableDataStore.delete (cognitive 17) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:2474— OrdersTableDataStore.delete has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (17 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WCEmailTemplateAutoApplier.apply_to_post (cognitive 17) wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateAutoApplier.php:93— WCEmailTemplateAutoApplier.apply_to_post has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
WPPostsImporter.register_product_attribute_taxonomies (cognitive 17) wp-content/plugins/woocommerce/src/Internal/Integrations/WPPostsImporter.php:31— WPPostsImporter.register_product_attribute_taxonomies has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Endpoint.maybe_create_host_page (cognitive 17) wp-content/plugins/woocommerce/src/Internal/OrderReviews/Endpoint.php:98— Endpoint.maybe_create_host_page has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SubmissionHandler.handle (cognitive 17) wp-content/plugins/woocommerce/src/Internal/OrderReviews/SubmissionHandler.php:59— SubmissionHandler.handle has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 5, ternaries 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AbstractPaymentGatewaySettingsSchema.build_fields_from_form_fields (cognitive 17) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/PaymentGateways/Schema/AbstractPaymentGatewaySettingsSchema.php:404— AbstractPaymentGatewaySettingsSchema.build_fields_from_form_fields has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CheckoutSessionsUpdate.get_route_post_response (cognitive 17) wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Agentic/CheckoutSessionsUpdate.php:170— CheckoutSessionsUpdate.get_route_post_response has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (5 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrderController.validate_coupons (cognitive 17) wp-content/plugins/woocommerce/src/StoreApi/Utilities/OrderController.php:255— OrderController.validate_coupons has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 3 (7 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PHPMailer.addOrEnqueueAnAddress (cognitive 17) wp-includes/PHPMailer/PHPMailer.php:1141— PHPMailer.addOrEnqueueAnAddress has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PHPMailer.addAnAddress (cognitive 17) wp-includes/PHPMailer/PHPMailer.php:1223— PHPMailer.addAnAddress has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AbstractOpenAiCompatibleTextGenerationModel.prepareGenerateTextParams (cognitive 17) wp-includes/php-ai-client/src/Providers/OpenAiCompatibleImplementation/AbstractOpenAiCompatibleTextGenerationModel.php:92— AbstractOpenAiCompatibleTextGenerationModel.prepareGenerateTextParams has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (16 pts), loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
AbstractOpenAiCompatibleTextGenerationModel.getMessagePartContentData (cognitive 17) wp-includes/php-ai-client/src/Providers/OpenAiCompatibleImplementation/AbstractOpenAiCompatibleTextGenerationModel.php:227— AbstractOpenAiCompatibleTextGenerationModel.getMessagePartContentData has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (17 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wp-login.login_footer (cognitive 17) REDACTED:325— wp-login.login_footer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
add-to-cart-variation.$.fn.wc_variations_image_update (cognitive 17) wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart-variation.js:992— add-to-cart-variation.$.fn.wc_variations_image_update has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
buildQuicktags (cognitive 17) REDACTED:8479— buildQuicktags has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
options (cognitive 17) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:1035— options has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 2 (nesting depth added 8). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
(anonymous) (cognitive 17) wp-content/plugins/woocommerce/assets/js/admin/meta-boxes.js:1— (anonymous) has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 3, boolean chains 1 (nesting depth added 1). None of this is in the body itself: all 17 points belong to 16 function items inside it that branch (maybe_disable_save_button, a function literal at line 9, a function literal at line 104, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
onTree (cognitive 17) wp-content/themes/monoka/assets/font-awesome/js/pro.js:2148— onTree has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 3, ternaries 2, boolean chains 1 (nesting depth added 3). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 2185, a function literal at line 2202, a function literal at line 2204, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
acf-field-functions.acf_render_field_wrap (cognitive 16) wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:632— acf-field-functions.acf_render_field_wrap has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
acf-field-group-functions.acf_import_field_group (cognitive 16) wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-group-functions.php:998— acf-field-group-functions.acf_import_field_group has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Abstract_Order.calculate_totals (cognitive 16) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:2013— WC_Abstract_Order.calculate_totals has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 5 (7 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Background_Process.handle (cognitive 16) wp-content/plugins/woocommerce/includes/abstracts/class-wc-background-process.php:95— WC_Background_Process.handle has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Admin_Menus.menu_order_count (cognitive 16) wp-content/plugins/woocommerce/includes/admin/class-wc-admin-menus.php:271— WC_Admin_Menus.menu_order_count has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 1 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_Admin.preview_emails (cognitive 16) wp-content/plugins/woocommerce/includes/admin/class-wc-admin.php:221— WC_Admin.preview_emails has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 2 (6 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Helper.get_local_woo_themes (cognitive 16) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:1681— WC_Helper.get_local_woo_themes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Report_Taxes_By_Code.get_main_chart (cognitive 16) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-code.php:77— WC_Report_Taxes_By_Code.get_main_chart has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (7 pts), if/else 3 (4 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-meta-box-functions.woocommerce_wp_textarea_input (cognitive 16) wp-content/plugins/woocommerce/includes/admin/wc-meta-box-functions.php:120— wc-meta-box-functions.woocommerce_wp_textarea_input has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8, boolean chains 3, if/else 3, loops 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Customer.has_full_shipping_address (cognitive 16) wp-content/plugins/woocommerce/includes/class-wc-customer.php:287— WC_Customer.has_full_shipping_address has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, ternaries 2 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Deprecated_Action_Hooks.trigger_hook (cognitive 16) wp-content/plugins/woocommerce/includes/class-wc-deprecated-action-hooks.php:119— WC_Deprecated_Action_Hooks.trigger_hook has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 1, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
WC_Discounts.validate_coupon_product_categories (cognitive 16) wp-content/plugins/woocommerce/includes/class-wc-discounts.php:835— WC_Discounts.validate_coupon_product_categories has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Form_Handler.cancel_order (cognitive 16) wp-content/plugins/woocommerce/includes/class-wc-form-handler.php:792— WC_Form_Handler.cancel_order has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (6 pts), ternaries 1 (2 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
WC_Install.install_actions (cognitive 16) wp-content/plugins/woocommerce/includes/class-wc-install.php:589— WC_Install.install_actions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 1 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
WC_Order.get_refunds (cognitive 16) wp-content/plugins/woocommerce/includes/class-wc-order.php:2207— WC_Order.get_refunds has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (4 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Product_Variable.get_available_variation (cognitive 16) wp-content/plugins/woocommerce/includes/class-wc-product-variable.php:413— WC_Product_Variable.get_available_variation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 5, ternaries 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Product_Data_Store_CPT.create_all_product_variations (cognitive 16) wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:1558— WC_Product_Data_Store_CPT.create_all_product_variations has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Gateway_COD.load_shipping_method_options (cognitive 16) wp-content/plugins/woocommerce/includes/gateways/cod/class-wc-gateway-cod.php:242— WC_Gateway_COD.load_shipping_method_options has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (7 pts), if/else 2 (5 pts), ternaries 1 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Customers_V1_Controller.update_customer_meta_fields (cognitive 16) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:693— WC_REST_Customers_V1_Controller.update_customer_meta_fields has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Orders_V2_Controller.prepare_objects_query (cognitive 16) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:616— WC_REST_Orders_V2_Controller.prepare_objects_query has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_REST_Product_Reviews_Controller.prepare_item_for_response (cognitive 16) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:691— WC_REST_Product_Reviews_Controller.prepare_item_for_response has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, ternaries 2 (3 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Shipping_Legacy_Flat_Rate.calculate_shipping (cognitive 16) wp-content/plugins/woocommerce/includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php:194— WC_Shipping_Legacy_Flat_Rate.calculate_shipping has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-page-functions.wc_nav_menu_items (cognitive 16) wp-content/plugins/woocommerce/includes/wc-page-functions.php:176— wc-page-functions.wc_nav_menu_items has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
wc-term-functions.wc_change_term_counts (cognitive 16) wp-content/plugins/woocommerce/includes/wc-term-functions.php:574— wc-term-functions.wc_change_term_counts has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WC_Widget_Price_Filter.widget (cognitive 16) wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-price-filter.php:70— WC_Widget_Price_Filter.widget has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 5, ternaries 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WC_Widget_Rating_Filter.widget (cognitive 16) wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-rating-filter.php:89— WC_Widget_Rating_Filter.widget has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (5 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Themes.upload_theme (cognitive 16) wp-content/plugins/woocommerce/src/Admin/API/Themes.php:75— Themes.upload_theme has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 6, ternaries 1 (3 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RedirectionController.is_product_supported (cognitive 16) wp-content/plugins/woocommerce/src/Admin/Features/ProductBlockEditor/RedirectionController.php:62— RedirectionController.is_product_supported has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 3, ternaries 2 (3 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProductMapper.slice_variation_ids (cognitive 16) wp-content/plugins/woocommerce/src/Api/Utils/Products/ProductMapper.php:150— ProductMapper.slice_variation_ids has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 5, ternaries 3 (4 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
VariationSelectorAttribute.replace_legacy_attribute_options_block (cognitive 16) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/VariationSelectorAttribute.php:159— VariationSelectorAttribute.replace_legacy_attribute_options_block has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 5, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VariationSelectorAttribute.get_default_selected_attribute (cognitive 16) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/VariationSelectorAttribute.php:254— VariationSelectorAttribute.get_default_selected_attribute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProductUpdate.execute (cognitive 16) wp-content/plugins/woocommerce/src/Internal/Abilities/Domain/ProductUpdate.php:76— ProductUpdate.execute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 3, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
PaymentGateway.get_settings_url (cognitive 16) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/PaymentGateway.php:756— PaymentGateway.get_settings_url has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WooPayments.get_onboarding_url (cognitive 16) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments.php:418— WooPayments.get_onboarding_url has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 6 (7 pts), ternaries 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SettingsUISchema.transform_legacy_field (cognitive 16) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/SettingsUISchema.php:147— SettingsUISchema.transform_legacy_field has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 6, ternaries 2, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
LegacyDataHandler.build_sql_query_for_cleanup (cognitive 16) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/LegacyDataHandler.php:91— LegacyDataHandler.build_sql_query_for_cleanup has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 2 (3 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrdersTableDataStore.read_multiple (cognitive 16) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:1351— OrdersTableDataStore.read_multiple has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrdersTableDataStore.update (cognitive 16) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:2899— OrdersTableDataStore.update has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 6, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
EmailApiController.save_email_data (cognitive 16) wp-content/plugins/woocommerce/src/Internal/EmailEditor/EmailApiController.php:101— EmailApiController.save_email_data has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
SubmissionHandler.maybe_mark_order_complete (cognitive 16) wp-content/plugins/woocommerce/src/Internal/OrderReviews/SubmissionHandler.php:292— SubmissionHandler.maybe_mark_order_complete has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 3, boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CLIRunner.regenerate_core (cognitive 16) wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/CLIRunner.php:373— CLIRunner.regenerate_core has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Filterer.get_product_counts_query_using_lookup_table (cognitive 16) wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/Filterer.php:229— Filterer.get_product_counts_query_using_lookup_table has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 1 (3 pts), ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FilterData.get_hierarchical_taxonomy_counts (cognitive 16) wp-content/plugins/woocommerce/src/Internal/ProductFilters/FilterData.php:386— FilterData.get_hierarchical_taxonomy_counts has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataUtils.calculate_refund_amount (cognitive 16) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/DataUtils.php:140— DataUtils.calculate_refund_amount has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Controller.update_item (cognitive 16) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:156— Controller.update_item has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, loops 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AbstractPaymentGatewaySettingsSchema.validate_field_value (cognitive 16) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/PaymentGateways/Schema/AbstractPaymentGatewaySettingsSchema.php:647— AbstractPaymentGatewaySettingsSchema.validate_field_value has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CodGatewaySettingsSchema.load_shipping_method_options (cognitive 16) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/PaymentGateways/Schema/CodGatewaySettingsSchema.php:108— CodGatewaySettingsSchema.load_shipping_method_options has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (7 pts), if/else 2 (5 pts), ternaries 1 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SignupService.parse_posted_attributes (cognitive 16) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Frontend/SignupService.php:420— SignupService.parse_posted_attributes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RestApiCache.store_cached_response (cognitive 16) wp-content/plugins/woocommerce/src/Internal/Traits/RestApiCache.php:1472— RestApiCache.store_cached_response has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ArrayUtil.merge_by_key (cognitive 16) wp-content/plugins/woocommerce/src/Internal/Utilities/ArrayUtil.php:51— ArrayUtil.merge_by_key has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (6 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
URL.get_parent_url (cognitive 16) wp-content/plugins/woocommerce/src/Internal/Utilities/URL.php:254— URL.get_parent_url has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 7, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BillingAddressSchema.get_item_response (cognitive 16) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/BillingAddressSchema.php:94— BillingAddressSchema.get_item_response has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ShippingAddressSchema.get_item_response (cognitive 16) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ShippingAddressSchema.php:35— ShippingAddressSchema.get_item_response has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OrderController.validate_address_fields (cognitive 16) wp-content/plugins/woocommerce/src/StoreApi/Utilities/OrderController.php:472— OrderController.validate_address_fields has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 5, if/else 3 (5 pts), loops 3 (4 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CallbackUtil.get_callback_signature (cognitive 16) wp-content/plugins/woocommerce/src/Utilities/CallbackUtil.php:24— CallbackUtil.get_callback_signature has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), error handling 2 (4 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PHPMailer.replaceCustomHeader (cognitive 16) wp-includes/PHPMailer/PHPMailer.php:4371— PHPMailer.replaceCustomHeader has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
jquery-ui-timepicker-addon.$.timepicker.handleRange (cognitive 16) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:2166— jquery-ui-timepicker-addon.$.timepicker.handleRange has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3 (nesting depth added 3). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 2 function items inside it that branch (selected, checkDates). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
post.$().on("heartbeat-send.refresh-lock").on("heartbeat-tick.refresh-lock") (cognitive 16) wp-content/plugins/classic-editor/scripts/post.js:184— post.$().on("heartbeat-send.refresh-lock").on("heartbeat-tick.refresh-lock") has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 1 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
jquery.flot.time.init (cognitive 16) wp-content/plugins/woocommerce/assets/js/jquery-flot/jquery.flot.time.js:197— jquery.flot.time.init has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 15, if/else 1. None of this is in the body itself: all 16 points belong to 3 function literals inside it that branch (lines 199, 204, 358). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
free.makeInlineSvgAbstract (cognitive 16) wp-content/themes/monoka/assets/font-awesome/js/free.js:2918— free.makeInlineSvgAbstract has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, ternaries 6, if/else 4. Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
free.onTree (cognitive 16) wp-content/themes/monoka/assets/font-awesome/js/free.js:3898— free.onTree has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 2, ternaries 2, boolean chains 1 (nesting depth added 3). Of this number, 8 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
pro.makeInlineSvgAbstract (cognitive 16) wp-content/themes/monoka/assets/font-awesome/js/pro.js:975— pro.makeInlineSvgAbstract has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, ternaries 6, if/else 4. Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
pro.resolveCustomIconVersion (cognitive 16) wp-content/themes/monoka/assets/font-awesome/js/pro.js:1952— pro.resolveCustomIconVersion has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 5, ternaries 2 (nesting depth added 4). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
update (cognitive 16) REDACTED:3083— update has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 4, loops 1 (2 pts), ternaries 1 (nesting depth added 6). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
registerAddressAutocompleteProvider (cognitive 16) wp-content/plugins/woocommerce/assets/js/frontend/utils/address-autocomplete-common.js:51— registerAddressAutocompleteProvider has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 6, error handling 1. Of this number, 13 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D4 · Code Duplication· Near-duplicate member family (5 members, 44 shared lines) · ×1
Near-duplicate member family (5 members, 44 shared lines) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:161— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:161-247 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Controller.php:175-289 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:157-248 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Controller.php:149-225 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Controller.php:141-226 — These 5 members are variants of one another: a block of 44 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Near-duplicate member family (4 members, 258 shared lines) · ×1
Near-duplicate member family (4 members, 258 shared lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1091— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1091-1366 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1071-1440 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:733-1170 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1003-1440 — These 4 members are variants of one another: a block of 258 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Near-duplicate member family (4 members, 46 shared lines) · ×1
Near-duplicate member family (4 members, 46 shared lines) wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Controller.php:412— wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Controller.php:412-683 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Stats/Controller.php:190-412 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Controller.php:234-411 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Controller.php:204-386 — These 4 members are variants of one another: a block of 46 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Near-duplicate member family (3 members, 75 shared lines) · ×1
Near-duplicate member family (3 members, 75 shared lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1378— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1378-1550 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:379-577 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:201-445 — These 3 members are variants of one another: a block of 75 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
Near-duplicate member pair (82 shared lines) wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:319— wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:319-446 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php:122-269 — These two members are variants of one another: 82 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (50 shared lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterCheckboxList.php:38— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterCheckboxList.php:38-244 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterChips.php:47-221 — These two members are variants of one another: 50 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (43 shared lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:801— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:801-854 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php:254-326 — These two members are variants of one another: 43 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (96 corresponding lines) · ×1
Edited copy of a member (96 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:569— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:569-706 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:957-1064 — These two members are one piece of code written twice and then edited apart: 96 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Members sharing a duplicated core (33 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (33 members, 50+ identical tokens) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:153— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:153-221 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customer-downloads-v1-controller.php:109-132 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:642-684 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:340-363 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php:124-230 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:133-364 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attribute-terms-v1-controller.php:138-166 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:426-452 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-categories-v1-controller.php:55-104 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:443-469 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-shipping-classes-v1-controller.php:54-79 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-tags-v1-controller.php:54-79 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:610-642 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-report-sales-v1-controller.php:98-237 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:551-585 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhook-deliveries-v1-controller.php:170-187 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php:561-596 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-coupons-v2-controller.php:220-237 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-customer-downloads-v2-controller.php:36-66 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-customers-v2-controller.php:104-120 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-notes-v2-controller.php:90-114 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php:197-229 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php:257-283 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-categories-v2-controller.php:37-88 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-reviews-v2-controller.php:81-108 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:291-353 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-methods-v2-controller.php:146-168 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-webhook-deliveries-v2-controller.php:37-55 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-webhooks-v2-controller.php:36-73 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-notes-controller.php:36-61 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-payment-gateways-controller.php:36-63 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-categories-controller.php:37-88 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-refunds-controller.php:98-113 — These 33 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 33 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 33 times.
D4 · Code Duplication· Members sharing a duplicated core (14 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (14 members, 50+ identical tokens) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:288— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:288-357 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php:308-406 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Categories/Controller.php:54-68 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Controller.php:53-63 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Controller.php:40-53 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Controller.php:56-103 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Stats/Controller.php:45-81 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/Controller.php:39-59 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Controller.php:53-80 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Controller.php:53-86 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Revenue/Stats/Controller.php:45-58 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Stock/Controller.php:55-84 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/Controller.php:58-68 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/Stats/Controller.php:70-83 — These 14 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 14 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 14 times.
D4 · Code Duplication· Members sharing a duplicated core (10 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (10 members, 50+ identical tokens) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:344— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:344-431 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:228-338 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php:242-302 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:394-447 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php:308-406 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-custom-fields-controller.php:70-125 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php:279-388 | wp-content/plugins/woocommerce/src/Admin/API/MarketingCampaigns.php:91-132 | wp-content/plugins/woocommerce/src/Admin/API/Reports/GenericController.php:72-96 | wp-content/plugins/woocommerce/src/Admin/API/Taxes.php:58-156 — These 10 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 10 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 10 times.
D4 · Code Duplication· Members sharing a duplicated core (8 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (8 members, 50+ identical tokens) wp-content/plugins/woocommerce/src/Internal/Admin/Notes/InstallJPAndWCSPlugins.php:50— wp-content/plugins/woocommerce/src/Internal/Admin/Notes/InstallJPAndWCSPlugins.php:50-65 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/LaunchChecklist.php:36-58 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/MobileApp.php:36-51 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/PaymentsMoreInfoNeeded.php:63-78 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/PaymentsRemindMeLater.php:63-78 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/PersonalizeStore.php:36-61 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/RealTimeOrderAlerts.php:36-55 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/TrackingOptIn.php:44-74 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication· Edited copy of a member (74 corresponding lines) · ×1
Edited copy of a member (74 corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:256— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:256-329 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Segmenter.php:349-436 — These two members are one piece of code written twice and then edited apart: 74 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (92 corresponding lines) · ×1
Edited copy of a member (92 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1643— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1643-1734 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1700-1829 — These two members are one piece of code written twice and then edited apart: 92 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (64 corresponding lines) · ×1
Edited copy of a member (64 corresponding lines) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-widget.php:325— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-widget.php:325-388 | REDACTED:216-286 — These two members are one piece of code written twice and then edited apart: 64 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (115 corresponding lines) · ×1
Edited copy of a member (115 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php:78— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php:78-201 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRatingCounter.php:78-192 — These two members are one piece of code written twice and then edited apart: 115 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (58 corresponding lines) · ×1
Edited copy of a member (58 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:240— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:240-301 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-coupons-v2-controller.php:280-337 — These two members are one piece of code written twice and then edited apart: 58 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 64+ corresponding lines) · ×1
Edited copies of one member (3 members, 64+ corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:598— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:598-698 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:457-522 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php:416-479 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 64 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (49 corresponding lines) · ×1
Edited copy of a member (49 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:2050— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:2050-2098 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:2454-2510 — These two members are one piece of code written twice and then edited apart: 49 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (63 corresponding lines) · ×1
Edited copy of a member (63 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:726— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:726-788 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-orders-controller.php:113-177 — These two members are one piece of code written twice and then edited apart: 63 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 78+ corresponding lines) · ×1
Edited copies of one member (3 members, 78+ corresponding lines) wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:412— wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:412-489 | wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/Filterer.php:60-152 | wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php:208-305 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 78 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (90 corresponding lines) · ×1
Edited copy of a member (90 corresponding lines) wp-content/plugins/advanced-custom-fields-pro/includes/api/api-helpers.php:1462— wp-content/plugins/advanced-custom-fields-pro/includes/api/api-helpers.php:1462-1581 | wp-content/plugins/advanced-custom-fields-pro/includes/api/api-term.php:172-261 — These two members are one piece of code written twice and then edited apart: 90 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (100 corresponding lines) · ×1
Edited copy of a member (100 corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:1107— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:1107-1215 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:1231-1330 — These two members are one piece of code written twice and then edited apart: 100 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (70 corresponding lines) · ×1
Edited copy of a member (70 corresponding lines) wp-content/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php:164— wp-content/plugins/woocommerce/includes/shipping/flat-rate/class-wc-shipping-flat-rate.php:164-233 | wp-content/plugins/woocommerce/includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php:195-277 — These two members are one piece of code written twice and then edited apart: 70 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (61 corresponding lines) · ×1
Edited copy of a member (61 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:1045— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:1045-1108 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/UpdateUtils.php:202-262 — These two members are one piece of code written twice and then edited apart: 61 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (78 corresponding lines) · ×1
Edited copy of a member (78 corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-emails.php:1008— wp-content/plugins/woocommerce/includes/class-wc-emails.php:1008-1089 | wp-content/plugins/woocommerce/includes/class-wc-emails.php:1099-1176 — These two members are one piece of code written twice and then edited apart: 78 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (192 corresponding lines) · ×1
Edited copy of a member (192 corresponding lines) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:378— wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:378-570 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:430-637 — These two members are one piece of code written twice and then edited apart: 192 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (47 corresponding lines) · ×1
Edited copy of a member (47 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:404— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:404-450 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:617-686 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 23+ corresponding lines) · ×1
Edited copies of one member (3 members, 23+ corresponding lines) wp-content/plugins/woocommerce/includes/class-wc-query.php:1042— wp-content/plugins/woocommerce/includes/class-wc-query.php:1042-1067 | wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:499-525 | wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php:557-579 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (60 corresponding lines) · ×1
Edited copy of a member (60 corresponding lines) wp-content/plugins/woocommerce/includes/data-stores/class-wc-coupon-data-store-cpt.php:550— wp-content/plugins/woocommerce/includes/data-stores/class-wc-coupon-data-store-cpt.php:550-612 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-coupon-data-store-cpt.php:650-709 — These two members are one piece of code written twice and then edited apart: 60 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 72+ corresponding lines) · ×1
Edited copies of one member (3 members, 72+ corresponding lines) wp-content/plugins/woocommerce/src/Admin/PluginsHelper.php:920— wp-content/plugins/woocommerce/src/Admin/PluginsHelper.php:920-995 | wp-content/plugins/woocommerce/src/Admin/PluginsHelper.php:1005-1082 | wp-content/plugins/woocommerce/src/Admin/PluginsHelper.php:1091-1162 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 72 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (109 corresponding lines) · ×1
Edited copy of a member (109 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1864— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1864-1972 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:2246-2375 — These two members are one piece of code written twice and then edited apart: 109 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (53 corresponding lines) · ×1
Edited copy of a member (53 corresponding lines) wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateAutoApplier.php:259— wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateAutoApplier.php:259-322 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateSyncBackfill.php:111-163 — These two members are one piece of code written twice and then edited apart: 53 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (82 corresponding lines) · ×1
Edited copy of a member (82 corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/SavedForLater.php:150— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/SavedForLater.php:150-244 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Wishlist.php:53-134 — These two members are one piece of code written twice and then edited apart: 82 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 33+ corresponding lines) · ×1
Edited copies of one member (3 members, 33+ corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:505— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:505-539 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php:465-497 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php:552-589 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 33 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 29+ corresponding lines) · ×1
Edited copies of one member (3 members, 29+ corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:350— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:350-379 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:875-904 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:793-821 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 29 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 32+ corresponding lines) · ×1
Edited copies of one member (6 members, 32+ corresponding lines) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:442— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:442-473 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:499-530 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:542-573 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:598-630 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:642-673 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:685-721 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 32 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 26+ corresponding lines) · ×1
Edited copies of one member (3 members, 26+ corresponding lines) wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:227— wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:227-256 | wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php:160-189 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQuery.php:467-492 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 46+ corresponding lines) · ×1
Edited copies of one member (3 members, 46+ corresponding lines) REDACTED:3404— REDACTED:3404-3467 | REDACTED:3476-3526 | REDACTED:3706-3751 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 46 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 47+ corresponding lines) · ×1
Edited copies of one member (4 members, 47+ corresponding lines) wp-content/plugins/woocommerce/src/Internal/ProductFilters/FilterData.php:129— wp-content/plugins/woocommerce/src/Internal/ProductFilters/FilterData.php:129-181 | wp-content/plugins/woocommerce/src/Internal/ProductFilters/FilterData.php:194-240 | wp-content/plugins/woocommerce/src/Internal/ProductFilters/FilterData.php:254-306 | wp-content/plugins/woocommerce/src/Internal/ProductFilters/FilterData.php:322-376 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 47 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 21+ corresponding lines) · ×1
Edited copies of one member (3 members, 21+ corresponding lines) wp-content/plugins/woocommerce/src/Gateways/PayPal/WebhookHandler.php:138— wp-content/plugins/woocommerce/src/Gateways/PayPal/WebhookHandler.php:138-163 | wp-content/plugins/woocommerce/src/Gateways/PayPal/WebhookHandler.php:175-195 | wp-content/plugins/woocommerce/src/Gateways/PayPal/WebhookHandler.php:207-231 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (54 corresponding lines) · ×1
Edited copy of a member (54 corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/Blueprint/Init.php:261— wp-content/plugins/woocommerce/src/Admin/Features/Blueprint/Init.php:261-326 | wp-content/plugins/woocommerce/src/Admin/Features/Blueprint/Init.php:336-389 — These two members are one piece of code written twice and then edited apart: 54 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (44 corresponding lines) · ×1
Edited copy of a member (44 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:401— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:401-452 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:700-743 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (43 corresponding lines) · ×1
Edited copy of a member (43 corresponding lines) wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:20— wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:20-65 | wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-group-functions.php:20-62 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (677 corresponding lines) · ×1
Edited copy of a member (677 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1179— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1179-1855 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1449-2170 — These two members are one piece of code written twice and then edited apart: 677 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 137+ corresponding lines) · ×1
Edited copies of one member (3 members, 137+ corresponding lines) wp-content/plugins/woocommerce/src/Internal/Features/ProductBlockEditor/ProductTemplates/ProductVariationTemplate.php:101— wp-content/plugins/woocommerce/src/Internal/Features/ProductBlockEditor/ProductTemplates/ProductVariationTemplate.php:101-272 | wp-content/plugins/woocommerce/src/Internal/Features/ProductBlockEditor/ProductTemplates/ProductVariationTemplate.php:279-415 | wp-content/plugins/woocommerce/src/Internal/Features/ProductBlockEditor/ProductTemplates/SimpleProductTemplate.php:533-671 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 137 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 91+ corresponding lines) · ×1
Edited copies of one member (4 members, 91+ corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Controller.php:221— wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Controller.php:221-311 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/Controller.php:198-288 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Controller.php:248-350 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Controller.php:202-302 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 91 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 69+ corresponding lines) · ×1
Edited copies of one member (3 members, 69+ corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/DHLShippingProvider.php:109— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/DHLShippingProvider.php:109-193 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/FedExShippingProvider.php:96-187 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/USPSShippingProvider.php:99-167 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 69 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 17+ corresponding lines) · ×1
Edited copies of one member (3 members, 17+ corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:503— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:503-519 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:692-714 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:781-800 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 18+ corresponding lines) · ×1
Edited copies of one member (6 members, 18+ corresponding lines) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:530— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:530-554 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:565-585 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:596-613 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:624-648 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:659-681 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:749-770 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 62+ corresponding lines) · ×1
Edited copies of one member (3 members, 62+ corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Notes.php:41— wp-content/plugins/woocommerce/src/Admin/API/Notes.php:41-141 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingProfile.php:46-144 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Import/Controller.php:33-94 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 62 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 37+ corresponding lines) · ×1
Edited copies of one member (3 members, 37+ corresponding lines) wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php:1140— wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php:1140-1176 | wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php:1258-1296 | wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php:1381-1423 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 37 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 20+ corresponding lines) · ×1
Edited copies of one member (5 members, 20+ corresponding lines) REDACTED:331— REDACTED:331-353 | REDACTED:362-385 | REDACTED:421-442 | REDACTED:528-547 | REDACTED:556-580 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 63+ corresponding lines) · ×1
Edited copies of one member (3 members, 63+ corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:984— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:984-1046 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php:709-776 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php:713-795 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 63 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 56+ corresponding lines) · ×1
Edited copies of one member (3 members, 56+ corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:728— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:728-783 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/AbstractTermsRoute.php:24-105 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/ProductReviews.php:173-239 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 56 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 10+ corresponding lines) · ×1
Edited copies of one member (6 members, 10+ corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:971— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:971-982 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:995-1006 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:1019-1031 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/UpdateUtils.php:399-408 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/UpdateUtils.php:421-430 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/UpdateUtils.php:443-455 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 13+ corresponding lines) · ×1
Edited copies of one member (5 members, 13+ corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-tax-classes-v1-controller.php:139— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-tax-classes-v1-controller.php:139-167 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php:123-136 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-methods-v2-controller.php:104-116 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-locations-v2-controller.php:56-75 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zones-v2-controller.php:113-129 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 24+ corresponding lines) · ×1
Edited copies of one member (4 members, 24+ corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:761— wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:761-785 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:795-820 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:874-900 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:964-987 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 30+ corresponding lines) · ×1
Edited copies of one member (3 members, 30+ corresponding lines) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentOrderNotes.php:162— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentOrderNotes.php:162-191 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentOrderNotes.php:204-233 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentOrderNotes.php:245-276 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 30 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 13+ corresponding lines) · ×1
Edited copies of one member (4 members, 13+ corresponding lines) wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-order.php:31— wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-order.php:31-43 | wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-order.php:55-68 | wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-order.php:78-94 | wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-order.php:109-125 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 11+ corresponding lines) · ×1
Edited copies of one member (4 members, 11+ corresponding lines) wp-content/plugins/woocommerce/includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php:93— wp-content/plugins/woocommerce/includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php:93-103 | wp-content/plugins/woocommerce/includes/shipping/legacy-free-shipping/class-wc-shipping-legacy-free-shipping.php:78-90 | wp-content/plugins/woocommerce/includes/shipping/legacy-local-delivery/class-wc-shipping-legacy-local-delivery.php:78-89 | wp-content/plugins/woocommerce/includes/shipping/legacy-local-pickup/class-wc-shipping-legacy-local-pickup.php:69-80 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 7+ corresponding lines) · ×1
Edited copies of one member (6 members, 7+ corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:928— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:928-934 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:944-950 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:960-966 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:169-175 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:185-191 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:201-207 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 9+ corresponding lines) · ×1
Edited copies of one member (5 members, 9+ corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-settings-v2-controller.php:117— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-settings-v2-controller.php:117-125 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-locations-v2-controller.php:129-138 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:352-375 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zones-v2-controller.php:232-256 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php:351-359 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (89 corresponding lines) · ×1
Edited copy of a member (89 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:46— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:46-134 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:135-238 — These two members are one piece of code written twice and then edited apart: 89 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 15+ corresponding lines) · ×1
Edited copies of one member (3 members, 15+ corresponding lines) wp-content/plugins/woocommerce/includes/abstracts/class-wc-background-process.php:32— wp-content/plugins/woocommerce/includes/abstracts/class-wc-background-process.php:32-46 | wp-content/plugins/woocommerce/includes/abstracts/class-wc-background-process.php:184-198 | wp-content/plugins/woocommerce/includes/libraries/wp-background-process.php:186-204 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (103 corresponding lines) · ×1
Edited copy of a member (103 corresponding lines) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:846— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:846-948 | wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductReviewSchema.php:49-152 — These two members are one piece of code written twice and then edited apart: 103 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 4+ corresponding lines) · ×1
Edited copies of one member (5 members, 4+ corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/Features.php:61— wp-content/plugins/woocommerce/src/Admin/API/Features.php:61-65 | wp-content/plugins/woocommerce/src/Admin/API/Notes.php:274-278 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingProductTypes.php:61-65 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingProfile.php:154-158 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Import/Controller.php:104-107 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 5+ corresponding lines) · ×1
Edited copies of one member (4 members, 5+ corresponding lines) wp-content/plugins/woocommerce/src/Admin/API/MarketingCampaignTypes.php:124— wp-content/plugins/woocommerce/src/Admin/API/MarketingCampaignTypes.php:124-140 | wp-content/plugins/woocommerce/src/Admin/API/MarketingChannels.php:110-125 | wp-content/plugins/woocommerce/src/Admin/API/MarketingRecommendations.php:118-122 | wp-content/plugins/woocommerce/src/Admin/API/Reports/GenericController.php:229-236 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 6+ corresponding lines) · ×1
Edited copies of one member (3 members, 6+ corresponding lines) wp-content/plugins/woocommerce/includes/admin/list-tables/class-wc-admin-list-table-coupons.php:99— wp-content/plugins/woocommerce/includes/admin/list-tables/class-wc-admin-list-table-coupons.php:99-104 | wp-content/plugins/woocommerce/includes/admin/list-tables/class-wc-admin-list-table-orders.php:165-170 | REDACTED:191-196 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 5+ corresponding lines) · ×1
Edited copies of one member (3 members, 5+ corresponding lines) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/VariationSelectorAttribute.php:34— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToCartWithOptions/VariationSelectorAttribute.php:34-41 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:45-49 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterChips.php:31-35 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (93–100 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1864— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1864-1956 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:2246-2345 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (77–86 lines × 2) wp-content/plugins/woocommerce/src/Internal/Features/ProductBlockEditor/ProductTemplates/ProductVariationTemplate.php:279— wp-content/plugins/woocommerce/src/Internal/Features/ProductBlockEditor/ProductTemplates/ProductVariationTemplate.php:279-355 | wp-content/plugins/woocommerce/src/Internal/Features/ProductBlockEditor/ProductTemplates/SimpleProductTemplate.php:712-797 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Internal/Features/ProductBlockEditor/ProductTemplates/SimpleProductTemplate.php:799` calls `get_option` and `wp-content/plugins/woocommerce/src/Internal/Features/ProductBlockEditor/ProductTemplates/ProductVariationTemplate.php:356` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (64–78 lines × 2) wp-content/plugins/woocommerce/src/Internal/Features/ProductBlockEditor/ProductTemplates/ProductVariationTemplate.php:422— wp-content/plugins/woocommerce/src/Internal/Features/ProductBlockEditor/ProductTemplates/ProductVariationTemplate.php:422-485 | wp-content/plugins/woocommerce/src/Internal/Features/ProductBlockEditor/ProductTemplates/SimpleProductTemplate.php:1000-1077 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (76 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:341— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:341-416 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:455-530 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:341` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (69–75 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/SavedForLater.php:165— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/SavedForLater.php:165-239 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Wishlist.php:62-130 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/SavedForLater.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Wishlist.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 134 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (44–73 lines × 26) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:988— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:988-1045 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:2594-2637 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php:713-766 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:2079-2130 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:2463-2506 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:573-619 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php:623-679 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:961-1011 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:1210-1281 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1895-1963 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php:717-779 | wp-content/plugins/woocommerce/src/Admin/API/Notes.php:618-683 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Controller.php:445-490 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Stats/Controller.php:192-239 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Controller.php:228-293 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/Controller.php:205-269 | wp-content/plugins/woocommerce/src/Admin/API/Reports/GenericController.php:119-169 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Controller.php:243-312 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Controller.php:213-283 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Controller.php:258-321 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Controller.php:226-291 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:2280-2352 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/AbstractTermsRoute.php:28-90 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/ProductReviews.php:177-237 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Products.php:112-170 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Products.php:327-376 — there are 26 copies across 25 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 26 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Products.php:327` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:2461` calls `array_merge`, `array` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:2592` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (33–72 lines × 9) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:205— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:205-238 | wp-content/plugins/woocommerce/src/Admin/API/LaunchYourStore.php:42-91 | wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:248-293 | wp-content/plugins/woocommerce/src/Admin/API/Notes.php:44-115 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingPlugins.php:75-107 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingProfile.php:61-101 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:132-172 | wp-content/plugins/woocommerce/src/Admin/API/Plugins.php:43-90 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Import/Controller.php:36-81 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 9 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 9 times. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:205` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (65–68 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:658— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:658-722 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:925-992 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:658` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (63–66 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php:144— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php:144-209 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:180-242 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 113 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php:144` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:176` calls `get_address`, `foreach`, `get_items` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php:144` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (20–64 lines × 9) wp-content/plugins/woocommerce/src/Admin/API/LaunchYourStore.php:39— wp-content/plugins/woocommerce/src/Admin/API/LaunchYourStore.php:39-82 | wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:204-223 | wp-content/plugins/woocommerce/src/Admin/API/Notes.php:55-118 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingPlugins.php:75-105 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingProfile.php:73-101 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:55-105 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:135-175 | wp-content/plugins/woocommerce/src/Admin/API/Plugins.php:40-80 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Import/Controller.php:46-83 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/LaunchYourStore.php` and `wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 197 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/LaunchYourStore.php:39` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Admin/API/Notes.php:55` calls `register_rest_route` and `wp-content/plugins/woocommerce/src/Admin/API/OnboardingPlugins.php:75` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (63 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:1132— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:1132-1194 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:1245-1307 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:1132` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:1197` calls `call_function` and `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:1311` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (53–60 lines × 8) wp-content/plugins/woocommerce/src/Admin/API/Reports/Categories/Controller.php:174— wp-content/plugins/woocommerce/src/Admin/API/Reports/Categories/Controller.php:174-233 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Controller.php:426-480 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Controller.php:222-275 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/Controller.php:199-251 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Controller.php:236-292 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Controller.php:205-262 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Controller.php:249-303 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Controller.php:213-272 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 8 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 8 times.
Duplicated block (41–59 lines × 10) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:986— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:986-1038 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:730-781 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php:711-755 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:571-613 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php:621-665 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:959-999 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php:715-773 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/AbstractTermsRoute.php:26-78 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/ProductReviews.php:175-230 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Products.php:110-157 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 10 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 10 times.
Duplicated block (58 lines × 3) wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:101— wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:101-158 | wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:172-229 | wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:312-369 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:101` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (52–56 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:280— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:280-331 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:524-579 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (54–56 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/DataStore.php:156— wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/DataStore.php:156-209 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/DataStore.php:176-231 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/DataStore.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/DataStore.php` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 118 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (54 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:284— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:284-337 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:408-461 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (30–53 lines × 5) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:135— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:135-164 | wp-content/plugins/woocommerce/src/Admin/API/Notes.php:41-93 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingProfile.php:58-99 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:132-162 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Import/Controller.php:33-71 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:135` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Admin/API/OnboardingProfile.php:58` calls `register_rest_route` and `wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:132` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (51–53 lines × 3) wp-content/plugins/woocommerce/includes/class-wc-emails.php:1037— wp-content/plugins/woocommerce/includes/class-wc-emails.php:1037-1089 | wp-content/plugins/woocommerce/includes/class-wc-emails.php:1126-1176 | wp-content/plugins/woocommerce/includes/class-wc-emails.php:1212-1262 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-emails.php:1037` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (51–52 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterRating.php:114— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterRating.php:114-164 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterStatus.php:115-166 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterRating.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterStatus.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 82 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterRating.php:114` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (45–51 lines × 6) wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Controller.php:221— wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Controller.php:221-266 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/Controller.php:198-242 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Controller.php:204-253 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Controller.php:233-280 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Controller.php:199-249 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Controller.php:248-296 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Controller.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/Controller.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 318 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (49–51 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-brands.php:694— wp-content/plugins/woocommerce/includes/class-wc-brands.php:694-744 | wp-content/plugins/woocommerce/includes/class-wc-brands.php:754-802 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7–50 lines × 3) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:119— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:119-125 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:360-387 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsRestController.php:76-125 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php` and `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsRestController.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 105 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:119` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (49 lines × 3) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php:152— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php:152-200 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRatingCounter.php:143-191 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRatingStars.php:99-147 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRatingCounter.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 106 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php:152` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (46–48 lines × 3) wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:444— wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:444-489 | wp-content/plugins/woocommerce/src/Internal/ProductAttributesLookup/Filterer.php:105-152 | wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php:260-305 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php` and `wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 115 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:444` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (45–47 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-categories-v1-controller.php:115— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-categories-v1-controller.php:115-159 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-categories-controller.php:223-269 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-categories-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-categories-controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 105 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (120 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1051— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1051-1170 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1321-1440 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1051` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (45 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:168— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:168-212 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:283-327 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (44–45 lines × 2) wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/BillingAddressSchema.php:107— wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/BillingAddressSchema.php:107-151 | wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ShippingAddressSchema.php:48-91 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/BillingAddressSchema.php:107` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (43 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1280— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1280-1322 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1331-1373 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1014-1056 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1284-1326 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1280` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1012` calls `set_low_stock_amount` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1278` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (42–43 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:499— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:499-541 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php:747-788 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (57 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1129— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1129-1185 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1172-1228 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:844-900 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1114-1170 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1129` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (40 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1234— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1234-1273 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1285-1324 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:957-996 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1227-1266 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1234` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (38–40 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-setting-options-v2-controller.php:164— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-setting-options-v2-controller.php:164-203 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-setting-options-controller.php:75-112 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-setting-options-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-setting-options-controller.php` as WHOLE FILES: 85% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-setting-options-v2-controller.php:164` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (39 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1091— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1091-1129 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1134-1172 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:801-839 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1071-1109 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1091` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:840` calls `set_global_unique_id`, `wc_clean`, `isset` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1130` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (38 lines × 20) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:996— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:996-1046 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:2613-2651 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php:724-776 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:2086-2132 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:1223-1290 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1916-1972 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php:740-795 | wp-content/plugins/woocommerce/src/Admin/API/Notes.php:624-684 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Controller.php:627-683 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Stats/Controller.php:365-412 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Controller.php:257-311 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/Controller.php:233-288 | wp-content/plugins/woocommerce/src/Admin/API/Reports/GenericController.php:126-171 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Controller.php:353-411 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Controller.php:296-350 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Controller.php:243-302 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:2323-2375 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/AbstractTermsRoute.php:50-105 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/ProductReviews.php:184-239 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Products.php:411-448 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 20 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 20 times. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:996` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:994` calls `array` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Controller.php:626` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (37–38 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:330— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:330-367 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php:524-560 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductQuery.php` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 236 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (33–37 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:696— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:696-728 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1095-1131 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:757-793 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1027-1063 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1095` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (37 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:603— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:603-639 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1716-1752 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 1018 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:603` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (36 lines × 21) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:996— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:996-1045 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:2613-2649 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php:724-774 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:2086-2130 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:999-1052 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:1223-1288 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1916-1970 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php:740-793 | wp-content/plugins/woocommerce/src/Admin/API/Notes.php:624-683 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Controller.php:627-682 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Stats/Controller.php:365-410 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Controller.php:257-309 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/Controller.php:233-286 | wp-content/plugins/woocommerce/src/Admin/API/Reports/GenericController.php:126-169 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Controller.php:353-409 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Controller.php:296-348 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Controller.php:243-300 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:2323-2373 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/AbstractTermsRoute.php:50-103 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/ProductReviews.php:184-237 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Products.php:411-446 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 21 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 21 times. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:996` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:994` calls `array` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Controller.php:626` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (27–36 lines × 3) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToWishlistButton.php:174— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AddToWishlistButton.php:174-200 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/SavedForLater.php:255-290 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Wishlist.php:146-180 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/SavedForLater.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Wishlist.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 134 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (33–35 lines × 4) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:191— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:191-225 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:192-226 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Controller.php:171-203 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Controller.php:171-205 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 184 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:191` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (33–35 lines × 3) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:285— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:285-319 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:349-383 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Controller.php:302-334 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 184 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:285` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:282` calls `sanitize_textarea_field` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:346` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (34 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:919— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:919-952 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1533-1566 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (33–34 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php:281— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php:281-313 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-refunds-controller.php:44-77 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (32–33 lines × 2) wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:134— wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:134-165 | wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-group-functions.php:124-156 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:134` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-functions.php:131` calls `acf_is_field_key` and `wp-content/plugins/advanced-custom-fields-pro/includes/acf-field-group-functions.php:121` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (27–33 lines × 2) wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:610— wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:610-636 | wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:668-700 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/helper/class-wc-helper.php:610` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (26–33 lines × 2) wp-content/plugins/woocommerce/includes/wc-user-functions.php:479— wp-content/plugins/woocommerce/includes/wc-user-functions.php:479-504 | wp-content/plugins/woocommerce/includes/wc-user-functions.php:510-542 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/wc-user-functions.php:479` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (31–33 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php:90— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php:90-120 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRatingCounter.php:88-120 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRatingCounter.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 106 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php:90` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php:122` calls `sprintf`, `__` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRatingCounter.php:120` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (32 lines × 4) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:146— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:146-177 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Schema/GeneralSettingsSchema.php:146-177 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Schema/ProductSettingsSchema.php:148-179 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Schema/TaxSettingsSchema.php:146-177 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Schema/GeneralSettingsSchema.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 103 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:146` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Schema/GeneralSettingsSchema.php:180` calls `in_array`, `array` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:180` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (40 lines × 2) wp-content/plugins/woocommerce/includes/gateways/cod/class-wc-gateway-cod.php:248— wp-content/plugins/woocommerce/includes/gateways/cod/class-wc-gateway-cod.php:248-287 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/PaymentGateways/Schema/CodGatewaySettingsSchema.php:113-152 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/gateways/cod/class-wc-gateway-cod.php:248` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (31 lines × 5) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:213— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:213-243 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Controller.php:255-285 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:214-244 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Controller.php:191-221 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Controller.php:193-223 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 105 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:213` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (27–31 lines × 2) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/CollectionQuery.php:191— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/CollectionQuery.php:191-221 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/CollectionQuery.php:105-131 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/CollectionQuery.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/CollectionQuery.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 2 separate duplicated blocks between them, totalling at least 49 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (27–29 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/CartOrderSummaryBlock.php:50— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/CartOrderSummaryBlock.php:50-76 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/CheckoutOrderSummaryBlock.php:50-78 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (28 lines × 4) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:977— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductCollection/QueryBuilder.php:977-1004 | wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php:365-392 | wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php:520-547 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQuery.php:571-598 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/QueryFilters.php` and `wp-content/plugins/woocommerce/src/Internal/ProductFilters/QueryClauses.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 115 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (28 lines × 3) wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationEmail.php:274— wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationEmail.php:274-301 | wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationVerifiedEmail.php:244-271 | wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationVerifyEmail.php:268-295 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationEmail.php` and `wp-content/plugins/woocommerce/src/Internal/StockNotifications/Emails/CustomerStockNotificationVerifiedEmail.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (18–28 lines × 2) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-date.php:743— wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-date.php:743-760 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-date.php:763-790 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-date.php:743` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (27–28 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1514— wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1514-1540 | wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1570-1597 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-geo-ip.php:1514` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (1–27 lines × 8) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1171— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1171-1171 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1186-1212 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1214-1214 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1229-1255 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:886-886 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:901-927 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1156-1156 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1171-1197 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1186` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (20–27 lines × 3) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-customers.php:169— wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-customers.php:169-189 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-date.php:578-604 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-product.php:143-162 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (23–27 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Init.php:106— wp-content/plugins/woocommerce/src/Admin/API/Init.php:106-132 | wp-content/plugins/woocommerce/src/Admin/API/Init.php:199-221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Init.php:106` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (26–27 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterCheckboxList.php:48— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterCheckboxList.php:48-73 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterChips.php:55-81 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterCheckboxList.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterChips.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (26 lines × 9) wp-content/plugins/woocommerce/src/Admin/API/LaunchYourStore.php:42— wp-content/plugins/woocommerce/src/Admin/API/LaunchYourStore.php:42-82 | wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php:248-276 | wp-content/plugins/woocommerce/src/Admin/API/Notes.php:58-118 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingPlugins.php:75-105 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingProfile.php:76-101 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:58-105 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingTasks.php:138-175 | wp-content/plugins/woocommerce/src/Admin/API/Plugins.php:43-80 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Import/Controller.php:49-83 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/LaunchYourStore.php` and `wp-content/plugins/woocommerce/src/Admin/API/MobileAppQRLogin.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 197 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/LaunchYourStore.php:42` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (23–26 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php:287— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php:287-309 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php:284-308 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-refunds-controller.php:47-72 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 126 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php:287` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (25–26 lines × 3) wp-includes/PHPMailer/PHPMailer.php:3466— wp-includes/PHPMailer/PHPMailer.php:3466-3490 | wp-includes/PHPMailer/PHPMailer.php:3997-4022 | wp-includes/PHPMailer/PHPMailer.php:4131-4156 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-includes/PHPMailer/PHPMailer.php:3466` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21–26 lines × 2) wp-content/plugins/woocommerce/includes/emails/class-wc-email.php:1154— wp-content/plugins/woocommerce/includes/emails/class-wc-email.php:1154-1179 | wp-content/plugins/woocommerce/includes/emails/class-wc-email.php:1195-1215 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (25–26 lines × 2) wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-recently-viewed.php:86— wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-recently-viewed.php:86-110 | wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-top-rated-products.php:78-103 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-recently-viewed.php` and `wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-top-rated-products.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 108 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-top-rated-products.php:105` calls `cache_widget` and `wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-recently-viewed.php:111` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (23–25 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:2108— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:2108-2130 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:2520-2544 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (23–24 lines × 5) wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:442— wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:442-465 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:499-522 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:542-565 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:598-620 | wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-settings-api.php:642-665 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (22–24 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php:303— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php:303-324 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-payment-gateways-controller.php:79-102 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/PaymentGateways/Schema/AbstractPaymentGatewaySettingsSchema.php:489-512 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-payment-gateways-controller.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 101 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php:303` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19–24 lines × 2) REDACTED:4247— REDACTED:4247-4265 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductSpecifications.php:78-101 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:4247` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (18–24 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php:123— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php:123-140 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRatingCounter.php:120-143 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRatingCounter.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 106 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php:122` calls `sprintf`, `__` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductRatingCounter.php:118` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (20–24 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:364— wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:364-387 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php:160-179 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php` and `wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 105 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:364` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php:159` calls `wp_prime_option_caches` and `wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:363` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (23 lines × 4) wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:100— wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:100-123 | wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:171-194 | wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:242-264 | wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:311-334 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:100` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:124` calls `isset` and `wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:265` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (23 lines × 3) wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php:1144— wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php:1144-1166 | wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php:1264-1286 | wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php:1387-1409 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (21–23 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:409— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:409-429 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:708-730 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:409` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19–23 lines × 2) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsController.php:204— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsController.php:204-226 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsController.php:243-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsController.php:204` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17–23 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:396— wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php:396-412 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php:182-204 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/Admin/Loader.php` and `wp-content/plugins/woocommerce/src/Internal/Admin/Settings.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 105 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (21–22 lines × 7) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1327— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1327-1348 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1421-1441 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:420-440 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1378-1399 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:270-290 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:1088-1109 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1358-1379 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 1094 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (20–22 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:175— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:175-194 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:371-390 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:300-321 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:424-445 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:175` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:322` calls `empty`, `array_merge` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:195` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (22 lines × 3) wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:231— wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:231-252 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-coupon-data-store-cpt.php:183-204 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variation-data-store-cpt.php:222-248 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:231` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21–22 lines × 3) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/AustraliaPostShippingProvider.php:155— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/AustraliaPostShippingProvider.php:155-175 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/CanadaPostShippingProvider.php:146-167 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/RoyalMailShippingProvider.php:159-180 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/AustraliaPostShippingProvider.php` and `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/CanadaPostShippingProvider.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/Providers/AustraliaPostShippingProvider.php:155` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–22 lines × 2) wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-checkout.php:160— wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-checkout.php:160-168 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/OrderController.php:755-776 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-checkout.php:160` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18–21 lines × 2) wp-content/plugins/woocommerce/includes/wc-core-functions.php:757— wp-content/plugins/woocommerce/includes/wc-core-functions.php:757-774 | wp-content/plugins/woocommerce/src/Utilities/ArrayUtil.php:47-67 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/wc-core-functions.php:757` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (19–20 lines × 3) wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-products.php:199— wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-products.php:199-218 | wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-recently-viewed.php:88-106 | wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-top-rated-products.php:80-99 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-recently-viewed.php` and `wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-top-rated-products.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 108 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-products.php:199` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-top-rated-products.php:105` calls `cache_widget` and `wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-recently-viewed.php:111` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (19–20 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:862— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:862-880 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1459-1478 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:862` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–20 lines × 2) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:2509— wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php:2509-2528 | wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableRefundDataStore.php:85-98 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (19 lines × 4) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Schema/EmailSettingsSchema.php:162— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Schema/EmailSettingsSchema.php:162-180 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Schema/GeneralSettingsSchema.php:159-177 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Schema/ProductSettingsSchema.php:161-179 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Schema/TaxSettingsSchema.php:159-177 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Schema/GeneralSettingsSchema.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Schema/ProductSettingsSchema.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 106 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Schema/EmailSettingsSchema.php:162` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–19 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:631— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:631-649 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:482-491 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:631` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (17–19 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-setting-options-v2-controller.php:243— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-setting-options-v2-controller.php:243-261 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-setting-options-controller.php:142-158 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-setting-options-v2-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-setting-options-controller.php` as WHOLE FILES: 85% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (18–19 lines × 2) wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsManager.php:292— wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsManager.php:292-309 | wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsManager.php:340-358 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/Features/Fulfillments/FulfillmentsManager.php:292` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–19 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:1451— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:1451-1466 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:1569-1587 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsService.php:1569` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16–18 lines × 14) wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:56— wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:56-73 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:79-94 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:96-111 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:113-128 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:130-145 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:147-162 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:164-179 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:181-196 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:198-213 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:215-230 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:232-247 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:249-264 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:266-281 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:283-298 — all 14 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/OrderTagsProvider.php:56` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–18 lines × 10) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:417— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:417-431 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:324-338 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php:288-302 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:433-447 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php:392-406 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-custom-fields-controller.php:111-125 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php:374-388 | wp-content/plugins/woocommerce/src/Admin/API/MarketingCampaigns.php:118-132 | wp-content/plugins/woocommerce/src/Admin/API/Reports/GenericController.php:79-96 | wp-content/plugins/woocommerce/src/Admin/API/Taxes.php:142-156 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 10 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 10 times. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/GenericController.php:79` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (14–18 lines × 9) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:671— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:671-684 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:347-363 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:435-452 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:569-585 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhook-deliveries-v1-controller.php:171-187 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-customers-v2-controller.php:106-120 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-notes-v2-controller.php:98-114 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-webhook-deliveries-v2-controller.php:39-55 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-notes-controller.php:45-61 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (18 lines × 6) wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-eleven.php:21— wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-eleven.php:21-38 | wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-fifteen.php:22-39 | wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-fourteen.php:22-39 | wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-sixteen.php:21-38 | wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-ten.php:21-38 | wp-content/plugins/woocommerce/includes/theme-support/class-wc-twenty-thirteen.php:22-39 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once.
Duplicated block (18 lines × 5) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:161— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:161-178 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Controller.php:175-192 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Emails/Controller.php:226-243 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:157-174 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Controller.php:149-166 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 105 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:177` calls `isset`, `unset` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:181` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14–18 lines × 3) wp-content/plugins/woocommerce/src/Internal/Admin/ProductForm/Field.php:28— wp-content/plugins/woocommerce/src/Internal/Admin/ProductForm/Field.php:28-45 | wp-content/plugins/woocommerce/src/Internal/Admin/ProductForm/Section.php:27-40 | wp-content/plugins/woocommerce/src/Internal/Admin/ProductForm/Tab.php:28-44 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (16–18 lines × 2) wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableFieldQuery.php:286— wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableFieldQuery.php:286-301 | wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableMetaQuery.php:610-627 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableFieldQuery.php` and `wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableMetaQuery.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableFieldQuery.php:286` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 7) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-report-coupons-totals-controller.php:90— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-report-coupons-totals-controller.php:90-106 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-report-customers-totals-controller.php:101-117 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-report-orders-totals-controller.php:76-92 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-report-products-totals-controller.php:80-96 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-report-reviews-totals-controller.php:79-95 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Stats/Controller.php:111-127 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Stock/Stats/Controller.php:59-77 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 7 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 7 times. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (31–32 lines × 4) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:284— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:284-314 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:348-378 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Controller.php:301-331 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Controller.php:288-319 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 8 separate duplicated blocks between them, totalling at least 184 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:284` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:282` calls `sanitize_textarea_field` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:346` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (16–17 lines × 3) wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/DataStore.php:132— wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/DataStore.php:132-147 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/DataStore.php:212-227 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/DataStore.php:234-250 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/DataStore.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/DataStore.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/DataStore.php:132` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–17 lines × 2) wp-content/plugins/woocommerce/includes/wc-product-functions.php:835— wp-content/plugins/woocommerce/includes/wc-product-functions.php:835-851 | wp-content/plugins/woocommerce/includes/wc-product-functions.php:854-867 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/wc-product-functions.php:835` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/wc-product-functions.php:869` calls `wc_apply_sale_state_for_product` and `wp-content/plugins/woocommerce/includes/wc-product-functions.php:852` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13–16 lines × 5) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:199— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:199-211 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:405-420 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:1023-1038 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:385-400 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:499-514 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:194` calls `empty` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:1019` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15–17 lines × 4) wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/DataStore.php:128— wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/DataStore.php:128-143 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/DataStore.php:413-427 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/DataStore.php:208-223 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/DataStore.php:230-246 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/DataStore.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/DataStore.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14–16 lines × 4) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:252— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:252-265 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterRating.php:155-168 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterStatus.php:155-170 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterTaxonomy.php:294-307 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterStatus.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:252` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–16 lines × 3) wp-content/plugins/woocommerce/includes/class-wc-order.php:189— wp-content/plugins/woocommerce/includes/class-wc-order.php:189-204 | wp-content/plugins/woocommerce/includes/class-wc-order.php:409-421 | wp-content/plugins/woocommerce/includes/class-wc-order.php:500-512 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-order.php:189` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–16 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:2024— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:2024-2038 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:2427-2442 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7–16 lines × 2) wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Controller.php:94— wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Controller.php:94-100 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Controller.php:70-85 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Controller.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Controller.php:94` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–15 lines × 4) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:359— wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:359-372 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-customers.php:223-236 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-category.php:265-278 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-date.php:613-627 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12–15 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:864— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:864-875 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1461-1472 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:666-677 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:933-947 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:864` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13–15 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:347— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:347-361 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:231-244 | wp-content/plugins/woocommerce/src/Admin/API/Taxes.php:61-73 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (14–15 lines × 3) wp-content/plugins/woocommerce/src/Admin/API/Reports/Segmenter.php:229— wp-content/plugins/woocommerce/src/Admin/API/Reports/Segmenter.php:229-243 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Segmenter.php:252-266 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Segmenter.php:297-310 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Segmenter.php:229` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 8) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:465— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:465-479 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:238-252 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php:312-326 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:849-862 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:290-304 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:424-438 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-notes-controller.php:90-104 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-attributes-controller.php:92-106 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:848` calls `get_post` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:288` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14 lines × 7) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1203— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1203-1216 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1473-1486 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:476-489 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1246-1259 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:331-344 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:918-931 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1188-1201 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 1094 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1203` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:490` calls `set_date_on_sale_from`, `strtotime`, `isset` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1217` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13–14 lines × 6) wp-content/plugins/woocommerce/src/Internal/Admin/Notes/CustomizeStoreWithBlocks.php:68— wp-content/plugins/woocommerce/src/Internal/Admin/Notes/CustomizeStoreWithBlocks.php:68-80 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/CustomizingProductCatalog.php:66-79 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/FirstProduct.php:69-82 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/MigrateFromShopify.php:60-73 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/OnboardingPayments.php:49-61 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/OnlineClothingStore.php:80-92 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Notes/CustomizeStoreWithBlocks.php:68` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (14 lines × 5) wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/CustomerTagsProvider.php:34— wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/CustomerTagsProvider.php:34-47 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/CustomerTagsProvider.php:53-66 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/CustomerTagsProvider.php:72-85 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/CustomerTagsProvider.php:93-106 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/CustomerTagsProvider.php:110-123 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/EmailEditor/PersonalizationTags/CustomerTagsProvider.php:34` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (3–14 lines × 6) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/DataStore.php:217— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/DataStore.php:217-219 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/DataStore.php:135-148 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/DataStore.php:435-437 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/DataStore.php:215-228 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/Stats/DataStore.php:228-241 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/DataStore.php:238-251 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/DataStore.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/DataStore.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/DataStore.php:217` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/Stats/DataStore.php:224` calls `add_sql_clause`, `get_sql_clause` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/DataStore.php:133` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13–14 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-product-attribute.php:80— wp-content/plugins/woocommerce/includes/class-wc-product-attribute.php:80-93 | wp-content/plugins/woocommerce/includes/class-wc-product-attribute.php:109-121 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-product-attribute.php:80` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–14 lines × 2) wp-content/plugins/woocommerce/src/Gateways/PayPal/TransactAccountManager.php:231— wp-content/plugins/woocommerce/src/Gateways/PayPal/TransactAccountManager.php:231-244 | wp-content/plugins/woocommerce/src/Gateways/PayPal/TransactAccountManager.php:299-310 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Gateways/PayPal/TransactAccountManager.php:231` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Gateways/PayPal/TransactAccountManager.php:311` calls `log`, `wc_print_r` and `wp-content/plugins/woocommerce/src/Gateways/PayPal/TransactAccountManager.php:245` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6–14 lines × 2) wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:932— wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:932-945 | wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:957-962 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/EmailEditor/WCTransactionalEmails/WCEmailTemplateChangeSummary.php:932` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (3–14 lines × 3) wp-includes/PHPMailer/PHPMailer.php:3106— wp-includes/PHPMailer/PHPMailer.php:3106-3108 | wp-includes/PHPMailer/PHPMailer.php:3165-3178 | wp-includes/PHPMailer/PHPMailer.php:3238-3251 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (13 lines × 6) REDACTED:3315— REDACTED:3315-3328 | REDACTED:3405-3418 | REDACTED:3477-3490 | REDACTED:3536-3548 | REDACTED:3707-3719 | REDACTED:3761-3773 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:3315` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:3778` calls `absint` and `REDACTED:3332` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10–13 lines × 6) wp-content/plugins/woocommerce/src/Internal/Admin/Notes/EditProductsOnTheMove.php:55— wp-content/plugins/woocommerce/src/Internal/Admin/Notes/EditProductsOnTheMove.php:55-65 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/GivingFeedbackNotes.php:41-50 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/MagentoMigration.php:84-94 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/ManageOrdersOnTheGo.php:48-58 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/PerformanceOnMobile.php:52-62 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/ScheduledUpdatesPromotion.php:79-91 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Notes/EditProductsOnTheMove.php:55` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/Internal/Admin/Notes/MagentoMigration.php:75` calls `save`, `get_note` and `wp-content/plugins/woocommerce/src/Internal/Admin/Notes/EditProductsOnTheMove.php:53` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 5) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:197— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:197-209 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Controller.php:239-251 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Controller.php:198-210 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Controller.php:175-187 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Controller.php:177-189 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Email/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 105 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Controller.php:197` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12–13 lines × 4) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:110— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:110-122 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:171-182 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:208-220 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zone-methods-v2-controller.php:265-277 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9–13 lines × 2) wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:847— wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:847-855 | wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:874-886 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Settings/PaymentsProviders/WooPayments/WooPaymentsRestController.php:847` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 6) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterActive.php:97— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterActive.php:97-108 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:256-267 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterPrice.php:175-186 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterRating.php:159-170 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterStatus.php:159-172 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterTaxonomy.php:298-309 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php` and `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterStatus.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 4) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:278— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:278-289 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Schema/GeneralSettingsSchema.php:325-336 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Schema/ProductSettingsSchema.php:305-316 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Tax/Schema/TaxSettingsSchema.php:270-281 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/General/Schema/GeneralSettingsSchema.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 103 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Account/Schema/AccountSettingsSchema.php:278` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10–12 lines × 3) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Customers/Controller.php:213— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Customers/Controller.php:213-222 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Controller.php:308-317 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/Controller.php:263-274 — `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Customers/Controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Controller.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 107 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/Controller.php:263` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (10–12 lines × 2) wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-coupon-data.php:234— wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-coupon-data.php:234-245 | wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-coupon-data.php:251-260 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11–12 lines × 2) wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:288— wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:288-298 | wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterTaxonomy.php:390-401 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php:288` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 21) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:206— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:206-221 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customer-downloads-v1-controller.php:117-132 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php:212-230 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:346-364 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attribute-terms-v1-controller.php:150-166 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-categories-v1-controller.php:88-104 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:454-469 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-shipping-classes-v1-controller.php:63-79 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-tags-v1-controller.php:63-79 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:624-642 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-coupons-v2-controller.php:222-237 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-customer-downloads-v2-controller.php:51-66 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php:211-229 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php:270-283 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-categories-v2-controller.php:72-88 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-reviews-v2-controller.php:93-108 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:338-353 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-methods-v2-controller.php:153-168 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-payment-gateways-controller.php:50-63 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-categories-controller.php:72-88 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-refunds-controller.php:103-113 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customer-downloads-v1-controller.php:143` calls `str_replace` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-methods-v2-controller.php:179` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7–11 lines × 6) wp-content/plugins/woocommerce/src/Internal/Admin/Notes/InstallJPAndWCSPlugins.php:52— wp-content/plugins/woocommerce/src/Internal/Admin/Notes/InstallJPAndWCSPlugins.php:52-60 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/LaunchChecklist.php:50-56 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/MobileApp.php:43-49 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/PersonalizeStore.php:53-59 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/RealTimeOrderAlerts.php:47-53 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/TrackingOptIn.php:62-72 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/Admin/Notes/InstallJPAndWCSPlugins.php:52` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10–11 lines × 4) wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Controller.php:96— wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Controller.php:96-105 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Controller.php:81-91 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Controller.php:114-123 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Controller.php:85-95 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Controller.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (9–11 lines × 2) wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-item-type-data-store.php:83— wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-item-type-data-store.php:83-93 | wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-item-type-data-store.php:119-127 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 7) wp-content/plugins/woocommerce/includes/admin/notes/class-wc-notes-refund-returns.php:81— wp-content/plugins/woocommerce/includes/admin/notes/class-wc-notes-refund-returns.php:81-90 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/CustomizeStoreWithBlocks.php:71-80 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/CustomizingProductCatalog.php:69-78 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/FirstProduct.php:72-81 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/MigrateFromShopify.php:64-73 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/OnboardingPayments.php:52-61 | wp-content/plugins/woocommerce/src/Internal/Admin/Notes/OnlineClothingStore.php:83-92 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 7 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 7 times. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/notes/class-wc-notes-refund-returns.php:81` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 6) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1017— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1017-1026 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1130-1139 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1173-1182 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1634-1643 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:845-854 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1115-1124 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php` as WHOLE FILES: this scan already matched 33 separate duplicated blocks between them, totalling at least 1651 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1017` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8–10 lines × 3) wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:142— wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:142-151 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-sales-by-category.php:125-132 | wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-taxes-by-code.php:58-67 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-coupon-usage.php:142` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–10 lines × 2) wp-content/plugins/woocommerce/includes/class-wc-emails.php:1025— wp-content/plugins/woocommerce/includes/class-wc-emails.php:1025-1034 | wp-content/plugins/woocommerce/includes/class-wc-emails.php:1116-1122 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/class-wc-emails.php:1025` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9–10 lines × 2) wp-content/plugins/woocommerce/includes/wc-update-functions.php:1901— wp-content/plugins/woocommerce/includes/wc-update-functions.php:1901-1910 | wp-content/plugins/woocommerce/includes/wc-update-functions.php:2557-2565 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/wc-update-functions.php:1901` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10–16 lines × 3) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:278— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:278-293 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Segmenter.php:372-387 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Segmenter.php:163-172 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Segmenter.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 35 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Segmenter.php:278` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 8) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1019— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1019-1027 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1132-1140 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1505-1513 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:517-525 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1175-1183 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1636-1644 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:847-855 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:1117-1125 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 1094 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1019` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1503` calls `get_attributes` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1130` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 6) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:148— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:148-156 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:181-189 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:200-208 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:153-161 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:186-194 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:205-213 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (6–9 lines × 3) wp-content/plugins/woocommerce/includes/class-wc-privacy.php:88— wp-content/plugins/woocommerce/includes/class-wc-privacy.php:88-94 | wp-content/plugins/woocommerce/includes/class-wc-privacy.php:106-111 | wp-content/plugins/woocommerce/includes/class-wc-privacy.php:114-122 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7–9 lines × 3) wp-content/plugins/woocommerce/includes/class-wc-privacy.php:96— wp-content/plugins/woocommerce/includes/class-wc-privacy.php:96-104 | wp-content/plugins/woocommerce/includes/class-wc-privacy.php:106-112 | wp-content/plugins/woocommerce/includes/class-wc-privacy.php:115-123 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5–9 lines × 2) wp-content/plugins/woocommerce/includes/admin/importers/class-wc-product-csv-importer-controller.php:869— wp-content/plugins/woocommerce/includes/admin/importers/class-wc-product-csv-importer-controller.php:869-873 | wp-content/plugins/woocommerce/includes/export/class-wc-product-csv-exporter.php:173-181 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/admin/importers/class-wc-product-csv-importer-controller.php:869` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 7) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:175— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:175-182 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:193-200 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:211-218 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zones-controller-base.php:61-68 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zones-controller-base.php:79-86 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zones-controller-base.php:97-104 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zones-controller-base.php:115-122 — there are 7 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 7 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:175` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 6) wp-content/plugins/woocommerce/src/Blocks/Templates/ProductAttributeTemplate.php:57— wp-content/plugins/woocommerce/src/Blocks/Templates/ProductAttributeTemplate.php:57-64 | wp-content/plugins/woocommerce/src/Blocks/Templates/ProductBrandTemplate.php:59-66 | wp-content/plugins/woocommerce/src/Blocks/Templates/ProductCatalogTemplate.php:53-60 | wp-content/plugins/woocommerce/src/Blocks/Templates/ProductCategoryTemplate.php:59-66 | wp-content/plugins/woocommerce/src/Blocks/Templates/ProductSearchResultsTemplate.php:52-59 | wp-content/plugins/woocommerce/src/Blocks/Templates/ProductTagTemplate.php:59-66 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Blocks/Templates/ProductBrandTemplate.php` and `wp-content/plugins/woocommerce/src/Blocks/Templates/ProductCategoryTemplate.php` as WHOLE FILES: 85% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/Blocks/Templates/ProductBrandTemplate.php:68` calls `add_filter` and `wp-content/plugins/woocommerce/src/Blocks/Templates/ProductAttributeTemplate.php:65` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 4) wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:30— wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:30-37 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:68-75 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:137-144 | wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:194-201 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:67` calls `unset` and `wp-content/plugins/woocommerce/src/StoreApi/Utilities/ProductQueryFilters.php:29` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7–8 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-settings-v2-controller.php:117— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-settings-v2-controller.php:117-123 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zones-v2-controller.php:238-245 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php:351-357 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
Duplicated block (7–8 lines × 4) wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:249— wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:249-256 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-coupon-data-store-cpt.php:201-208 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:360-366 | wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variation-data-store-cpt.php:245-251 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:249` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-variation-data-store-cpt.php:234` calls `get_slug` and `wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:238` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6–7 lines × 4) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php:334— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php:334-339 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php:418-423 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/DataStore.php:215-221 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/DataStore.php:490-495 — `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/DataStore.php` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 36 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/DataStore.php:334` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 18) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:203— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:203-208 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:652-674 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:340-352 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attribute-terms-v1-controller.php:140-153 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:426-439 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:443-458 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-shipping-classes-v1-controller.php:54-66 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-tags-v1-controller.php:54-66 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php:567-585 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-customer-downloads-v2-controller.php:36-55 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-notes-v2-controller.php:90-103 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php:258-273 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-reviews-v2-controller.php:81-97 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:335-340 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-methods-v2-controller.php:146-157 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-webhooks-v2-controller.php:42-62 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-notes-controller.php:36-50 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-payment-gateways-controller.php:37-53 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attribute-terms-v1-controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 139 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:203` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attribute-terms-v1-controller.php:138` calls `get_term_meta` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:339` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 14) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:288— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:288-293 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php:308-313 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Categories/Controller.php:54-59 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Controller.php:53-58 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Controller.php:40-45 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Controller.php:56-61 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Stats/Controller.php:45-50 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/Controller.php:39-44 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Controller.php:53-58 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Controller.php:53-58 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Revenue/Stats/Controller.php:45-50 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Stock/Controller.php:55-60 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/Controller.php:58-63 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/Stats/Controller.php:70-75 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 14 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 14 times.
Duplicated block (6 lines × 5) wp-content/plugins/woocommerce/src/Admin/API/Reports/Categories/Controller.php:59— wp-content/plugins/woocommerce/src/Admin/API/Reports/Categories/Controller.php:59-64 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/Controller.php:44-49 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Controller.php:56-61 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Controller.php:72-77 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Controller.php:59-64 — there are 5 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (5 lines × 9) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:333— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:333-337 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php:474-479 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:247-252 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php:321-326 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:858-862 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:769-773 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:433-438 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-order-notes-controller.php:99-104 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php:216-221 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 32 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:324` calls `add_post_meta_fields` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:849` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (5 lines × 5) wp-content/plugins/woocommerce/src/Admin/API/Reports/Categories/Controller.php:61— wp-content/plugins/woocommerce/src/Admin/API/Reports/Categories/Controller.php:61-65 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/Controller.php:46-50 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Controller.php:58-62 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Controller.php:61-65 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/Controller.php:73-77 — there are 5 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (3–5 lines × 6) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/DataStore.php:223— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/DataStore.php:223-228 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/DataStore.php:152-154 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/DataStore.php:441-446 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/DataStore.php:234-239 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/Stats/DataStore.php:247-251 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/DataStore.php:257-262 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/DataStore.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Orders/Stats/DataStore.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/DataStore.php:223` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (2–5 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1648— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1648-1649 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php:147-151 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php:254-258 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1648` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (3–5 lines × 3) wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/AbstractCartRoute.php:127— wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/AbstractCartRoute.php:127-131 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Batch.php:126-128 | wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Checkout.php:164-168 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/AbstractCartRoute.php:127` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Batch.php:129` calls `get_route_error_response`, `getMessage` and `wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Checkout.php:168` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (20 lines × 11) wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Query.php:37— wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Query.php:37-56 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Stats/Query.php:37-56 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/Stats/Query.php:38-63 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Query.php:37-56 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Downloads/Stats/Query.php:27-46 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Query.php:38-57 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Products/Stats/Query.php:38-57 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/Query.php:37-56 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Taxes/Stats/Query.php:38-57 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Query.php:38-57 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Stats/Query.php:38-57 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 11 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 11 times. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Query.php:37` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (68 lines × 3) wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Schema/OrderFeeSchema.php:38— wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Schema/OrderFeeSchema.php:38-106 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Schema/OrderShippingSchema.php:38-105 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Schema/OrderTaxSchema.php:38-108 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Schema/OrderFeeSchema.php:38` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (42 lines × 15) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:59— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:59-125 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php:62-122 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attribute-terms-v1-controller.php:43-126 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php:55-136 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:65-125 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php:52-130 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php:48-134 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-coupons-v2-controller.php:53-134 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-orders-v2-controller.php:70-142 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:100-196 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-setting-options-v2-controller.php:41-107 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-currencies-controller.php:49-90 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-reviews-controller.php:39-128 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-terms-controller.php:45-126 | wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:42-87 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 151 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:58` calls `add_action`, `array` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-coupons-v1-controller.php:52` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (24 lines × 25) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:50— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:50-111 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php:58-112 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-product-reviews-v1-controller.php:43-123 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-tax-classes-v1-controller.php:41-85 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-webhook-deliveries-v1-controller.php:44-80 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-order-refunds-v2-controller.php:64-126 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php:39-74 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-methods-v2-controller.php:39-68 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-shipping-zones-v2-controller.php:25-83 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php:42-79 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-tax-classes-v2-controller.php:32-81 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-continents-controller.php:52-81 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-data-countries-controller.php:52-81 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-layout-templates-controller.php:38-72 | wp-content/plugins/woocommerce/src/Admin/API/Customers.php:31-63 | wp-content/plugins/woocommerce/src/Admin/API/PaymentGatewaySuggestions.php:41-71 | wp-content/plugins/woocommerce/src/Admin/API/ProductForm.php:39-62 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Export/Controller.php:35-60 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Customers/Controller.php:95-172 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/OrderNotes/Controller.php:84-138 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Orders/Controller.php:126-191 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Refunds/Controller.php:119-186 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Settings/Emails/Controller.php:57-100 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZoneMethod/Controller.php:72-112 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/ShippingZones/Controller.php:82-130 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-refunds-v1-controller.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 102 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 6) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:121— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:121-125 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-order-notes-v1-controller.php:136-140 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php:56-60 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php:70-74 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php:133-137 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-custom-fields-controller.php:135-139 — there are 6 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (352 lines × 3) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1743— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php:1743-2583 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php:774-1125 | wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php:1838-2450 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php` and `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-product-variations-v2-controller.php` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 1094 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 5) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php:1689— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php:1689-1701 | wp-content/plugins/woocommerce/src/Admin/API/Leaderboards.php:471-482 | wp-content/plugins/woocommerce/src/Admin/API/OnboardingProfile.php:414-426 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Import/Controller.php:160-171 | wp-content/plugins/woocommerce/src/Admin/API/Themes.php:139-150 — before extracting anything, compare `wp-content/plugins/woocommerce/src/Admin/API/OnboardingProfile.php` and `wp-content/plugins/woocommerce/src/Admin/API/Reports/Import/Controller.php` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 263 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (41 lines × 2) wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:89— wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php:89-129 | wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php:127-167 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php` and `wp-content/plugins/woocommerce/src/Internal/RestApi/Routes/V4/Products/Controller.php` as WHOLE FILES: this scan already matched 50 separate duplicated blocks between them, totalling at least 1617 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 9) REDACTED:20— REDACTED:20-32 | wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-product-categories.php:36-87 | wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-product-search.php:20-32 | wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-product-tag-cloud.php:22-34 | wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-products.php:22-83 | wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-rating-filter.php:20-31 | wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-recent-reviews.php:20-40 | wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-recently-viewed.php:22-42 | wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-top-rated-products.php:21-41 — before extracting anything, compare `wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-recently-viewed.php` and `wp-content/plugins/woocommerce/includes/widgets/class-wc-widget-top-rated-products.php` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 108 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 4) wp-content/plugins/woocommerce/src/Admin/API/Reports/Categories/Controller.php:80— wp-content/plugins/woocommerce/src/Admin/API/Reports/Categories/Controller.php:80-92 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Coupons/Controller.php:74-86 | wp-content/plugins/woocommerce/src/Admin/API/Reports/PerformanceIndicators/Controller.php:481-494 | wp-content/plugins/woocommerce/src/Admin/API/Reports/Variations/Controller.php:74-89 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplication concentrated across 2 sibling directories (8 clone groups) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:2963— 8 of the duplicated blocks reported below have copies in at least two of the sibling directories advanced-custom-fields-pro, woocommerce under wp-content/plugins/. That concentration is one structural fact, not 8 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 8 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
Duplicated block (1254 lines × 4 locations) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:2963— wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:2963 · wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:2963 · wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:2963 · wp-content/plugins/woocommerce/assets/js/select2/select2.js:2963 — the 4 copies are spread across 4 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (833 lines × 2 locations) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:3688— wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:3688 · wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:3672 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
Duplicated block (762 lines × 2 locations) wp-content/themes/monoka/assets/font-awesome/js/free.js:2261— wp-content/themes/monoka/assets/font-awesome/js/free.js:2261 · wp-content/themes/monoka/assets/font-awesome/js/pro.js:318 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
Duplicated block (719 lines × 2 locations) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:4727— wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:4727 · wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:4727 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (553 lines × 4 locations) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:757— wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:757 · wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:757 · wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:757 · wp-content/plugins/woocommerce/assets/js/select2/select2.js:757 — the 4 copies are spread across 4 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (478 lines × 2 locations) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:4867— wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:4867 · wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:4851 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (472 lines × 2 locations) wp-content/themes/monoka/assets/font-awesome/js/free.js:3212— wp-content/themes/monoka/assets/font-awesome/js/free.js:3212 · wp-content/themes/monoka/assets/font-awesome/js/pro.js:1414 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (467 lines × 2 locations) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:336— wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:336 · wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:336 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
R10 · Code Duplication· Duplicated block with local edits (263 matched lines × 2 locations) · ×1
Duplicated block with local edits (263 matched lines × 2 locations) wp-content/plugins/advanced-custom-fields-pro/pro/assets/js/acf-pro-input.js:62— wp-content/plugins/advanced-custom-fields-pro/pro/assets/js/acf-pro-input.js:62 · wp-content/plugins/advanced-custom-fields-pro/pro/assets/js/acf-pro-input.js:662 — the two spans are one implementation copied and then locally edited — 1553 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (240 lines × 3 locations) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:5382— wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:5382 · wp-content/plugins/woocommerce/assets/js/select2/select2.js:5382 · wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:5537 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (223 lines × 2 locations) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:1097— wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:1097 · wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:1091 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (219 lines × 2 locations) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:1670— wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:1670 · wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:1654 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (211 lines × 3 locations) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:5785— wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:5785 · wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:5785 · wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:5960 — the 3 copies are spread across 3 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete.
Duplicated block (211 lines × 2 locations) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:6121— wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:6121 · wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:6121 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (153 lines × 2 locations) wp-content/themes/monoka/assets/font-awesome/js/free.js:2048— wp-content/themes/monoka/assets/font-awesome/js/free.js:2048 · wp-content/themes/monoka/assets/font-awesome/js/pro.js:65 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (139 matched lines × 2 locations) · ×1
Duplicated block with local edits (139 matched lines × 2 locations) wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-classes.js:27— wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-classes.js:27 · wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-providers.js:32 — the two spans are one implementation copied and then locally edited — 1062 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (106 matched lines × 2 locations) · ×1
Duplicated block with local edits (106 matched lines × 2 locations) wp-content/plugins/woocommerce/assets/js/admin/settings-views-html-settings-tax.js:37— wp-content/plugins/woocommerce/assets/js/admin/settings-views-html-settings-tax.js:37 · wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zones.js:19 — the two spans are one implementation copied and then locally edited — 725 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (82 lines × 2 locations) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:1445— wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:1445 · wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:1434 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (68 matched lines × 2 locations) · ×1
Duplicated block with local edits (68 matched lines × 2 locations) wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:20— wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:20 · wp-content/plugins/woocommerce/assets/js/admin/users.js:10 — the two spans are one implementation copied and then locally edited — 539 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (58 lines × 2 locations) wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:6533— wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:6533 · wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:5802 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (45 matched lines × 2 locations) · ×1
Duplicated block with local edits (45 matched lines × 2 locations) wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js:1704— wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js:1704 · REDACTED:580 — the two spans are one implementation copied and then locally edited — 263 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (44 lines × 2 locations) wp-content/plugins/woocommerce/assets/js/admin/wc-brands-enhanced-select.js:5— wp-content/plugins/woocommerce/assets/js/admin/wc-brands-enhanced-select.js:5 · wp-content/plugins/woocommerce/assets/js/admin/wc-enhanced-select.js:4 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
Duplicated block (43 lines × 3 locations) wp-content/themes/monoka/assets/font-awesome/js/free.js:5— wp-content/themes/monoka/assets/font-awesome/js/free.js:5 · wp-content/themes/monoka/assets/font-awesome/js/free.js:586 · wp-content/themes/monoka/assets/font-awesome/js/free.js:862 — all 3 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (43 lines × 2 locations) wp-content/themes/monoka/assets/font-awesome/js/free.js:1988— wp-content/themes/monoka/assets/font-awesome/js/free.js:1988 · wp-content/themes/monoka/assets/font-awesome/js/pro.js:5 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (38 lines × 2 locations) wp-content/plugins/woocommerce/assets/js/admin/wc-enhanced-select.js:282— wp-content/plugins/woocommerce/assets/js/admin/wc-enhanced-select.js:282 · wp-content/plugins/woocommerce/assets/js/admin/wc-enhanced-select.js:328 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (36 matched lines × 2 locations) · ×1
Duplicated block with local edits (36 matched lines × 2 locations) wp-content/plugins/woocommerce/assets/js/admin/product-ordering.js:25— wp-content/plugins/woocommerce/assets/js/admin/product-ordering.js:25 · wp-content/plugins/woocommerce/assets/js/admin/term-ordering.js:63 — the two spans are one implementation copied and then locally edited — 263 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (36 lines × 2 locations) REDACTED:208— REDACTED:208 · REDACTED:248 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (35 lines × 3 locations) wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:1695— wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:1695 · wp-content/plugins/woocommerce/assets/js/admin/wc-brands-enhanced-select.js:7 · wp-content/plugins/woocommerce/assets/js/admin/wc-enhanced-select.js:6 — the 3 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete.
Duplicated block (27 lines × 2 locations) wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:486— wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:486 · wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:731 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
R10 · Code Duplication· Duplicated block with local edits (24 matched lines × 2 locations) · ×1
Duplicated block with local edits (24 matched lines × 2 locations) wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js:815— wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js:815 · REDACTED:4110 — the two spans are one implementation copied and then locally edited — 114 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R2 · Cyclomatic Complexity· Complex function Va (cyclomatic 80, cognitive 28) · ×1
Complex function Va (cyclomatic 80, cognitive 28) REDACTED:2— Va has cyclomatic complexity 80 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity· Complex function Ra (cyclomatic 53, cognitive 67) · ×1
Complex function Ra (cyclomatic 53, cognitive 67) REDACTED:2— Ra has cyclomatic complexity 53 and cognitive complexity 67; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function _limitMinMaxDateTime (cyclomatic 52, cognitive 120) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:586— _limitMinMaxDateTime has cyclomatic complexity 52 and cognitive complexity 120; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function compute (cyclomatic 50, cognitive 46) REDACTED:2— compute has cyclomatic complexity 50 and cognitive complexity 46; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 47, cognitive 52) wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.js:2720— (anonymous) has cyclomatic complexity 47 and cognitive complexity 52; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function _onDragRelease (cyclomatic 46, cognitive 60) REDACTED:1955— _onDragRelease has cyclomatic complexity 46 and cognitive complexity 60; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity· Complex function b (cyclomatic 45, cognitive 51) · ×1
Complex function b (cyclomatic 45, cognitive 51) REDACTED:2— b has cyclomatic complexity 45 and cognitive complexity 51; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function _newInst (cyclomatic 43, cognitive 53) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:169— _newInst has cyclomatic complexity 43 and cognitive complexity 53; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function _onTimeChange (cyclomatic 43, cognitive 51) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:779— _onTimeChange has cyclomatic complexity 43 and cognitive complexity 51; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 43, cognitive 41) wp-content/themes/monoka/assets/font-awesome/js/pro.js:5— (anonymous) has cyclomatic complexity 43 and cognitive complexity 41; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function _injectTimePicker (cyclomatic 41, cognitive 105) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:373— _injectTimePicker has cyclomatic complexity 41 and cognitive complexity 105; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity· Complex function n (cyclomatic 40, cognitive 48) · ×1
Complex function n (cyclomatic 40, cognitive 48) REDACTED:2— n has cyclomatic complexity 40 and cognitive complexity 48; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 39, cognitive 380) REDACTED:2— (anonymous) has cyclomatic complexity 39 and cognitive complexity 380; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function getProjectionStyles (cyclomatic 39, cognitive 49) REDACTED:2— getProjectionStyles has cyclomatic complexity 39 and cognitive complexity 49; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 39, cognitive 36) REDACTED:2— (anonymous) has cyclomatic complexity 39 and cognitive complexity 36; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function handleKeyDown (cyclomatic 38, cognitive 85) REDACTED:2— handleKeyDown has cyclomatic complexity 38 and cognitive complexity 85; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity· Complex function c (cyclomatic 38, cognitive 84) · ×1
Complex function c (cyclomatic 38, cognitive 84) REDACTED:2— c has cyclomatic complexity 38 and cognitive complexity 84; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 38, cognitive 34) REDACTED:2— (anonymous) has cyclomatic complexity 38 and cognitive complexity 34; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 37, cognitive 31) REDACTED:2— (anonymous) has cyclomatic complexity 37 and cognitive complexity 31; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function resolveTargetDelta (cyclomatic 36, cognitive 51) REDACTED:2— resolveTargetDelta has cyclomatic complexity 36 and cognitive complexity 51; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function _optionDatepicker (cyclomatic 34, cognitive 61) wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:1822— _optionDatepicker has cyclomatic complexity 34 and cognitive complexity 61; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function do_variation_action (cyclomatic 34, cognitive 36) wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product-variation.js:1230— do_variation_action has cyclomatic complexity 34 and cognitive complexity 36; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function _panOrMoveMainScroll (cyclomatic 33, cognitive 81) REDACTED:1521— _panOrMoveMainScroll has cyclomatic complexity 33 and cognitive complexity 81; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 33, cognitive 31) wp-content/themes/monoka/assets/font-awesome/js/free.js:1988— (anonymous) has cyclomatic complexity 33 and cognitive complexity 31; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function (anonymous) (cyclomatic 29, cognitive 37) REDACTED:2— (anonymous) has cyclomatic complexity 29 and cognitive complexity 37; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function _renderMovement (cyclomatic 28, cognitive 50) REDACTED:1791— _renderMovement has cyclomatic complexity 28 and cognitive complexity 50; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function fetch (cyclomatic 28, cognitive 35) wp-content/plugins/woocommerce/assets/js/sourcebuster/sourcebuster.js:795— fetch has cyclomatic complexity 28 and cognitive complexity 35; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function calcProjection (cyclomatic 28, cognitive 27) REDACTED:2— calcProjection has cyclomatic complexity 28 and cognitive complexity 27; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
REDACTED: 8673 lines of code REDACTED:1— REDACTED has 8673 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js · ×1
wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js: 5331 lines of code wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:1— wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js has 5331 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js · ×1
wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js: 5168 lines of code wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:1— wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js has 5168 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/woocommerce/assets/js/select2/select2.full.js · ×1
wp-content/plugins/woocommerce/assets/js/select2/select2.full.js: 5168 lines of code wp-content/plugins/woocommerce/assets/js/select2/select2.full.js:1— wp-content/plugins/woocommerce/assets/js/select2/select2.full.js has 5168 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js · ×1
wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js: 4753 lines of code wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js:1— wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js has 4753 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js · ×1
wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js: 4606 lines of code wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js:1— wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js has 4606 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/woocommerce/assets/js/select2/select2.js · ×1
wp-content/plugins/woocommerce/assets/js/select2/select2.js: 4606 lines of code wp-content/plugins/woocommerce/assets/js/select2/select2.js:1— wp-content/plugins/woocommerce/assets/js/select2/select2.js has 4606 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 3748 lines of code REDACTED:1— REDACTED has 3748 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.js · ×1
wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.js: 2982 lines of code wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.js:1— wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.js has 2982 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 2958 lines of code REDACTED:1— REDACTED has 2958 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 2955 lines of code REDACTED:1— REDACTED has 2955 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/themes/monoka/assets/font-awesome/js/pro.js · ×1
wp-content/themes/monoka/assets/font-awesome/js/pro.js: 2367 lines of code wp-content/themes/monoka/assets/font-awesome/js/pro.js:1— wp-content/themes/monoka/assets/font-awesome/js/pro.js has 2367 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js · ×1
wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js: 2085 lines of code wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:1— wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js has 2085 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js · ×1
wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js: 1938 lines of code wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js:1— wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js has 1938 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product-variation.js · ×1
wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product-variation.js: 1554 lines of code wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product-variation.js:1— wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product-variation.js has 1554 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js · ×1
wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js: 1534 lines of code wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js:1— wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-order.js has 1534 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/advanced-custom-fields-pro/pro/assets/js/acf-pro-input.js · ×1
wp-content/plugins/advanced-custom-fields-pro/pro/assets/js/acf-pro-input.js: 1435 lines of code wp-content/plugins/advanced-custom-fields-pro/pro/assets/js/acf-pro-input.js:1— wp-content/plugins/advanced-custom-fields-pro/pro/assets/js/acf-pro-input.js has 1435 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/woocommerce/assets/js/frontend/checkout.js · ×1
wp-content/plugins/woocommerce/assets/js/frontend/checkout.js: 1318 lines of code wp-content/plugins/woocommerce/assets/js/frontend/checkout.js:1— wp-content/plugins/woocommerce/assets/js/frontend/checkout.js has 1318 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product.js · ×1
wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product.js: 1276 lines of code wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product.js:1— wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product.js has 1276 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart-variation.js · ×1
wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart-variation.js: 1153 lines of code wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart-variation.js:1— wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart-variation.js has 1153 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/woocommerce/assets/js/frontend/address-autocomplete.js · ×1
wp-content/plugins/woocommerce/assets/js/frontend/address-autocomplete.js: 911 lines of code wp-content/plugins/woocommerce/assets/js/frontend/address-autocomplete.js:1— wp-content/plugins/woocommerce/assets/js/frontend/address-autocomplete.js has 911 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js · ×1
wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js: 862 lines of code wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js:1— wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js has 862 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/woocommerce/assets/js/admin/variation-gallery.js · ×1
wp-content/plugins/woocommerce/assets/js/admin/variation-gallery.js: 829 lines of code wp-content/plugins/woocommerce/assets/js/admin/variation-gallery.js:1— wp-content/plugins/woocommerce/assets/js/admin/variation-gallery.js has 829 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/woocommerce/assets/js/sourcebuster/sourcebuster.js · ×1
wp-content/plugins/woocommerce/assets/js/sourcebuster/sourcebuster.js: 768 lines of code wp-content/plugins/woocommerce/assets/js/sourcebuster/sourcebuster.js:1— wp-content/plugins/woocommerce/assets/js/sourcebuster/sourcebuster.js has 768 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 762 lines of code REDACTED:1— REDACTED has 762 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/woocommerce/assets/js/frontend/cart.js · ×1
wp-content/plugins/woocommerce/assets/js/frontend/cart.js: 726 lines of code wp-content/plugins/woocommerce/assets/js/frontend/cart.js:1— wp-content/plugins/woocommerce/assets/js/frontend/cart.js has 726 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 708 lines of code REDACTED:1— REDACTED has 708 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/woocommerce/assets/js/frontend/single-product.js · ×1
wp-content/plugins/woocommerce/assets/js/frontend/single-product.js: 472 lines of code wp-content/plugins/woocommerce/assets/js/frontend/single-product.js:1— wp-content/plugins/woocommerce/assets/js/frontend/single-product.js has 472 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/woocommerce/assets/js/frontend/a8c-address-autocomplete-service.js · ×1
wp-content/plugins/woocommerce/assets/js/frontend/a8c-address-autocomplete-service.js: 429 lines of code wp-content/plugins/woocommerce/assets/js/frontend/a8c-address-autocomplete-service.js:1— wp-content/plugins/woocommerce/assets/js/frontend/a8c-address-autocomplete-service.js has 429 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/woocommerce/assets/js/admin/marketplace-suggestions.js · ×1
wp-content/plugins/woocommerce/assets/js/admin/marketplace-suggestions.js: 417 lines of code wp-content/plugins/woocommerce/assets/js/admin/marketplace-suggestions.js:1— wp-content/plugins/woocommerce/assets/js/admin/marketplace-suggestions.js has 417 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· wp-content/plugins/woocommerce/assets/js/frontend/order-review.js · ×1
wp-content/plugins/woocommerce/assets/js/frontend/order-review.js: 413 lines of code wp-content/plugins/woocommerce/assets/js/frontend/order-review.js:1— wp-content/plugins/woocommerce/assets/js/frontend/order-review.js has 413 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
Dead file (~1357 LoC) wp-content/plugins/classic-editor/scripts/post.js— no import path from any entry point (104 application, 0 tooling, 3 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~23 LoC) wp-content/plugins/classic-editor/js/block-editor-plugin.js— no import path from any entry point (104 application, 0 tooling, 3 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Third-party script without Subresource Integrity REDACTED:93— `//platform.twitter.com/widgets.js` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session. The URL also names no version, so it resolves to whatever that origin serves at fetch time — the executed bytes can change with nobody touching this repository. 6 such include(s) across the repository's markup.
X2 · Cancellation propagation· Async function without AbortSignal · ×1
Async function without AbortSignal: select wp-content/plugins/woocommerce/assets/js/frontend/a8c-address-autocomplete-service.js:396— `select` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
Minor — 131 finding(s)
P2 · Observability· Console output used as the logging channel · ×40
Console output used as the logging channel wp-content/themes/monoka/assets/js/custom-slider/jquery.nivo.slider.js:600— `wp-content/themes/monoka/assets/js/custom-slider/jquery.nivo.slider.js` reports through `console.*` at line 600 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/js/frontend/utils/address-autocomplete-common.js:40— `wp-content/plugins/woocommerce/assets/js/frontend/utils/address-autocomplete-common.js` reports through `console.*` at line 40 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/js/frontend/utils/address-autocomplete-common.js:105— `wp-content/plugins/woocommerce/assets/js/frontend/utils/address-autocomplete-common.js` reports through `console.*` at line 105 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/js/frontend/utils/address-autocomplete-common.js:133— `wp-content/plugins/woocommerce/assets/js/frontend/utils/address-autocomplete-common.js` reports through `console.*` at line 133 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/blocks/add-to-cart-form.js:1— `wp-content/plugins/woocommerce/assets/client/blocks/add-to-cart-form.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/blocks/add-to-cart-with-options.js:1— `wp-content/plugins/woocommerce/assets/client/blocks/add-to-cart-with-options.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/blocks/blocks-checkout-events.js:1— `wp-content/plugins/woocommerce/assets/client/blocks/blocks-checkout-events.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/blocks/product-description.js:1— `wp-content/plugins/woocommerce/assets/client/blocks/product-description.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/blocks/product-details.js:1— `wp-content/plugins/woocommerce/assets/client/blocks/product-details.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/blocks/product-gallery.js:1— `wp-content/plugins/woocommerce/assets/client/blocks/product-gallery.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/blocks/product-image.js:4— `wp-content/plugins/woocommerce/assets/client/blocks/product-image.js` reports through `console.*` at line 4 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/blocks/product-price-frontend.js:2— `wp-content/plugins/woocommerce/assets/client/blocks/product-price-frontend.js` reports through `console.*` at line 2 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/blocks/product-price.js:2— `wp-content/plugins/woocommerce/assets/client/blocks/product-price.js` reports through `console.*` at line 2 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/blocks/product-query.js:14— `wp-content/plugins/woocommerce/assets/client/blocks/product-query.js` reports through `console.*` at line 14 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/blocks/product-reviews.js:1— `wp-content/plugins/woocommerce/assets/client/blocks/product-reviews.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/blocks/product-specifications.js:1— `wp-content/plugins/woocommerce/assets/client/blocks/product-specifications.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/blocks/product-title.js:1— `wp-content/plugins/woocommerce/assets/client/blocks/product-title.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/blocks/wc-blocks-google-analytics.js:1— `wp-content/plugins/woocommerce/assets/client/blocks/wc-blocks-google-analytics.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/blocks/wc-blocks-registry.js:1— `wp-content/plugins/woocommerce/assets/client/blocks/wc-blocks-registry.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/blocks/woocommerce/product-elements.js:1— `wp-content/plugins/woocommerce/assets/client/blocks/woocommerce/product-elements.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/admin/product-editor/blocks/generic/tab/edit.js:1— `wp-content/plugins/woocommerce/assets/client/admin/product-editor/blocks/generic/tab/edit.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/admin/chunks/2999.js:1— `wp-content/plugins/woocommerce/assets/client/admin/chunks/2999.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/admin/chunks/5945.js:2— `wp-content/plugins/woocommerce/assets/client/admin/chunks/5945.js` reports through `console.*` at line 2 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/woocommerce/assets/client/admin/chunks/analytics-report.js:1— `wp-content/plugins/woocommerce/assets/client/admin/chunks/analytics-report.js` reports through `console.*` at line 1 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js:347— `wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js` reports through `console.*` at line 347 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:3156— `!$option.is('option') && !$option.is('optgroup')` appears character-identically in 6 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:1599— `!container.isOpen() && evt.which >= 48 && evt.which <= 90` appears character-identically in 2 files — wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js, wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:4292— `!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove` appears character-identically in 6 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:4290— `!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove` appears character-identically in 6 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:157— `!foundStarMap && starMap && starMap[nameSegment]` appears character-identically in 6 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:214— `!hasProp(defined, name) && !hasProp(defining, name)` appears character-identically in 6 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:453— `!hasProp(defined, name) && !hasProp(waiting, name)` appears character-identically in 6 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:3460— `!results || !results.results || !$.isArray(results.results)` appears character-identically in 4 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:4993— `$.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset` appears character-identically in 6 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js:6586— `$.fn.select2 != null && $.fn.select2.defaults != null` appears character-identically in 2 files — wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js, wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:715— `$el.innerHeight() < el.scrollHeight || $el.innerWidth() < el.scrollWidth` appears character-identically in 6 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:3472— `$request.status && $request.status === '0'` appears character-identically in 6 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:6249— `'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS` appears character-identically in 3 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:6160— `'onwheel' in document || document.documentMode >= 9` appears character-identically in 3 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/selectWoo/selectWoo.full.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/woocommerce/assets/js/admin/settings-views-html-settings-tax.js:98— `'success' === textStatus && response.success` appears character-identically in 2 files — wp-content/plugins/woocommerce/assets/js/admin/settings-views-html-settings-tax.js, wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/woocommerce/assets/js/frontend/cart-fragments.js:176— `'undefined' !== typeof wp && wp.customize && wp.customize.selectiveRefresh && wp.customize.widgetsPreview && wp.customize.widgetsPreview.Wid…` appears character-identically in 2 files — wp-content/plugins/woocommerce/assets/js/frontend/cart-fragments.js, wp-content/plugins/woocommerce/assets/js/frontend/price-slider.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:4414— `(data.element != null && data.element.selected) || (data.element == null && data.selected)` appears character-identically in 6 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:1415— `(document.activeElement == self.$selection[0]) || ($.contains(self.$selection[0], document.activeElement))` appears character-identically in 6 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:897— `(item.element != null && item.element.selected) || (item.element == null && $.inArray(id, selectedIds) > -1)` appears character-identically in 6 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product-variation.js:591— `attachment.sizes && attachment.sizes.thumbnail` appears character-identically in 2 files — wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product-variation.js, wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:314— `callbackType === 'undefined' || callbackType === 'function'` appears character-identically in 6 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:351— `cjsModule && cjsModule.exports !== undef && cjsModule.exports !== defined[name]` appears character-identically in 6 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:278— `config && config.config && config.config[name]` appears character-identically in 6 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:82— `config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])` appears character-identically in 6 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js:3640— `container.dropdown.$search || container.selection.$search || $container.find('.select2-search__field')` appears character-identically in 6 files — wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.full.js, wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/4/select2.js, wp-content/plugins/woocommerce/assets/js/select2/select2.full.js, wp-content/plugins/woocommerce/assets/js/select2/select2.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
redundant comment wp-content/plugins/advanced-custom-fields-pro/assets/inc/select2/3/select2.js:2389— "check for a placeholder option if attached to a select" repeats the code it sits on: 4 of its 5 words (check, placeholder, option, select) are already in `if (this.select && this.getPlaceholderOption() === undefined) return;`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:233— "controlType is string - key to our this._controls" repeats the code it sits on: 4 of its 5 words (control, type, string, controls) are already in `if (typeof(tp_inst._defaults.controlType) === 'string')`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/advanced-custom-fields-pro/assets/inc/timepicker/jquery-ui-timepicker-addon.js:490— "end for loop" only labels the closing brace of the for. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/advanced-custom-fields-pro/assets/js/acf-field-group.js:2035— "set menu order" repeats the code it sits on: 3 of its 3 words (set, menu, order) are already in `this.setFieldMenuOrder( newField );`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment REDACTED:1866— 11 comments in this file only repeat the code they sit on (lines 1866, 2119, 4932, 5026, 5038, 5923, 6941, 7932, 9253, 9496, 9719), for example "Add map events.". Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/advanced-custom-fields-pro/pro/assets/js/acf-pro-input.js:119— 5 comments in this file only repeat the code they sit on (lines 119, 234, 716, 1348, 1712), for example "add unscoped events". Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/classic-editor/scripts/post.js:954— "Post Status edit click." repeats the code it sits on: 4 of its 4 words (post, status, edit, click) are already in `$postStatusSelect.siblings('a.edit-post-status').on( 'click', function( event )`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/classic-editor/scripts/post.js:1135— "Hide the resize handle." repeats the code it sits on: 3 of its 3 words (hide, resize, handle) are already in `$('#content-resize-handle').hide();`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/woocommerce/assets/js/admin/meta-boxes-product-variation.js:292— "Remove variation-needs-update classes" repeats the code it sits on: 5 of its 5 words (remove, variation, needs, update, classes) are already in `$(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/woocommerce/assets/js/admin/meta-boxes.js:11— "Check if the field is optional, a checkbox or a search field." repeats the code it sits on: 5 of its 5 words (check, field, optional, checkbox, search) are already in `if (`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js:129— "Check if value is a string and config is provided" repeats the code it sits on: 4 of its 5 words (check, value, string, config) are already in `if (`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js:552— "Save method settings via ajax call" repeats the code it sits on: 4 of its 5 words (save, method, settings, call) are already in `$.post(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js:762— "Add method to zone via ajax call" repeats the code it sits on: 4 of its 5 words (add, method, zone, call) are already in `$.post( ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=woocommerce_shipping_zone_add_method', {`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-zone-methods.js:916— "Remove method to zone via ajax call" repeats the code it sits on: 4 of its 5 words (remove, method, zone, call) are already in `$.post( {`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment REDACTED:386— "wc_input_table tables" repeats the code it sits on: 4 of its 4 words (wc, input, table, tables) are already in `$( '.wc_input_table.sortable tbody' ).sortable( {`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment REDACTED:507— "Show order items on orders page" repeats the code it sits on: 4 of its 5 words (show, order, items, orders) are already in `$( document.body ).on( 'click', '.show_order_items', function ()`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment REDACTED:725— "Orders list table." repeats the code it sits on: 3 of its 3 words (orders, list, table) are already in `this.$list_table = $( 'table.wc-orders-list-table' );`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/woocommerce/assets/js/frontend/address-autocomplete.js:338— "Sanitize label for display." repeats the code it sits on: 3 of its 3 words (sanitize, label, display) are already in `const sanitizedLabel = sanitizeForDisplay( label );`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/woocommerce/assets/js/frontend/address-autocomplete.js:415— "Sanitize input value." repeats the code it sits on: 3 of its 3 words (sanitize, input, value) are already in `const sanitizedInput = sanitizeForDisplay( inputValue );`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/woocommerce/assets/js/frontend/address-autocomplete.js:447— "Check if we have an active provider for this address type." repeats the code it sits on: 4 of its 5 words (check, active, provider, address) are already in `if ( ! window.wc.addressAutocomplete.activeProvider[ type ] )`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/woocommerce/assets/js/frontend/checkout.js:170— "Inputs/selects which update totals" repeats the code it sits on: 4 of its 4 words (inputs, selects, update, totals) are already in `this.$checkout_form.on(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/woocommerce/assets/js/frontend/checkout.js:352— "Check if window.wc.addressAutocomplete exists and has an active provider" repeats the code it sits on: 7 of its 8 words (check, window, wc, address, autocomplete, active, provider) are already in `if (`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/woocommerce/assets/js/frontend/checkout.js:389— "Check if window.wc.addressAutocomplete exists and has an active provider" repeats the code it sits on: 7 of its 8 words (check, window, wc, address, autocomplete, active, provider) are already in `if (`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/woocommerce/assets/js/frontend/checkout.js:444— "Check if window.wc.addressAutocomplete exists and has an active provider" repeats the code it sits on: 7 of its 8 words (check, window, wc, address, autocomplete, active, provider) are already in `if (`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment wp-content/plugins/woocommerce/assets/js/frontend/password-strength-meter.js:44— "Allow password strength meter stop checkout." repeats the code it sits on: 5 of its 6 words (password, strength, meter, stop, checkout) are already in `if ( wc_password_strength_meter_params.stop_checkout )`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
Silent fallback default in catch wp-content/plugins/woocommerce/includes/class-wc-tracker.php:989— `get_migrator_data` swallows every exception into `return array()` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the docblock, and the row stops firing.
Silent fallback default in catch wp-content/plugins/woocommerce/includes/import/class-wc-product-csv-importer.php:250— `parse_relative_field` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the docblock, and the row stops firing.
Silent fallback default in catch wp-content/plugins/woocommerce/includes/wc-order-functions.php:417— `wc_orders_count` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the docblock, and the row stops firing.
Silent fallback default in catch wp-content/plugins/woocommerce/src/Internal/Admin/WCAdminAssets.php:465— `get_settings_ui_script_dependencies` swallows every exception into `return array()` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the docblock, and the row stops firing.
Hand-rolled JSON/XML parsing via regex wp-content/plugins/woocommerce/src/Internal/EmailEditor/WooContentProcessor.php:89— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This PHP code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex wp-content/plugins/woocommerce/src/Admin/Features/LaunchYourStore.php:317— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This PHP code already uses a real parser in the same package; use it here too.
Hand-rolled JSON/XML parsing via regex wp-content/plugins/woocommerce/assets/client/admin/remote-logging/index.js:2— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Fat interface: BlockInterface (18 methods) wp-content/plugins/woocommerce/src/Admin/BlockTemplates/BlockInterface.php:8— `BlockInterface` declares 18 methods: `get_name`, `get_id`, `get_order`, `set_order`, `get_attributes`, `set_attributes`, `set_attribute`, `get_parent`, `get_root_template`, `remove`, `is_detached`, `add_hide_condition`, `remove_hide_condition`, `get_hide_conditions`, `add_disable_condition`, `remove_disable_condition`, `get_disable_conditions`, `get_formatted_template`. Counted over its public instance methods, once per name; constants and static methods are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: UriInterface (16 methods) wp-includes/php-ai-client/third-party/Psr/Http/Message/UriInterface.php:25— `UriInterface` declares 16 methods: `getScheme`, `getAuthority`, `getUserInfo`, `getHost`, `getPort`, `getPath`, `getQuery`, `getFragment`, `withScheme`, `withUserInfo`, `withHost`, `withPort`, `withPath`, `withQuery`, `withFragment`, `__toString`. Counted over its public instance methods, once per name; constants and static methods are not counted. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
C2 · Access Controls· No named authorization policies · ×1
No named authorization policies — Authorization IS enforced here (by route guards, auth middleware or checks that refuse a caller) — this is NOT a claim that endpoints are unprotected. What's missing is a NAMED rule set: who may do what is encoded inline where it is checked, so the rules can't be listed, reviewed or tested apart from the code that applies them. Recommendation, not a defect.
D28 · Secrets (history)· Rotate the exposed credentials · ×1
Thin README README.md:1— The root README is 2 words, against a bar of 120. Of the three newcomer-critical sections this check looks for by heading, in the README and in the repository documents it links, it found no a build/run or getting-started section, no a testing section, no an architecture or project-map section. Sections are matched on HEADING text only, so material written under a heading this check does not recognise — or with no heading at all — is not seen and this row may understate what the document covers.
No src/ separation — Most of the production code is in directories of its own, but 15 application file(s) sit at the repository root beside the build and tooling files (`index.php`, `wp-activate.php`, `wp-blog-header.php`, `wp-comments-post.php`, `wp-config-sample.php` and 10 more).
No SAST — No static application security testing detected. For this repository's stack, add phpstan or psalm (or `semgrep --config=auto`, which runs on any language) — this repository has no CI pipeline yet, so run it locally to clear the existing findings, then make it a step of the first workflow you add so a regression fails the build. What was searched, so you can tell an absence from a miss: the 0 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
S1 · Web-Security Posture· Information-disclosure response header set · ×1
Information-disclosure response header set wp-content/plugins/woocommerce/assets/client/blocks/484.js:1— `product` is set explicitly here. The OWASP Secure Headers Project lists it among the response headers to REMOVE: it names the server, framework or tooling behind the application, which is exactly what an attacker looks up known exploits for. (No deduction on this card.)
X2 · Cancellation propagation· Not all async functions that make a request accept an AbortSignal · ×1
Not all async functions that make a request accept an AbortSignal — Only 0/1 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
X5 · Nullable reference types· PHP static analysis does not check null everywhere · ×1
PHP static analysis does not check null everywhere — This repository commits no PHPStan or Psalm configuration (`phpstan.neon[.dist]`, `phpstan.dist.neon`, `psalm.xml[.dist]`, or one a composer.json script names with `--configuration`), so nothing checks null: a `?Customer` reaches `->name()` silently and throws `Error: Call to a member function name() on null` the first time it is null. If the build passes a level on a command line instead, put it in a committed configuration — this check reads configuration, and configuration is all it can read.
doc comments repeat the names wp-content/plugins/woocommerce/assets/js/admin/api-keys.js:13— 4 of 275 documented parameters and 34 of 441 summaries in `.` only repeat the member or parameter name (e.g. "Events" for `events`). 38 documentation tag(s) are empty. Delete the restating tags, or add what the name does not say.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
none (no readable dependency manifest): not applicable — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Python pyproject.toml/requirements.txt (pip/uv/Poetry), a Swift Package.swift/Package.resolved, a Cargo manifest, a Go module (go.mod/go.sum), a Gradle version catalogue, a Maven POM, an sbt build (build.sbt), composer.json, package.json, a Dart pubspec.yaml, an Elixir mix.exs/mix.lock (Hex), a rebar.config / erlang.mk DEPS (Hex), a Ruby Gemfile/Gemfile.lock or .gemspec (Bundler/RubyGems) — not scanned yet).
trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
provenance: not applicable — No CI/build pipeline found (.github/.forgejo/.gitea workflows, .circleci, .buildkite, .woodpecker, .teamcity, .gitlab-ci.yml, .travis.yml, bitbucket-pipelines.yml, .drone.yml, .cirrus.yml, .woodpecker.yml, appveyor.yml, azure-pipelines*.yml, .pipelines/, .vsts-ci/, .azuredevops/, Jenkinsfile); there is no build to attest provenance for.
disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
none (no readable dependency manifest): not applicable — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Python pyproject.toml/requirements.txt (pip/uv/Poetry), a Swift Package.swift/Package.resolved, a Cargo manifest, a Go module (go.mod/go.sum), a Gradle version catalogue, a Maven POM, an sbt build (build.sbt), composer.json, package.json, a Dart pubspec.yaml, an Elixir mix.exs/mix.lock (Hex), a rebar.config / erlang.mk DEPS (Hex), a Ruby Gemfile/Gemfile.lock or .gemspec (Bundler/RubyGems) — not scanned yet).
0
—
Run 01a1e6f2-3bd1-7cfb-86ff-f8884c0265ed · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 95 · Warnings: 3201 · Recommendations: 131 · Info: 1 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 17-11-2026 @ 00:39 UTC.
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.