Public report of opnsense/core, published 20 October 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.10.5). Watchdog 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, 20 October 2026, 23:23 UTC · Survey ID cd_1274c6f9df5742199a63052fa82299f4
opnsense/core
Measured 20 October 2026, 23:13 UTC, at code version 6e32839
CAI scoreWeak
CriticalWeakAdequateStrongExemplary
Down 4 since the last survey
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 large codebase: 110,421 lines of product code, tests not counted · Estimated rebuild effort: about 0.7 person-years · Weakest lens: Production Readiness, 19
Findings by how serious they are
27 critical1194 serious43 minor
27 dimensions are left out of the score. For each one, Watchdog either couldn't measure it in this code, or found no evidence of the safeguard it looks 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
Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
20 October 2026, 23:13 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 Watchdog. It is open to any tool that
implements it, and today Watchdog is the only one that does.
The score is deterministic, which means the same code always gets the same score. Watchdog works 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 ▸
62of 64 dimensions measured by tools. The other 2 are advisory notes from an AI model, which explain the code but don't count towards the score.
1248of 1264 findings point to an exact file and line, so you can open each one in the code. The other 16 concern the repository as a whole, such as missing documentation.
64dimensions across 7 lenses, read from 110,421 lines of product code.
opnsense/core scores 30 out of 100 and is rated Weak, while five of its seven lenses score higher still: Performance at 100, rated Exemplary, Architecture at 89, rated Strong, Security and Compliance at 63 and Maturity at 54, both rated Adequate, and Code Health at 32, rated Weak.
The score is lower than those five because the weakest lens counts most, and here that is Production Readiness, which scores 19 and is rated Critical. Its Test Coverage dimension scores 0 out of 10, and until that reaches 4, Production Readiness can't be rated higher than Adequate. The first actions are to resolve the 1 Leaked secret finding(s) in REDACTED Scanning and to add a CI workflow that builds and runs the test suite on every push/PR, and if Production Readiness rose to 70, the score would rise from 30 to about 39.
27 findings are critical: 17 in Forms & labels, four in Keyboard semantics, two in Text alternatives, one in ARIA correctness, one in Page structure, one in REDACTED Scanning and one in Secrets (history).
Watchdog couldn't measure 26 dimensions in this code, among them Coupling, Code Coverage and Test Reliability, so they are left out of the score. The product code is 110,421 lines, which would take an estimated 0.7 person-years, around €99,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.
Outbound HTTP resilience · Outbound HTTP without resilience src/opnsense/scripts/monit/status.php
Outbound HTTP resilience · Outbound HTTP without resilience src/opnsense/site-python/tls_helper.py
Forms & labels · <select> without a programmatic label src/opnsense/www/js/opnsense_widgets.js
Forms & labels · <input> without a programmatic label src/opnsense/www/js/opnsense_widgets.js
Forms & labels · <textarea> without a programmatic label src/opnsense/www/js/opnsense_widgets.js
Forms & labels · <input> without a programmatic label src/opnsense/www/js/opnsense_widgets.js
Forms & labels · <button> with no accessible text src/opnsense/www/js/opnsense_widgets.js
Forms & labels · <button> with no accessible text src/opnsense/www/js/opnsense_widgets.js
Forms & labels · <select> without a programmatic label src/opnsense/www/js/opnsense_widgets.js
Keyboard semantics · Modal dialog does not manage focus src/opnsense/www/js/opnsense_bootgrid.js
Keyboard semantics · Anchor without href src/opnsense/www/js/opnsense_widgets.js
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap-select.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap-select.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/main.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_button-groups.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_button-groups.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_buttons.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_carousel.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_dropdowns.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_dropdowns.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_dropdowns.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_modals.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_modals.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_navbar.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/main.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap-select/less/bootstrap-select.less
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_button-groups.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_button-groups.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_buttons.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_carousel.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_dropdowns.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_dropdowns.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_dropdowns.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_modals.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_modals.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_navbar.scss
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/css/bootstrap-select.css
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/css/bootstrap-select.css
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/css/jquery.bootgrid.css
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/css/jquery.bootgrid.css
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/css/jquery.bootgrid.css
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/css/tokenize2.css
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/www/css/tokenize2.css
Visual & motion safety · Focus outline removed in CSS without a :focus replacement src/opnsense/scripts/captiveportal/htdocs_default/css/signin.css
Visual & motion safety · Animation without a prefers-reduced-motion guard src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap-dialog.scss
Visual & motion safety · Animation without a prefers-reduced-motion guard src/opnsense/www/themes/opnsense-dark/assets/stylesheets/dashboard.scss
Visual & motion safety · Animation without a prefers-reduced-motion guard src/opnsense/www/themes/opnsense-dark/assets/stylesheets/dashboard.scss
Visual & motion safety · Animation without a prefers-reduced-motion guard src/opnsense/www/themes/opnsense-dark/assets/stylesheets/main.scss
Visual & motion safety · Animation without a prefers-reduced-motion guard src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap-dialog.scss
Visual & motion safety · Animation without a prefers-reduced-motion guard src/opnsense/www/themes/opnsense/assets/stylesheets/dashboard.scss
Visual & motion safety · Animation without a prefers-reduced-motion guard src/opnsense/www/themes/opnsense/assets/stylesheets/dashboard.scss
Watchdog compares every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 32 findings
These 32 critical or serious findings were in the previous survey, on 4 October 2026, and are gone from this one.
Outbound HTTP resilience · Outbound HTTP without resilience src/opnsense/mvc/app/controllers/OPNsense/Monit/Api/StatusController.php
Text alternatives · <canvas> without a text alternative src/opnsense/www/js/widgets/Firewall.js
Forms & labels · <select> without a programmatic label src/opnsense/www/js/opnsense_widget_manager.js
Forms & labels · Link with no accessible name src/opnsense/www/js/opnsense_widget_manager.js
Forms & labels · <select> without a programmatic label src/opnsense/www/js/opnsense_widget_manager.js
Forms & labels · <select> without a programmatic label src/opnsense/www/js/opnsense_widget_manager.js
Forms & labels · <input> without a programmatic label src/opnsense/www/js/opnsense_widget_manager.js
Forms & labels · <textarea> without a programmatic label src/opnsense/www/js/opnsense_widget_manager.js
Rebuild cost: about €99,000 · Estimate
Cost to rebuild
€33,000 to €170,000, for 548 to 1,738 hours of work, about 0.7 person-years for 1 to 2 engineers
Difficulty of the problem
Standard, 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 30. 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
Large: 110,421 lines of product code
How the estimate is made: Watchdog prices 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.
Add a CI workflow that builds and runs the test suite on every push/PR.
Raises the score by about 5 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 €99,000 to build again, about 0.7 person-years of work. Its weakest lens is Production Readiness, at 19 (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 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 6.2 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 4% to 10% on every change. The history of the code shows how much it changes: about 22,201 lines over the last 90 days, which is about 90,037 lines a year. At that pace, the extra work comes to an estimated 9.9 to 59.3 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 Watchdog's 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; 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: 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.
244 modules, with 149 dependencies between them. Every module uses only modules listed above it, so there are no loops.
The table shows the 40 modules with the most connections; 204 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.
JakubOnderka.PhpParallelLint uses JakubOnderka.PhpParallelLint.Process, so a change to JakubOnderka.PhpParallelLint.Process can break JakubOnderka.PhpParallelLint, while a change to JakubOnderka.PhpParallelLint can't break JakubOnderka.PhpParallelLint.Process.
Position
Below the diagonal: JakubOnderka.PhpParallelLint uses a module listed above it, which is the healthy direction.
OPNsense.Auth.Api uses OPNsense.Base, so a change to OPNsense.Base can break OPNsense.Auth.Api, while a change to OPNsense.Auth.Api can't break OPNsense.Base.
Position
Below the diagonal: OPNsense.Auth.Api uses a module listed above it, which is the healthy direction.
OPNsense.Auth.FieldTypes uses OPNsense.Base.FieldTypes, so a change to OPNsense.Base.FieldTypes can break OPNsense.Auth.FieldTypes, while a change to OPNsense.Auth.FieldTypes can't break OPNsense.Base.FieldTypes.
Position
Below the diagonal: OPNsense.Auth.FieldTypes uses a module listed above it, which is the healthy direction.
OPNsense.Base.Constraints uses OPNsense.Base, so a change to OPNsense.Base can break OPNsense.Base.Constraints, while a change to OPNsense.Base.Constraints can't break OPNsense.Base.
Position
Below the diagonal: OPNsense.Base.Constraints uses a module listed above it, which is the healthy direction.
OPNsense.Base.Validators uses OPNsense.Base, so a change to OPNsense.Base can break OPNsense.Base.Validators, while a change to OPNsense.Base.Validators can't break OPNsense.Base.
Position
Below the diagonal: OPNsense.Base.Validators uses a module listed above it, which is the healthy direction.
OPNsense.CaptivePortal uses OPNsense.Base, so a change to OPNsense.Base can break OPNsense.CaptivePortal, while a change to OPNsense.CaptivePortal can't break OPNsense.Base.
Position
Below the diagonal: OPNsense.CaptivePortal uses a module listed above it, which is the healthy direction.
OPNsense.CaptivePortal.Api uses OPNsense.Base, so a change to OPNsense.Base can break OPNsense.CaptivePortal.Api, while a change to OPNsense.CaptivePortal.Api can't break OPNsense.Base.
Position
Below the diagonal: OPNsense.CaptivePortal.Api uses a module listed above it, which is the healthy direction.
OPNsense.CaptivePortal.Migrations uses OPNsense.Base, so a change to OPNsense.Base can break OPNsense.CaptivePortal.Migrations, while a change to OPNsense.CaptivePortal.Migrations can't break OPNsense.Base.
Position
Below the diagonal: OPNsense.CaptivePortal.Migrations uses a module listed above it, which is the healthy direction.
OPNsense.Core.Api uses OPNsense.Base, so a change to OPNsense.Base can break OPNsense.Core.Api, while a change to OPNsense.Core.Api can't break OPNsense.Base.
Position
Below the diagonal: OPNsense.Core.Api uses a module listed above it, which is the healthy direction.
OPNsense.Core.FieldTypes uses OPNsense.Base.FieldTypes, so a change to OPNsense.Base.FieldTypes can break OPNsense.Core.FieldTypes, while a change to OPNsense.Core.FieldTypes can't break OPNsense.Base.FieldTypes.
Position
Below the diagonal: OPNsense.Core.FieldTypes uses a module listed above it, which is the healthy direction.
OPNsense.Core.Menu uses OPNsense.Base.Menu, so a change to OPNsense.Base.Menu can break OPNsense.Core.Menu, while a change to OPNsense.Core.Menu can't break OPNsense.Base.Menu.
Position
Below the diagonal: OPNsense.Core.Menu uses a module listed above it, which is the healthy direction.
OPNsense.Core.Migrations uses OPNsense.Base, so a change to OPNsense.Base can break OPNsense.Core.Migrations, while a change to OPNsense.Core.Migrations can't break OPNsense.Base.
Position
Below the diagonal: OPNsense.Core.Migrations uses a module listed above it, which is the healthy direction.
OPNsense.Cron.Api uses OPNsense.Base, so a change to OPNsense.Base can break OPNsense.Cron.Api, while a change to OPNsense.Cron.Api can't break OPNsense.Base.
Position
Below the diagonal: OPNsense.Cron.Api uses a module listed above it, which is the healthy direction.
OPNsense.Cron.Migrations uses OPNsense.Base, so a change to OPNsense.Base can break OPNsense.Cron.Migrations, while a change to OPNsense.Cron.Migrations can't break OPNsense.Base.
Position
Below the diagonal: OPNsense.Cron.Migrations uses a module listed above it, which is the healthy direction.
OPNsense.DHCRelay uses OPNsense.Base, so a change to OPNsense.Base can break OPNsense.DHCRelay, while a change to OPNsense.DHCRelay can't break OPNsense.Base.
Position
Below the diagonal: OPNsense.DHCRelay uses a module listed above it, which is the healthy direction.
OPNsense.DHCRelay.Api uses OPNsense.Base, so a change to OPNsense.Base can break OPNsense.DHCRelay.Api, while a change to OPNsense.DHCRelay.Api can't break OPNsense.Base.
Position
Below the diagonal: OPNsense.DHCRelay.Api uses a module listed above it, which is the healthy direction.
OPNsense.DHCRelay.Migrations uses OPNsense.Base, so a change to OPNsense.Base can break OPNsense.DHCRelay.Migrations, while a change to OPNsense.DHCRelay.Migrations can't break OPNsense.Base.
Position
Below the diagonal: OPNsense.DHCRelay.Migrations uses a module listed above it, which is the healthy direction.
OPNsense.Diagnostics uses OPNsense.Base, so a change to OPNsense.Base can break OPNsense.Diagnostics, while a change to OPNsense.Diagnostics can't break OPNsense.Base.
Position
Below the diagonal: OPNsense.Diagnostics uses a module listed above it, which is the healthy direction.
OPNsense.Diagnostics.Api uses OPNsense.Base, so a change to OPNsense.Base can break OPNsense.Diagnostics.Api, while a change to OPNsense.Diagnostics.Api can't break OPNsense.Base.
Position
Below the diagonal: OPNsense.Diagnostics.Api uses a module listed above it, which is the healthy direction.
OPNsense.Diagnostics.FieldTypes uses OPNsense.Base.FieldTypes, so a change to OPNsense.Base.FieldTypes can break OPNsense.Diagnostics.FieldTypes, while a change to OPNsense.Diagnostics.FieldTypes can't break OPNsense.Base.FieldTypes.
Position
Below the diagonal: OPNsense.Diagnostics.FieldTypes uses a module listed above it, which is the healthy direction.
OPNsense.Routing uses OPNsense.Base, so a change to OPNsense.Base can break OPNsense.Routing, while a change to OPNsense.Routing can't break OPNsense.Base.
Position
Below the diagonal: OPNsense.Routing uses a module listed above it, which is the healthy direction.
src.opnsense.www.js.widgets.BaseGaugeWidget uses src.opnsense.www.js.widgets.BaseWidget, so a change to src.opnsense.www.js.widgets.BaseWidget can break src.opnsense.www.js.widgets.BaseGaugeWidget, while a change to src.opnsense.www.js.widgets.BaseGaugeWidget can't break src.opnsense.www.js.widgets.BaseWidget.
Position
Below the diagonal: src.opnsense.www.js.widgets.BaseGaugeWidget uses a module listed above it, which is the healthy direction.
src.opnsense.www.js.widgets.BaseTableWidget uses src.opnsense.www.js.widgets.BaseWidget, so a change to src.opnsense.www.js.widgets.BaseWidget can break src.opnsense.www.js.widgets.BaseTableWidget, while a change to src.opnsense.www.js.widgets.BaseTableWidget can't break src.opnsense.www.js.widgets.BaseWidget.
Position
Below the diagonal: src.opnsense.www.js.widgets.BaseTableWidget uses a module listed above it, which is the healthy direction.
JakubOnderka.PhpParallelLint.Contracts uses JakubOnderka.PhpParallelLint, so a change to JakubOnderka.PhpParallelLint can break JakubOnderka.PhpParallelLint.Contracts, while a change to JakubOnderka.PhpParallelLint.Contracts can't break JakubOnderka.PhpParallelLint.
Position
Below the diagonal: JakubOnderka.PhpParallelLint.Contracts uses a module listed above it, which is the healthy direction.
OPNsense.Auth.Services uses OPNsense.Auth, so a change to OPNsense.Auth can break OPNsense.Auth.Services, while a change to OPNsense.Auth.Services can't break OPNsense.Auth.
Position
Below the diagonal: OPNsense.Auth.Services uses a module listed above it, which is the healthy direction.
OPNsense.Firewall uses OPNsense.Base, so a change to OPNsense.Base can break OPNsense.Firewall, while a change to OPNsense.Firewall can't break OPNsense.Base.
Position
Below the diagonal: OPNsense.Firewall uses a module listed above it, which is the healthy direction.
OPNsense.Firewall uses OPNsense.Routing, so a change to OPNsense.Routing can break OPNsense.Firewall, while a change to OPNsense.Firewall can't break OPNsense.Routing.
Position
Below the diagonal: OPNsense.Firewall uses a module listed above it, which is the healthy direction.
OPNsense.Firewall.Api uses OPNsense.Base, so a change to OPNsense.Base can break OPNsense.Firewall.Api, while a change to OPNsense.Firewall.Api can't break OPNsense.Base.
Position
Below the diagonal: OPNsense.Firewall.Api uses a module listed above it, which is the healthy direction.
OPNsense.Firewall.Api uses OPNsense.Firewall, so a change to OPNsense.Firewall can break OPNsense.Firewall.Api, while a change to OPNsense.Firewall.Api can't break OPNsense.Firewall.
Position
Below the diagonal: OPNsense.Firewall.Api uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 32% · Weak · gated by D2, R1, 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
130
Medium
A07:2025 — Authentication Failures
3
High / Critical
Roadmap
Immediately resolve the leaked secret in REDACTED and establish a CI pipeline that builds and tests on every push. Integrate static analysis and security scanning into this workflow to ensure regressions fail the build, while simultaneously adding tests for all unreached production modules. Finally, enforce explicit timeouts and retry logic on all outbound HTTP clients to prevent indefinite waits and improve resilience.
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.
Give every client an explicit bound: `new Client(['timeout' => 10, 'connect_timeout' => 3])` for Guzzle (whose default is to wait forever), `CURLOPT_TIMEOUT`/`CURLOPT_CONNECTTIMEOUT` before `curl_exec`, `timeout`/`max_duration` on Symfony HttpClient (or `framework.http_client.default_options`), and a stream-context `timeout` or `connection_timeout` for `file_get_contents`/`SoapClient`. In Drupal, use the `http_client` service, which carries core's site-wide timeout, rather than `new Client()`. Add retries with back-off (Guzzle `Middleware::retry`, Symfony `RetryableHttpClient`, Laravel `->retry()`) around dependencies that fail.
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.
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
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 — 27
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 — 1194
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 — 43
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 27
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
Watchdog 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. 62 of 64 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 2 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 0.7 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.
Every figure here is one of three 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; ◐ Advisory — an LLM prose judgement. 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; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.
What we checked — 64 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, 1248 of 1264 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, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — 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.
D5 Coupling — not measured this run — Watchdog 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 the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
D8 Code Coverage — not measured this run — Watchdog 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, .py) 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. To have real coverage read, produce a coverage report in a standard format (Clover XML — with Xdebug (`XDEBUG_MODE=coverage`) or PCOV installed, `vendor/bin/phpunit --coverage-clover coverage.xml`, or `coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures. You can widen what we reach: optional: produce a coverage report in a standard format (Clover XML — with Xdebug (`XDEBUG_MODE=coverage`) or PCOV installed, `vendor/bin/phpunit --coverage-clover coverage.xml`, or `coverage run -m pytest` then `coverage xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then the real number is read on the next scan.
D11 Test Reliability — not measured this run — Watchdog 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, .py) 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 — Watchdog 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 — Watchdog 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.
D19 Documentation Quality — LLM provider failed — The model provider returned an unusable result, so this LLM-assisted dimension fell back to a measurement gap (confidence 0) rather than a penalty. Re-run with a reachable provider to score it.
D20 ADR Quality — not measured this run — Watchdog 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. The ADR expectation is gated on whether a repository ships a deployable product. Our repo-kind classifier reads .NET project files and the host and package markers of the other ecosystems it knows (a Go `package main`, a Cargo binary, a package.json `bin`, `start` script or application dev server such as Vite or Next, Python console scripts or a Django/WSGI entry point, a Spring Boot / WAR / Gradle application build, a Rack or Rails app, a Composer project, an OTP release or escript, a Dockerfile, a Procfile, a Platform.sh `.platform/routes.yaml`, and the corresponding published-package manifests, including an OTP `*.app.src`, a Drupal module's `*.info` and a Claude Code `.claude-plugin/plugin.json`), and found none here, so we could not tell what kind of repository this is and did not assess its ADR log. This is a gap in our analyzer, not a finding about this repository.
D22 Internal API Consistency — not measured this run — Watchdog 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 a COLLECTOR gap, not an environment fault: no published-package marker D22 reads admitted any project here, so this ecosystem's public API has no collector, and the remedy is to write one — no change to the scan image can close it.
D26 Project Cohesion — not measured this run — Watchdog 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. Project size and spread are measured over build units (a .NET project, a Maven or Gradle module, an npm, Deno or JSR package, a Go module, a Cargo crate, a Python, Composer, Bundler, RubyGems, Mix, rebar3, sbt, SwiftPM or pub package, an OTP application, an Xcode project or XcodeGen spec, or a checkout that declares no build at all) whose source a code model reads. This repository's production source is in a language no model reads, or in units whose build tool D26 does not recognise. That is a gap in this analyzer's language reach — not a finding that the repository's projects are cohesive.
D27 Navigability — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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. Tracing effort is measured over resolved call sites, and all 768 sampled here came from .php files. This repository's .py source is a material share of its production lines and contributed none, so the score above is a verdict about the part that was read. Not a finding that the unread half navigates well — it is unmeasured.
D32 Data Compliance (PII/GDPR) — not measured this run — Watchdog 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. `src/opnsense/mvc/app/library/OPNsense/Auth/SSOProviders/Provider.php`, `src/opnsense/mvc/app/library/OPNsense/System/SystemStatusCode.php` 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.
D44 Platform End-of-Life — not measured this run — Watchdog 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.
AC6 Visual & motion safety — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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. 4 further occurrence(s) are not listed individually; the score already reflects all 44.
AX1 Captive dependencies — not measured this run — Watchdog 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's container is Phalcon DI, 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.
AX3 Project dependency cycles — not measured this run — Watchdog 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 is computed over which project references which. That is a language-neutral question, but the project-reference graph is collected from MSBuild .csproj/.fsproj/.vbproj, Gradle, Maven, Cargo, npm/pnpm/yarn, Go module (and dep/glide/godep), Python pyproject.toml/setup.cfg/setup.py, SwiftPM, sbt, Mill, RubyGems, Composer, Mix/rebar3, pub, Unity assembly-definition, Deno/JSR, Tuist, CMake, Bazel, Xcode and XcodeGen builds and uni-app uni_modules plugins, or — when none declares a module — from the imports between a JavaScript/TypeScript, Python or Ruby tree's top-level directories, or as one module when all of a tree's source is one directory, and this repository offers none of them — so there was no graph to read, and re-running the same commit reads the same nothing. No module manifest of any ecosystem this engine recognises was found either, and the source's own imports could not stand in: they are read for JavaScript/TypeScript, Python and Ruby only, and only when those languages are the product — in any other language a tree is read only when its whole source is one directory, which this one's is not. The collector owed is an import reader for this repository's languages. That is a COLLECTOR gap in this analyzer — no change to the scan image closes it — and not a finding that the repository is free of what this check looks for.
AX4 Dependency direction — not measured this run — Watchdog 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 is computed over the direction each project reference points. That is a language-neutral question, but the project-reference graph is collected from MSBuild .csproj/.fsproj/.vbproj, Gradle, Maven, Cargo, npm/pnpm/yarn, Go module (and dep/glide/godep), Python pyproject.toml/setup.cfg/setup.py, SwiftPM, sbt, Mill, RubyGems, Composer, Mix/rebar3, pub, Unity assembly-definition, Deno/JSR, Tuist, CMake, Bazel, Xcode and XcodeGen builds and uni-app uni_modules plugins, or — when none declares a module — from the imports between a JavaScript/TypeScript, Python or Ruby tree's top-level directories, or as one module when all of a tree's source is one directory, and this repository offers none of them — so there was no graph to read, and re-running the same commit reads the same nothing. No module manifest of any ecosystem this engine recognises was found either, and the source's own imports could not stand in: they are read for JavaScript/TypeScript, Python and Ruby only, and only when those languages are the product — in any other language a tree is read only when its whole source is one directory, which this one's is not. The collector owed is an import reader for this repository's languages. That is a COLLECTOR gap in this analyzer — no change to the scan image closes it — and not a finding that the repository is free of what this check looks for.
AX6 Interface segregation — not measured this run — Watchdog 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 is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing 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.
AX8 Test isolation — not measured this run — Watchdog 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 is computed over which projects are test projects, and what they reference. That is a language-neutral question, but the project-reference graph is collected from MSBuild .csproj/.fsproj/.vbproj, Gradle, Maven, Cargo, npm/pnpm/yarn, Go module (and dep/glide/godep), Python pyproject.toml/setup.cfg/setup.py, SwiftPM, sbt, Mill, RubyGems, Composer, Mix/rebar3, pub, Unity assembly-definition, Deno/JSR, Tuist, CMake, Bazel, Xcode and XcodeGen builds and uni-app uni_modules plugins, or — when none declares a module — from the imports between a JavaScript/TypeScript, Python or Ruby tree's top-level directories, or as one module when all of a tree's source is one directory, and this repository offers none of them — so there was no graph to read, and re-running the same commit reads the same nothing. No module manifest of any ecosystem this engine recognises was found either, and the source's own imports could not stand in: they are read for JavaScript/TypeScript, Python and Ruby only, and only when those languages are the product — in any other language a tree is read only when its whole source is one directory, which this one's is not. The collector owed is an import reader for this repository's languages. That is a COLLECTOR gap in this analyzer — no change to the scan image closes it — and 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 — Watchdog 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: 12 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. Watchdog then boots 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 — Watchdog 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. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
C2 Access Controls — not measured this run — Watchdog 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. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
C3 Audit Trail — not measured this run — Watchdog 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. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
C4 Data Retention — not measured this run — Watchdog 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. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
C5 Data-Subject Rights — not measured this run — Watchdog 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. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
GD1 Unfinished & placeholder code — not measured this run — Watchdog 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 and Scala source only, and this repository's PHP, Python, lua 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 — Watchdog 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 and Scala source only, and this repository's PHP, Python, lua 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.
M3 Folder & project structure — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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. Whether the tests sit apart from production code is not visible here, because the suite is not in a form this pass reads. The test-separation credit is granted rather than withheld: this is a gap in the analyzer's language coverage, not a finding about the repository's tests. You can widen what we reach: keep the test surface somewhere a reader can find it without opening a binary — an exported/checked-in test source tree beside the production code makes the suite reviewable, diffable and discoverable by tooling.
P10 Library API & versioning — not measured this run — Watchdog 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 NuGet packaging and C# public API, and npm, PyPI, crates.io, Maven/Gradle, Go module, RubyGems, Composer, SwiftPM, CocoaPods, pub.dev, Hex, sbt, Mill and scala-cli package manifests only, and no .NET project and no package manifest of those ecosystems was found in this repository, 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.
P5 DR & Backup — not measured this run — Watchdog 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 backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found. Whether there is anything here to recover could NOT be determined: persistence is detected from deployment/container manifests and from dependency manifests, and neither was readable by this pass, so a data store this code opens directly — a file, an embedded database — would not be visible to it. The blindness is this analyzer's, not a finding that the repository holds no data. You can widen what we reach: keep the deployment/container manifest or a dependency manifest in this repository — or a link to the ops repo that holds the DR evidence — so the persistence probe has something to read.
S1 Web-Security Posture — not measured this run — Watchdog 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. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
Watchdog assesses the repository exactly as committed, and only the repository. By design it does 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.
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.
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.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
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.
D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
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").
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
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.
AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
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.
M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
The LLM boundary
LLM-set scores this run (2): D21, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score; each names its own sample and method on its card. They are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.
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.
213 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was Filter.performValidation at 117. A further 2 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 opnsense_ui.$.fn.SimpleActionButton at 20 — they are counted neither in the figure above nor in this dimension's score.
+ 187 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 11 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with Filter.performValidation (cyclomatic 117), Dnsmasq.performValidation (cyclomatic 103), OpenVPN.generateInstanceConfig (cyclomatic 89). — 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 Cyclomatic Complexity from 4.0 to about 5.3/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Stand up a CI pipeline, then gate Cyclomatic Complexity in it to reach Verified (currently Documented). — This repository has no CI pipeline, so there is nothing to add a gate to yet — the pipeline comes first. Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
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.
+ 425 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 52 bodies over 60 down to 60 or less in Cognitive Complexity — start with OpenVPN.generateInstanceConfig (cognitive 303), Filter.performValidation (cognitive 300), Dnsmasq.performValidation (cognitive 195). — 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 52 together lifts Cognitive Complexity from 2.0 to about 3.2/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Stand up a CI pipeline, then gate Cognitive Complexity in it to reach Verified (currently Documented). — This repository has no CI pipeline, so there is nothing to add a gate to yet — the pipeline comes first. Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes8.4 / 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 20 MethodTooLong finding(s) in God Classes — start with opnsense_bootgrid.js (4), OpenVPN.php (2), KeaDhcpv6.php (2). — One of this dimension's main actionable groups (20 warning-level).
Resolve the 15 FileTooLong finding(s) in God Classes — start with bootstrap-select.js, tokenize2.js, REDACTED. — One of this dimension's main actionable groups (15 warning-level).
Resolve the 9 TooManyMethods finding(s) in God Classes — start with SettingsController.php (3), BaseField.php, opnsense_bootgrid.js. — One of this dimension's main actionable groups (9 warning-level).
Stand up a CI pipeline, then gate God Classes in it to reach Verified (currently Documented). — This repository has no CI pipeline, so there is nothing to add a gate to yet — the pipeline comes first. Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Copy-pasted code that should be shared instead.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.
133 duplicated block group(s) detected. A further 3 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted.
+ 54 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 19 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with __init__.py (3), TunnelController.php (2), NetworkinsightController.php. — One of this dimension's main actionable groups (19 warning-level).
Resolve the 14 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with FilterRule.php (2), ApiControllerBase.php, LeasesController.php. — One of this dimension's main actionable groups (14 warning-level).
Resolve the 9 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with KeaDhcpv4.php (2), FirmwareController.php, DnsDiagnosticsController.php. — One of this dimension's main actionable groups (9 warning-level).
Stand up a CI pipeline, then gate Code Duplication in it to reach Verified (currently Documented). — This repository has no CI pipeline, so there is nothing to add a gate to yet — the pipeline comes first. Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
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 3 Low cohesion finding(s) in Cohesion (LCOM4) — start with FilterBaseController.php, Rule.php, PortField.php. — One of this dimension's main actionable groups (3 warning-level).
Stand up a CI pipeline, then gate Cohesion (LCOM4) in it to reach Verified (currently Documented). — This repository has no CI pipeline, so there is nothing to add a gate to yet — the pipeline comes first. Hardens enforcement from Documented toward Verified — provenance only; does not change the score.
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
Resolve the 1 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Stand up a CI pipeline, then gate REDACTED Scanning in it to reach Verified (currently Documented). — This repository has no CI pipeline, so there is nothing to add a gate to yet — the pipeline comes first. Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d13_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
Resolve the 20 Hotspot finding(s) in Churn × Complexity Hotspots — start with NetworkInterface.php, FilterRule.php, Filter.php. — One of this dimension's main actionable groups (20 warning-level).
Resolve the 1 Repeated repair finding(s) in Churn × Complexity Hotspots — start with LvtemplateController.php. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor8.3 / 10Strong✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
88 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is REDACTED. Counted over 544 of the 926 production source files in this repository: 370 are under the ~2,400-byte size floor this dimension measures over, and the remaining 12 have no attributable history left to measure.
Off-boarding risk: anonymized user #1 · ×4
Further sole-owners (lower concentration)
What to do
Resolve the 4 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (4 recommendation-level).
Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
58 deducted task-comment markers across 110421 LoC (0.1/KLoC) → score 9.9. 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 58 XxxComment finding(s) in Explicit Debt — start with __init__.py (7), tls_helper.py (4), FilterController.php (3). — One of this dimension's main actionable groups (58 warning-level).
Stand up a CI pipeline, then gate Explicit Debt in it to reach Verified (currently Documented). — This repository has no CI pipeline, so there is nothing to add a gate to yet — the pipeline comes first. Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.
What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.
Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.
Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.
45 % of calls cross a namespace and 0 % go through an interface, but 90 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated. Measured over the .php source only — this repository's .py was not sampled for call sites, so this score covers part of the tree, not all of it.
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).
132 finding(s): 0 critical, 0 high, 129 medium, 3 low. semgrep hit a parse error in 5 file(s) — `src/opnsense/mvc/app/library/OPNsense/Auth/SSOProviders/Provider.php` (line 35, line 36, line 37, …), `src/opnsense/mvc/app/library/OPNsense/System/SystemStatusCode.php` (line 33), `src/opnsense/scripts/firmware/health.sh`, `src/opnsense/service/templates/OPNsense/IDS/suricata.yaml`, `src/opnsense/www/js/bootstrap-select.js` — 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
+ 3 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 118 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (23), REDACTED (21), REDACTED (18). — One of this dimension's main actionable groups (118 warning-level).
Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 warning-level).
Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 warning-level).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
1 of 556 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is src/opnsense/mvc/app/models/OPNsense/Monit/Migrations/M1_0_7.php. Counted over 556 of the 926 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
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.
Resolve the 4 Change coupling finding(s) in Change Coupling — start with ArchiveOpenVPN.php, OverviewController.php, CategoryController.php. — One of this dimension's main actionable groups (4 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.
Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.
A vulnerability-disclosure policy (SECURITY.md) is published with a reporting contact.
✓ On the Gold path — maintain.
Detailed fixes: d37_recommendation.md.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC1 · Text alternatives2.7 / 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. (×2) — src/opnsense/scripts/captiveportal/htdocs_default/index.html:179, src/opnsense/scripts/captiveportal/htdocs_default/index.html:180
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 & labels3.6 / 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.
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). (×8) — src/opnsense/www/js/opnsense_bootgrid.js:1379, src/opnsense/www/js/opnsense_bootgrid.js:1962, src/opnsense/www/js/opnsense_bootgrid.js:1983, …
This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×9) — REDACTED:356, REDACTED:1051, REDACTED:1201, …
An <optgroup> groups <option>s but has no label, so assistive tech announces the group with no name. Add a label attribute. (×2) — REDACTED:987, REDACTED:1223
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.
Do you agree with this assessment?
AC3 · Page structure4.3 / 10Weak✓ Tool-verified
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.
The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en"). — src/opnsense/scripts/captiveportal/htdocs_default/index.html:2
An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative. — src/opnsense/www/js/bootstrap.js:1994
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".
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. (×4) — src/opnsense/www/js/opnsense_bootgrid.js:1281, REDACTED:1168, src/opnsense/www/js/opnsense_widgets.js:94, …
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. — src/opnsense/www/js/opnsense_bootgrid.js:1181
The repo's own CSS styles .btn 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:199, REDACTED:200, REDACTED:204
A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler. — src/opnsense/www/js/widgets/Interfaces.js:72
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.
aria-hidden="true" hides the element from assistive tech but leaves it keyboard-focusable — a confusing dead stop. Remove aria-hidden or make the element non-focusable. — src/opnsense/www/js/bootstrap-select.js:1079
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 · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.
Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.
Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
`.bootstrap-select.disabled:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. (×2) — src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap-select.scss:197, src/opnsense/www/css/bootstrap-select.css:201
`.bootstrap-select .dropdown-menu > .inner:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. (×2) — src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap-select.scss:265, src/opnsense/www/css/bootstrap-select.css:269
`button.toggle-sidebar` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. (×2) — src/opnsense/www/themes/opnsense-dark/assets/stylesheets/main.scss:428, src/opnsense/www/themes/opnsense/assets/stylesheets/main.scss:429
`.btn-group > .btn:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. (×2) — src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_button-groups.scss:23, src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_button-groups.scss:23
`.btn-group.open .dropdown-toggle` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. (×2) — src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_button-groups.scss:91, src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_button-groups.scss:91
`.btn.active` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. (×2) — src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_buttons.scss:40, src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_buttons.scss:40
`.carousel-control:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. (×2) — src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_carousel.scss:96, src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_carousel.scss:96
`.dropdown-toggle:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. (×2) — src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_dropdowns.scss:25, src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_dropdowns.scss:25
`.dropdown-menu > .active > a` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. (×2) — src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_dropdowns.scss:91, src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_dropdowns.scss:91
`.open > a` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. (×2) — src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_dropdowns.scss:128, src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_dropdowns.scss:128
`.modal` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. (×2) — src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_modals.scss:29, src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_modals.scss:29
`.modal-content` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. (×2) — src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_modals.scss:60, src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_modals.scss:60
`.navbar-toggle:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. (×2) — src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_navbar.scss:203, src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_navbar.scss:203
`.bootstrap-select.btn-group.disabled:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap-select/less/bootstrap-select.less:113
`.bootgrid-header a` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — src/opnsense/www/css/jquery.bootgrid.css:12
`.bootgrid-table a` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — src/opnsense/www/css/jquery.bootgrid.css:80
`.bootgrid-table th.select-cell .select-box` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — src/opnsense/www/css/jquery.bootgrid.css:149
`.tokenize.focus > .tokens-container` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — src/opnsense/www/css/tokenize2.css:19
`.tokenize > .tokens-container > .token-search > input` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — src/opnsense/www/css/tokenize2.css:88
`input[type="text"]` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — src/opnsense/scripts/captiveportal/htdocs_default/css/signin.css:133
`.bootstrap-dialog .icon-spin` moves (`animation: spin 2s infinite linear`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. (×2) — src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap-dialog.scss:96, src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap-dialog.scss:96
`#save-spinner` moves (`transition: opacity 0.3s ease, transform 0.3s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. (×2) — src/opnsense/www/themes/opnsense-dark/assets/stylesheets/dashboard.scss:35, src/opnsense/www/themes/opnsense/assets/stylesheets/dashboard.scss:35
`.transition-spinner` moves (`transition: opacity 0.3s ease, transform 0.3s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. (×2) — src/opnsense/www/themes/opnsense-dark/assets/stylesheets/dashboard.scss:39, src/opnsense/www/themes/opnsense/assets/stylesheets/dashboard.scss:39
`.list-group-item:before` moves (`transition: width .2s`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — src/opnsense/www/themes/opnsense-dark/assets/stylesheets/main.scss:606
What to do
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Do you agree with this assessment?
AC7 · A11y enforcement4.0 / 10Weak✓ Tool-verified
Other · Accessibility — Whether accessibility is ENFORCED in the toolchain — an accessibility checker configured over the markup (an a11y lint rule set, e.g. eslint-plugin-jsx-a11y or vuejs-accessibility where the project lints JavaScript) and an automated accessibility assertion wired into tests or CI (axe/pa11y/Lighthouse or an equivalent) — on the Documented→Verified→Prevented ladder.
Method: Repo config/CI scan: an accessibility checker configured over the markup (an a11y lint rule set such as eslint-plugin-jsx-a11y / vuejs-accessibility where JavaScript is linted) and an automated accessibility assertion in tests or CI (axe/pa11y/Lighthouse or equivalent), graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.
Coverage: Population: the repository's own tooling configuration — lint config, test and CI files — NOT the markup. It is read for a configured accessibility checker and an automated accessibility assertion (axe/pa11y/Lighthouse, or a native-toolkit equivalent), and it credits an INVOCATION, never a mention: a licence filename, an import comment or a doc reference earns no rung. Enforcement configured entirely outside the repository leaves no evidence here and cannot be credited.
No accessibility enforcement found — no automated accessibility check runs over your pages. Add an accessibility checker (axe-core, pa11y or Lighthouse) over your HTML in CI and fail the build on new violations. What was searched, so you can tell an absence from a miss: the 12 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
What to do
Enforce accessibility over your pages: run an accessibility checker (axe-core, pa11y or Lighthouse) against your HTML in CI and fail the build on new violations — these run as standalone tools without adding a package manifest.
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.
What to do
The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
369 code files changed in the last 6 months but the README was not touched — it may no longer reflect the system.
What to do
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.
Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
Review the README against recent changes; refresh the parts that drifted.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).
Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.
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.
Do you agree with this assessment?
P2 · Observability8.0 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
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.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.
Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.
`curl_exec(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×4) — src/etc/inc/plugins.inc.d/opendns.inc:67, src/opnsense/mvc/app/controllers/OPNsense/Core/Api/DashboardController.php:235, src/opnsense/scripts/monit/status.php:58, …
`requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×4) — src/opnsense/scripts/filter/lib/alias/geoip.py:165, src/opnsense/scripts/suricata/lib/downloader.py:112, src/opnsense/scripts/system/crl_fetch.py:62, …
`requests.Session(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×2) — src/opnsense/site-python/tls_helper.py:104, src/opnsense/site-python/tls_helper.py:109
What to do
Give every client an explicit bound: `new Client(['timeout' => 10, 'connect_timeout' => 3])` for Guzzle (whose default is to wait forever), `CURLOPT_TIMEOUT`/`CURLOPT_CONNECTTIMEOUT` before `curl_exec`, `timeout`/`max_duration` on Symfony HttpClient (or `framework.http_client.default_options`), and a stream-context `timeout` or `connection_timeout` for `file_get_contents`/`SoapClient`. In Drupal, use the `http_client` service, which carries core's site-wide timeout, rather than `new Client()`. Add retries with back-off (Guzzle `Middleware::retry`, Symfony `RetryableHttpClient`, Laravel `->retry()`) around dependencies that fail.
Pass `timeout=` on every `requests`/`httpx` call (requests has no default and will wait forever), mount an `HTTPAdapter(max_retries=Retry(...))` on shared sessions, and wrap calls to flaky dependencies in `tenacity` retries or a `pybreaker` circuit breaker.
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 the language 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 · 53 plain JS — the untyped files are src/opnsense/www/js/bootstrap-dialog.js, src/opnsense/www/js/bootstrap-select.js, src/opnsense/www/js/chartjs-plugin-streaming.js, src/opnsense/www/js/jquery-sortable.js, src/opnsense/www/js/opnsense-treeview.js, src/opnsense/www/js/opnsense.js (+47 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 — Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm over JS/TS tokens, D-386): 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. Deterministic.
src/opnsense/www/js/jquery-sortable.js:31 · src/opnsense/www/js/tokenize2.js:2005 — 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. — src/opnsense/www/js/jquery-sortable.js:31
src/opnsense/www/js/widgets/DnsmasqLeases.js:72 · src/opnsense/www/js/widgets/KeaLeases.js:92 — the two spans are one implementation copied and then locally edited — 253 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. — src/opnsense/www/js/widgets/DnsmasqLeases.js:72
src/opnsense/www/js/opnsense_bootgrid.js:2215 · src/opnsense/www/js/opnsense_bootgrid.js:2362 — 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. — src/opnsense/www/js/opnsense_bootgrid.js:2215
src/opnsense/www/js/bootstrap-dialog.js:1192 · src/opnsense/www/js/bootstrap-dialog.js:1241 — 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. — src/opnsense/www/js/bootstrap-dialog.js:1192
src/opnsense/www/js/opnsense_bootgrid.js:2486 · src/opnsense/www/js/opnsense_bootgrid.js:2504 — 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. — src/opnsense/www/js/opnsense_bootgrid.js:2486
src/opnsense/www/js/opnsense_theme.js:185 · src/opnsense/www/js/opnsense_theme.js:207 — the two spans are one implementation copied and then locally edited — 73 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. — src/opnsense/www/js/opnsense_theme.js:185
src/opnsense/www/js/widgets/FirewallStates.js:27 · src/opnsense/www/js/widgets/Mbuf.js:27 · src/opnsense/www/js/widgets/Swap.js:27 — 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. — src/opnsense/www/js/widgets/FirewallStates.js:27
src/opnsense/www/js/widgets/IpsecLeases.js:50 · src/opnsense/www/js/widgets/IpsecTunnels.js:51 — 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. — src/opnsense/www/js/widgets/IpsecLeases.js:50
src/opnsense/www/js/widgets/Certificates.js:27 · src/opnsense/www/js/widgets/LiveLog.js:27 — the two spans are one implementation copied and then locally edited — 51 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. — src/opnsense/www/js/widgets/Certificates.js:27
src/opnsense/www/js/widgets/OpenVPNServers.js:27 · src/opnsense/www/js/widgets/Wireguard.js:28 — 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. — src/opnsense/www/js/widgets/OpenVPNServers.js:27
REDACTED:722 · REDACTED:757 — 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:722
src/opnsense/www/js/opnsense_bootgrid.js:1873 · src/opnsense/www/js/opnsense_bootgrid.js:1885 — 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. — src/opnsense/www/js/opnsense_bootgrid.js:1873
src/opnsense/www/js/opnsense.js:328 · src/opnsense/www/js/opnsense.js:354 — 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. — src/opnsense/www/js/opnsense.js:328
src/opnsense/www/js/opnsense_bootgrid.js:2289 · src/opnsense/www/js/opnsense_bootgrid.js:2379 — 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. — src/opnsense/www/js/opnsense_bootgrid.js:2289
src/opnsense/www/js/bootstrap-dialog.js:764 · src/opnsense/www/js/bootstrap-dialog.js:790 — 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. — src/opnsense/www/js/bootstrap-dialog.js:764
src/opnsense/www/js/bootstrap-select.js:756 · src/opnsense/www/js/bootstrap-select.js:791 — 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. — src/opnsense/www/js/bootstrap-select.js:756
src/opnsense/www/js/widgets/Announcements.js:38 · src/opnsense/www/js/widgets/Carp.js:37 · src/opnsense/www/js/widgets/Gateways.js:40 — 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. — src/opnsense/www/js/widgets/Announcements.js:38
src/opnsense/www/js/widgets/Interfaces.js:40 · src/opnsense/www/js/widgets/IpsecLeases.js:41 · src/opnsense/www/js/widgets/Wireguard.js:41 — 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. — src/opnsense/www/js/widgets/Interfaces.js:40
src/opnsense/www/js/qrcode.js:1071 · src/opnsense/www/js/qrcode.js:1087 — 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. — src/opnsense/www/js/qrcode.js:1071
src/opnsense/www/js/widgets/Firewall.js:287 · src/opnsense/www/js/widgets/InterfaceStatistics.js:171 — 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. — src/opnsense/www/js/widgets/Firewall.js:287
src/opnsense/www/js/widgets/Gateways.js:56 · src/opnsense/www/js/widgets/ThermalSensors.js:188 — 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. — src/opnsense/www/js/widgets/Gateways.js:56
src/opnsense/www/js/bootstrap-dialog.js:1030 · src/opnsense/www/js/bootstrap-dialog.js:1046 — 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. — src/opnsense/www/js/bootstrap-dialog.js:1030
REDACTED:377 · REDACTED:405 — 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:377
REDACTED:464 · REDACTED:1077 — 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:464
src/opnsense/www/js/qrcode.js:311 · src/opnsense/www/js/qrcode.js:320 — 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. — src/opnsense/www/js/qrcode.js:311
src/opnsense/www/js/qrcode.js:338 · src/opnsense/www/js/qrcode.js:432 — 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. — src/opnsense/www/js/qrcode.js:338
src/opnsense/www/js/widgets/IpsecTunnels.js:180 · src/opnsense/www/js/widgets/IpsecTunnels.js:192 — 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. — src/opnsense/www/js/widgets/IpsecTunnels.js:180
src/opnsense/www/js/opnsense.js:69 · src/opnsense/www/js/opnsense.js:147 — 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. — src/opnsense/www/js/opnsense.js:69
src/opnsense/www/js/qrcode.js:917 · src/opnsense/www/js/qrcode.js:925 — 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. — src/opnsense/www/js/qrcode.js:917
src/opnsense/www/js/smoothie.js:525 · src/opnsense/www/js/smoothie.js:545 — 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. — src/opnsense/www/js/smoothie.js:525
src/opnsense/www/js/widgets/BaseWidget.js:256 · src/opnsense/www/js/widgets/Traffic.js:38 — 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. — src/opnsense/www/js/widgets/BaseWidget.js:256
src/opnsense/www/js/widgets/InterfaceStatistics.js:93 · src/opnsense/www/js/widgets/InterfaceStatistics.js:194 — the two spans are one implementation copied and then locally edited — 73 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. — src/opnsense/www/js/widgets/InterfaceStatistics.js:93
src/opnsense/www/js/opnsense_bootgrid.js:390 · src/opnsense/www/js/opnsense_bootgrid.js:413 — 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. — src/opnsense/www/js/opnsense_bootgrid.js:390
REDACTED:364 · REDACTED:379 · REDACTED:407 — 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. — REDACTED:364
src/opnsense/www/js/qrcode.js:621 · src/opnsense/www/js/qrcode.js:683 — 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. — src/opnsense/www/js/qrcode.js:621
src/opnsense/www/js/smoothie.js:709 · src/opnsense/www/js/smoothie.js:716 — 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. — src/opnsense/www/js/smoothie.js:709
src/opnsense/www/js/widgets/BaseGaugeWidget.js:115 · src/opnsense/www/js/widgets/BaseGaugeWidget.js:126 — 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. — src/opnsense/www/js/widgets/BaseGaugeWidget.js:115
src/opnsense/www/themes/opnsense-auto/build/js/theme.js:9 · src/opnsense/www/themes/opnsense-auto/build/js/theme.js:18 — 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. — src/opnsense/www/themes/opnsense-auto/build/js/theme.js:9
src/opnsense/www/js/qrcode.js:648 · src/opnsense/www/js/qrcode.js:700 — 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. — src/opnsense/www/js/qrcode.js:648
src/opnsense/www/js/smoothie.js:688 · src/opnsense/www/js/smoothie.js:693 — 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. — src/opnsense/www/js/smoothie.js:688
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.
translateCompatOptions has cyclomatic complexity 68 and cognitive complexity 78; 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. — src/opnsense/www/js/opnsense_bootgrid.js:244
keydown has cyclomatic complexity 66 and cognitive complexity 113; 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. — src/opnsense/www/js/bootstrap-select.js:2827
render has cyclomatic complexity 61 and cognitive complexity 93; 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. — src/opnsense/www/js/smoothie.js:839
scroll has cyclomatic complexity 55 and cognitive complexity 99; 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. — src/opnsense/www/js/bootstrap-select.js:1227
liHeight has cyclomatic complexity 43 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 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. — src/opnsense/www/js/bootstrap-select.js:1878
getLostPoint has cyclomatic complexity 42 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. — src/opnsense/www/js/qrcode.js:1020
(anonymous) has cyclomatic complexity 38 and cognitive complexity 99; 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. — src/opnsense/www/js/bootstrap-select.js:2454
render has cyclomatic complexity 37 and cognitive complexity 90; 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. — src/opnsense/www/js/bootstrap-select.js:1714
(anonymous) has cyclomatic complexity 29 and cognitive complexity 82; 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. — src/opnsense/www/js/opnsense.js:155
_parseGridView has cyclomatic complexity 22 and cognitive complexity 33; 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. — src/opnsense/www/js/opnsense_bootgrid.js:476
createSvgTag has cyclomatic complexity 22 and cognitive complexity 24; 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. — src/opnsense/www/js/qrcode.js:495
setupPositionProbePattern has cyclomatic complexity 19 and cognitive complexity 19; 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. — src/opnsense/www/js/qrcode.js:75
_parseColumns has cyclomatic complexity 18 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 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. — src/opnsense/www/js/opnsense_bootgrid.js:536
(anonymous) has cyclomatic complexity 18 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 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. — src/opnsense/www/js/bootstrap-select.js:2672
setMenuSize has cyclomatic complexity 18 and cognitive complexity 23; 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. — src/opnsense/www/js/bootstrap-select.js:2030
_createHalfASCII has cyclomatic complexity 18 and cognitive complexity 19; 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. — src/opnsense/www/js/qrcode.js:620
createDropdown has cyclomatic complexity 18 and cognitive complexity 18; 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. — src/opnsense/www/js/bootstrap-select.js:1057
(anonymous) has cyclomatic complexity 18 and cognitive complexity 15; 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:694
getLengthInBits has cyclomatic complexity 17 and cognitive complexity 11; 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. — src/opnsense/www/js/qrcode.js:974
setStyle has cyclomatic complexity 16 and cognitive complexity 21; 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. — src/opnsense/www/js/bootstrap-select.js:1841
What to do
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
Do you agree with this assessment?
R3 · Large Files1.7 / 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.
src/opnsense/www/js/bootstrap-select.js has 2685 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/opnsense/www/js/bootstrap-select.js:1
src/opnsense/www/js/tokenize2.js has 2412 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/opnsense/www/js/tokenize2.js:1
src/opnsense/www/js/opnsense_bootgrid.js has 2218 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/opnsense/www/js/opnsense_bootgrid.js:1
src/opnsense/www/js/qrcode.js has 1798 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/opnsense/www/js/qrcode.js:1
src/opnsense/www/js/bootstrap-dialog.js has 1204 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/opnsense/www/js/bootstrap-dialog.js:1
REDACTED has 1199 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
src/opnsense/www/js/opnsense_widgets.js has 1138 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/opnsense/www/js/opnsense_widgets.js:1
src/opnsense/www/js/smoothie.js has 1075 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/opnsense/www/js/smoothie.js:1
src/opnsense/www/js/chartjs-plugin-streaming.js has 939 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/opnsense/www/js/chartjs-plugin-streaming.js:1
src/opnsense/www/js/jquery-sortable.js has 631 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/opnsense/www/js/jquery-sortable.js:1
src/opnsense/www/js/opnsense.js has 411 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — src/opnsense/www/js/opnsense.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.0 / 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.
0% of 53 production file(s) reachable from 0 test file(s) via the import graph — 'production' here is the RESIDUE: every source file left once tests, tooling, generated output, config, declarations and declaration-only modules, fixture corpora, type fixtures, behaviour-free data modules, re-export barrels, registration/constant data modules and service workers are set aside, so the percentage is taken over a smaller denominator than the workspace's file count
What to do
Add tests that import the unreached modules (directly or through their public entry).
Do you agree with this assessment?
R7 · Dead Code10.0 / 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.
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 · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.
Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.
Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. 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 `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.
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.
Do you agree with this assessment?
X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.
Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. 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.
Do you agree with this assessment?
X17 · Uncapped recursion over a caller-supplied document10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.
Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. 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.
`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 350, reset at line 386) — 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. — src/opnsense/mvc/app/library/OPNsense/Auth/LDAP.php:346
`loadFromStream` 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 388, reset at line 396) — 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. — src/opnsense/mvc/app/library/OPNsense/Core/Config.php:378
`signCert` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the error-reporting level (changed at line 267, put back at line 276) — 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. — src/opnsense/mvc/app/library/OPNsense/Trust/Store.php:258
`reIssueCert` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the error-reporting level (changed at line 305, put back at line 318) — 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. — src/opnsense/mvc/app/library/OPNsense/Trust/Store.php:295
`createCert` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the error-reporting level (changed at line 346, put back at line 373) — 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. — src/opnsense/mvc/app/library/OPNsense/Trust/Store.php:336
`getPKCS12` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the error-reporting level (changed at line 553, put back at line 565) — 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. — src/opnsense/mvc/app/library/OPNsense/Trust/Store.php:546
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 Python the same holds for `os.chdir`, `os.environ` and `sys.stdout`: pass `cwd=`/`env=` to `subprocess`, or use `contextlib.chdir`/`redirect_stdout`, rather than moving the global by hand. 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/2 async functions that make a cancellable request (fetch, axios, ky, ofetch) 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.
`_fetchRRDList` 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 })`. — src/opnsense/www/js/opnsense_health.js:119
`_fetchData` 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 })`. — src/opnsense/www/js/opnsense_health.js:124
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 a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back.
Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. 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.
Do you agree with this assessment?
X24 · Document value interpolated into markup unescaped6.8 / 10Adequate✓ Tool-verified
Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.
Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.
`content` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — src/opnsense/www/js/bootstrap-select.js:714
`text` is text this program did not author, and it is written into the text of an element through `insertAdjacentHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — src/opnsense/www/js/bootstrap-select.js:731
`options.content` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — src/opnsense/www/js/bootstrap-select.js:747
`options.display` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — src/opnsense/www/js/bootstrap-select.js:786
`this.options.noneResultsText.replace('{0}','"'+htmlEscape(searchValue)+'"')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — src/opnsense/www/js/bootstrap-select.js:812
`unsafeHtml` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — src/opnsense/www/js/bootstrap.js:1401
`this.options.tooltipFormatter.call(this,t,data)` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — src/opnsense/www/js/smoothie.js:647
What to do
Each finding names the expression, the attribute it lands in and the line. Confirm the value's origin from the read this analyzer traced, then escape it at the sink or validate it against the shape the attribute accepts before interpolating.
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.
Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.
Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.
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.
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.
Do you agree with this assessment?
X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.
Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. 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.
`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. (×2) — contrib/IXR/IXR_Library.php:656, contrib/IXR/IXR_Library.php:662
`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. — src/etc/inc/config.inc:217
`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. — src/opnsense/mvc/app/library/OPNsense/Mvc/Dispatcher.php:134
`except` 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. — src/opnsense/scripts/filter/lib/states.py:170
An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `close()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch. — src/opnsense/scripts/unbound-dnsbl/lib/log.py:87
`except 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. — src/opnsense/scripts/unbound/logger.py:68
`.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it. — src/opnsense/www/js/opnsense_widgets.js:1192
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. (×3) — src/opnsense/www/js/bootstrap-select.js:255, src/opnsense/www/js/bootstrap-select.js:652, REDACTED:58
What to do
Swallowed exception (caught, then discarded)
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 log calls use message templates (queryable) rather than interpolated strings.
Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. 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 `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.
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 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 40 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 — 2 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 — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 3 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 5 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: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) 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. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) 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. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) 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. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
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
Not included — 60 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.
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 — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. 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).
AX3 Project dependency cycles — not assessed — project cycles and dependency direction are computed over a project-reference graph that was not loaded for this repository, because the repository commits no project file of a kind this check models. This is a gap in the analyzer, not a finding about this repository
AX4 Dependency direction — not assessed — project cycles and dependency direction are computed over a project-reference graph that was not loaded for this repository, because the repository commits no project file of a kind this check models. This is a gap in the analyzer, not a finding about this repository
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) 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
AX6 Interface segregation — not assessed — interface segregation is computed over a type surface 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
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — not assessed — test isolation is computed from a project graph (which projects are test projects, and what they reference) that was not loaded for this repository, because the repository commits no project file of a kind this check models. This is a gap in the analyzer, not a finding about this repository
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.
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) 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. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) 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. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
D10 Test Quality — ~5837 lines of test source are present (.php, .py) 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
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 — LLM evaluation failed
D20 ADR Quality — Repository kind not determined
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. 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"]`.
D24 Comment Value — No inline comments to assess — comment value is not applicable here.
D25 ADR Conformance — no ADRs to check
D26 Project Cohesion — D26 measured no build unit over this repository's .lua, .php source. Not scored: this is a gap in the analyzer, not a verdict about this repository.
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.
D32 Data Compliance (PII/GDPR) — 2 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
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.
D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
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
D5 Coupling — D5 reads a .NET project-reference graph only — this repository's production source is .php, .py, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
D8 Code Coverage — Coverage not included — suite not readable by the collector
D9 Test Distribution — Test source is present (.php, .py) 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 its unit/integration/BDD/E2E split couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
DM1 Domain Modelling — applicable but not scored (2 of 3 signals for this style — below the bar we score at): 3 value object(s); a Domain/Aggregates/ValueObjects layer
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 and Scala, 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
P10 Library API & versioning — 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
P12 CI test-gate honesty — no CI workflow found
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 — no coverage report found on disk — produce a coverage report in a standard format (Clover XML — with Xdebug (`XDEBUG_MODE=coverage`) or PCOV installed, `vendor/bin/phpunit --coverage-clover coverage.xml`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
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 applicable: PHP and TypeScript/JavaScript and Python runs on a garbage-collected runtime that gives a program no allocation-control idiom to choose on a hot path — no pools, stack allocation or value types — so allocation awareness is not something this code can be rated on.
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).
S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) 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. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
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.
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.
X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
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 — 27 finding(s)
AC2 · Forms & labels· <button> with no accessible text · ×8
<button> with no accessible text src/opnsense/www/js/opnsense_bootgrid.js:1379— 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).
<button> with no accessible text src/opnsense/www/js/opnsense_bootgrid.js:1962— 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).
<button> with no accessible text src/opnsense/www/js/opnsense_bootgrid.js:1983— 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).
<button> with no accessible text src/opnsense/www/js/opnsense_bootgrid.js:1984— 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).
<button> with no accessible text src/opnsense/www/js/opnsense_bootgrid.js:1985— 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).
<button> with no accessible text src/opnsense/www/js/opnsense_bootgrid.js:1986— 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).
<button> with no accessible text src/opnsense/www/js/opnsense_widgets.js:1182— 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).
<button> with no accessible text src/opnsense/www/js/opnsense_widgets.js:1202— 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).
AC2 · Forms & labels· <textarea> without a programmatic label · ×3
<textarea> without a programmatic label REDACTED:356— 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 src/opnsense/www/js/opnsense_widgets.js:367— 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 src/opnsense/www/js/widgets/Firewall.js:229— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC2 · Forms & labels· <input> without a programmatic label · ×3
<input> without a programmatic label REDACTED:1051— 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 src/opnsense/www/js/opnsense_widgets.js:363— 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 src/opnsense/www/js/opnsense_widgets.js:375— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC2 · Forms & labels· <select> without a programmatic label · ×3
<select> without a programmatic label REDACTED:1201— 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 src/opnsense/www/js/opnsense_widgets.js:352— 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 src/opnsense/www/js/opnsense_widgets.js:1213— 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 · ×3
Clickable element isn't keyboard-operable REDACTED:199— The repo's own CSS styles .btn 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:200— The repo's own CSS styles .btn 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:204— The repo's own CSS styles .btn 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.
AC1 · Text alternatives· <img> without a text alternative · ×2
<img> without a text alternative src/opnsense/scripts/captiveportal/htdocs_default/index.html:179— 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 src/opnsense/scripts/captiveportal/htdocs_default/index.html:180— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<html> without a lang src/opnsense/scripts/captiveportal/htdocs_default/index.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
AC4 · Keyboard semantics· Click handler on a non-interactive <b> · ×1
Click handler on a non-interactive <b> src/opnsense/www/js/widgets/Interfaces.js:72— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
AC5 · ARIA correctness· aria-hidden on a focusable element · ×1
aria-hidden on a focusable element src/opnsense/www/js/bootstrap-select.js:1079— aria-hidden="true" hides the element from assistive tech but leaves it keyboard-focusable — a confusing dead stop. Remove aria-hidden or make the element non-focusable.
XxxComment contrib/spdx-sbom/lib/spdx/spdx_element.py:48— # XXX: should replace — 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.
XxxComment contrib/spdx-sbom/lib/spdx/__init__.py:43— # XXX: temp static block — 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.
XxxComment contrib/spdx-sbom/lib/spdx/__init__.py:73— # XXX: temp static block — 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.
XxxComment contrib/spdx-sbom/lib/spdx/__init__.py:62— # XXX: replace — 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.
XxxComment contrib/spdx-sbom/lib/spdx/__init__.py:63— # XXX: static — 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.
XxxComment contrib/spdx-sbom/lib/spdx/__init__.py:65— # XXX static data from SpdxCreationInfo — 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.
XxxComment src/opnsense/mvc/app/controllers/OPNsense/Base/ApiControllerBase.php:402— // XXX: fallback, controller returned data as string. a deprecation message might be an option here. — 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.
XxxComment src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/FirewallController.php:84— // XXX: Omit group types since they don't link to actual interfaces. — 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.
XxxComment src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterController.php:215— // XXX: ideally this should get its own parameter and not reuse show_all — 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.
XxxComment src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterController.php:320— // XXX: Loopback excluded since no rules should be on there — 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.
XxxComment src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterController.php:339— // XXX: as shaper1/2 don't have functional keys, we can only export uuid's here — 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.
XxxComment src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/AliasUtilController.php:128— // XXX: addresses from "pfctl -t xxx -T show" don't always match our input, we probably need a — 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.
XxxComment src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/AliasController.php:484— // XXX: we might add some attribute in firmware to store subscription status, since we now only store uri — 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.
XxxComment src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/TunnelController.php:240— // XXX: a bit convoluted, should probably replace id at some point — 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.
XxxComment src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/VipSettingsController.php:139— // XXX a bit unpractical, but we can not validate previous values from the model so — 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.
XxxComment src/opnsense/mvc/app/controllers/OPNsense/TrafficShaper/Api/ServiceController.php:144— // XXX: sched_nr seems to be the linking pin to pipe — 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.
XxxComment src/opnsense/mvc/app/controllers/OPNsense/TrafficShaper/Api/ServiceController.php:152— // XXX: If not directly connected, we better still list the queues so we know what we miss. — 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.
XxxComment src/opnsense/mvc/app/library/OPNsense/Base/UIModelGrid.php:81— // XXX: backwards compatible for direct callers that do not know about search_tokens — 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.
XxxComment src/opnsense/mvc/app/library/OPNsense/Base/UIModelGrid.php:136— // XXX: Structured field data (e.g. JsonAuditField) would need flattening here — 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.
XxxComment src/opnsense/mvc/app/library/OPNsense/Mvc/Session.php:50— // XXX: One could argue these settings actually should be set in php.ini, but since legacy code is also — 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.
XxxComment src/opnsense/mvc/app/models/OPNsense/Base/Validation.php:88— // XXX: temporary dual validation — 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.
XxxComment src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/PortField.php:221— // XXX: although it's not 100% clean, — 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.
XxxComment src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/NetworkAliasField.php:46— // XXX: don't use as list, only for validation — 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.
XxxComment src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/ModelRelationField.php:219— // XXX: may be improved a bit to prevent the same object being constructed multiple times when used — 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.
XxxComment src/opnsense/mvc/app/models/OPNsense/IDS/FieldTypes/PolicyContentField.php:54— // XXX: we could add caching here if configd overhead is an issue — 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.
+ 33 more in this group — see findings.md.
AC6 · Visual & motion safety· Focus outline removed in CSS without a · ×33
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap-select.scss:197— `.bootstrap-select.disabled:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap-select.scss:265— `.bootstrap-select .dropdown-menu > .inner:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/main.scss:428— `button.toggle-sidebar` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_button-groups.scss:23— `.btn-group > .btn:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_button-groups.scss:91— `.btn-group.open .dropdown-toggle` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_buttons.scss:40— `.btn.active` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_carousel.scss:96— `.carousel-control:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_dropdowns.scss:25— `.dropdown-toggle:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_dropdowns.scss:91— `.dropdown-menu > .active > a` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_dropdowns.scss:128— `.open > a` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_modals.scss:29— `.modal` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_modals.scss:60— `.modal-content` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap/_navbar.scss:203— `.navbar-toggle:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/main.scss:429— `button.toggle-sidebar` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap-select/less/bootstrap-select.less:113— `.bootstrap-select.btn-group.disabled:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_button-groups.scss:23— `.btn-group > .btn:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_button-groups.scss:91— `.btn-group.open .dropdown-toggle` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_buttons.scss:40— `.btn.active` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_carousel.scss:96— `.carousel-control:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_dropdowns.scss:25— `.dropdown-toggle:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_dropdowns.scss:91— `.dropdown-menu > .active > a` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_dropdowns.scss:128— `.open > a` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_modals.scss:29— `.modal` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_modals.scss:60— `.modal-content` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Focus outline removed in CSS without a :focus replacement src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap/_navbar.scss:203— `.navbar-toggle:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
Hotspot: src/opnsense/mvc/app/models/OPNsense/Interfaces/NetworkInterface.php src/opnsense/mvc/app/models/OPNsense/Interfaces/NetworkInterface.php:200— src/opnsense/mvc/app/models/OPNsense/Interfaces/NetworkInterface.php changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 39 in NetworkInterface.performValidation at line 200. 1 of those changes was a fix/bug commit, and the other 22 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- src/opnsense/mvc/app/models/OPNsense/Interfaces/NetworkInterface.php`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php:203— src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 71 in FilterRule.parseFilterRules at line 203. 2 of those changes were fix/bug commits, and the other 5 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/opnsense/mvc/app/models/OPNsense/Firewall/Filter.php src/opnsense/mvc/app/models/OPNsense/Firewall/Filter.php:42— src/opnsense/mvc/app/models/OPNsense/Firewall/Filter.php changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 117 in Filter.performValidation at line 42. 1 of those changes was a fix/bug commit, and the other 3 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- src/opnsense/mvc/app/models/OPNsense/Firewall/Filter.php`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/opnsense/www/js/opnsense_bootgrid.js src/opnsense/www/js/opnsense_bootgrid.js:720— src/opnsense/www/js/opnsense_bootgrid.js changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 39 in UIBootgrid._registerEvents at line 720. 1 of those changes was a fix/bug commit, and the other 10 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- src/opnsense/www/js/opnsense_bootgrid.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterController.php src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterController.php:84— src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterController.php changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 35 in FilterController.searchRuleAction at line 84. 2 of those changes were fix/bug commits, and the other 7 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterController.php`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: REDACTED REDACTED:816— REDACTED changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in opnsense_ui.$.fn.SimpleActionButton at line 816. 1 of those changes was a fix/bug commit, and the other 11 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: REDACTED REDACTED:100— REDACTED changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 35 in ForwardRule.parseRdrRules at line 100. 1 of those changes was a fix/bug commit, and the other 5 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php:329— src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 34 in Gateways.getGateways at line 329. 1 of those changes was a fix/bug commit, and the other 3 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:182— src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in KeaDhcpv4.getConfigSubnets at line 182. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/NetworkInterfaceField.php src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/NetworkInterfaceField.php:41— src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/NetworkInterfaceField.php changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in NetworkInterfaceContainerField.toLegacy at line 41. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/NetworkInterfaceField.php`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/opnsense/mvc/app/controllers/OPNsense/Base/ControllerBase.php src/opnsense/mvc/app/controllers/OPNsense/Base/ControllerBase.php:373— src/opnsense/mvc/app/controllers/OPNsense/Base/ControllerBase.php changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in ControllerBase.beforeExecuteRoute at line 373. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- src/opnsense/mvc/app/controllers/OPNsense/Base/ControllerBase.php`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CertController.php src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CertController.php:52— src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CertController.php changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in CertController.setBaseHook at line 52. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CertController.php`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:328— src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 39 in KeaDhcpv6.getConfigSubnets at line 328. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/opnsense/scripts/captiveportal/cp-background-process.py src/opnsense/scripts/captiveportal/cp-background-process.py:140— src/opnsense/scripts/captiveportal/cp-background-process.py changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in CPBackgroundProcess.sync_zone at line 140. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- src/opnsense/scripts/captiveportal/cp-background-process.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/opnsense/www/js/opnsense.js src/opnsense/www/js/opnsense.js:146— src/opnsense/www/js/opnsense.js changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in opnsense.setFormData at line 146. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- src/opnsense/www/js/opnsense.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CaController.php src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CaController.php:55— src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CaController.php changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in CaController.setBaseHook at line 55. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CaController.php`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/Api/LeasesController.php src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/Api/LeasesController.php:39— src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/Api/LeasesController.php changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in LeasesController.searchAction at line 39. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/Api/LeasesController.php`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/opnsense/mvc/app/models/OPNsense/Firewall/FieldTypes/SourceNatRuleField.php src/opnsense/mvc/app/models/OPNsense/Firewall/FieldTypes/SourceNatRuleField.php:48— src/opnsense/mvc/app/models/OPNsense/Firewall/FieldTypes/SourceNatRuleField.php changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 15 in SourceNatRuleContainerField.serialize at line 48. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- src/opnsense/mvc/app/models/OPNsense/Firewall/FieldTypes/SourceNatRuleField.php`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/opnsense/www/js/widgets/BaseWidget.js src/opnsense/www/js/widgets/BaseWidget.js:58— src/opnsense/www/js/widgets/BaseWidget.js changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 15 in BaseWidget.getWidgetConfig at line 58. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- src/opnsense/www/js/widgets/BaseWidget.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: src/opnsense/mvc/app/models/OPNsense/Firewall/Menu/Menu.php src/opnsense/mvc/app/models/OPNsense/Firewall/Menu/Menu.php:36— src/opnsense/mvc/app/models/OPNsense/Firewall/Menu/Menu.php changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 15 in Menu.collect at line 36. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- src/opnsense/mvc/app/models/OPNsense/Firewall/Menu/Menu.php`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
MethodTooLong: Filter.performValidation src/opnsense/mvc/app/models/OPNsense/Firewall/Filter.php:42— MethodTooLong — performValidation runs 239 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 139 over it, 2.39× 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: Dnsmasq.performValidation src/opnsense/mvc/app/models/OPNsense/Dnsmasq/Dnsmasq.php:53— MethodTooLong — performValidation runs 230 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 130 over it, 2.30× 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: OpenVPN.generateInstanceConfig src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php:551— MethodTooLong — generateInstanceConfig runs 193 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 93 over it, 1.93× 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: FirmwareController.statusAction src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:96— MethodTooLong — statusAction runs 182 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 82 over it, 1.82× 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: UIBootgrid._registerEvents src/opnsense/www/js/opnsense_bootgrid.js:720— MethodTooLong — _registerEvents runs 151 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 51 over it, 1.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: KeaDhcpv6.performValidation src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:44— MethodTooLong — performValidation runs 141 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 41 over it, 1.41× 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: CrlController.setAction src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CrlController.php:180— MethodTooLong — setAction runs 138 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 38 over it, 1.38× 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: KeaDhcpv6.getConfigSubnets src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:328— MethodTooLong — getConfigSubnets runs 132 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 32 over it, 1.32× 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: Radius.authenticate src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:512— MethodTooLong — authenticate runs 130 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 30 over it, 1.30× 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: UIBootgrid.tabulatorDefaults src/opnsense/www/js/opnsense_bootgrid.js:1559— MethodTooLong — tabulatorDefaults runs 125 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 25 over it, 1.25× 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: UIBootgrid.translateCompatOptions src/opnsense/www/js/opnsense_bootgrid.js:244— MethodTooLong — translateCompatOptions runs 118 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 18 over it, 1.18× 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: OpenVPN.performValidation src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php:47— MethodTooLong — performValidation runs 116 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 16 over it, 1.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.
MethodTooLong: CertController.setBaseHook src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CertController.php:52— MethodTooLong — setBaseHook runs 114 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 14 over it, 1.14× 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: Monit.performValidation src/opnsense/mvc/app/models/OPNsense/Monit/Monit.php:153— MethodTooLong — performValidation runs 113 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 13 over it, 1.13× 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: UIBootgrid._internalFormatters src/opnsense/www/js/opnsense_bootgrid.js:1923— MethodTooLong — _internalFormatters runs 113 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 13 over it, 1.13× 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: Vip.performValidation src/opnsense/mvc/app/models/OPNsense/Interfaces/Vip.php:59— MethodTooLong — performValidation runs 109 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 9 over it, 1.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: Gateways.getGateways src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php:329— MethodTooLong — getGateways runs 104 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 4 over it, 1.04× 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: setaddr.console_configure_ip_address src/opnsense/scripts/shell/setaddr.php:294— MethodTooLong — console_configure_ip_address runs 103 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 3 over it, 1.03× 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: TunnelController.searchPhase2Action src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/TunnelController.php:129— MethodTooLong — searchPhase2Action runs 102 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2 over it, 1.02× 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: OpenVPNClients.updateClients src/opnsense/www/js/widgets/OpenVPNClients.js:62— MethodTooLong — updateClients runs 101 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1 over it, 1.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.
Duplicated block (5 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/NetworkinsightController.php:63— src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/NetworkinsightController.php:63-67 | src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/NetworkinsightController.php:158-162 — 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) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/TunnelController.php:78— src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/TunnelController.php:78-82 | src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/TunnelController.php:153-157 — 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 `src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/TunnelController.php:78` 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) src/opnsense/mvc/app/library/OPNsense/Firewall/DNatRule.php:120— src/opnsense/mvc/app/library/OPNsense/Firewall/DNatRule.php:120-124 | src/opnsense/mvc/app/library/OPNsense/Firewall/DNatRule.php:137-141 — 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 `src/opnsense/mvc/app/library/OPNsense/Firewall/DNatRule.php:120` 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) src/opnsense/mvc/app/models/OPNsense/Core/FieldTypes/TunableField.php:97— src/opnsense/mvc/app/models/OPNsense/Core/FieldTypes/TunableField.php:97-101 | src/opnsense/mvc/app/models/OPNsense/Core/FieldTypes/TunableField.php:107-111 — 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 `src/opnsense/mvc/app/models/OPNsense/Core/FieldTypes/TunableField.php:97` 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, `src/opnsense/mvc/app/models/OPNsense/Core/FieldTypes/TunableField.php:105` calls `setValue` and `src/opnsense/mvc/app/models/OPNsense/Core/FieldTypes/TunableField.php:94` 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 × 2) src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php:371— src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php:371-375 | src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php:437-441 — 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) src/opnsense/mvc/app/models/OPNsense/Unbound/Migrations/M1_0_13.php:122— src/opnsense/mvc/app/models/OPNsense/Unbound/Migrations/M1_0_13.php:122-126 | src/opnsense/mvc/app/models/OPNsense/Unbound/Migrations/M1_0_13.php:146-150 — 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 `src/opnsense/mvc/app/models/OPNsense/Unbound/Migrations/M1_0_13.php:122` 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) src/opnsense/scripts/health/library/OPNsense/RRD/Stats/Interfaces.php:35— src/opnsense/scripts/health/library/OPNsense/RRD/Stats/Interfaces.php:35-39 | src/opnsense/scripts/health/library/OPNsense/RRD/Stats/OpenVPN.php:35-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 both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/opnsense/scripts/health/library/OPNsense/RRD/Stats/Interfaces.php:35` 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) src/opnsense/mvc/app/models/OPNsense/Auth/FieldTypes/MemberField.php:60— src/opnsense/mvc/app/models/OPNsense/Auth/FieldTypes/MemberField.php:60-64 | src/opnsense/mvc/app/models/OPNsense/Auth/FieldTypes/PrivField.php:54-58 — 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 (5 lines × 2) src/opnsense/mvc/app/models/OPNsense/Cron/Migrations/M1_0_2.php:40— src/opnsense/mvc/app/models/OPNsense/Cron/Migrations/M1_0_2.php:40-44 | src/opnsense/mvc/app/models/OPNsense/Cron/Migrations/M1_0_4.php:40-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 both call sites, so a change lands once.
Duplicated block (5 lines × 2) src/opnsense/mvc/app/models/OPNsense/IPsec/FieldTypes/IKEAddressField.php:51— src/opnsense/mvc/app/models/OPNsense/IPsec/FieldTypes/IKEAddressField.php:51-55 | src/opnsense/mvc/app/models/OPNsense/OpenVPN/FieldTypes/RemoteHostField.php:47-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.
Duplicated block (5 lines × 2) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:131— src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:131-135 | src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:305-309 — before extracting anything, compare `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php` and `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 145 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 × 2) src/opnsense/mvc/app/models/OPNsense/Base/Menu/MenuSystem.php:174— src/opnsense/mvc/app/models/OPNsense/Base/Menu/MenuSystem.php:174-178 | src/opnsense/mvc/app/models/OPNsense/Core/ACL.php:511-515 — 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) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/TunnelController.php:337— src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/TunnelController.php:337-341 | src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/TunnelController.php:357-361 — 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 `src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/TunnelController.php:337` 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) src/opnsense/mvc/app/models/OPNsense/IDS/Migrations/M1_0_7.php:72— src/opnsense/mvc/app/models/OPNsense/IDS/Migrations/M1_0_7.php:72-76 | src/opnsense/mvc/app/models/OPNsense/IDS/Migrations/M1_0_7.php:83-87 — 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 `src/opnsense/mvc/app/models/OPNsense/IDS/Migrations/M1_0_7.php:72` 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) REDACTED:98— REDACTED:98-102 | REDACTED:110-114 — 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:98` 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) src/opnsense/scripts/captiveportal/cp-background-process.py:171— src/opnsense/scripts/captiveportal/cp-background-process.py:171-175 | src/opnsense/scripts/captiveportal/cp-background-process.py:181-185 — 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) src/opnsense/scripts/filter/lib/__init__.py:87— src/opnsense/scripts/filter/lib/__init__.py:87-91 | src/opnsense/scripts/filter/lib/alias/base.py:103-107 — before extracting anything, compare `src/opnsense/scripts/filter/lib/__init__.py` and `src/opnsense/scripts/filter/lib/alias/base.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 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) src/opnsense/scripts/captiveportal/lib/__init__.py:68— src/opnsense/scripts/captiveportal/lib/__init__.py:68-72 | src/opnsense/scripts/captiveportal/lib/__init__.py:73-77 — 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) src/opnsense/scripts/syslog/logformats/__init__.py:151— src/opnsense/scripts/syslog/logformats/__init__.py:151-155 | src/opnsense/scripts/unbound/blocklists/__init__.py:284-288 — 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.
FileTooLong: js/bootstrap-select.js src/opnsense/www/js/bootstrap-select.js— FileTooLong — 2045 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 545 over it, 1.36× 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/tokenize2.js src/opnsense/www/js/tokenize2.js— FileTooLong — 1840 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 340 over it, 1.23× 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 — 1782 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1282 over it, 3.56× 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/opnsense_bootgrid.js src/opnsense/www/js/opnsense_bootgrid.js— FileTooLong — 1537 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), about 97% of them inside a single declaration: UIBootgrid (104-2539). The bar is 1500 significant lines; this is 37 over it, 1.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: js/bootstrap.js src/opnsense/www/js/bootstrap.js— FileTooLong — 1471 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 971 over it, 2.94× 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/opnsense_widgets.js src/opnsense/www/js/opnsense_widgets.js— FileTooLong — 855 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 355 over it, 1.71× 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/bootstrap-dialog.js src/opnsense/www/js/bootstrap-dialog.js— FileTooLong — 784 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 284 over it, 1.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: www/firewall_schedule_edit.php src/www/firewall_schedule_edit.php— FileTooLong — 773 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 273 over it, 1.55× 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 — 757 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 500 significant lines; this is 257 over it, 1.51× 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: IXR/IXR_Library.php contrib/IXR/IXR_Library.php— FileTooLong — 732 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 232 over it, 1.46× 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/chartjs-plugin-streaming.js src/opnsense/www/js/chartjs-plugin-streaming.js— FileTooLong — 728 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 500 significant lines; this is 228 over it, 1.46× 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 — 696 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 196 over it, 1.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: js/smoothie.js src/opnsense/www/js/smoothie.js— FileTooLong — 568 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 68 over it, 1.14× 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: Api/FirmwareController.php src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php— FileTooLong — 533 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: FirmwareController (42-1008). The bar is 500 significant lines; this is 33 over it, 1.07× 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: OpenVPN/OpenVPN.php src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php— FileTooLong — 512 significant lines (blank, comment-only and punctuation-only lines excluded), about 98% of them inside a single declaration: OpenVPN (42-854). The bar is 500 significant lines; this is 12 over it, 1.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.
Duplicated block (6 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/Base/ApiControllerBase.php:107— src/opnsense/mvc/app/controllers/OPNsense/Base/ApiControllerBase.php:107-112 | src/opnsense/mvc/app/controllers/OPNsense/Syslog/Api/ServiceController.php:127-132 — 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 `src/opnsense/mvc/app/controllers/OPNsense/Base/ApiControllerBase.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 (6 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/Api/LeasesController.php:112— src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/Api/LeasesController.php:112-117 | src/opnsense/mvc/app/controllers/OPNsense/Kea/Api/LeasesController.php:99-104 — 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 `src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/Api/LeasesController.php:112` 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) src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GifSettingsController.php:128— src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GifSettingsController.php:128-133 | src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GreSettingsController.php:128-133 — before extracting anything, compare `src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GifSettingsController.php` and `src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GreSettingsController.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 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 `src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GifSettingsController.php:128` 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) src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/Api/ServiceController.php:75— src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/Api/ServiceController.php:75-80 | src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/Api/ServiceController.php:144-149 — 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 `src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/Api/ServiceController.php:75` 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) src/opnsense/mvc/app/library/OPNsense/Auth/AuthenticationFactory.php:50— src/opnsense/mvc/app/library/OPNsense/Auth/AuthenticationFactory.php:50-55 | src/opnsense/mvc/app/library/OPNsense/Auth/AuthenticationFactory.php:73-78 — 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 `src/opnsense/mvc/app/library/OPNsense/Auth/AuthenticationFactory.php:50` 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) src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:206— src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:206-215 | src/opnsense/mvc/app/library/OPNsense/Auth/TOTP.php:220-225 — 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. 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 (6 lines × 2) src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php:399— src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php:399-404 | src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php:425-430 — 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 `src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php:399` 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 (6 lines × 2) src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php:412— src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php:412-417 | src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php:438-443 — 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 (6 lines × 2) src/opnsense/mvc/app/library/OPNsense/OpenVPN/PlainOpenVPN.php:200— src/opnsense/mvc/app/library/OPNsense/OpenVPN/PlainOpenVPN.php:200-205 | src/opnsense/mvc/app/library/OPNsense/OpenVPN/ViscosityVisz.php:132-137 — 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 `src/opnsense/mvc/app/library/OPNsense/OpenVPN/PlainOpenVPN.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.
Duplicated block (6 lines × 2) src/opnsense/mvc/app/models/OPNsense/IPsec/Migrations/M1_0_4.php:52— src/opnsense/mvc/app/models/OPNsense/IPsec/Migrations/M1_0_4.php:52-57 | src/opnsense/mvc/app/models/OPNsense/IPsec/Migrations/M1_0_4.php:63-68 — 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 `src/opnsense/mvc/app/models/OPNsense/IPsec/Migrations/M1_0_4.php:52` 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) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:200— src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:200-205 | src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:363-368 — before extracting anything, compare `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php` and `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 145 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 `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.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.
Duplicated block (6 lines × 2) src/opnsense/mvc/app/library/OPNsense/System/Status/DnsmasqOverrideStatus.php:38— src/opnsense/mvc/app/library/OPNsense/System/Status/DnsmasqOverrideStatus.php:38-43 | src/opnsense/mvc/app/library/OPNsense/System/Status/IPsecOverrideStatus.php:38-43 — before extracting anything, compare `src/opnsense/mvc/app/library/OPNsense/System/Status/DnsmasqOverrideStatus.php` and `src/opnsense/mvc/app/library/OPNsense/System/Status/IPsecOverrideStatus.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. 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 (6 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/Syslog/IndexController.php:46— src/opnsense/mvc/app/controllers/OPNsense/Syslog/IndexController.php:46-53 | src/opnsense/mvc/app/controllers/OPNsense/Unbound/AclController.php:37-42 — 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) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/FirewallController.php:126— src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/FirewallController.php:126-131 | src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/FirewallController.php:166-171 — 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.
Outbound HTTP without resilience src/etc/inc/plugins.inc.d/opendns.inc:67— `curl_exec(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience src/opnsense/mvc/app/controllers/OPNsense/Core/Api/DashboardController.php:235— `curl_exec(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience src/opnsense/scripts/filter/lib/alias/geoip.py:165— `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience src/opnsense/scripts/monit/status.php:58— `curl_exec(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience src/opnsense/scripts/suricata/lib/downloader.py:112— `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience src/opnsense/scripts/system/crl_fetch.py:62— `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience src/opnsense/scripts/unbound/blocklists/__init__.py:109— `requests.get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience src/opnsense/site-python/tls_helper.py:104— `requests.Session(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience src/opnsense/site-python/tls_helper.py:109— `requests.Session(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience REDACTED:79— `curl_exec(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
TooManyMethods: BaseField src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/BaseField.php:46— TooManyMethods — 70 methods. The bar is 30 methods; this is 40 over it, 2.33× 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: UIBootgrid src/opnsense/www/js/opnsense_bootgrid.js:104— TooManyMethods — 62 methods. The bar is 30 methods; this is 32 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.
TooManyMethods: SettingsController src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/Api/SettingsController.php:34— TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.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: SettingsController src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php:36— TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.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: SettingsController src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/SettingsController.php:39— TooManyMethods — 32 methods. The bar is 30 methods; this is 2 over it, 1.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: BaseModel src/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php:51— TooManyMethods — 32 methods. The bar is 30 methods; this is 2 over it, 1.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: Util src/opnsense/mvc/app/library/OPNsense/Firewall/Util.php:38— TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× 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: KeaOptionDataField src/opnsense/mvc/app/models/OPNsense/Kea/FieldTypes/KeaOptionDataField.php:50— TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× 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: WidgetManager src/opnsense/www/js/opnsense_widgets.js:686— TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× 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.
Duplicated block (11 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:423— src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:423-433 | src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:443-453 — 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) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/DnsDiagnosticsController.php:43— src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/DnsDiagnosticsController.php:43-53 | src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/TracerouteController.php:41-53 — 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) src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GifSettingsController.php:136— src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GifSettingsController.php:136-146 | src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GreSettingsController.php:136-146 — before extracting anything, compare `src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GifSettingsController.php` and `src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GreSettingsController.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 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 `src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GifSettingsController.php:136` 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) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:169— src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:169-179 | src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:315-325 — before extracting anything, compare `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php` and `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 145 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 (11 lines × 2) src/opnsense/mvc/app/models/OPNsense/Routing/GatewayGroups.php:58— src/opnsense/mvc/app/models/OPNsense/Routing/GatewayGroups.php:58-68 | src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php:129-139 — 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 `src/opnsense/mvc/app/models/OPNsense/Routing/GatewayGroups.php:58` 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) src/opnsense/mvc/app/controllers/OPNsense/Kea/Api/Dhcpv4Controller.php:46— src/opnsense/mvc/app/controllers/OPNsense/Kea/Api/Dhcpv4Controller.php:46-56 | src/opnsense/mvc/app/controllers/OPNsense/Kea/Api/Dhcpv6Controller.php:46-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 (11 lines × 2) src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/DUIDField.php:84— src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/DUIDField.php:84-94 | src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/LinkAddressField.php:95-107 — 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) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:321— src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:321-331 | src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:537-547 — before extracting anything, compare `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php` and `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 145 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 (11 lines × 2) src/opnsense/service/modules/daemonize.py:46— src/opnsense/service/modules/daemonize.py:46-56 | src/opnsense/site-python/daemonize.py:46-56 — before extracting anything, compare `src/opnsense/service/modules/daemonize.py` and `src/opnsense/site-python/daemonize.py` as WHOLE FILES: this scan already matched 7 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.
Duplicated block (7 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/Auth/Api/GroupController.php:82— src/opnsense/mvc/app/controllers/OPNsense/Auth/Api/GroupController.php:82-88 | src/opnsense/mvc/app/controllers/OPNsense/Auth/Api/UserController.php:216-222 — 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) src/opnsense/mvc/app/controllers/OPNsense/Kea/DhcpController.php:57— src/opnsense/mvc/app/controllers/OPNsense/Kea/DhcpController.php:57-63 | src/opnsense/mvc/app/controllers/OPNsense/Kea/DhcpController.php:75-81 — 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 lines × 2) src/opnsense/mvc/app/library/OPNsense/Auth/Voucher.php:428— src/opnsense/mvc/app/library/OPNsense/Auth/Voucher.php:428-434 | src/opnsense/mvc/app/library/OPNsense/Auth/Voucher.php:440-446 — 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 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/DHCRelay/Api/ServiceController.php:42— src/opnsense/mvc/app/controllers/OPNsense/DHCRelay/Api/ServiceController.php:42-48 | src/opnsense/mvc/app/controllers/OPNsense/Radvd/Api/ServiceController.php:48-54 — 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) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/NetflowController.php:187— src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/NetflowController.php:187-193 | src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/OverviewController.php:139-145 — 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) src/opnsense/mvc/app/controllers/OPNsense/Routing/Api/GroupSettingsController.php:44— src/opnsense/mvc/app/controllers/OPNsense/Routing/Api/GroupSettingsController.php:44-50 | src/opnsense/mvc/app/controllers/OPNsense/Routing/Api/SettingsController.php:45-51 — 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) src/opnsense/mvc/app/controllers/OPNsense/Unbound/DotController.php:37— src/opnsense/mvc/app/controllers/OPNsense/Unbound/DotController.php:37-43 | src/opnsense/mvc/app/controllers/OPNsense/Unbound/ForwardController.php:37-43 — before extracting anything, compare `src/opnsense/mvc/app/controllers/OPNsense/Unbound/DotController.php` and `src/opnsense/mvc/app/controllers/OPNsense/Unbound/ForwardController.php` as WHOLE FILES: 82% 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.
Duplicated block (7 lines × 2) src/opnsense/scripts/shaper/lib/__init__.py:83— src/opnsense/scripts/shaper/lib/__init__.py:83-89 | src/opnsense/scripts/shaper/lib/__init__.py:127-133 — 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) src/opnsense/scripts/filter/lib/__init__.py:121— src/opnsense/scripts/filter/lib/__init__.py:121-127 | src/opnsense/scripts/filter/lib/alias/base.py:137-143 — before extracting anything, compare `src/opnsense/scripts/filter/lib/__init__.py` and `src/opnsense/scripts/filter/lib/alias/base.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 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.
AC6 · Visual & motion safety· Animation without a prefers-reduced-motion guard · ×7
Animation without a prefers-reduced-motion guard src/opnsense/www/themes/opnsense-dark/assets/stylesheets/bootstrap-dialog.scss:96— `.bootstrap-dialog .icon-spin` moves (`animation: spin 2s infinite linear`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard src/opnsense/www/themes/opnsense-dark/assets/stylesheets/dashboard.scss:35— `#save-spinner` moves (`transition: opacity 0.3s ease, transform 0.3s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard src/opnsense/www/themes/opnsense-dark/assets/stylesheets/dashboard.scss:39— `.transition-spinner` moves (`transition: opacity 0.3s ease, transform 0.3s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard src/opnsense/www/themes/opnsense-dark/assets/stylesheets/main.scss:606— `.list-group-item:before` moves (`transition: width .2s`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard src/opnsense/www/themes/opnsense/assets/stylesheets/bootstrap-dialog.scss:96— `.bootstrap-dialog .icon-spin` moves (`animation: spin 2s infinite linear`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard src/opnsense/www/themes/opnsense/assets/stylesheets/dashboard.scss:35— `#save-spinner` moves (`transition: opacity 0.3s ease, transform 0.3s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Animation without a prefers-reduced-motion guard src/opnsense/www/themes/opnsense/assets/stylesheets/dashboard.scss:39— `.transition-spinner` moves (`transition: opacity 0.3s ease, transform 0.3s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
qrcode::QRUtil::getLostPoint (cognitive 84) src/opnsense/www/js/qrcode.js:1020— qrcode::QRUtil::getLostPoint has cognitive complexity 84 (threshold 15). Drivers by points: if/else 13 (46 pts), loops 12 (22 pts), boolean chains 16 (nesting depth added 43). 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.
qrcode::qrcode::mapData (cognitive 31) src/opnsense/www/js/qrcode.js:216— qrcode::qrcode::mapData has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (24 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 21). 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.
qrcode::qrcode::createSvgTag (cognitive 24) src/opnsense/www/js/qrcode.js:495— qrcode::qrcode::createSvgTag has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 9, boolean chains 8, if/else 2 (4 pts), loops 2 (3 pts) (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.
qrcode::qrcode::setupPositionAdjustPattern (cognitive 21) src/opnsense/www/js/qrcode.js:133— qrcode::qrcode::setupPositionAdjustPattern has cognitive complexity 21 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 3 (9 pts), boolean chains 2 (nesting depth added 12). 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.
qrcode::qrcode::createBytes (cognitive 21) src/opnsense/www/js/qrcode.js:267— qrcode::qrcode::createBytes has cognitive complexity 21 (threshold 15). Drivers by points: loops 8 (12 pts), if/else 2 (6 pts), ternaries 1 (3 pts) (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.
qrcode::qrcode::setupPositionProbePattern (cognitive 19) src/opnsense/www/js/qrcode.js:75— qrcode::qrcode::setupPositionProbePattern has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 7, loops 2 (3 pts) (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.
qrcode::qrcode::_createHalfASCII (cognitive 19) src/opnsense/www/js/qrcode.js:620— qrcode::qrcode::_createHalfASCII has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, ternaries 2 (4 pts), loops 2 (3 pts) (nesting depth added 7). 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.
X24 · Document value interpolated into markup unescaped· Untrusted text written into markup unescaped · ×7
Untrusted text written into markup unescaped src/opnsense/www/js/bootstrap-select.js:714— `content` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped src/opnsense/www/js/bootstrap-select.js:731— `text` is text this program did not author, and it is written into the text of an element through `insertAdjacentHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped src/opnsense/www/js/bootstrap-select.js:747— `options.content` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped src/opnsense/www/js/bootstrap-select.js:786— `options.display` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped src/opnsense/www/js/bootstrap-select.js:812— `this.options.noneResultsText.replace('{0}','"'+htmlEscape(searchValue)+'"')` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped src/opnsense/www/js/bootstrap.js:1401— `unsafeHtml` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Untrusted text written into markup unescaped src/opnsense/www/js/smoothie.js:647— `this.options.tooltipFormatter.call(this,t,data)` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
Duplicated block (8 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/GroupController.php:119— src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/GroupController.php:119-126 | src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/LaggSettingsController.php:147-154 — 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) src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php:175— src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php:175-182 | src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.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. Read the line range as the matched WINDOW rather than a finished unit: at `src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.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. 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 × 2) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SadController.php:107— src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SadController.php:107-114 | src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SpdController.php:107-114 — before extracting anything, compare `src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SadController.php` and `src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SpdController.php` as WHOLE FILES: this scan already matched 3 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.
Duplicated block (8 lines × 2) src/opnsense/mvc/app/library/OPNsense/System/Status/ConfigdProxyOverrideStatus.php:38— src/opnsense/mvc/app/library/OPNsense/System/Status/ConfigdProxyOverrideStatus.php:38-47 | src/opnsense/mvc/app/library/OPNsense/System/Status/IDSOverrideStatus.php:38-45 — 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) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:119— src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:119-126 | src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:282-289 — before extracting anything, compare `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php` and `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 145 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 (8 lines × 2) src/opnsense/scripts/captiveportal/cp-background-process.py:197— src/opnsense/scripts/captiveportal/cp-background-process.py:197-205 | src/opnsense/scripts/captiveportal/cp-background-process.py:206-213 — 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 locations) src/opnsense/www/js/bootstrap-dialog.js:1030— src/opnsense/www/js/bootstrap-dialog.js:1030 · src/opnsense/www/js/bootstrap-dialog.js:1046 — 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 (8 lines × 2 locations) REDACTED:377— REDACTED:377 · REDACTED:405 — 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 (8 lines × 2 locations) REDACTED:464— REDACTED:464 · REDACTED:1077 — 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 (8 lines × 2 locations) src/opnsense/www/js/qrcode.js:311— src/opnsense/www/js/qrcode.js:311 · src/opnsense/www/js/qrcode.js:320 — 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 locations) src/opnsense/www/js/qrcode.js:338— src/opnsense/www/js/qrcode.js:338 · src/opnsense/www/js/qrcode.js:432 — 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 locations) src/opnsense/www/js/widgets/IpsecTunnels.js:180— src/opnsense/www/js/widgets/IpsecTunnels.js:180 · src/opnsense/www/js/widgets/IpsecTunnels.js:192 — 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.
X19 · Unrestored process-global state· Process-global state is restored only on the happy path · ×6
Process-global state is restored only on the happy path src/opnsense/mvc/app/library/OPNsense/Auth/LDAP.php:346— `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 350, reset at line 386) — 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 src/opnsense/mvc/app/library/OPNsense/Core/Config.php:378— `loadFromStream` 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 388, reset at line 396) — 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 src/opnsense/mvc/app/library/OPNsense/Trust/Store.php:258— `signCert` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the error-reporting level (changed at line 267, put back at line 276) — 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 src/opnsense/mvc/app/library/OPNsense/Trust/Store.php:295— `reIssueCert` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the error-reporting level (changed at line 305, put back at line 318) — 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 src/opnsense/mvc/app/library/OPNsense/Trust/Store.php:336— `createCert` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the error-reporting level (changed at line 346, put back at line 373) — 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 src/opnsense/mvc/app/library/OPNsense/Trust/Store.php:546— `getPKCS12` changes state that belongs to the whole PROCESS and changes it back at the end of the same body — the error-reporting level (changed at line 553, put back at line 565) — 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.
Swallowed exception (caught, then discarded) contrib/IXR/IXR_Library.php:656— `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) contrib/IXR/IXR_Library.php:662— `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) src/etc/inc/config.inc:217— `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) src/opnsense/mvc/app/library/OPNsense/Mvc/Dispatcher.php:134— `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) src/opnsense/scripts/filter/lib/states.py:170— `except` 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) src/opnsense/scripts/unbound/logger.py:68— `except 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.
qrcode::QRUtil::getLostPoint (cyclomatic 42) src/opnsense/www/js/qrcode.js:1020— qrcode::QRUtil::getLostPoint 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.
qrcode::qrcode::createSvgTag (cyclomatic 22) src/opnsense/www/js/qrcode.js:495— qrcode::qrcode::createSvgTag 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.
qrcode::qrcode::setupPositionProbePattern (cyclomatic 19) src/opnsense/www/js/qrcode.js:75— qrcode::qrcode::setupPositionProbePattern has cyclomatic complexity 19 (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.
qrcode::qrcode::_createHalfASCII (cyclomatic 18) src/opnsense/www/js/qrcode.js:620— qrcode::qrcode::_createHalfASCII 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.
qrcode::QRUtil::getLengthInBits (cyclomatic 17) src/opnsense/www/js/qrcode.js:974— qrcode::QRUtil::getLengthInBits 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.
Duplicated block (6 lines × 2 locations) src/opnsense/www/js/opnsense_bootgrid.js:390— src/opnsense/www/js/opnsense_bootgrid.js:390 · src/opnsense/www/js/opnsense_bootgrid.js:413 — 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 (6 lines × 2 locations) src/opnsense/www/js/qrcode.js:621— src/opnsense/www/js/qrcode.js:621 · src/opnsense/www/js/qrcode.js:683 — 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 locations) src/opnsense/www/js/smoothie.js:709— src/opnsense/www/js/smoothie.js:709 · src/opnsense/www/js/smoothie.js:716 — 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 locations) src/opnsense/www/js/widgets/BaseGaugeWidget.js:115— src/opnsense/www/js/widgets/BaseGaugeWidget.js:115 · src/opnsense/www/js/widgets/BaseGaugeWidget.js:126 — 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 locations) src/opnsense/www/themes/opnsense-auto/build/js/theme.js:9— src/opnsense/www/themes/opnsense-auto/build/js/theme.js:9 · src/opnsense/www/themes/opnsense-auto/build/js/theme.js:18 — 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.
Swallowed exception (empty catch) src/opnsense/scripts/unbound-dnsbl/lib/log.py:87— An empty catch block silently discards the error — failures vanish with no log and no rethrow. On a teardown path letting it propagate is not an option (throwing out of `close()` masks the failure already in flight and abandons the rest of the cleanup), so make the swallow deliberate instead: narrow the catch to the exception this release can actually raise, and record it through whatever this codebase already uses to report problems — or, if it truly cannot matter, say why in a comment on the catch.
Swallowed exception (empty catch) src/opnsense/www/js/opnsense_widgets.js:1192— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) src/opnsense/www/js/bootstrap-select.js:255— 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) src/opnsense/www/js/bootstrap-select.js:652— 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) REDACTED:58— 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.
AC4 · Keyboard semantics· Anchor without href · ×4
Anchor without href src/opnsense/www/js/opnsense_bootgrid.js:1281— 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.
Anchor without href REDACTED:1168— 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.
Anchor without href src/opnsense/www/js/opnsense_widgets.js:94— 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.
Anchor without href src/opnsense/www/js/widgets/SystemInformation.js:59— 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.
ClassTooLong: UIBootgrid src/opnsense/www/js/opnsense_bootgrid.js:104— ClassTooLong — 1495 significant lines (blank, comment-only and punctuation-only lines excluded), 62 methods. The bar is 400 significant lines; this is 1095 over it, 3.74× 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: FirmwareController src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:42— ClassTooLong — 526 significant lines (blank, comment-only and punctuation-only lines excluded), 28 methods. The bar is 400 significant lines; this is 126 over it, 1.32× 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: OpenVPN src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php:42— ClassTooLong — 504 significant lines (blank, comment-only and punctuation-only lines excluded), 8 methods. The bar is 400 significant lines; this is 104 over it, 1.26× 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: BaseModel src/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php:51— ClassTooLong — 421 significant lines (blank, comment-only and punctuation-only lines excluded), 32 methods. The bar is 400 significant lines; this is 21 over it, 1.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.
Change coupling: ArchiveOpenVPN.php ↔ ViscosityVisz.php src/opnsense/mvc/app/library/OPNsense/OpenVPN/ArchiveOpenVPN.php:1— `src/opnsense/mvc/app/library/OPNsense/OpenVPN/ArchiveOpenVPN.php` and `src/opnsense/mvc/app/library/OPNsense/OpenVPN/ViscosityVisz.php` change together 90% of the time (9 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `693ea2d9` VPN: OpenVPN: add tls-crypt-v2 support (#10069); `84ec4540` VPN: OpenVPN: add tls-crypt-v2 support (#10069); `3ef4d20e` openvpn: replace exec() in MVC code #9325 — run `git show` on any of them.
Change coupling: OverviewController.php ↔ stats.py src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/OverviewController.php:1— `src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/OverviewController.php` and `src/opnsense/scripts/unbound/stats.py` change together 58% of the time (7 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `9ac5b8e2` unbound: add per-policy quick actions in reporting overview. (#9559); `b533835f` Reporting: Unbound DNS - duckdb version upgrade handling; `1e07a736` Reporting Unbound DNS: add drill-down for client graph — run `git show` on any of them.
Change coupling: CategoryController.php ↔ opnsense_legacy.js src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/CategoryController.php:1— `src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/CategoryController.php` and `src/www/javascript/opnsense_legacy.js` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `1d039417` Firewall: Categories / cleanup search action.; `b5b9a2ea` firewall: categories improvements (#4790); `0cf98f4f` firewall: categories improvements (#4790) — run `git show` on any of them.
Change coupling: logger.py ↔ stats.py src/opnsense/scripts/unbound/logger.py:1— `src/opnsense/scripts/unbound/logger.py` and `src/opnsense/scripts/unbound/stats.py` change together 50% of the time (6 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `9ac5b8e2` unbound: add per-policy quick actions in reporting overview. (#9559); `b533835f` Reporting: Unbound DNS - duckdb version upgrade handling; `5a3765a0` Reporting: Unbound DNS: resolve hostnames for clients — run `git show` on any of them.
Duplicated block (12 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:463— src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:463-474 | src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:484-495 — 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) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/ConnectionsController.php:298— src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/ConnectionsController.php:298-309 | src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/TunnelController.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/TunnelController.php:402` calls `touch` and `src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/ConnectionsController.php:310` 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 × 2) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:299— src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:299-310 | src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:518-529 — before extracting anything, compare `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php` and `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 145 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, `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:311` calls `empty`, `array_values`, `array_unique` and `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:530` 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) src/opnsense/scripts/shell/setaddr.php:492— src/opnsense/scripts/shell/setaddr.php:492-503 | src/opnsense/scripts/shell/setaddr.php:506-517 — 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 `src/opnsense/scripts/shell/setaddr.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 (5 lines × 3) src/opnsense/mvc/app/controllers/OPNsense/Core/Api/HasyncController.php:45— src/opnsense/mvc/app/controllers/OPNsense/Core/Api/HasyncController.php:45-49 | src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/NeighborSettingsController.php:66-70 | src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/SettingsController.php:49-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 (5 lines × 3) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/CategoryController.php:135— src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/CategoryController.php:135-139 | src/opnsense/mvc/app/controllers/OPNsense/TrafficShaper/Api/SettingsController.php:279-283 | src/opnsense/mvc/app/controllers/OPNsense/TrafficShaper/Api/SettingsController.php:301-305 — 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.
Duplicated block (5 lines × 3) src/opnsense/mvc/app/controllers/OPNsense/Firewall/DNatController.php:34— src/opnsense/mvc/app/controllers/OPNsense/Firewall/DNatController.php:34-38 | src/opnsense/mvc/app/controllers/OPNsense/Firewall/NptController.php:34-38 | src/opnsense/mvc/app/controllers/OPNsense/Firewall/OneToOneController.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) src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php:370— src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php:370-374 | src/opnsense/mvc/app/library/OPNsense/Firewall/NptRule.php:94-98 | src/opnsense/mvc/app/library/OPNsense/Firewall/SNatRule.php:149-153 — 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. 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 locations) src/opnsense/www/js/opnsense.js:69— src/opnsense/www/js/opnsense.js:69 · src/opnsense/www/js/opnsense.js:147 — 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 (7 lines × 2 locations) src/opnsense/www/js/qrcode.js:917— src/opnsense/www/js/qrcode.js:917 · src/opnsense/www/js/qrcode.js:925 — 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 (7 lines × 2 locations) src/opnsense/www/js/smoothie.js:525— src/opnsense/www/js/smoothie.js:525 · src/opnsense/www/js/smoothie.js:545 — 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 (7 lines × 2 locations) src/opnsense/www/js/widgets/BaseWidget.js:256— src/opnsense/www/js/widgets/BaseWidget.js:256 · src/opnsense/www/js/widgets/Traffic.js:38 — 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 (16 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/NptController.php:37— src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/NptController.php:37-52 | src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/OneToOneController.php:37-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/NptController.php:37` 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) src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CaController.php:220— src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CaController.php:220-235 | src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CertController.php:269-284 — 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 (16 lines × 2) src/opnsense/mvc/app/library/OPNsense/OpenVPN/ArchiveOpenVPN.php:104— src/opnsense/mvc/app/library/OPNsense/OpenVPN/ArchiveOpenVPN.php:104-119 | src/opnsense/mvc/app/library/OPNsense/OpenVPN/ViscosityVisz.php:133-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/opnsense/mvc/app/library/OPNsense/OpenVPN/ArchiveOpenVPN.php:104` 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 × 2) src/opnsense/mvc/app/models/OPNsense/Firewall/Migrations/MFP1_0_3.php:59— src/opnsense/mvc/app/models/OPNsense/Firewall/Migrations/MFP1_0_3.php:59-72 | src/opnsense/mvc/app/models/OPNsense/Firewall/Migrations/MFP1_0_4.php:68-81 — 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) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDdns.php:65— src/opnsense/mvc/app/models/OPNsense/Kea/KeaDdns.php:65-78 | src/opnsense/mvc/app/models/OPNsense/Kea/KeaDdns.php:81-94 — 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) src/opnsense/scripts/openvpn/kill_session.py:40— src/opnsense/scripts/openvpn/kill_session.py:40-53 | src/opnsense/scripts/openvpn/ovpn_status.py:39-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. 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) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:76— src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:76-85 | src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:46-55 — before extracting anything, compare `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php` and `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 145 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 `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:76` 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) src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CaController.php:195— src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CaController.php:195-204 | src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CertController.php:242-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 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) src/opnsense/scripts/filter/lib/__init__.py:130— src/opnsense/scripts/filter/lib/__init__.py:130-139 | src/opnsense/scripts/filter/lib/alias/base.py:146-155 — before extracting anything, compare `src/opnsense/scripts/filter/lib/__init__.py` and `src/opnsense/scripts/filter/lib/alias/base.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 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 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/AliasController.php:103— src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/AliasController.php:103-111 | src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterBaseController.php:176-184 — 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 `src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/AliasController.php:103` 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) src/opnsense/mvc/app/models/OPNsense/Dnsmasq/Dnsmasq.php:422— src/opnsense/mvc/app/models/OPNsense/Dnsmasq/Dnsmasq.php:422-430 | src/opnsense/mvc/app/models/OPNsense/Unbound/Unbound.php:47-55 — 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 `src/opnsense/mvc/app/models/OPNsense/Dnsmasq/Dnsmasq.php:422` 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) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:336— src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:336-344 | src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:552-560 — before extracting anything, compare `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php` and `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 145 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.
Low cohesion: FilterBaseController (LCOM4 10) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterBaseController.php:44— FilterBaseController'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: Rule (LCOM4 6) src/opnsense/mvc/app/library/OPNsense/Firewall/Rule.php:38— Rule's methods fall into 6 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 6 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: PortField (LCOM4 4) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/PortField.php:38— PortField's methods fall into 4 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 4 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.
Duplicated block (9 lines × 2 locations) src/opnsense/www/js/qrcode.js:1071— src/opnsense/www/js/qrcode.js:1071 · src/opnsense/www/js/qrcode.js:1087 — 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 (9 lines × 2 locations) src/opnsense/www/js/widgets/Firewall.js:287— src/opnsense/www/js/widgets/Firewall.js:287 · src/opnsense/www/js/widgets/InterfaceStatistics.js:171 — 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 (9 lines × 2 locations) src/opnsense/www/js/widgets/Gateways.js:56— src/opnsense/www/js/widgets/Gateways.js:56 · src/opnsense/www/js/widgets/ThermalSensors.js:188 — 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.
AC2 · Forms & labels· <optgroup> without a label · ×2
<optgroup> without a label REDACTED:987— An <optgroup> groups <option>s but has no label, so assistive tech announces the group with no name. Add a label attribute.
<optgroup> without a label REDACTED:1223— An <optgroup> groups <option>s but has no label, so assistive tech announces the group with no name. Add a label attribute.
Daemonize.start (cyclomatic 30) src/opnsense/service/modules/daemonize.py:75— Daemonize.start 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.
Daemonize.start (cyclomatic 30) src/opnsense/site-python/daemonize.py:73— Daemonize.start 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.
M1_0_0.run (cyclomatic 19) src/opnsense/mvc/app/models/OPNsense/OpenVPN/Migrations/M1_0_0.php:50— M1_0_0.run 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.
M1_0_0.run (cyclomatic 19) src/opnsense/mvc/app/models/OPNsense/Routing/Migrations/M1_0_0.php:42— M1_0_0.run 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.
Daemonize.start (cognitive 52) src/opnsense/service/modules/daemonize.py:75— Daemonize.start has cognitive complexity 52 (threshold 15). Drivers by points: if/else 19 (30 pts), error handling 9 (18 pts), loops 1 (3 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.
Daemonize.start (cognitive 52) src/opnsense/site-python/daemonize.py:73— Daemonize.start has cognitive complexity 52 (threshold 15). Drivers by points: if/else 19 (30 pts), error handling 9 (18 pts), loops 1 (3 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.
searchValidTarget (cognitive 19) src/opnsense/www/js/tokenize2.js:2287— searchValidTarget has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 3, loops 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.
searchValidTarget (cognitive 19) src/opnsense/www/js/jquery-sortable.js:313— searchValidTarget has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 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.
Duplicated block (26 lines × 3) src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:259— src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:259-284 | src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:331-356 | src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:423-448 — 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 `src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:259` 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, `src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:328` calls `splitBytes` and `src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:257` 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 (26 lines × 3) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/ManualSpdController.php:44— src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/ManualSpdController.php:44-69 | src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/VtiController.php:44-69 | src/opnsense/mvc/app/controllers/OPNsense/Radvd/Api/SettingsController.php:40-65 — 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 `src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/ManualSpdController.php:44` 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 (22 lines × 2) src/opnsense/mvc/app/library/OPNsense/Backup/BackupFactory.php:43— src/opnsense/mvc/app/library/OPNsense/Backup/BackupFactory.php:43-64 | src/opnsense/mvc/app/library/OPNsense/OpenVPN/ExportFactory.php:43-64 — before extracting anything, compare `src/opnsense/mvc/app/library/OPNsense/Backup/BackupFactory.php` and `src/opnsense/mvc/app/library/OPNsense/OpenVPN/ExportFactory.php` as WHOLE FILES: 84% 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. 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 (22 lines × 2) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/IPPortField.php:105— src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/IPPortField.php:105-150 | src/opnsense/mvc/app/models/OPNsense/Kea/FieldTypes/KeaPoolsField.php:47-68 — 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 `src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/IPPortField.php:105` 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) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:212— src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:212-232 | src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:452-472 — before extracting anything, compare `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php` and `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 145 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 `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:212` 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 lines × 2) src/opnsense/scripts/filter/lib/__init__.py:50— src/opnsense/scripts/filter/lib/__init__.py:50-70 | src/opnsense/scripts/filter/lib/alias/base.py:179-199 — before extracting anything, compare `src/opnsense/scripts/filter/lib/__init__.py` and `src/opnsense/scripts/filter/lib/alias/base.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 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 (20 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:688— src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:688-707 | src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:718-737 — 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 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/Kea/Api/Dhcpv4Controller.php:132— src/opnsense/mvc/app/controllers/OPNsense/Kea/Api/Dhcpv4Controller.php:132-151 | src/opnsense/mvc/app/controllers/OPNsense/Kea/Api/Dhcpv6Controller.php:132-151 — 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 `src/opnsense/mvc/app/controllers/OPNsense/Kea/Api/Dhcpv4Controller.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–15 lines × 2) contrib/IXR/IXR_Library.php:701— contrib/IXR/IXR_Library.php:701-715 | contrib/IXR/IXR_Library.php:1264-1277 — 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 (14–15 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/DNatController.php:154— src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/DNatController.php:154-168 | src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/SourceNatController.php:137-150 — 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 `src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/DNatController.php:154` 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:75— REDACTED:75-87 | REDACTED:100-112 — 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:75` 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:113` calls `unset` and `REDACTED:88` 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) src/opnsense/mvc/app/library/OPNsense/System/Status/MonitOverrideStatus.php:38— src/opnsense/mvc/app/library/OPNsense/System/Status/MonitOverrideStatus.php:38-52 | src/opnsense/mvc/app/library/OPNsense/System/Status/OpensshOverrideStatus.php:38-50 — 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 `src/opnsense/mvc/app/library/OPNsense/System/Status/MonitOverrideStatus.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. 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–12 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/DNatController.php:100— src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/DNatController.php:100-111 | src/opnsense/mvc/app/library/OPNsense/Base/UIModelGrid.php:134-143 — 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–12 lines × 2) src/opnsense/scripts/dnsmasq/dnsmasq_watcher.py:72— src/opnsense/scripts/dnsmasq/dnsmasq_watcher.py:72-83 | src/opnsense/scripts/unbound/unbound_watcher.py:164-173 — 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 `src/opnsense/scripts/dnsmasq/dnsmasq_watcher.py:72` 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, `src/opnsense/scripts/unbound/unbound_watcher.py:162` calls `list`, `time` and `src/opnsense/scripts/dnsmasq/dnsmasq_watcher.py:72` 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 (11 lines × 3) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SadController.php:52— src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SadController.php:52-62 | src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SpdController.php:52-62 | src/opnsense/mvc/app/models/OPNsense/IPsec/FieldTypes/SPDField.php:45-55 — before extracting anything, compare `src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SadController.php` and `src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SpdController.php` as WHOLE FILES: this scan already matched 3 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 `src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SadController.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.
Duplicated block (11 lines × 3) src/opnsense/mvc/app/models/OPNsense/Auth/FieldTypes/GidField.php:97— src/opnsense/mvc/app/models/OPNsense/Auth/FieldTypes/GidField.php:97-107 | src/opnsense/mvc/app/models/OPNsense/Auth/FieldTypes/UidField.php:106-116 | src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/AutoNumberField.php:134-144 — before extracting anything, compare `src/opnsense/mvc/app/models/OPNsense/Auth/FieldTypes/GidField.php` and `src/opnsense/mvc/app/models/OPNsense/Auth/FieldTypes/UidField.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.
Duplicated block (9 lines × 3) src/opnsense/mvc/app/library/OPNsense/Auth/TOTP.php:231— src/opnsense/mvc/app/library/OPNsense/Auth/TOTP.php:231-239 | src/opnsense/mvc/app/library/OPNsense/Auth/TOTP.php:244-252 | src/opnsense/mvc/app/library/OPNsense/Auth/Voucher.php:430-438 — 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 `src/opnsense/mvc/app/library/OPNsense/Auth/TOTP.php:231` 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) src/opnsense/mvc/app/library/OPNsense/Firewall/DNatRule.php:79— src/opnsense/mvc/app/library/OPNsense/Firewall/DNatRule.php:79-87 | REDACTED:83-91 | src/opnsense/mvc/app/library/OPNsense/Firewall/NptRule.php:56-64 — 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 (8–9 lines × 2) src/opnsense/mvc/app/library/OPNsense/Auth/LDAP.php:320— src/opnsense/mvc/app/library/OPNsense/Auth/LDAP.php:320-327 | src/opnsense/mvc/app/library/OPNsense/Auth/TOTP.php:262-270 — 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–9 lines × 2) src/opnsense/mvc/app/library/OPNsense/Auth/Services/System.php:64— src/opnsense/mvc/app/library/OPNsense/Auth/Services/System.php:64-72 | src/opnsense/mvc/app/library/OPNsense/Auth/Services/WebGui.php:59-66 — 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–7 lines × 3) src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:273— src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:273-278 | src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:282-287 | src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:289-295 — 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 `src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:273` 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, `src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:288` calls `gettext`, `elseif`, `array_key_exists` and `src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:279` 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 × 3) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:285— src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:285-291 | src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:446-451 | src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:508-513 — before extracting anything, compare `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php` and `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 145 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 `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.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.
Duplicated block (11 lines × 2 locations) src/opnsense/www/js/opnsense.js:328— src/opnsense/www/js/opnsense.js:328 · src/opnsense/www/js/opnsense.js:354 — 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 (11 lines × 2 locations) src/opnsense/www/js/opnsense_bootgrid.js:2289— src/opnsense/www/js/opnsense_bootgrid.js:2289 · src/opnsense/www/js/opnsense_bootgrid.js:2379 — 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 (10 lines × 2 locations) src/opnsense/www/js/bootstrap-dialog.js:764— src/opnsense/www/js/bootstrap-dialog.js:764 · src/opnsense/www/js/bootstrap-dialog.js:790 — 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 (10 lines × 2 locations) src/opnsense/www/js/bootstrap-select.js:756— src/opnsense/www/js/bootstrap-select.js:756 · src/opnsense/www/js/bootstrap-select.js:791 — 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 × 3 locations) src/opnsense/www/js/widgets/Announcements.js:38— src/opnsense/www/js/widgets/Announcements.js:38 · src/opnsense/www/js/widgets/Carp.js:37 · src/opnsense/www/js/widgets/Gateways.js:40 — 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 (10 lines × 3 locations) src/opnsense/www/js/widgets/Interfaces.js:40— src/opnsense/www/js/widgets/Interfaces.js:40 · src/opnsense/www/js/widgets/IpsecLeases.js:41 · src/opnsense/www/js/widgets/Wireguard.js:41 — 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 (5 lines × 2 locations) src/opnsense/www/js/qrcode.js:648— src/opnsense/www/js/qrcode.js:648 · src/opnsense/www/js/qrcode.js:700 — 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 (5 lines × 2 locations) src/opnsense/www/js/smoothie.js:688— src/opnsense/www/js/smoothie.js:688 · src/opnsense/www/js/smoothie.js:693 — 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.
X2 · Cancellation propagation· Async function without AbortSignal · ×2
Async function without AbortSignal: _fetchRRDList src/opnsense/www/js/opnsense_health.js:119— `_fetchRRDList` 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 })`.
Async function without AbortSignal: _fetchData src/opnsense/www/js/opnsense_health.js:124— `_fetchData` 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 })`.
Empty <h3> heading src/opnsense/www/js/bootstrap.js:1994— 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· Modal dialog does not manage focus · ×1
Modal dialog does not manage focus src/opnsense/www/js/opnsense_bootgrid.js:1181— 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.
AC7 · A11y enforcement· Accessibility enforcement below the top rung · ×1
Accessibility enforcement below the top rung — No accessibility enforcement found — no automated accessibility check runs over your pages. Add an accessibility checker (axe-core, pa11y or Lighthouse) over your HTML in CI and fail the build on new violations. What was searched, so you can tell an absence from a miss: the 12 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
Filter.performValidation (cyclomatic 117) src/opnsense/mvc/app/models/OPNsense/Firewall/Filter.php:42— Filter.performValidation has cyclomatic complexity 117 (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.
Dnsmasq.performValidation (cyclomatic 103) src/opnsense/mvc/app/models/OPNsense/Dnsmasq/Dnsmasq.php:53— Dnsmasq.performValidation has cyclomatic complexity 103 (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.
OpenVPN.generateInstanceConfig (cyclomatic 89) src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php:551— OpenVPN.generateInstanceConfig has cyclomatic complexity 89 (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.
FilterRule.parseFilterRules (cyclomatic 71) src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php:203— FilterRule.parseFilterRules has cyclomatic complexity 71 (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.
translateCompatOptions (cyclomatic 69) src/opnsense/www/js/opnsense_bootgrid.js:244— translateCompatOptions has cyclomatic complexity 69 (threshold 15). Of this number, 68 points are the body's own statements and 1 belongs to 7 function items inside it that branch. 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.
KeaDhcpv6.performValidation (cyclomatic 66) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:44— KeaDhcpv6.performValidation has cyclomatic complexity 66 (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.
keydown (cyclomatic 66) src/opnsense/www/js/bootstrap-select.js:2827— keydown has cyclomatic complexity 66 (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.
smoothie.SmoothieChart.render (cyclomatic 63) src/opnsense/www/js/smoothie.js:839— smoothie.SmoothieChart.render has cyclomatic complexity 63 (threshold 15). Of this number, 61 points are the body's own statements and 2 belong to 2 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.
clickListener (cyclomatic 63) src/opnsense/www/js/bootstrap-select.js:2390— clickListener has cyclomatic complexity 63 (threshold 15). Most of this is not in the body itself: 1 of the 63 points is its own statement and the rest belongs to 19 function items inside it that branch (a function literal at line 2454, checkPopperExists, a function literal at line 2578, …). 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.
FirmwareController.statusAction (cyclomatic 61) src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:96— FirmwareController.statusAction has cyclomatic complexity 61 (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.
OpenVPN.performValidation (cyclomatic 56) src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php:47— OpenVPN.performValidation has cyclomatic complexity 56 (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.
createView::scroll (cyclomatic 55) src/opnsense/www/js/bootstrap-select.js:1227— createView::scroll has cyclomatic complexity 55 (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.
states.query_states (cyclomatic 47) src/opnsense/scripts/filter/lib/states.py:110— states.query_states 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.
Monit.performValidation (cyclomatic 45) src/opnsense/mvc/app/models/OPNsense/Monit/Monit.php:153— Monit.performValidation 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.
CrlController.setAction (cyclomatic 44) src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CrlController.php:180— CrlController.setAction 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.
FirmwareController.infoAction (cyclomatic 43) src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:801— FirmwareController.infoAction 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.
Swanctl.performValidation (cyclomatic 43) src/opnsense/mvc/app/models/OPNsense/IPsec/Swanctl.php:66— Swanctl.performValidation 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.
Vip.performValidation (cyclomatic 43) src/opnsense/mvc/app/models/OPNsense/Interfaces/Vip.php:59— Vip.performValidation 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.
liHeight (cyclomatic 43) src/opnsense/www/js/bootstrap-select.js:1878— liHeight 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.
Radius.authenticate (cyclomatic 42) src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:512— Radius.authenticate 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.
setaddr.console_configure_ip_address (cyclomatic 40) src/opnsense/scripts/shell/setaddr.php:294— setaddr.console_configure_ip_address 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.
_registerEvents (cyclomatic 40) src/opnsense/www/js/opnsense_bootgrid.js:720— _registerEvents has cyclomatic complexity 40 (threshold 15). Most of this is not in the body itself: 2 of the 40 points are its own statements and the rest belongs to 33 function items inside it that branch (title, onMouseEnter, (anonymous)::findTreeRowByIndex::walk, …). 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.
NetworkInterface.performValidation (cyclomatic 39) src/opnsense/mvc/app/models/OPNsense/Interfaces/NetworkInterface.php:200— NetworkInterface.performValidation 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.
KeaDhcpv6.getConfigSubnets (cyclomatic 39) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:328— KeaDhcpv6.getConfigSubnets 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.
certctl.cmd_rehash (cyclomatic 39) src/opnsense/scripts/system/certctl.py:120— certctl.cmd_rehash 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.
OverviewController.parseIfInfo (cyclomatic 38) src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/OverviewController.php:108— OverviewController.parseIfInfo 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.
Swanctl.getConfig (cyclomatic 38) src/opnsense/mvc/app/models/OPNsense/IPsec/Swanctl.php:211— Swanctl.getConfig 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.
CPBackgroundProcess.sync_zone (cyclomatic 38) src/opnsense/scripts/captiveportal/cp-background-process.py:140— CPBackgroundProcess.sync_zone 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.
render (cyclomatic 37) src/opnsense/www/js/bootstrap-select.js:1714— render has cyclomatic complexity 37 (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.
FilterController.searchRuleAction (cyclomatic 35) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterController.php:84— FilterController.searchRuleAction 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.
ForwardRule.parseRdrRules (cyclomatic 35) REDACTED:100— ForwardRule.parseRdrRules 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.
setFormData (cyclomatic 35) src/opnsense/www/js/opnsense.js:146— setFormData has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 1 of the 35 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 155, 196, 147, …). 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.
SettingsController.searchGatewayAction (cyclomatic 34) src/opnsense/mvc/app/controllers/OPNsense/Routing/Api/SettingsController.php:54— SettingsController.searchGatewayAction 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.
Gateways.getGateways (cyclomatic 34) src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php:329— Gateways.getGateways 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) (cyclomatic 32) src/opnsense/www/js/opnsense_favorites.js:27— (anonymous) has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 9 of the 32 points are its own statements and the rest belongs to 13 function items inside it that branch ((anonymous)::success, a function literal at line 69, a function literal at line 51, …). 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.
interfaces.validate_track6_idassoc6 (cyclomatic 31) REDACTED:39— interfaces.validate_track6_idassoc6 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.
M1_0_4.run (cyclomatic 30) src/opnsense/mvc/app/models/OPNsense/IPsec/Migrations/M1_0_4.php:37— M1_0_4.run 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.
CertificatesField.actionPostLoadingEvent (cyclomatic 30) src/opnsense/mvc/app/models/OPNsense/Trust/FieldTypes/CertificatesField.php:138— CertificatesField.actionPostLoadingEvent 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.
user_pass_verify.do_auth (cyclomatic 30) src/opnsense/scripts/openvpn/user_pass_verify.php:63— user_pass_verify.do_auth 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.
(anonymous) (cyclomatic 30) src/opnsense/www/js/opnsense_theme.js:30— (anonymous) has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 9 of the 30 points are its own statements and the rest belongs to 26 function items inside it that branch (a function literal at line 181, opnsense_sidebar_toggle, mouseenter, …). 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.
TunnelController.searchPhase2Action (cyclomatic 29) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/TunnelController.php:129— TunnelController.searchPhase2Action 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.
PlainOpenVPN.openvpnConfParts (cyclomatic 29) src/opnsense/mvc/app/library/OPNsense/OpenVPN/PlainOpenVPN.php:92— PlainOpenVPN.openvpnConfParts 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.
RuleCache.search (cyclomatic 28) src/opnsense/scripts/suricata/lib/rulecache.py:342— RuleCache.search 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.
CaController.setBaseHook (cyclomatic 27) src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CaController.php:55— CaController.setBaseHook 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.
CertController.setBaseHook (cyclomatic 27) src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CertController.php:52— CertController.setBaseHook 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.
SNatRule.parseNatRules (cyclomatic 27) src/opnsense/mvc/app/library/OPNsense/Firewall/SNatRule.php:64— SNatRule.parseNatRules 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.
OpenVPN.getOverwrite (cyclomatic 27) src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php:234— OpenVPN.getOverwrite 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.
UIBootgrid.tabulatorDefaults (cyclomatic 27) src/opnsense/www/js/opnsense_bootgrid.js:1559— UIBootgrid.tabulatorDefaults 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 1627, 1598, 1657, …). 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.
UIBootgrid._internalFormatters (cyclomatic 27) src/opnsense/www/js/opnsense_bootgrid.js:1923— UIBootgrid._internalFormatters 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 10 function literals inside it that branch (lines 2050, 1947, 2020, …). 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.
ServiceController.statisticsAction (cyclomatic 26) src/opnsense/mvc/app/controllers/OPNsense/TrafficShaper/Api/ServiceController.php:88— ServiceController.statisticsAction 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.
LDAP._authenticate (cyclomatic 26) src/opnsense/mvc/app/library/OPNsense/Auth/LDAP.php:487— LDAP._authenticate 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.
Rule.mapAddressInfo (cyclomatic 26) src/opnsense/mvc/app/library/OPNsense/Firewall/Rule.php:73— Rule.mapAddressInfo 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.
Store.parseX509 (cyclomatic 26) src/opnsense/mvc/app/library/OPNsense/Trust/Store.php:450— Store.parseX509 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.
KeaDhcpv4.getConfigSubnets (cyclomatic 26) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:182— KeaDhcpv4.getConfigSubnets 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.
dnsbl_module.operate (cyclomatic 26) src/opnsense/scripts/unbound-dnsbl/dnsbl_module.py:173— dnsbl_module.operate 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.
ControllerBase.beforeExecuteRoute (cyclomatic 25) src/opnsense/mvc/app/controllers/OPNsense/Base/ControllerBase.php:373— ControllerBase.beforeExecuteRoute 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.
DNatRule.parseNatRules (cyclomatic 25) src/opnsense/mvc/app/library/OPNsense/Firewall/DNatRule.php:96— DNatRule.parseNatRules 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.
MFP1_0_4.run (cyclomatic 25) src/opnsense/mvc/app/models/OPNsense/Firewall/Migrations/MFP1_0_4.php:41— MFP1_0_4.run 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.
Menu.collect (cyclomatic 25) src/opnsense/mvc/app/models/OPNsense/Interfaces/Menu/Menu.php:36— Menu.collect 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.
OpenVPN.getInstanceById (cyclomatic 25) src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php:405— OpenVPN.getInstanceById 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.
M1_0_13.run (cyclomatic 25) src/opnsense/mvc/app/models/OPNsense/Unbound/Migrations/M1_0_13.php:70— M1_0_13.run 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.
setaddr.add_gateway_to_config (cyclomatic 25) src/opnsense/scripts/shell/setaddr.php:199— setaddr.add_gateway_to_config 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.
setaddr.console_configure_dhcpd (cyclomatic 25) src/opnsense/scripts/shell/setaddr.php:469— setaddr.console_configure_dhcpd 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.
unbound_watcher.run_watcher (cyclomatic 25) src/opnsense/scripts/unbound/unbound_watcher.py:115— unbound_watcher.run_watcher 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.
buildData (cyclomatic 25) src/opnsense/www/js/bootstrap-select.js:1499— buildData has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 5 of the 25 points are its own statements and the rest belongs to 3 function items inside it that branch (addOption, addOptgroup, addDivider). 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.
ApiControllerBase.searchRecordsetBase (cyclomatic 24) src/opnsense/mvc/app/controllers/OPNsense/Base/ApiControllerBase.php:85— ApiControllerBase.searchRecordsetBase 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.
ApiMutableModelControllerBase.importCsv (cyclomatic 24) src/opnsense/mvc/app/controllers/OPNsense/Base/ApiMutableModelControllerBase.php:694— ApiMutableModelControllerBase.importCsv 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.
LeasesController.searchAction (cyclomatic 24) src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/Api/LeasesController.php:39— LeasesController.searchAction 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.
Base.setGroupMembership (cyclomatic 24) src/opnsense/mvc/app/library/OPNsense/Auth/Base.php:148— Base.setGroupMembership 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.
Radius.stopAccounting (cyclomatic 24) src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:322— Radius.stopAccounting 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.
Radius.updateAccounting (cyclomatic 24) src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:411— Radius.updateAccounting 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.
IPPortField.getValidators (cyclomatic 24) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/IPPortField.php:103— IPPortField.getValidators 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.
InterfaceField.actionPostLoadingEvent (cyclomatic 24) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/InterfaceField.php:106— InterfaceField.actionPostLoadingEvent 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.
JsonKeyValueStoreField.actionPostLoadingEvent (cyclomatic 24) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/JsonKeyValueStoreField.php:123— JsonKeyValueStoreField.actionPostLoadingEvent 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.
wg-service-control.wg_start (cyclomatic 24) REDACTED:65— wg-service-control.wg_start 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.
Daemonize.start (cyclomatic 24) src/opnsense/scripts/captiveportal/lib/daemonize.py:61— Daemonize.start 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.
bootstrap-select.Plugin (cyclomatic 24) src/opnsense/www/js/bootstrap-select.js:3106— bootstrap-select.Plugin has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 11 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 3163). 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.
IXR_IntrospectionServer.call (cyclomatic 23) contrib/IXR/IXR_Library.php:919— IXR_IntrospectionServer.call has cyclomatic complexity 23 (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.
SystemController.statusAction (cyclomatic 23) src/opnsense/mvc/app/controllers/OPNsense/Core/Api/SystemController.php:62— SystemController.statusAction 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.
InterfaceController.getVipStatusAction (cyclomatic 23) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/InterfaceController.php:251— InterfaceController.getVipStatusAction 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.
M1_0_0.run (cyclomatic 23) src/opnsense/mvc/app/models/OPNsense/Radvd/Migrations/M1_0_0.php:41— M1_0_0.run 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.
Metadata.list_rules (cyclomatic 23) src/opnsense/scripts/suricata/lib/metadata.py:74— Metadata.list_rules 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.
RuleCache.list_local_changes (cyclomatic 23) src/opnsense/scripts/suricata/lib/rulecache.py:60— RuleCache.list_local_changes 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.
showOptionsDialog (cyclomatic 23) src/opnsense/www/js/opnsense_widgets.js:227— showOptionsDialog has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 7 of the 23 points are its own statements and the rest belongs to 12 function items inside it that branch ((anonymous)::action, updateOptions, (anonymous)::onhide, …). 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.
FilterBaseController.moveRuleBeforeBase (cyclomatic 22) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterBaseController.php:338— FilterBaseController.moveRuleBeforeBase 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.
Rule.reader (cyclomatic 22) src/opnsense/mvc/app/library/OPNsense/Firewall/Rule.php:262— Rule.reader 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.
ArrayField.importRecordSet (cyclomatic 22) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/ArrayField.php:315— ArrayField.importRecordSet 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.
UriParser.iter_addresses (cyclomatic 22) src/opnsense/scripts/filter/lib/alias/uri.py:59— UriParser.iter_addresses has cyclomatic complexity 22 (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.
bootstrap.Tooltip.show (cyclomatic 22) src/opnsense/www/js/bootstrap.js:1603— bootstrap.Tooltip.show has cyclomatic complexity 22 (threshold 15). Of this number, 21 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.
_parseGridView (cyclomatic 22) src/opnsense/www/js/opnsense_bootgrid.js:476— _parseGridView 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.
_parseColumns (cyclomatic 22) src/opnsense/www/js/opnsense_bootgrid.js:536— _parseColumns has cyclomatic complexity 22 (threshold 15). Of this number, 18 points are the body's own statements and 4 belong to 3 function literals 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.
CrlController.getAction (cyclomatic 21) src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CrlController.php:105— CrlController.getAction 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.
ACL.loadUserGroupRights (cyclomatic 21) src/opnsense/mvc/app/models/OPNsense/Core/ACL.php:90— ACL.loadUserGroupRights 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.
FilterRuleContainerField.serialize (cyclomatic 21) src/opnsense/mvc/app/models/OPNsense/Firewall/FieldTypes/FilterRuleField.php:54— FilterRuleContainerField.serialize 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.
Gateways.performValidation (cyclomatic 21) src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php:49— Gateways.performValidation 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.
M1_0_1.run (cyclomatic 21) src/opnsense/mvc/app/models/OPNsense/Unbound/Migrations/M1_0_1.php:43— M1_0_1.run 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.
GEOIP.process_zip (cyclomatic 21) src/opnsense/scripts/filter/lib/alias/geoip.py:50— GEOIP.process_zip 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.
chartjs-plugin-streaming.clean (cyclomatic 21) src/opnsense/www/js/chartjs-plugin-streaming.js:473— chartjs-plugin-streaming.clean 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 4 function literals inside it that branch (lines 481, 526, 510, …). 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.
InitialSetup.performValidation (cyclomatic 20) src/opnsense/mvc/app/models/OPNsense/Core/InitialSetup.php:157— InitialSetup.performValidation 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.
DHCRelay.performValidation (cyclomatic 20) src/opnsense/mvc/app/models/OPNsense/DHCRelay/DHCRelay.php:39— DHCRelay.performValidation 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.
Alias.performValidation (cyclomatic 20) src/opnsense/mvc/app/models/OPNsense/Firewall/Alias.php:52— Alias.performValidation 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.
Radvd.performValidation (cyclomatic 20) src/opnsense/mvc/app/models/OPNsense/Radvd/Radvd.php:43— Radvd.performValidation 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.
Unbound.performValidation (cyclomatic 20) src/opnsense/mvc/app/models/OPNsense/Unbound/Unbound.php:40— Unbound.performValidation 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.
diag_backup.restore_config_section (cyclomatic 20) REDACTED:48— diag_backup.restore_config_section 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.
states.query_top (cyclomatic 20) src/opnsense/scripts/filter/lib/states.py:225— states.query_top 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.
read_log.parse_record (cyclomatic 20) src/opnsense/scripts/filter/read_log.py:94— read_log.parse_record 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.
ping.read_latest_stats (cyclomatic 20) src/opnsense/scripts/interfaces/ping.py:63— ping.read_latest_stats 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.
ovpn_status.main (cyclomatic 20) src/opnsense/scripts/openvpn/ovpn_status.py:112— ovpn_status.main 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.
DNSBL.policy_match (cyclomatic 20) src/opnsense/scripts/unbound-dnsbl/lib/dnsbl.py:123— DNSBL.policy_match 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.
opnsense_legacy.hook_firewall_categories (cyclomatic 20) src/www/javascript/opnsense_legacy.js:184— opnsense_legacy.hook_firewall_categories has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 186, 197, 248, …). 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.
SimpleActionButton (cyclomatic 20) REDACTED:816— SimpleActionButton has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 14 function items inside it that branch (a function literal at line 884, construct, setIcon, …). 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.
ApiMutableModelControllerBase.checkAndThrowValueInUse (cyclomatic 19) src/opnsense/mvc/app/controllers/OPNsense/Base/ApiMutableModelControllerBase.php:109— ApiMutableModelControllerBase.checkAndThrowValueInUse 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.
AccessController.logonAction (cyclomatic 19) src/opnsense/mvc/app/controllers/OPNsense/CaptivePortal/Api/AccessController.php:235— AccessController.logonAction 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.
NetworkinsightController.timeserieAction (cyclomatic 19) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/NetworkinsightController.php:53— NetworkinsightController.timeserieAction 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.
ExportController.downloadAction (cyclomatic 19) src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/Api/ExportController.php:295— ExportController.downloadAction 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.
Config.fromArray (cyclomatic 19) src/opnsense/mvc/app/library/OPNsense/Core/Config.php:191— Config.fromArray 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.
UniqueConstraint.validate (cyclomatic 19) src/opnsense/mvc/app/models/OPNsense/Base/Constraints/UniqueConstraint.php:49— UniqueConstraint.validate 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.
InitialSetup.init (cyclomatic 19) src/opnsense/mvc/app/models/OPNsense/Core/InitialSetup.php:76— InitialSetup.init 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.
HostField.getValidators (cyclomatic 19) src/opnsense/mvc/app/models/OPNsense/Diagnostics/FieldTypes/HostField.php:45— HostField.getValidators 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.
Downloader._unpack (cyclomatic 19) src/opnsense/scripts/suricata/lib/downloader.py:49— Downloader._unpack 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.
liveSearchListener (cyclomatic 19) src/opnsense/www/js/bootstrap-select.js:2658— liveSearchListener 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 3 function literals inside it that branch (lines 2672, 2661, 2668). 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.
IXR_Message.tag_close (cyclomatic 18) contrib/IXR/IXR_Library.php:262— IXR_Message.tag_close 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.
ControllerBase.parseFormNode (cyclomatic 18) src/opnsense/mvc/app/controllers/OPNsense/Base/ControllerBase.php:166— ControllerBase.parseFormNode 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.
M1_0_0.run (cyclomatic 18) src/opnsense/mvc/app/models/OPNsense/Firewall/Migrations/M1_0_0.php:45— M1_0_0.run 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.
M1_0_7.run (cyclomatic 18) src/opnsense/mvc/app/models/OPNsense/IDS/Migrations/M1_0_7.php:42— M1_0_7.run 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.
VlanInterfaceField.actionPostLoadingEvent (cyclomatic 18) src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/VlanInterfaceField.php:41— VlanInterfaceField.actionPostLoadingEvent 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.
NetworkInterface.serializeToConfig (cyclomatic 18) src/opnsense/mvc/app/models/OPNsense/Interfaces/NetworkInterface.php:120— NetworkInterface.serializeToConfig 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.
BaseFlowAggregator.get_top_data (cyclomatic 18) src/opnsense/scripts/netflow/lib/aggregates/__init__.py:283— BaseFlowAggregator.get_top_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.
FlowParser.__iter__ (cyclomatic 18) src/opnsense/scripts/netflow/lib/flowparser.py:130— FlowParser.__iter__ 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.
update-crl-fetch.main (cyclomatic 18) src/opnsense/scripts/system/update-crl-fetch.py:67— update-crl-fetch.main 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.
UIBootgrid._renderActionBar (cyclomatic 18) src/opnsense/www/js/opnsense_bootgrid.js:1234— UIBootgrid._renderActionBar has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 1276, 1283, 1300, …). 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.
opnsense_ui.initGlobalOpenShortcuts (cyclomatic 18) REDACTED:693— opnsense_ui.initGlobalOpenShortcuts 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 one function literal inside it that branches (line 694). 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. This is NOT this file's highest cyclomatic complexity: opnsense_ui.$.fn.SimpleActionButton (cyclomatic 20) 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.
createDropdown (cyclomatic 18) src/opnsense/www/js/bootstrap-select.js:1057— createDropdown 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.
setMenuSize (cyclomatic 18) src/opnsense/www/js/bootstrap-select.js:2030— setMenuSize 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.
SadController.searchAction (cyclomatic 17) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SadController.php:46— SadController.searchAction 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.
SpdController.searchAction (cyclomatic 17) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SpdController.php:46— SpdController.searchAction 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.
TunnelController.searchPhase1Action (cyclomatic 17) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/TunnelController.php:43— TunnelController.searchPhase1Action 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.
LaggSettingsController.delItemAction (cyclomatic 17) src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/LaggSettingsController.php:126— LaggSettingsController.delItemAction 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.
ServiceController.searchSessionsAction (cyclomatic 17) src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/Api/ServiceController.php:72— ServiceController.searchSessionsAction 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.
ServiceController.statsAction (cyclomatic 17) src/opnsense/mvc/app/controllers/OPNsense/Syslog/Api/ServiceController.php:69— ServiceController.statsAction 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.
UIModelGrid.fetch (cyclomatic 17) src/opnsense/mvc/app/library/OPNsense/Base/UIModelGrid.php:111— UIModelGrid.fetch 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.
Config.toArray (cyclomatic 17) src/opnsense/mvc/app/library/OPNsense/Core/Config.php:97— Config.toArray 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.
Plugin.setGatewayGroups (cyclomatic 17) src/opnsense/mvc/app/library/OPNsense/Firewall/Plugin.php:133— Plugin.setGatewayGroups 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.
BaseModel.runMigrations (cyclomatic 17) src/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php:882— BaseModel.runMigrations 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.
HostnameField.getValidators (cyclomatic 17) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/HostnameField.php:129— HostnameField.getValidators 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.
NetworkField.isValidInput (cyclomatic 17) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/NetworkField.php:142— NetworkField.isValidInput 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.
DNat.performValidation (cyclomatic 17) src/opnsense/mvc/app/models/OPNsense/Firewall/DNat.php:41— DNat.performValidation 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.
NetworkInterfaceContainerField.toLegacy (cyclomatic 17) src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/NetworkInterfaceField.php:41— NetworkInterfaceContainerField.toLegacy 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.
NetworkInterfaceContainerField.fromLegacy (cyclomatic 17) src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/NetworkInterfaceField.php:140— NetworkInterfaceContainerField.fromLegacy 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.
M1_0_0.run (cyclomatic 17) src/opnsense/mvc/app/models/OPNsense/Monit/Migrations/M1_0_0.php:37— M1_0_0.run 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.
Gateways.gatewayIterator (cyclomatic 17) src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php:192— Gateways.gatewayIterator 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.
DB.update_accounting_info (cyclomatic 17) src/opnsense/scripts/captiveportal/lib/db.py:478— DB.update_accounting_info 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.
AsyncDNSResolver.request_ittr (cyclomatic 17) src/opnsense/scripts/filter/lib/alias/base.py:112— AsyncDNSResolver.request_ittr 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.
ovpn_event.main (cyclomatic 17) src/opnsense/scripts/openvpn/ovpn_event.py:39— ovpn_event.main 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.
lib.parse_ipfw_pipes (cyclomatic 17) src/opnsense/scripts/shaper/lib/__init__.py:82— lib.parse_ipfw_pipes 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.
Template._generate (cyclomatic 17) REDACTED:219— Template._generate 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.
bootstrap.Modal.backdrop (cyclomatic 17) src/opnsense/www/js/bootstrap.js:1112— bootstrap.Modal.backdrop has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 belong to 2 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.
opnsense.getFormData (cyclomatic 17) src/opnsense/www/js/opnsense.js:67— opnsense.getFormData 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 3 function literals inside it that branch (lines 77, 69, 99). 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.
setPlaceholder (cyclomatic 17) src/opnsense/www/js/bootstrap-select.js:1447— setPlaceholder has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs 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.
handleModalEvents (cyclomatic 17) src/opnsense/www/js/bootstrap-dialog.js:1023— handleModalEvents 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 6 function literals inside it that branch (lines 1024, 1040, 1052, …). 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.
processTunnels (cyclomatic 17) src/opnsense/www/js/widgets/Wireguard.js:77— processTunnels 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 6 function literals inside it that branch (lines 82, 117, 140, …). 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.
IXR_Client.query (cyclomatic 16) contrib/IXR/IXR_Library.php:625— IXR_Client.query has cyclomatic complexity 16 (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.
ControllerBase.getFormGrid (cyclomatic 16) src/opnsense/mvc/app/controllers/OPNsense/Base/ControllerBase.php:281— ControllerBase.getFormGrid 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.
FirewallController.statsAction (cyclomatic 16) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/FirewallController.php:105— FirewallController.statsAction 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.
AliasController.importAction (cyclomatic 16) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/AliasController.php:404— AliasController.importAction 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.
SettingsController.searchInstalledRulesAction (cyclomatic 16) src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/SettingsController.php:64— SettingsController.searchInstalledRulesAction 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.
ServiceController.showAction (cyclomatic 16) src/opnsense/mvc/app/controllers/OPNsense/Wireguard/Api/ServiceController.php:69— ServiceController.showAction 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.
Radius.startAccounting (cyclomatic 16) src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:253— Radius.startAccounting 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.
TunableField.actionPostLoadingEvent (cyclomatic 16) src/opnsense/mvc/app/models/OPNsense/Core/FieldTypes/TunableField.php:71— TunableField.actionPostLoadingEvent 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.
Firmware.getRepositoryOptions (cyclomatic 16) src/opnsense/mvc/app/models/OPNsense/Core/Firmware.php:44— Firmware.getRepositoryOptions 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.
InitialSetup.flush_network_wan (cyclomatic 16) src/opnsense/mvc/app/models/OPNsense/Core/InitialSetup.php:282— InitialSetup.flush_network_wan 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.
MFP1_0_3.run (cyclomatic 16) src/opnsense/mvc/app/models/OPNsense/Firewall/Migrations/MFP1_0_3.php:41— MFP1_0_3.run 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.
IPsec.traverseItems (cyclomatic 16) src/opnsense/mvc/app/models/OPNsense/IPsec/IPsec.php:188— IPsec.traverseItems 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.
M1_0_1.run (cyclomatic 16) src/opnsense/mvc/app/models/OPNsense/IPsec/Migrations/M1_0_1.php:40— M1_0_1.run 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.
DUIDField.isValidDuid (cyclomatic 16) src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/DUIDField.php:38— DUIDField.isValidDuid 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.
WLAN1_0_0.post (cyclomatic 16) src/opnsense/mvc/app/models/OPNsense/Interfaces/Migrations/WLAN1_0_0.php:55— WLAN1_0_0.post 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.
KeaDdns.generateConfig (cyclomatic 16) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDdns.php:41— KeaDdns.generateConfig 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.
CPBackgroundProcess.initialize_fixed (cyclomatic 16) src/opnsense/scripts/captiveportal/cp-background-process.py:100— CPBackgroundProcess.initialize_fixed 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.
AsyncDNSResolver.request_ittr (cyclomatic 16) src/opnsense/scripts/filter/lib/__init__.py:96— AsyncDNSResolver.request_ittr 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.
BlocklistParser.modify_blocklist (cyclomatic 16) src/opnsense/scripts/unbound/blocklists/__init__.py:147— BlocklistParser.modify_blocklist 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.
Action.execute (cyclomatic 16) src/opnsense/service/modules/actions/inline.py:39— Action.execute 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.
RealTimeScale._generate (cyclomatic 16) src/opnsense/www/js/chartjs-plugin-streaming.js:708— RealTimeScale._generate 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.
opnsense_ui.initFormHelpUI (cyclomatic 16) REDACTED:423— opnsense_ui.initFormHelpUI has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 476, 432, 505, …). 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. This is NOT this file's highest cyclomatic complexity: opnsense_ui.$.fn.SimpleActionButton (cyclomatic 20) 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.
tokenize2.Tokenize2.init (cyclomatic 16) src/opnsense/www/js/tokenize2.js:134— tokenize2.Tokenize2.init has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to 5 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.
_makeOptionField (cyclomatic 16) src/opnsense/www/js/opnsense_widgets.js:350— _makeOptionField 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.
SimpleFileUploadDlg (cyclomatic 16) REDACTED:1045— SimpleFileUploadDlg 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 8 function items inside it that branch (a function literal at line 1111, a function literal at line 1073, construct::(anonymous)::(anonymous)::onload, …). 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.
_renderFooterCommands (cyclomatic 16) src/opnsense/www/js/opnsense_bootgrid.js:1350— _renderFooterCommands has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to 5 function literals 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.
setStyle (cyclomatic 16) src/opnsense/www/js/bootstrap-select.js:1841— setStyle has cyclomatic complexity 16 (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.
onWidgetTick (cyclomatic 16) src/opnsense/www/js/widgets/KeaLeases.js:46— onWidgetTick 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.
Repeated repair: src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/LvtemplateController.php src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/LvtemplateController.php:38— src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/LvtemplateController.php changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is LvtemplateController.searchItemAction at line 38), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “mvc: fix stale imports in diagnostics”; “mvc: fix imports for Backend”; “mvc: fix imports for UserException”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-22..2026-10-20, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-22 20:57:18 +02:00' --until='2026-10-20 20:57:18 +02:00' --full-history --no-merges -- src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/LvtemplateController.php`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
OpenVPN.generateInstanceConfig (cognitive 303) src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php:551— OpenVPN.generateInstanceConfig has cognitive complexity 303 (threshold 15). Drivers by points: if/else 60 (213 pts), loops 12 (49 pts), ternaries 5 (27 pts), boolean chains 14 (nesting depth added 212). 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.
Filter.performValidation (cognitive 300) src/opnsense/mvc/app/models/OPNsense/Firewall/Filter.php:42— Filter.performValidation has cognitive complexity 300 (threshold 15). Drivers by points: if/else 45 (196 pts), boolean chains 48, ternaries 6 (29 pts), loops 9 (27 pts) (nesting depth added 192). 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.
Dnsmasq.performValidation (cognitive 195) src/opnsense/mvc/app/models/OPNsense/Dnsmasq/Dnsmasq.php:53— Dnsmasq.performValidation has cognitive complexity 195 (threshold 15). Drivers by points: if/else 48 (121 pts), boolean chains 34, loops 14 (27 pts), ternaries 5 (13 pts) (nesting depth added 94). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CrlController.setAction (cognitive 153) src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CrlController.php:180— CrlController.setAction has cognitive complexity 153 (threshold 15). Drivers by points: if/else 33 (94 pts), loops 9 (31 pts), ternaries 4 (17 pts), error handling 2 (9 pts), boolean chains 2 (nesting depth added 103). 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.
FilterRule.parseFilterRules (cognitive 151) src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php:203— FilterRule.parseFilterRules has cognitive complexity 151 (threshold 15). Drivers by points: if/else 28 (83 pts), boolean chains 26, ternaries 6 (24 pts), loops 4 (15 pts), match/switch 1 (3 pts) (nesting depth added 86). 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.
KeaDhcpv6.performValidation (cognitive 139) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:44— KeaDhcpv6.performValidation has cognitive complexity 139 (threshold 15). Drivers by points: if/else 40 (107 pts), loops 8 (17 pts), boolean chains 15 (nesting depth added 76). 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.
states.query_states (cognitive 129) src/opnsense/scripts/filter/lib/states.py:110— states.query_states has cognitive complexity 129 (threshold 15). Drivers by points: if/else 20 (85 pts), loops 5 (19 pts), ternaries 4 (12 pts), boolean chains 8, error handling 1 (5 pts) (nesting depth added 91). 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.
clickListener (cognitive 129) src/opnsense/www/js/bootstrap-select.js:2390— clickListener has cognitive complexity 129 (threshold 15). Drivers by points: if/else 41 (75 pts), ternaries 6 (28 pts), boolean chains 20, loops 1 (6 pts) (nesting depth added 61). None of this is in the body itself: all 129 points belong to 19 function items inside it that branch (a function literal at line 2454, a function literal at line 2578, a function literal at line 2608, …). 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.
ServiceController.statisticsAction (cognitive 128) src/opnsense/mvc/app/controllers/OPNsense/TrafficShaper/Api/ServiceController.php:88— ServiceController.statisticsAction has cognitive complexity 128 (threshold 15). Drivers by points: if/else 15 (75 pts), loops 8 (38 pts), ternaries 3 (15 pts) (nesting depth added 102). 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.
keydown (cognitive 113) src/opnsense/www/js/bootstrap-select.js:2827— keydown has cognitive complexity 113 (threshold 15). Drivers by points: if/else 40 (84 pts), boolean chains 23, ternaries 3 (4 pts), loops 1 (2 pts) (nesting depth added 46). 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.
CPBackgroundProcess.sync_zone (cognitive 107) src/opnsense/scripts/captiveportal/cp-background-process.py:140— CPBackgroundProcess.sync_zone has cognitive complexity 107 (threshold 15). Drivers by points: if/else 23 (85 pts), boolean chains 12, loops 4 (10 pts) (nesting depth added 68). 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.
OpenVPN.performValidation (cognitive 105) src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php:47— OpenVPN.performValidation has cognitive complexity 105 (threshold 15). Drivers by points: if/else 27 (82 pts), boolean chains 22, loops 1 (nesting depth added 55). 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.
KeaDhcpv6.getConfigSubnets (cognitive 102) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:328— KeaDhcpv6.getConfigSubnets has cognitive complexity 102 (threshold 15). Drivers by points: if/else 32 (84 pts), loops 8 (18 pts) (nesting depth added 62). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Monit.performValidation (cognitive 101) src/opnsense/mvc/app/models/OPNsense/Monit/Monit.php:153— Monit.performValidation has cognitive complexity 101 (threshold 15). Drivers by points: if/else 13 (64 pts), boolean chains 16, match/switch 4 (15 pts), loops 2 (6 pts) (nesting depth added 66). 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.
setFormData (cognitive 100) src/opnsense/www/js/opnsense.js:146— setFormData has cognitive complexity 100 (threshold 15). Drivers by points: if/else 28 (84 pts), loops 2 (9 pts), boolean chains 5, other 2 (nesting depth added 63). None of this is in the body itself: all 100 points belong to 5 function literals inside it that branch (lines 155, 196, 147, …). 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.
OverviewController.parseIfInfo (cognitive 99) src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/OverviewController.php:108— OverviewController.parseIfInfo has cognitive complexity 99 (threshold 15). Drivers by points: if/else 15 (52 pts), loops 11 (28 pts), ternaries 6 (14 pts), boolean chains 5 (nesting depth added 62). 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.
createView::scroll (cognitive 99) src/opnsense/www/js/bootstrap-select.js:1227— createView::scroll has cognitive complexity 99 (threshold 15). Drivers by points: if/else 27 (63 pts), boolean chains 18, ternaries 6 (14 pts), loops 2 (4 pts) (nesting depth added 46). 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.
setaddr.console_configure_ip_address (cognitive 96) src/opnsense/scripts/shell/setaddr.php:294— setaddr.console_configure_ip_address has cognitive complexity 96 (threshold 15). Drivers by points: if/else 16 (51 pts), ternaries 8 (20 pts), loops 4 (13 pts), boolean chains 12 (nesting depth added 56). 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.
dnsbl_module.operate (cognitive 95) src/opnsense/scripts/unbound-dnsbl/dnsbl_module.py:173— dnsbl_module.operate has cognitive complexity 95 (threshold 15). Drivers by points: if/else 15 (64 pts), loops 2 (13 pts), ternaries 3 (12 pts), boolean chains 6 (nesting depth added 69). 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.
render (cognitive 95) src/opnsense/www/js/smoothie.js:839— render has cognitive complexity 95 (threshold 15). Drivers by points: if/else 21 (33 pts), ternaries 12 (28 pts), boolean chains 20, loops 7 (12 pts), match/switch 1 (2 pts) (nesting depth added 34). Of this number, 93 points are the body's own statements and 2 belong to 5 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.
Swanctl.getConfig (cognitive 94) src/opnsense/mvc/app/models/OPNsense/IPsec/Swanctl.php:211— Swanctl.getConfig has cognitive complexity 94 (threshold 15). Drivers by points: if/else 17 (63 pts), loops 7 (24 pts), ternaries 1 (5 pts), boolean chains 2 (nesting depth added 67). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FirmwareController.statusAction (cognitive 93) src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:96— FirmwareController.statusAction has cognitive complexity 93 (threshold 15). Drivers by points: if/else 15 (33 pts), ternaries 6 (22 pts), boolean chains 15, loops 5 (14 pts), match/switch 2 (9 pts) (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
render (cognitive 90) src/opnsense/www/js/bootstrap-select.js:1714— render has cognitive complexity 90 (threshold 15). Drivers by points: if/else 24 (68 pts), boolean chains 12, ternaries 3 (6 pts), loops 1 (4 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.
certctl.cmd_rehash (cognitive 84) src/opnsense/scripts/system/certctl.py:120— certctl.cmd_rehash has cognitive complexity 84 (threshold 15). Drivers by points: if/else 16 (50 pts), loops 10 (19 pts), boolean chains 8, ternaries 2 (7 pts) (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TunnelController.searchPhase2Action (cognitive 83) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/TunnelController.php:129— TunnelController.searchPhase2Action has cognitive complexity 83 (threshold 15). Drivers by points: if/else 14 (43 pts), ternaries 5 (19 pts), loops 5 (15 pts), match/switch 1 (5 pts), boolean chains 1 (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MFP1_0_4.run (cognitive 82) src/opnsense/mvc/app/models/OPNsense/Firewall/Migrations/MFP1_0_4.php:41— MFP1_0_4.run has cognitive complexity 82 (threshold 15). Drivers by points: if/else 9 (36 pts), ternaries 6 (31 pts), loops 3 (12 pts), boolean chains 3 (nesting depth added 61). 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.
Gateways.getGateways (cognitive 81) src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php:329— Gateways.getGateways has cognitive complexity 81 (threshold 15). Drivers by points: if/else 14 (47 pts), loops 6 (17 pts), boolean chains 9, ternaries 2 (8 pts) (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RuleCache.search (cognitive 80) src/opnsense/scripts/suricata/lib/rulecache.py:342— RuleCache.search has cognitive complexity 80 (threshold 15). Drivers by points: if/else 22 (58 pts), loops 8 (20 pts), boolean chains 2 (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
translateCompatOptions (cognitive 80) src/opnsense/www/js/opnsense_bootgrid.js:244— translateCompatOptions has cognitive complexity 80 (threshold 15). Drivers by points: if/else 39 (47 pts), other 27, boolean chains 2, loops 2, ternaries 1 (2 pts) (nesting depth added 9). Of this number, 78 points are the body's own statements and 2 belong to 7 function items 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.
SettingsController.searchGatewayAction (cognitive 78) src/opnsense/mvc/app/controllers/OPNsense/Routing/Api/SettingsController.php:54— SettingsController.searchGatewayAction has cognitive complexity 78 (threshold 15). Drivers by points: if/else 13 (43 pts), loops 5 (15 pts), ternaries 4 (12 pts), boolean chains 8 (nesting depth added 48). 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.
FirmwareController.infoAction (cognitive 77) src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:801— FirmwareController.infoAction has cognitive complexity 77 (threshold 15). Drivers by points: if/else 14 (35 pts), ternaries 10 (18 pts), loops 10 (16 pts), boolean chains 8 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RuleCache.list_local_changes (cognitive 75) src/opnsense/scripts/suricata/lib/rulecache.py:60— RuleCache.list_local_changes has cognitive complexity 75 (threshold 15). Drivers by points: if/else 13 (54 pts), loops 6 (18 pts), boolean chains 2, ternaries 1 (nesting depth added 53). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
unbound_watcher.run_watcher (cognitive 75) src/opnsense/scripts/unbound/unbound_watcher.py:115— unbound_watcher.run_watcher has cognitive complexity 75 (threshold 15). Drivers by points: if/else 13 (39 pts), loops 9 (30 pts), error handling 1 (4 pts), boolean chains 2 (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NetworkInterface.performValidation (cognitive 72) src/opnsense/mvc/app/models/OPNsense/Interfaces/NetworkInterface.php:200— NetworkInterface.performValidation has cognitive complexity 72 (threshold 15). Drivers by points: if/else 19 (50 pts), boolean chains 12, loops 3 (7 pts), ternaries 1 (3 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CaController.setBaseHook (cognitive 71) src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CaController.php:55— CaController.setBaseHook has cognitive complexity 71 (threshold 15). Drivers by points: if/else 19 (57 pts), loops 2 (8 pts), boolean chains 3, ternaries 1 (2 pts), match/switch 1 (nesting depth added 45). 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.
CrlController.getAction (cognitive 71) src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CrlController.php:105— CrlController.getAction has cognitive complexity 71 (threshold 15). Drivers by points: if/else 7 (24 pts), loops 7 (23 pts), ternaries 5 (23 pts), boolean chains 1 (nesting depth added 51). 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.
Vip.performValidation (cognitive 71) src/opnsense/mvc/app/models/OPNsense/Interfaces/Vip.php:59— Vip.performValidation has cognitive complexity 71 (threshold 15). Drivers by points: if/else 18 (49 pts), boolean chains 14, loops 4 (8 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LDAP._authenticate (cognitive 69) src/opnsense/mvc/app/library/OPNsense/Auth/LDAP.php:487— LDAP._authenticate has cognitive complexity 69 (threshold 15). Drivers by points: if/else 17 (48 pts), loops 3 (13 pts), boolean chains 5, ternaries 1 (3 pts) (nesting depth added 43). 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.
SystemController.statusAction (cognitive 67) src/opnsense/mvc/app/controllers/OPNsense/Core/Api/SystemController.php:62— SystemController.statusAction has cognitive complexity 67 (threshold 15). Drivers by points: if/else 21 (60 pts), loops 2 (4 pts), ternaries 1 (3 pts) (nesting depth added 43). 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.
user_pass_verify.do_auth (cognitive 67) src/opnsense/scripts/openvpn/user_pass_verify.php:63— user_pass_verify.do_auth has cognitive complexity 67 (threshold 15). Drivers by points: if/else 19 (49 pts), ternaries 3 (10 pts), boolean chains 7, loops 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.
M1_0_0.run (cognitive 66) src/opnsense/mvc/app/models/OPNsense/OpenVPN/Migrations/M1_0_0.php:50— M1_0_0.run has cognitive complexity 66 (threshold 15). Drivers by points: if/else 8 (31 pts), loops 5 (21 pts), ternaries 3 (12 pts), boolean chains 2 (nesting depth added 48). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ACL.loadUserGroupRights (cognitive 65) src/opnsense/mvc/app/models/OPNsense/Core/ACL.php:90— ACL.loadUserGroupRights has cognitive complexity 65 (threshold 15). Drivers by points: if/else 9 (37 pts), loops 8 (27 pts), boolean chains 1 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Swanctl.performValidation (cognitive 63) src/opnsense/mvc/app/models/OPNsense/IPsec/Swanctl.php:66— Swanctl.performValidation has cognitive complexity 63 (threshold 15). Drivers by points: if/else 17 (35 pts), boolean chains 16, loops 7 (8 pts), ternaries 1 (4 pts) (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.
CertificatesField.actionPostLoadingEvent (cognitive 63) src/opnsense/mvc/app/models/OPNsense/Trust/FieldTypes/CertificatesField.php:138— CertificatesField.actionPostLoadingEvent has cognitive complexity 63 (threshold 15). Drivers by points: if/else 12 (37 pts), loops 5 (12 pts), ternaries 5 (10 pts), boolean chains 4 (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.
interfaces.validate_track6_idassoc6 (cognitive 63) REDACTED:39— interfaces.validate_track6_idassoc6 has cognitive complexity 63 (threshold 15). Drivers by points: if/else 12 (33 pts), ternaries 5 (19 pts), boolean chains 8, loops 1 (3 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.
Radius.authenticate (cognitive 62) src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:512— Radius.authenticate has cognitive complexity 62 (threshold 15). Drivers by points: if/else 13 (36 pts), match/switch 3 (10 pts), boolean chains 6, ternaries 2 (6 pts), loops 1 (4 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.
ForwardRule.parseRdrRules (cognitive 62) REDACTED:100— ForwardRule.parseRdrRules has cognitive complexity 62 (threshold 15). Drivers by points: if/else 15 (40 pts), boolean chains 16, loops 3 (6 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.
KeaDhcpv4.getConfigSubnets (cognitive 61) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:182— KeaDhcpv4.getConfigSubnets has cognitive complexity 61 (threshold 15). Drivers by points: if/else 17 (48 pts), loops 6 (13 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.
Metadata.list_rules (cognitive 61) src/opnsense/scripts/suricata/lib/metadata.py:74— Metadata.list_rules has cognitive complexity 61 (threshold 15). Drivers by points: if/else 17 (45 pts), loops 4 (11 pts), boolean chains 5 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExportController.downloadAction (cognitive 59) src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/Api/ExportController.php:295— ExportController.downloadAction has cognitive complexity 59 (threshold 15). Drivers by points: if/else 15 (54 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 41). 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.
ping.read_latest_stats (cognitive 59) src/opnsense/scripts/interfaces/ping.py:63— ping.read_latest_stats has cognitive complexity 59 (threshold 15). Drivers by points: if/else 13 (51 pts), loops 2 (6 pts), boolean chains 2 (nesting depth added 42). 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.
_registerEvents (cognitive 59) src/opnsense/www/js/opnsense_bootgrid.js:720— _registerEvents has cognitive complexity 59 (threshold 15). Drivers by points: if/else 28 (45 pts), boolean chains 5, loops 3 (5 pts), ternaries 2 (3 pts), other 1 (nesting depth added 20). Most of this is not in the body itself: 1 of the 59 points is its own statement and the rest belongs to 33 function items inside it that branch (title, (anonymous)::findTreeRowByIndex::walk, a function literal at line 918, …). 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.
AccessController.logonAction (cognitive 58) src/opnsense/mvc/app/controllers/OPNsense/CaptivePortal/Api/AccessController.php:235— AccessController.logonAction has cognitive complexity 58 (threshold 15). Drivers by points: if/else 14 (49 pts), boolean chains 5, loops 1 (4 pts) (nesting depth added 38). 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.
InterfaceController.getVipStatusAction (cognitive 58) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/InterfaceController.php:251— InterfaceController.getVipStatusAction has cognitive complexity 58 (threshold 15). Drivers by points: if/else 11 (29 pts), loops 7 (18 pts), ternaries 1 (7 pts), boolean chains 2, match/switch 1 (2 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.
Menu.collect (cognitive 58) src/opnsense/mvc/app/models/OPNsense/Interfaces/Menu/Menu.php:36— Menu.collect has cognitive complexity 58 (threshold 15). Drivers by points: if/else 10 (30 pts), loops 8 (15 pts), ternaries 4 (12 pts), boolean chains 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClientController.getServerInfoAction (cognitive 57) src/opnsense/mvc/app/controllers/OPNsense/Wireguard/Api/ClientController.php:172— ClientController.getServerInfoAction has cognitive complexity 57 (threshold 15). Drivers by points: loops 6 (25 pts), if/else 5 (20 pts), ternaries 2 (12 pts) (nesting depth added 44). 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.
M1_0_1.run (cognitive 56) src/opnsense/mvc/app/models/OPNsense/Unbound/Migrations/M1_0_1.php:43— M1_0_1.run has cognitive complexity 56 (threshold 15). Drivers by points: ternaries 10 (34 pts), if/else 6 (14 pts), loops 3 (7 pts), boolean chains 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.
ApiMutableModelControllerBase.importCsv (cognitive 55) src/opnsense/mvc/app/controllers/OPNsense/Base/ApiMutableModelControllerBase.php:694— ApiMutableModelControllerBase.importCsv has cognitive complexity 55 (threshold 15). Drivers by points: if/else 9 (29 pts), loops 6 (16 pts), ternaries 4 (6 pts), boolean chains 4 (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.
Gateways.gatewayIterator (cognitive 55) src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php:192— Gateways.gatewayIterator has cognitive complexity 55 (threshold 15). Drivers by points: if/else 10 (37 pts), loops 5 (16 pts), boolean chains 2 (nesting depth added 38). 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.
setaddr.add_gateway_to_config (cognitive 55) src/opnsense/scripts/shell/setaddr.php:199— setaddr.add_gateway_to_config has cognitive complexity 55 (threshold 15). Drivers by points: if/else 14 (36 pts), ternaries 5 (9 pts), loops 3 (7 pts), boolean chains 3 (nesting depth added 30). 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.
setaddr.console_configure_dhcpd (cognitive 55) src/opnsense/scripts/shell/setaddr.php:469— setaddr.console_configure_dhcpd has cognitive complexity 55 (threshold 15). Drivers by points: if/else 8 (25 pts), ternaries 6 (17 pts), loops 4 (9 pts), boolean chains 4 (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.
BaseFlowAggregator.get_top_data (cognitive 55) src/opnsense/scripts/netflow/lib/aggregates/__init__.py:283— BaseFlowAggregator.get_top_data has cognitive complexity 55 (threshold 15). Drivers by points: if/else 11 (34 pts), loops 5 (19 pts), boolean chains 2 (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.
Template.__find_filters (cognitive 55) REDACTED:150— Template.__find_filters has cognitive complexity 55 (threshold 15). Drivers by points: if/else 12 (45 pts), loops 4 (10 pts) (nesting depth added 39). 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.
FilterController.searchRuleAction (cognitive 54) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterController.php:84— FilterController.searchRuleAction has cognitive complexity 54 (threshold 15). Drivers by points: if/else 19 (29 pts), loops 7 (14 pts), boolean chains 8, ternaries 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.
SNatRule.parseNatRules (cognitive 54) src/opnsense/mvc/app/library/OPNsense/Firewall/SNatRule.php:64— SNatRule.parseNatRules has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (45 pts), boolean chains 6, loops 2 (3 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.
AsyncDNSResolver.request_ittr (cognitive 54) src/opnsense/scripts/filter/lib/__init__.py:96— AsyncDNSResolver.request_ittr has cognitive complexity 54 (threshold 15). Drivers by points: if/else 8 (31 pts), loops 6 (22 pts), boolean chains 1 (nesting depth added 39). 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.
AsyncDNSResolver.request_ittr (cognitive 53) src/opnsense/scripts/filter/lib/alias/base.py:112— AsyncDNSResolver.request_ittr has cognitive complexity 53 (threshold 15). Drivers by points: if/else 7 (30 pts), loops 6 (22 pts), boolean chains 1 (nesting depth added 39). 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.
AssignmentController.reconfigureAction (cognitive 52) src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/AssignmentController.php:140— AssignmentController.reconfigureAction has cognitive complexity 52 (threshold 15). Drivers by points: if/else 8 (31 pts), loops 4 (21 pts) (nesting depth added 40). 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.
OpenVPN.getOverwrite (cognitive 52) src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php:234— OpenVPN.getOverwrite has cognitive complexity 52 (threshold 15). Drivers by points: if/else 13 (29 pts), loops 7 (15 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
M1_0_0.run (cognitive 52) src/opnsense/mvc/app/models/OPNsense/Routing/Migrations/M1_0_0.php:42— M1_0_0.run has cognitive complexity 52 (threshold 15). Drivers by points: if/else 8 (24 pts), ternaries 6 (18 pts), loops 3 (9 pts), boolean chains 1 (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.
UriParser.iter_addresses (cognitive 52) src/opnsense/scripts/filter/lib/alias/uri.py:59— UriParser.iter_addresses has cognitive complexity 52 (threshold 15). Drivers by points: loops 6 (23 pts), if/else 10 (21 pts), error handling 2 (5 pts), boolean chains 3 (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.
FirewallController.statsAction (cognitive 51) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/FirewallController.php:105— FirewallController.statsAction has cognitive complexity 51 (threshold 15). Drivers by points: if/else 8 (22 pts), ternaries 4 (15 pts), loops 3 (11 pts), match/switch 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.
ArrayField.importRecordSet (cognitive 51) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/ArrayField.php:315— ArrayField.importRecordSet has cognitive complexity 51 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 6 (13 pts), ternaries 3 (8 pts), error handling 1 (3 pts), boolean chains 2 (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.
InterfaceField.actionPostLoadingEvent (cognitive 51) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/InterfaceField.php:106— InterfaceField.actionPostLoadingEvent has cognitive complexity 51 (threshold 15). Drivers by points: if/else 13 (34 pts), loops 5 (10 pts), boolean chains 4, ternaries 1 (3 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.
JsonKeyValueStoreField.actionPostLoadingEvent (cognitive 51) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/JsonKeyValueStoreField.php:123— JsonKeyValueStoreField.actionPostLoadingEvent has cognitive complexity 51 (threshold 15). Drivers by points: if/else 18 (36 pts), loops 2 (6 pts), ternaries 2 (5 pts), boolean chains 4 (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.
wg-service-control.wg_start (cognitive 50) REDACTED:65— wg-service-control.wg_start has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 7 (19 pts), if/else 8 (17 pts), loops 6 (13 pts), boolean chains 1 (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.
Template._generate (cognitive 50) REDACTED:219— Template._generate has cognitive complexity 50 (threshold 15). Drivers by points: if/else 6 (28 pts), loops 5 (12 pts), error handling 2 (7 pts), boolean chains 3 (nesting depth added 34). 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.
NetworkinsightController.timeserieAction (cognitive 49) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/NetworkinsightController.php:53— NetworkinsightController.timeserieAction has cognitive complexity 49 (threshold 15). Drivers by points: if/else 7 (27 pts), loops 5 (17 pts), ternaries 1 (5 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.
TunnelController.searchPhase1Action (cognitive 49) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/TunnelController.php:43— TunnelController.searchPhase1Action has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 7 (22 pts), if/else 7 (18 pts), loops 3 (9 pts) (nesting depth added 32). 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.
MFP1_0_3.run (cognitive 49) src/opnsense/mvc/app/models/OPNsense/Firewall/Migrations/MFP1_0_3.php:41— MFP1_0_3.run has cognitive complexity 49 (threshold 15). Drivers by points: if/else 7 (26 pts), ternaries 2 (10 pts), loops 2 (8 pts), boolean chains 5 (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.
sqlite3_helper.check_and_repair (cognitive 49) src/opnsense/site-python/sqlite3_helper.py:35— sqlite3_helper.check_and_repair has cognitive complexity 49 (threshold 15). Drivers by points: if/else 6 (26 pts), loops 4 (17 pts), error handling 2 (5 pts), boolean chains 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.
Plugin (cognitive 49) src/opnsense/www/js/bootstrap-select.js:3106— Plugin has cognitive complexity 49 (threshold 15). Drivers by points: if/else 17 (32 pts), loops 3 (8 pts), boolean chains 4, ternaries 1 (3 pts), error handling 1 (2 pts) (nesting depth added 23). Of this number, 19 points are the body's own statements and 30 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.
UIModelGrid.fetch (cognitive 48) src/opnsense/mvc/app/library/OPNsense/Base/UIModelGrid.php:111— UIModelGrid.fetch has cognitive complexity 48 (threshold 15). Drivers by points: if/else 9 (31 pts), loops 4 (13 pts), boolean chains 4 (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.
Store.parseX509 (cognitive 48) src/opnsense/mvc/app/library/OPNsense/Trust/Store.php:450— Store.parseX509 has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 5 (13 pts), boolean chains 8 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IPPortField.getValidators (cognitive 48) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/IPPortField.php:103— IPPortField.getValidators has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (34 pts), boolean chains 12, loops 1 (2 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenVPN.getInstanceById (cognitive 48) src/opnsense/mvc/app/models/OPNsense/OpenVPN/OpenVPN.php:405— OpenVPN.getInstanceById has cognitive complexity 48 (threshold 15). Drivers by points: if/else 8 (25 pts), boolean chains 9, loops 4 (8 pts), ternaries 2 (6 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
M1_0_0.run (cognitive 48) src/opnsense/mvc/app/models/OPNsense/Radvd/Migrations/M1_0_0.php:41— M1_0_0.run has cognitive complexity 48 (threshold 15). Drivers by points: if/else 21 (44 pts), loops 2 (3 pts), boolean chains 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.
RuleCache.list_rules (cognitive 48) src/opnsense/scripts/suricata/lib/rulecache.py:159— RuleCache.list_rules has cognitive complexity 48 (threshold 15). Drivers by points: if/else 7 (28 pts), loops 3 (10 pts), ternaries 1 (9 pts), boolean chains 1 (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.
DNSBL.policy_match (cognitive 48) src/opnsense/scripts/unbound-dnsbl/lib/dnsbl.py:123— DNSBL.policy_match has cognitive complexity 48 (threshold 15). Drivers by points: if/else 12 (37 pts), boolean chains 7, loops 2 (4 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.
DNatRule.parseNatRules (cognitive 47) src/opnsense/mvc/app/library/OPNsense/Firewall/DNatRule.php:96— DNatRule.parseNatRules has cognitive complexity 47 (threshold 15). Drivers by points: if/else 7 (22 pts), boolean chains 10, ternaries 2 (8 pts), loops 3 (7 pts) (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.
diag_backup.restore_config_section (cognitive 47) REDACTED:48— diag_backup.restore_config_section has cognitive complexity 47 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 7 (16 pts), boolean chains 1, error handling 1 (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.
RuleCache.parse_policies (cognitive 47) src/opnsense/scripts/suricata/lib/rulecache.py:130— RuleCache.parse_policies has cognitive complexity 47 (threshold 15). Drivers by points: if/else 7 (31 pts), loops 4 (15 pts), boolean chains 1 (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.
liHeight (cognitive 46) src/opnsense/www/js/bootstrap-select.js:1878— liHeight has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 25, if/else 10 (12 pts), boolean chains 7, loops 1 (2 pts) (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.
ApiControllerBase.searchRecordsetBase (cognitive 45) src/opnsense/mvc/app/controllers/OPNsense/Base/ApiControllerBase.php:85— ApiControllerBase.searchRecordsetBase has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 5 (12 pts), boolean chains 5, ternaries 3 (4 pts) (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.
CertController.setBaseHook (cognitive 45) src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CertController.php:52— CertController.setBaseHook has cognitive complexity 45 (threshold 15). Drivers by points: if/else 25 (43 pts), boolean chains 1, match/switch 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.
Config.toArray (cognitive 45) src/opnsense/mvc/app/library/OPNsense/Core/Config.php:97— Config.toArray has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (37 pts), loops 3 (6 pts), boolean chains 2 (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.
UniqueConstraint.validate (cognitive 45) src/opnsense/mvc/app/models/OPNsense/Base/Constraints/UniqueConstraint.php:49— UniqueConstraint.validate has cognitive complexity 45 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 4 (14 pts), ternaries 3 (10 pts), boolean chains 4 (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.
M1_0_4.run (cognitive 45) src/opnsense/mvc/app/models/OPNsense/IPsec/Migrations/M1_0_4.php:37— M1_0_4.run has cognitive complexity 45 (threshold 15). Drivers by points: if/else 21 (32 pts), loops 5 (9 pts), boolean chains 4 (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.
Firmware.getRepositoryOptions (cognitive 44) src/opnsense/mvc/app/models/OPNsense/Core/Firmware.php:44— Firmware.getRepositoryOptions has cognitive complexity 44 (threshold 15). Drivers by points: if/else 8 (27 pts), loops 4 (13 pts), boolean chains 4 (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.
GEOIP.process_zip (cognitive 44) src/opnsense/scripts/filter/lib/alias/geoip.py:50— GEOIP.process_zip has cognitive complexity 44 (threshold 15). Drivers by points: if/else 8 (27 pts), loops 5 (13 pts), boolean chains 3, error handling 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.
Base.setGroupMembership (cognitive 43) src/opnsense/mvc/app/library/OPNsense/Auth/Base.php:148— Base.setGroupMembership has cognitive complexity 43 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 6 (15 pts), boolean chains 6, ternaries 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.
WLAN1_0_0.post (cognitive 43) src/opnsense/mvc/app/models/OPNsense/Interfaces/Migrations/WLAN1_0_0.php:55— WLAN1_0_0.post has cognitive complexity 43 (threshold 15). Drivers by points: if/else 8 (23 pts), ternaries 2 (10 pts), loops 4 (8 pts), boolean chains 2 (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.
crl_fetch.main (cognitive 43) src/opnsense/scripts/system/crl_fetch.py:85— crl_fetch.main has cognitive complexity 43 (threshold 15). Drivers by points: if/else 6 (28 pts), loops 5 (12 pts), error handling 1 (3 pts) (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.
ApiControllerBase.beforeExecuteRoute (cognitive 42) src/opnsense/mvc/app/controllers/OPNsense/Base/ApiControllerBase.php:289— ApiControllerBase.beforeExecuteRoute has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (39 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.
ControllerBase.getFormGrid (cognitive 42) src/opnsense/mvc/app/controllers/OPNsense/Base/ControllerBase.php:281— ControllerBase.getFormGrid has cognitive complexity 42 (threshold 15). Drivers by points: if/else 7 (22 pts), loops 3 (8 pts), ternaries 1 (6 pts), match/switch 1 (4 pts), boolean chains 2 (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.
NetworkinsightController.topAction (cognitive 42) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/NetworkinsightController.php:149— NetworkinsightController.topAction has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (33 pts), loops 2 (6 pts), boolean chains 3 (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.
AliasController.importAction (cognitive 42) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/AliasController.php:404— AliasController.importAction has cognitive complexity 42 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 3 (11 pts), boolean chains 5, ternaries 1 (4 pts) (nesting depth added 24). 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.
NetworkField.isValidInput (cognitive 42) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/NetworkField.php:142— NetworkField.isValidInput has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (35 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (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.
CPBackgroundProcess.initialize_fixed (cognitive 42) src/opnsense/scripts/captiveportal/cp-background-process.py:100— CPBackgroundProcess.initialize_fixed has cognitive complexity 42 (threshold 15). Drivers by points: if/else 8 (27 pts), loops 5 (12 pts), boolean chains 3 (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.
VlanInterfaceField.actionPostLoadingEvent (cognitive 41) src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/VlanInterfaceField.php:41— VlanInterfaceField.actionPostLoadingEvent has cognitive complexity 41 (threshold 15). Drivers by points: if/else 6 (16 pts), ternaries 3 (12 pts), loops 3 (8 pts), boolean chains 5 (nesting depth added 24). 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.
KeaDdns.generateConfig (cognitive 41) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDdns.php:41— KeaDdns.generateConfig has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (33 pts), loops 2 (3 pts), ternaries 1 (3 pts), boolean chains 2 (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.
M1_0_13.run (cognitive 41) src/opnsense/mvc/app/models/OPNsense/Unbound/Migrations/M1_0_13.php:70— M1_0_13.run has cognitive complexity 41 (threshold 15). Drivers by points: loops 8 (21 pts), if/else 7 (18 pts), boolean chains 2 (nesting depth added 24). 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.
LeasesController.searchAction (cognitive 40) src/opnsense/mvc/app/controllers/OPNsense/Dnsmasq/Api/LeasesController.php:39— LeasesController.searchAction has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 6 (10 pts), ternaries 4 (8 pts), boolean chains 6 (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.
Rule.reader (cognitive 40) src/opnsense/mvc/app/library/OPNsense/Firewall/Rule.php:262— Rule.reader has cognitive complexity 40 (threshold 15). Drivers by points: loops 7 (18 pts), if/else 6 (15 pts), ternaries 4, boolean chains 3 (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.
update-crl-fetch.main (cognitive 40) src/opnsense/scripts/system/update-crl-fetch.py:67— update-crl-fetch.main has cognitive complexity 40 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 5 (9 pts), ternaries 2 (7 pts), error handling 2 (4 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.
ServiceController.searchSessionsAction (cognitive 39) src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/Api/ServiceController.php:72— ServiceController.searchSessionsAction has cognitive complexity 39 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 7 (15 pts), boolean chains 2 (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.
BaseModel.parseXml (cognitive 39) src/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php:255— BaseModel.parseXml has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (29 pts), loops 3 (6 pts), ternaries 2 (4 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseModel.runMigrations (cognitive 39) src/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php:882— BaseModel.runMigrations has cognitive complexity 39 (threshold 15). Drivers by points: if/else 7 (17 pts), error handling 2 (8 pts), loops 3 (7 pts), ternaries 1 (4 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.
M1_0_0.run (cognitive 39) src/opnsense/mvc/app/models/OPNsense/Firewall/Migrations/M1_0_0.php:45— M1_0_0.run has cognitive complexity 39 (threshold 15). Drivers by points: if/else 7 (24 pts), loops 4 (14 pts), boolean chains 1 (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.
Syslog.performValidation (cognitive 39) src/opnsense/mvc/app/models/OPNsense/Syslog/Syslog.php:44— Syslog.performValidation has cognitive complexity 39 (threshold 15). Drivers by points: if/else 7 (29 pts), ternaries 1 (6 pts), boolean chains 3, loops 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.
Alias.resolve (cognitive 39) src/opnsense/scripts/filter/lib/alias/__init__.py:199— Alias.resolve has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 2 (9 pts), ternaries 1 (4 pts), error handling 1 (3 pts), boolean chains 1 (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.
(anonymous) (cognitive 39) src/opnsense/www/js/opnsense_theme.js:30— (anonymous) has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 10, ternaries 1 (3 pts), other 1 (nesting depth added 9). Most of this is not in the body itself: 11 of the 39 points are its own statements and the rest belongs to 26 function items inside it that branch (a function literal at line 181, opnsense_sidebar_toggle, mouseenter, …). 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.
IPsec.traverseItems (cognitive 38) src/opnsense/mvc/app/models/OPNsense/IPsec/IPsec.php:188— IPsec.traverseItems has cognitive complexity 38 (threshold 15). Drivers by points: if/else 6 (23 pts), loops 3 (9 pts), ternaries 2 (5 pts), boolean chains 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.
CAsField.actionPostLoadingEvent (cognitive 38) src/opnsense/mvc/app/models/OPNsense/Trust/FieldTypes/CAsField.php:85— CAsField.actionPostLoadingEvent has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (30 pts), loops 2 (4 pts), ternaries 2 (4 pts) (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.
Daemonize.start (cognitive 38) src/opnsense/scripts/captiveportal/lib/daemonize.py:61— Daemonize.start has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (21 pts), error handling 8 (15 pts), loops 1 (2 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.
states.query_top (cognitive 38) src/opnsense/scripts/filter/lib/states.py:225— states.query_top has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (17 pts), ternaries 3 (11 pts), boolean chains 5, loops 3 (5 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.
ovpn_status.main (cognitive 38) src/opnsense/scripts/openvpn/ovpn_status.py:112— ovpn_status.main has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (28 pts), ternaries 2 (5 pts), boolean chains 4, 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.
clean (cognitive 38) src/opnsense/www/js/chartjs-plugin-streaming.js:473— clean has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 6, loops 2 (5 pts), ternaries 1 (nesting depth added 16). Most of this is not in the body itself: 2 of the 38 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 481, 526, 510, …). 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.
SettingsController.searchInstalledRulesAction (cognitive 37) src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/SettingsController.php:64— SettingsController.searchInstalledRulesAction has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 3 (8 pts), boolean chains 4, ternaries 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.
SettingsController.setRulesetpropertiesAction (cognitive 37) src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/SettingsController.php:282— SettingsController.setRulesetpropertiesAction has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (27 pts), loops 2 (8 pts), boolean chains 2 (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.
LaggSettingsController.delItemAction (cognitive 37) src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/LaggSettingsController.php:126— LaggSettingsController.delItemAction has cognitive complexity 37 (threshold 15). Drivers by points: if/else 5 (12 pts), ternaries 4 (12 pts), loops 5 (11 pts), boolean chains 2 (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.
ModelRelationField.loadModelOptions (cognitive 37) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/ModelRelationField.php:101— ModelRelationField.loadModelOptions has cognitive complexity 37 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 4 (14 pts), boolean chains 4, ternaries 1 (3 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.
GatewayGroups.performValidation (cognitive 37) src/opnsense/mvc/app/models/OPNsense/Routing/GatewayGroups.php:44— GatewayGroups.performValidation has cognitive complexity 37 (threshold 15). Drivers by points: if/else 6 (23 pts), loops 4 (12 pts), boolean chains 2 (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.
InterfaceController.getSocketStatisticsAction (cognitive 36) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/InterfaceController.php:386— InterfaceController.getSocketStatisticsAction has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (20 pts), ternaries 2 (8 pts), loops 2 (5 pts), boolean chains 3 (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.
ConnectionsController.setConnectionAction (cognitive 36) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/ConnectionsController.php:87— ConnectionsController.setConnectionAction has cognitive complexity 36 (threshold 15). Drivers by points: loops 4 (17 pts), if/else 6 (16 pts), boolean chains 3 (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.
Config.fromArray (cognitive 36) src/opnsense/mvc/app/library/OPNsense/Core/Config.php:191— Config.fromArray has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 3 (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.
BaseModel.getFieldObject (cognitive 36) src/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php:161— BaseModel.getFieldObject has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (29 pts), loops 3 (7 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.
Unbound.performValidation (cognitive 36) src/opnsense/mvc/app/models/OPNsense/Unbound/Unbound.php:40— Unbound.performValidation has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (23 pts), boolean chains 6, loops 3 (4 pts), ternaries 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.
(anonymous) (cognitive 36) src/opnsense/www/js/opnsense_favorites.js:27— (anonymous) has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 9, ternaries 7 (8 pts) (nesting depth added 5). Most of this is not in the body itself: 8 of the 36 points are its own statements and the rest belongs to 13 function items inside it that branch ((anonymous)::success, a function literal at line 69, a function literal at line 51, …). 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.
getFormData (cognitive 36) src/opnsense/www/js/opnsense.js:67— getFormData has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (31 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 16). None of this is in the body itself: all 36 points belong to 3 function literals inside it that branch (lines 77, 69, 99). 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.
SessionsController.searchPhase1Action (cognitive 35) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SessionsController.php:51— SessionsController.searchPhase1Action has cognitive complexity 35 (threshold 15). Drivers by points: loops 6 (19 pts), if/else 7 (16 pts) (nesting depth added 22). 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.
Plugin.setGatewayGroups (cognitive 35) src/opnsense/mvc/app/library/OPNsense/Firewall/Plugin.php:133— Plugin.setGatewayGroups has cognitive complexity 35 (threshold 15). Drivers by points: if/else 6 (21 pts), boolean chains 5, loops 2 (5 pts), ternaries 1 (4 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.
Rule.mapAddressInfo (cognitive 35) src/opnsense/mvc/app/library/OPNsense/Firewall/Rule.php:73— Rule.mapAddressInfo has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 8, ternaries 2 (6 pts), 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.
PlainOpenVPN.openvpnConfParts (cognitive 35) src/opnsense/mvc/app/library/OPNsense/OpenVPN/PlainOpenVPN.php:92— PlainOpenVPN.openvpnConfParts has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 5, loops 3 (5 pts), match/switch 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.
JsonAuditField.setValue (cognitive 35) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/JsonAuditField.php:49— JsonAuditField.setValue has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 3 (11 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.
TunableField.actionPostLoadingEvent (cognitive 35) src/opnsense/mvc/app/models/OPNsense/Core/FieldTypes/TunableField.php:71— TunableField.actionPostLoadingEvent has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 3 (7 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.
FilterRuleContainerField.serialize (cognitive 35) src/opnsense/mvc/app/models/OPNsense/Firewall/FieldTypes/FilterRuleField.php:54— FilterRuleContainerField.serialize has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (29 pts), ternaries 1 (3 pts), loops 2, 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.
M1_0_6.run (cognitive 35) src/opnsense/mvc/app/models/OPNsense/Unbound/Migrations/M1_0_6.php:36— M1_0_6.run has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 2 (6 pts), ternaries 2 (6 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.
Downloader.fetch (cognitive 35) src/opnsense/scripts/suricata/lib/downloader.py:90— Downloader.fetch has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (27 pts), loops 1 (4 pts), error handling 1 (3 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.
SimpleFileUploadDlg (cognitive 35) REDACTED:1045— SimpleFileUploadDlg has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 5 (12 pts), boolean chains 2 (nesting depth added 17). None of this is in the body itself: all 35 points belong to 8 function items inside it that branch (a function literal at line 1111, a function literal at line 1073, construct::(anonymous)::(anonymous)::onload, …). 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.
_parseColumns (cognitive 35) src/opnsense/www/js/opnsense_bootgrid.js:536— _parseColumns has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (22 pts), other 6, boolean chains 3, ternaries 1 (3 pts), loops 1 (nesting depth added 12). Of this number, 31 points are the body's own statements and 4 belong to 3 function literals 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.
SessionsController.searchPhase2Action (cognitive 34) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SessionsController.php:112— SessionsController.searchPhase2Action has cognitive complexity 34 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 5 (14 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.
TunnelController.togglePhase1Action (cognitive 34) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/TunnelController.php:299— TunnelController.togglePhase1Action has cognitive complexity 34 (threshold 15). Drivers by points: if/else 6 (18 pts), ternaries 2 (12 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 24). 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.
DNat.performValidation (cognitive 34) src/opnsense/mvc/app/models/OPNsense/Firewall/DNat.php:41— DNat.performValidation has cognitive complexity 34 (threshold 15). Drivers by points: if/else 5 (16 pts), boolean chains 7, loops 3 (7 pts), ternaries 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.
AuthGroup._update (cognitive 34) src/opnsense/scripts/filter/lib/alias/auth.py:37— AuthGroup._update has cognitive complexity 34 (threshold 15). Drivers by points: if/else 5 (21 pts), loops 5 (10 pts), error handling 2, 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.
DefaultBlocklistHandler.blocklists_iter (cognitive 34) src/opnsense/scripts/unbound/blocklists/default_bl.py:151— DefaultBlocklistHandler.blocklists_iter has cognitive complexity 34 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 7 (14 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.
opnsense_legacy.hook_firewall_categories (cognitive 34) src/www/javascript/opnsense_legacy.js:184— opnsense_legacy.hook_firewall_categories has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 4, loops 2 (4 pts), ternaries 1 (3 pts) (nesting depth added 13). None of this is in the body itself: all 34 points belong to 5 function literals inside it that branch (lines 186, 197, 248, …). 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.
FilterBaseController.moveRuleBeforeBase (cognitive 33) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterBaseController.php:338— FilterBaseController.moveRuleBeforeBase has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (23 pts), ternaries 2 (4 pts), boolean chains 3, loops 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.
LDAP.searchUsers (cognitive 33) src/opnsense/mvc/app/library/OPNsense/Auth/LDAP.php:400— LDAP.searchUsers has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 2 (7 pts), boolean chains 1 (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.
DHCRelay.performValidation (cognitive 33) src/opnsense/mvc/app/models/OPNsense/DHCRelay/DHCRelay.php:39— DHCRelay.performValidation has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 4 (5 pts), boolean chains 4 (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.
GatewayGroups.getActiveGroups (cognitive 33) src/opnsense/mvc/app/models/OPNsense/Routing/GatewayGroups.php:223— GatewayGroups.getActiveGroups has cognitive complexity 33 (threshold 15). Drivers by points: if/else 5 (17 pts), ternaries 2 (10 pts), loops 3 (6 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.
base.net_wildcard_iterator (cognitive 33) src/opnsense/scripts/filter/lib/alias/base.py:161— base.net_wildcard_iterator has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 3 (10 pts), error handling 1 (2 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.
UIBootgrid._internalFormatters (cognitive 33) src/opnsense/www/js/opnsense_bootgrid.js:1923— UIBootgrid._internalFormatters has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (17 pts), ternaries 6 (8 pts), boolean chains 7, loops 1 (nesting depth added 3). None of this is in the body itself: all 33 points belong to 10 function literals inside it that branch (lines 1947, 2050, 2020, …). 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.
_parseGridView (cognitive 33) src/opnsense/www/js/opnsense_bootgrid.js:476— _parseGridView has cognitive complexity 33 (threshold 15). Drivers by points: other 8, if/else 4 (7 pts), ternaries 2 (7 pts), boolean chains 6, loops 2 (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.
M1_0_1.run (cognitive 32) src/opnsense/mvc/app/models/OPNsense/IPsec/Migrations/M1_0_1.php:40— M1_0_1.run has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 4 (9 pts), ternaries 1 (4 pts), boolean chains 2 (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.
NetworkInterface.serializeToConfig (cognitive 32) src/opnsense/mvc/app/models/OPNsense/Interfaces/NetworkInterface.php:120— NetworkInterface.serializeToConfig has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 5 (7 pts), ternaries 2 (7 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.
FlowParser.__iter__ (cognitive 32) src/opnsense/scripts/netflow/lib/flowparser.py:130— FlowParser.__iter__ has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (26 pts), boolean chains 3, 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.
hook_stacked_form_tables (cognitive 32) src/www/javascript/opnsense_legacy.js:85— hook_stacked_form_tables has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (30 pts), boolean chains 2 (nesting depth added 18). None of this is in the body itself: all 32 points belong to 4 function items inside it that branch (a function literal at line 92, a function literal at line 87, 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.
fetch_options (cognitive 32) REDACTED:958— fetch_options has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 2 (6 pts), ternaries 1 (5 pts), boolean chains 2, other 1 (nesting depth added 15). Most of this is not in the body itself: 1 of the 32 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 963, 972). 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.
AccessController.apiAction (cognitive 31) src/opnsense/mvc/app/controllers/OPNsense/CaptivePortal/Api/AccessController.php:159— AccessController.apiAction has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (28 pts), boolean chains 3 (nesting depth added 20). 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.
SettingsController.toggleRuleAction (cognitive 31) src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/SettingsController.php:437— SettingsController.toggleRuleAction has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 2 (5 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.
SettingsController.delGatewayAction (cognitive 31) src/opnsense/mvc/app/controllers/OPNsense/Routing/Api/SettingsController.php:197— SettingsController.delGatewayAction has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (25 pts), loops 2 (6 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.
ServiceController.statsAction (cognitive 31) src/opnsense/mvc/app/controllers/OPNsense/Syslog/Api/ServiceController.php:69— ServiceController.statsAction has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 6 (11 pts), boolean chains 3, ternaries 1 (2 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.
Util.getPortAlias (cognitive 31) src/opnsense/mvc/app/library/OPNsense/Firewall/Util.php:308— Util.getPortAlias has cognitive complexity 31 (threshold 15). Drivers by points: if/else 5 (19 pts), loops 3 (10 pts), boolean chains 2 (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.
User.getUserPrivs (cognitive 31) src/opnsense/mvc/app/models/OPNsense/Auth/User.php:105— User.getUserPrivs has cognitive complexity 31 (threshold 15). Drivers by points: if/else 4 (16 pts), loops 4 (15 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.
MFP1_0_8.run (cognitive 31) src/opnsense/mvc/app/models/OPNsense/Firewall/Migrations/MFP1_0_8.php:85— MFP1_0_8.run has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 7 (21 pts), if/else 3 (7 pts), loops 1 (2 pts), boolean chains 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.
lib.net_wildcard_iterator (cognitive 31) src/opnsense/scripts/filter/lib/__init__.py:36— lib.net_wildcard_iterator has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 3 (10 pts) (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.
hook_ipv4v6 (cognitive 31) src/www/javascript/opnsense_legacy.js:38— hook_ipv4v6 has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 2 (7 pts), loops 2 (6 pts), boolean chains 4 (nesting depth added 16). None of this is in the body itself: all 31 points belong to 2 function literals inside it that branch (lines 43, 40). 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.
showOptionsDialog (cognitive 31) src/opnsense/www/js/opnsense_widgets.js:227— showOptionsDialog has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 5 (9 pts), loops 5 (6 pts), boolean chains 3, other 2, error handling 1 (nesting depth added 9). Most of this is not in the body itself: 9 of the 31 points are its own statements and the rest belongs to 12 function items inside it that branch ((anonymous)::action, updateOptions, (anonymous)::onhide, …). 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.
ApiMutableModelControllerBase.checkAndThrowValueInUse (cognitive 30) src/opnsense/mvc/app/controllers/OPNsense/Base/ApiMutableModelControllerBase.php:109— ApiMutableModelControllerBase.checkAndThrowValueInUse has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 4 (7 pts), boolean chains 4, ternaries 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.
ControllerBase.parseFormNode (cognitive 30) src/opnsense/mvc/app/controllers/OPNsense/Base/ControllerBase.php:166— ControllerBase.parseFormNode has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 3 (8 pts), match/switch 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.
ControllerBase.beforeExecuteRoute (cognitive 30) src/opnsense/mvc/app/controllers/OPNsense/Base/ControllerBase.php:373— ControllerBase.beforeExecuteRoute has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 9, loops 5 (7 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.
GroupSettingsController.delAction (cognitive 30) src/opnsense/mvc/app/controllers/OPNsense/Routing/Api/GroupSettingsController.php:107— GroupSettingsController.delAction has cognitive complexity 30 (threshold 15). Drivers by points: if/else 4 (16 pts), loops 3 (12 pts), ternaries 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.
BaseModel.internalSerializeToConfig (cognitive 30) src/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php:721— BaseModel.internalSerializeToConfig has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 5 (11 pts), ternaries 1 (4 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.
ACL.hasPrivilege (cognitive 30) src/opnsense/mvc/app/models/OPNsense/Core/ACL.php:355— ACL.hasPrivilege has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 4 (12 pts), boolean chains 2 (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.
Gateways.performValidation (cognitive 30) src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php:49— Gateways.performValidation has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 6, loops 3 (4 pts), ternaries 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.
Template.list_module (cognitive 30) REDACTED:83— Template.list_module has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (22 pts), loops 3 (6 pts), boolean chains 2 (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.
SettingsController.setJobAction (cognitive 29) src/opnsense/mvc/app/controllers/OPNsense/Cron/Api/SettingsController.php:61— SettingsController.setJobAction has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (24 pts), loops 1 (4 pts), boolean chains 1 (nesting depth added 20). 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.
HostField.getValidators (cognitive 29) src/opnsense/mvc/app/models/OPNsense/Diagnostics/FieldTypes/HostField.php:45— HostField.getValidators has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 9, ternaries 2 (6 pts), loops 2 (4 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.
Radvd.performValidation (cognitive 29) src/opnsense/mvc/app/models/OPNsense/Radvd/Radvd.php:43— Radvd.performValidation has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (21 pts), match/switch 1 (4 pts), boolean chains 3, 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.
treeview_node_to_table (cognitive 29) src/opnsense/www/js/opnsense-treeview.js:191— treeview_node_to_table has cognitive complexity 29 (threshold 15). Drivers by points: loops 6 (17 pts), if/else 6 (10 pts), boolean chains 1, other 1 (nesting depth added 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.
liveSearchListener (cognitive 29) src/opnsense/www/js/bootstrap-select.js:2658— liveSearchListener has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 14). None of this is in the body itself: all 29 points belong to 3 function literals inside it that branch (lines 2672, 2661, 2668). 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.
Router.resolveNamespace (cognitive 28) src/opnsense/mvc/app/library/OPNsense/Mvc/Router.php:60— Router.resolveNamespace has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 3 (7 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.
IPsecProposalField.actionPostLoadingEvent (cognitive 28) src/opnsense/mvc/app/models/OPNsense/IPsec/FieldTypes/IPsecProposalField.php:175— IPsecProposalField.actionPostLoadingEvent has cognitive complexity 28 (threshold 15). Drivers by points: loops 6 (16 pts), if/else 3 (11 pts), boolean chains 1 (nesting depth added 18). 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.
NetworkInterfaceContainerField.toLegacy (cognitive 28) src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/NetworkInterfaceField.php:41— NetworkInterfaceContainerField.toLegacy has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 4 (6 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.
DB.update_accounting_info (cognitive 28) src/opnsense/scripts/captiveportal/lib/db.py:478— DB.update_accounting_info has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 5 (6 pts), boolean chains 3, 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.
IPFW.add_accounting (cognitive 28) src/opnsense/scripts/captiveportal/lib/ipfw.py:94— IPFW.add_accounting has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 4 (8 pts), 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.
BlocklistParser.modify_blocklist (cognitive 28) src/opnsense/scripts/unbound/blocklists/__init__.py:147— BlocklistParser.modify_blocklist has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (20 pts), ternaries 2 (4 pts), error handling 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.
PlatformTLSAdaptor.get_sslcontext (cognitive 28) src/opnsense/site-python/tls_helper.py:47— PlatformTLSAdaptor.get_sslcontext has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 2 (7 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.
Certificates.processItems (cognitive 28) src/opnsense/www/js/widgets/Certificates.js:76— Certificates.processItems has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 10 (26 pts), boolean chains 1, if/else 1 (nesting depth added 16). None of this is in the body itself: all 28 points belong to one function literal inside it that branches (line 77). 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.
buildData (cognitive 28) src/opnsense/www/js/bootstrap-select.js:1499— buildData has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 8, ternaries 3 (4 pts), loops 2 (nesting depth added 4). Most of this is not in the body itself: 6 of the 28 points are its own statements and the rest belongs to 3 function items inside it that branch (addOption, addOptgroup, addDivider). 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.
FirewallController.queryStatesAction (cognitive 27) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/FirewallController.php:162— FirewallController.queryStatesAction has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (8 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.
FirewallController.queryPfTopAction (cognitive 27) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/FirewallController.php:223— FirewallController.queryPfTopAction has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (7 pts), ternaries 1 (4 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.
AliasUtilController.deleteAction (cognitive 27) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/AliasUtilController.php:119— AliasUtilController.deleteAction has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 2 (7 pts), loops 1 (3 pts), boolean chains 2 (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.
ServiceController.reconfigureAction (cognitive 27) src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/ServiceController.php:55— ServiceController.reconfigureAction has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (26 pts), boolean chains 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.
SadController.searchAction (cognitive 27) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SadController.php:46— SadController.searchAction has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (6 pts), boolean chains 4, 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.
SpdController.searchAction (cognitive 27) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SpdController.php:46— SpdController.searchAction has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (6 pts), boolean chains 4, 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.
OptionField.setOptionValues (cognitive 27) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/OptionField.php:43— OptionField.setOptionValues has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 2 (11 pts), if/else 4 (8 pts), loops 2 (8 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.
InitialSetup.flush_network_wan (cognitive 27) src/opnsense/mvc/app/models/OPNsense/Core/InitialSetup.php:282— InitialSetup.flush_network_wan has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 2 (3 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.
ConnnectionField.actionPostLoadingEvent (cognitive 27) src/opnsense/mvc/app/models/OPNsense/IPsec/FieldTypes/ConnnectionField.php:44— ConnnectionField.actionPostLoadingEvent has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 4 (9 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.
M1_0_0.post (cognitive 27) src/opnsense/mvc/app/models/OPNsense/IPsec/Migrations/M1_0_0.php:40— M1_0_0.post has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (10 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.
getserviceproviders.provider_plans_list (cognitive 27) src/www/getserviceproviders.php:128— getserviceproviders.provider_plans_list has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 2 (10 pts), loops 3 (9 pts), if/else 3 (8 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.
DNSBL._load_dnsbl (cognitive 27) src/opnsense/scripts/unbound-dnsbl/lib/dnsbl.py:71— DNSBL._load_dnsbl has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 3 (4 pts), error handling 1 (3 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.
Action.execute (cognitive 27) src/opnsense/service/modules/actions/inline.py:39— Action.execute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 4 (11 pts), error handling 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.
IXR_IntrospectionServer.call (cognitive 26) contrib/IXR/IXR_Library.php:919— IXR_IntrospectionServer.call has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 12). 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.
ApiMutableModelControllerBase.toggleBase (cognitive 26) src/opnsense/mvc/app/controllers/OPNsense/Base/ApiMutableModelControllerBase.php:641— ApiMutableModelControllerBase.toggleBase has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 2 (7 pts), boolean chains 2, loops 1 (2 pts) (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.
SettingsController.toggleGatewayAction (cognitive 26) src/opnsense/mvc/app/controllers/OPNsense/Routing/Api/SettingsController.php:253— SettingsController.toggleGatewayAction has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (15 pts), ternaries 2 (10 pts), boolean chains 1 (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.
ServiceController.showAction (cognitive 26) src/opnsense/mvc/app/controllers/OPNsense/Wireguard/Api/ServiceController.php:69— ServiceController.showAction has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 4 (5 pts), boolean chains 2, 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.
LDAP.search (cognitive 26) src/opnsense/mvc/app/library/OPNsense/Auth/LDAP.php:170— LDAP.search has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 2 (7 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.
FilterRule.convertReplyTo (cognitive 26) src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php:156— FilterRule.convertReplyTo has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 6, match/switch 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.
BaseField.setNodes (cognitive 26) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/BaseField.php:810— BaseField.setNodes has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 2 (3 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.
ConfigdActionsField.actionPostLoadingEvent (cognitive 26) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/ConfigdActionsField.php:54— ConfigdActionsField.actionPostLoadingEvent has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 2 (3 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.
Vlan.performValidation (cognitive 26) src/opnsense/mvc/app/models/OPNsense/Interfaces/Vlan.php:40— Vlan.performValidation has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (14 pts), ternaries 1 (4 pts), loops 2 (3 pts), match/switch 1 (3 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.
dnsmasq_watcher.run_watcher (cognitive 26) src/opnsense/scripts/dnsmasq/dnsmasq_watcher.py:45— dnsmasq_watcher.run_watcher has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 4 (9 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.
read_log.parse_record (cognitive 26) src/opnsense/scripts/filter/read_log.py:94— read_log.parse_record has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 1 (nesting depth added 13). 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.
updateBoxAnnotation (cognitive 26) src/opnsense/www/js/chartjs-plugin-streaming.js:87— updateBoxAnnotation has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 4 (12 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.
AliasUtilController.addAction (cognitive 25) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/AliasUtilController.php:166— AliasUtilController.addAction has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 2 (7 pts), boolean chains 3 (nesting depth added 12). 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.
ACL.urlMasks (cognitive 25) src/opnsense/mvc/app/models/OPNsense/Core/ACL.php:287— ACL.urlMasks has cognitive complexity 25 (threshold 15). Drivers by points: loops 5 (16 pts), if/else 3 (8 pts), ternaries 1 (nesting depth added 16). 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.
InitialSetup.init (cognitive 25) src/opnsense/mvc/app/models/OPNsense/Core/InitialSetup.php:76— InitialSetup.init has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 3, loops 2 (3 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.
LinkAddressField.actionPostLoadingEvent (cognitive 25) src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/LinkAddressField.php:46— LinkAddressField.actionPostLoadingEvent has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (7 pts), ternaries 1 (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.
Lagg.performValidation (cognitive 25) src/opnsense/mvc/app/models/OPNsense/Interfaces/Lagg.php:43— Lagg.performValidation has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 4 (7 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.
interfaces_ppps_edit.serial_devices (cognitive 25) REDACTED:56— interfaces_ppps_edit.serial_devices has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 4 (8 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.
get_kea_leases.build_reserved_matches (cognitive 25) src/opnsense/scripts/kea/get_kea_leases.py:70— get_kea_leases.build_reserved_matches has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 3 (6 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.
LogMatcher.match_records (cognitive 25) src/opnsense/scripts/syslog/log_matcher.py:87— LogMatcher.match_records has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (15 pts), error handling 1 (4 pts), loops 2 (4 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.
Config._traverse (cognitive 25) REDACTED:66— Config._traverse has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 2 (6 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.
ActionHandler.load_config (cognitive 25) REDACTED:244— ActionHandler.load_config has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 4 (9 pts), error handling 1 (2 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.
bootstrap.Tooltip.show (cognitive 25) src/opnsense/www/js/bootstrap.js:1603— bootstrap.Tooltip.show has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 8, ternaries 3 (6 pts) (nesting depth added 8). Of this number, 23 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.
append (cognitive 25) src/opnsense/www/js/smoothie.js:235— append has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 1 (2 pts), ternaries 2, boolean chains 1 (nesting depth added 12). 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.
updateLineAnnotation (cognitive 25) src/opnsense/www/js/chartjs-plugin-streaming.js:123— updateLineAnnotation has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 3 (8 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.
IXR_Client.query (cognitive 24) contrib/IXR/IXR_Library.php:625— IXR_Client.query has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (18 pts), error handling 2 (4 pts), loops 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.
AssignmentController.delItemAction (cognitive 24) src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/AssignmentController.php:61— AssignmentController.delItemAction has cognitive complexity 24 (threshold 15). Drivers by points: loops 5 (15 pts), if/else 3 (8 pts), boolean chains 1 (nesting depth added 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.
AssignmentController.cleanRules (cognitive 24) src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/AssignmentController.php:100— AssignmentController.cleanRules has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 4 (9 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.
Local.shouldChangePassword (cognitive 24) src/opnsense/mvc/app/library/OPNsense/Auth/Local.php:116— Local.shouldChangePassword has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (20 pts), ternaries 1 (4 pts) (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.
Store.getCertificate (cognitive 24) src/opnsense/mvc/app/library/OPNsense/Trust/Store.php:106— Store.getCertificate has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 2 (7 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.
HostnameField.getValidators (cognitive 24) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/HostnameField.php:129— HostnameField.getValidators has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 2 (7 pts), boolean chains 5, 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.
VirtualIPField.actionPostLoadingEvent (cognitive 24) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/VirtualIPField.php:73— VirtualIPField.actionPostLoadingEvent has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (20 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.
InitialSetup.performValidation (cognitive 24) src/opnsense/mvc/app/models/OPNsense/Core/InitialSetup.php:157— InitialSetup.performValidation has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 6, 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.
Gateways.getInterfaceGateway (cognitive 24) src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php:594— Gateways.getInterfaceGateway has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (7 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.
Downloader._unpack (cognitive 24) src/opnsense/scripts/suricata/lib/downloader.py:49— Downloader._unpack has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (6 pts), boolean chains 5 (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.
Handler.run (cognitive 24) REDACTED:76— Handler.run has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (13 pts), error handling 4 (8 pts), loops 2 (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.
SimpleActionButton (cognitive 24) REDACTED:816— SimpleActionButton has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 5, ternaries 4 (5 pts) (nesting depth added 3). None of this is in the body itself: all 24 points belong to 14 function items inside it that branch (a function literal at line 884, construct, setIcon, …). 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.
ServiceController.searchRoutesAction (cognitive 23) src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/Api/ServiceController.php:140— ServiceController.searchRoutesAction has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (9 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.
InitialSetup.flush_deployment_type (cognitive 23) src/opnsense/mvc/app/models/OPNsense/Core/InitialSetup.php:425— InitialSetup.flush_deployment_type has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3 (6 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.
FilterRuleContainerField.getPriority (cognitive 23) src/opnsense/mvc/app/models/OPNsense/Firewall/FieldTypes/FilterRuleField.php:145— FilterRuleContainerField.getPriority has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 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.
IDS.getRuleAction (cognitive 23) src/opnsense/mvc/app/models/OPNsense/IDS/IDS.php:164— IDS.getRuleAction has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 1 (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.
Cert.linkCaRefs (cognitive 23) src/opnsense/mvc/app/models/OPNsense/Trust/Cert.php:59— Cert.linkCaRefs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (6 pts), ternaries 1 (3 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.
list_assign_options.list_devices (cognitive 23) src/opnsense/scripts/interfaces/list_assign_options.php:36— list_assign_options.list_devices has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 4 (6 pts), boolean chains 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.
getserviceproviders.provider_plan_data (cognitive 23) src/www/getserviceproviders.php:96— getserviceproviders.provider_plan_data has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (9 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.
lib.parse_ipfw_pipes (cognitive 23) src/opnsense/scripts/shaper/lib/__init__.py:82— lib.parse_ipfw_pipes has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (19 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.
lib.parse_ipfw_rules (cognitive 23) src/opnsense/scripts/shaper/lib/__init__.py:178— lib.parse_ipfw_rules has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 3 (9 pts), boolean chains 1, 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.
RuleCache.create (cognitive 23) src/opnsense/scripts/suricata/lib/rulecache.py:233— RuleCache.create has cognitive complexity 23 (threshold 15). Drivers by points: loops 5 (16 pts), if/else 3 (6 pts), error handling 1 (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.
HandlerClient.run (cognitive 23) REDACTED:153— HandlerClient.run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (17 pts), error handling 3 (4 pts), boolean chains 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.
bootstrap.Modal.backdrop (cognitive 23) src/opnsense/www/js/bootstrap.js:1112— bootstrap.Modal.backdrop has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 4 (7 pts), boolean chains 5 (nesting depth added 7). Of this number, 16 points are the body's own statements and 7 belong to 2 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.
UIBootgrid._renderActionBar (cognitive 23) src/opnsense/www/js/opnsense_bootgrid.js:1234— UIBootgrid._renderActionBar has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 6 (8 pts), boolean chains 4 (nesting depth added 4). Most of this is not in the body itself: 8 of the 23 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 1283, 1276, 1300, …). 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.
UIBootgrid.tabulatorDefaults (cognitive 23) src/opnsense/www/js/opnsense_bootgrid.js:1559— UIBootgrid.tabulatorDefaults has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 6, ternaries 2 (3 pts), match/switch 1 (nesting depth added 2). None of this is in the body itself: all 23 points belong to 9 function literals inside it that branch (lines 1657, 1627, 1598, …). 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.
setPlaceholder (cognitive 23) src/opnsense/www/js/bootstrap-select.js:1447— setPlaceholder has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 8, ternaries 1 (2 pts) (nesting depth added 7). Of this number, 20 points are the body's own statements and 3 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.
setMenuSize (cognitive 23) src/opnsense/www/js/bootstrap-select.js:2030— setMenuSize has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6, loops 1 (2 pts), ternaries 1 (2 pts) (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.
ApiMutableModelControllerBase.delBase (cognitive 22) src/opnsense/mvc/app/controllers/OPNsense/Base/ApiMutableModelControllerBase.php:544— ApiMutableModelControllerBase.delBase has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (11 pts), if/else 5 (9 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.
ApiMutableServiceControllerBase.reconfigureAction (cognitive 22) src/opnsense/mvc/app/controllers/OPNsense/Base/ApiMutableServiceControllerBase.php:186— ApiMutableServiceControllerBase.reconfigureAction has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), ternaries 1 (3 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.
SettingsController.getRuleInfoAction (cognitive 22) src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/SettingsController.php:147— SettingsController.getRuleInfoAction has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (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.
VipSettingsController.delItemAction (cognitive 22) src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/VipSettingsController.php:186— VipSettingsController.delItemAction has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (6 pts), boolean chains 1, ternaries 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.
ExportController.openvpnServers (cognitive 22) src/opnsense/mvc/app/controllers/OPNsense/OpenVPN/Api/ExportController.php:97— ExportController.openvpnServers has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 3 (10 pts), if/else 3 (7 pts), boolean chains 3, 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.
Util.smallestCIDR (cognitive 22) src/opnsense/mvc/app/library/OPNsense/Firewall/Util.php:560— Util.smallestCIDR has cognitive complexity 22 (threshold 15). Drivers by points: loops 6 (14 pts), if/else 4 (8 pts) (nesting depth added 12). 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.
IPsecIkev1Status.collectStatus (cognitive 22) src/opnsense/mvc/app/library/OPNsense/System/Status/IPsecIkev1Status.php:48— IPsecIkev1Status.collectStatus has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, loops 2 (4 pts), ternaries 1 (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.
GroupMembershipField.actionPostLoadingEvent (cognitive 22) src/opnsense/mvc/app/models/OPNsense/Auth/FieldTypes/GroupMembershipField.php:40— GroupMembershipField.actionPostLoadingEvent has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (11 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.
Dnsmasq.getDhcpInterfaces (cognitive 22) src/opnsense/mvc/app/models/OPNsense/Dnsmasq/Dnsmasq.php:444— Dnsmasq.getDhcpInterfaces has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (8 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.
Group.whereUsed (cognitive 22) src/opnsense/mvc/app/models/OPNsense/Firewall/Group.php:119— Group.whereUsed has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 4, loops 2 (3 pts), ternaries 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.
Menu.collect (cognitive 22) src/opnsense/mvc/app/models/OPNsense/Firewall/Menu/Menu.php:36— Menu.collect has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, ternaries 1 (4 pts), 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.
OpenVPN.run (cognitive 22) src/opnsense/scripts/health/library/OPNsense/RRD/Stats/OpenVPN.php:33— OpenVPN.run has cognitive complexity 22 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (6 pts), ternaries 1 (6 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.
Config.get_zones (cognitive 22) src/opnsense/scripts/captiveportal/lib/__init__.py:54— Config.get_zones has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (6 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.
BGPASN._update (cognitive 22) src/opnsense/scripts/filter/lib/alias/bgpasn.py:45— BGPASN._update has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 2 (4 pts), loops 1 (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.
pfstatistics.pfctl_rules (cognitive 22) src/opnsense/scripts/filter/pfstatistics.py:99— pfstatistics.pfctl_rules has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 2 (10 pts), loops 3 (7 pts), if/else 1 (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.
BaseFlowAggregator.get_timeserie_data (cognitive 22) src/opnsense/scripts/netflow/lib/aggregates/__init__.py:242— BaseFlowAggregator.get_timeserie_data has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (5 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.
ovpn_event.main (cognitive 22) src/opnsense/scripts/openvpn/ovpn_event.py:39— ovpn_event.main has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (21 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.
ovpn_status.ovpn_status (cognitive 22) src/opnsense/scripts/openvpn/ovpn_status.py:59— ovpn_status.ovpn_status has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (7 pts), ternaries 1 (3 pts), boolean chains 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.
BaseBlocklistHandler._uri_reader (cognitive 22) src/opnsense/scripts/unbound/blocklists/__init__.py:100— BaseBlocklistHandler._uri_reader has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (6 pts), boolean chains 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.
DNSReader._read (cognitive 22) src/opnsense/scripts/unbound/logger.py:138— DNSReader._read has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 1 (4 pts), loops 1 (2 pts), ternaries 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.
_renderFooterCommands (cognitive 22) src/opnsense/www/js/opnsense_bootgrid.js:1350— _renderFooterCommands has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3 (6 pts), boolean chains 5, other 2, loops 1 (nesting depth added 6). Of this number, 19 points are the body's own statements and 3 belong to 5 function literals 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.
UserController.setBaseHook (cognitive 21) src/opnsense/mvc/app/controllers/OPNsense/Auth/Api/UserController.php:58— UserController.setBaseHook has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, loops 2 (4 pts), 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.
ApiMutableModelControllerBase.setBase (cognitive 21) src/opnsense/mvc/app/controllers/OPNsense/Base/ApiMutableModelControllerBase.php:590— ApiMutableModelControllerBase.setBase has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 3 (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.
SettingsController.toggleRulesetAction (cognitive 21) src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/SettingsController.php:394— SettingsController.toggleRulesetAction has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, 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.
TunnelController.delPhase1Action (cognitive 21) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/TunnelController.php:261— TunnelController.delPhase1Action has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (10 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.
GroupSettingsController.searchAction (cognitive 21) src/opnsense/mvc/app/controllers/OPNsense/Routing/Api/GroupSettingsController.php:53— GroupSettingsController.searchAction has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 3 (6 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.
AuthenticationFactory.authenticate (cognitive 21) src/opnsense/mvc/app/library/OPNsense/Auth/AuthenticationFactory.php:187— AuthenticationFactory.authenticate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), ternaries 3, loops 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.
Base.groups (cognitive 21) src/opnsense/mvc/app/library/OPNsense/Auth/Base.php:57— Base.groups has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (8 pts) (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.
ConfigMaintenance.traverseConfig (cognitive 21) src/opnsense/mvc/app/library/OPNsense/Core/ConfigMaintenance.php:91— ConfigMaintenance.traverseConfig has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 1 (5 pts), boolean chains 3, 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.
CrashReporterStatus.collectStatus (cognitive 21) src/opnsense/mvc/app/library/OPNsense/System/Status/CrashReporterStatus.php:44— CrashReporterStatus.collectStatus has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, ternaries 1 (3 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.
Store.createCert (cognitive 21) src/opnsense/mvc/app/library/OPNsense/Trust/Store.php:336— Store.createCert has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 1 (4 pts), boolean chains 1 (nesting depth added 12). 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.
ProtocolField.actionPostLoadingEvent (cognitive 21) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/ProtocolField.php:55— ProtocolField.actionPostLoadingEvent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3, ternaries 2, 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.
SPDField.getStaticChildren (cognitive 21) src/opnsense/mvc/app/models/OPNsense/IPsec/FieldTypes/SPDField.php:42— SPDField.getStaticChildren has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (8 pts), ternaries 1 (4 pts), boolean chains 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.
Gif.performValidation (cognitive 21) src/opnsense/mvc/app/models/OPNsense/Interfaces/Gif.php:40— Gif.performValidation has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 4 (9 pts), boolean chains 1, 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.
Gre.performValidation (cognitive 21) src/opnsense/mvc/app/models/OPNsense/Interfaces/Gre.php:40— Gre.performValidation has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 4 (9 pts), boolean chains 1, 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.
Vip.whereUsed (cognitive 21) src/opnsense/mvc/app/models/OPNsense/Interfaces/Vip.php:234— Vip.whereUsed has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 4 (9 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.
register.plugins_disk_get (cognitive 21) src/opnsense/scripts/firmware/register.php:88— register.plugins_disk_get has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, loops 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.
BaseContentParser.iter_addresses (cognitive 21) src/opnsense/scripts/filter/lib/alias/base.py:41— BaseContentParser.iter_addresses has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 2 (5 pts), error handling 2 (4 pts), ternaries 1 (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.
FlowParser._parse_binary (cognitive 21) src/opnsense/scripts/netflow/lib/flowparser.py:100— FlowParser._parse_binary has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 1 (5 pts), ternaries 1 (5 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.
tokenize2.Tokenize2.keydown (cognitive 21) src/opnsense/www/js/tokenize2.js:447— tokenize2.Tokenize2.keydown has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 1 (2 pts) (nesting depth added 12). 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.
updateValueRange (cognitive 21) src/opnsense/www/js/smoothie.js:784— updateValueRange has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 2 (6 pts), boolean chains 2, loops 1 (nesting depth added 7). 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.
setStyle (cognitive 21) src/opnsense/www/js/bootstrap-select.js:1841— setStyle has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 4 (nesting depth added 5). 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.
FilterBaseController.listCategoriesAction (cognitive 20) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterBaseController.php:166— FilterBaseController.listCategoriesAction has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 4 (9 pts), 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.
TunnelController.togglePhase2Action (cognitive 20) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/TunnelController.php:355— TunnelController.togglePhase2Action has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (8 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.
DiagnosticsController.testBlocklistAction (cognitive 20) src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/DiagnosticsController.php:116— DiagnosticsController.testBlocklistAction has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 13). 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.
Voucher.generateVouchers (cognitive 20) src/opnsense/mvc/app/library/OPNsense/Auth/Voucher.php:193— Voucher.generateVouchers has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (9 pts), 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.
Util.aliasSummary (cognitive 20) src/opnsense/mvc/app/library/OPNsense/Firewall/Util.php:273— Util.aliasSummary has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 1 (2 pts) (nesting depth added 13). 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.
ACL.mergePluggableACLs (cognitive 20) src/opnsense/mvc/app/models/OPNsense/Core/ACL.php:168— ACL.mergePluggableACLs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (7 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.
InterfaceField.actionPostLoadingEvent (cognitive 20) src/opnsense/mvc/app/models/OPNsense/Diagnostics/FieldTypes/InterfaceField.php:41— InterfaceField.actionPostLoadingEvent has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (6 pts), ternaries 1 (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.
Netflow.performValidation (cognitive 20) src/opnsense/mvc/app/models/OPNsense/Diagnostics/Netflow.php:43— Netflow.performValidation has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 2 (8 pts), boolean chains 2, loops 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.
Alias.performValidation (cognitive 20) src/opnsense/mvc/app/models/OPNsense/Firewall/Alias.php:52— Alias.performValidation has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 4, match/switch 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.
SourceNatRuleContainerField.serialize (cognitive 20) src/opnsense/mvc/app/models/OPNsense/Firewall/FieldTypes/SourceNatRuleField.php:48— SourceNatRuleContainerField.serialize has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 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.
Group.refactor (cognitive 20) src/opnsense/mvc/app/models/OPNsense/Firewall/Group.php:78— Group.refactor has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 3, 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.
M1_0_7.run (cognitive 20) src/opnsense/mvc/app/models/OPNsense/IDS/Migrations/M1_0_7.php:42— M1_0_7.run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, 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.
NetworkInterfaceContainerField.fromLegacy (cognitive 20) src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/NetworkInterfaceField.php:140— NetworkInterfaceContainerField.fromLegacy has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 5 (7 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.
Vip.findSubnet (cognitive 20) src/opnsense/mvc/app/models/OPNsense/Interfaces/Vip.php:287— Vip.findSubnet has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 4, match/switch 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.
Route.performValidation (cognitive 20) src/opnsense/mvc/app/models/OPNsense/Routes/Route.php:44— Route.performValidation has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 3 (7 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.
Main.run (cognitive 20) src/opnsense/scripts/netflow/flowd_aggregate.py:140— Main.run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (4 pts), error handling 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.
flowd_aggregate.check_rotate (cognitive 20) src/opnsense/scripts/netflow/flowd_aggregate.py:91— flowd_aggregate.check_rotate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (13 pts), error handling 1 (4 pts), loops 1 (2 pts), boolean chains 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.
ModuleContext.set_config (cognitive 20) src/opnsense/scripts/unbound-dnsbl/lib/__init__.py:140— ModuleContext.set_config has cognitive complexity 20 (threshold 15). Drivers by points: error handling 2 (7 pts), if/else 3 (6 pts), loops 2 (4 pts), ternaries 1 (2 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.
stats.handle_rolling (cognitive 20) src/opnsense/scripts/unbound/stats.py:46— stats.handle_rolling has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (8 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.
OpenVPNClients.updateClients (cognitive 20) src/opnsense/www/js/widgets/OpenVPNClients.js:62— OpenVPNClients.updateClients has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2, ternaries 1 (2 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 75, 100). 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.
PrivController.setItemAction (cognitive 19) src/opnsense/mvc/app/controllers/OPNsense/Auth/Api/PrivController.php:108— PrivController.setItemAction has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (5 pts), ternaries 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.
AliasController.searchItemAction (cognitive 19) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/AliasController.php:51— AliasController.searchItemAction has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (5 pts), boolean chains 3, ternaries 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.
SettingsController.updateBlocklistAction (cognitive 19) src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php:43— SettingsController.updateBlocklistAction has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 6, 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.
BaseField.getConstraintValidators (cognitive 19) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/BaseField.php:631— BaseField.getConstraintValidators has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (17 pts), boolean chains 1, loops 1 (nesting depth added 12). 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.
PortField.actionPostLoadingEvent (cognitive 19) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/PortField.php:134— PortField.actionPostLoadingEvent has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (8 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.
MenuSystem.__construct (cognitive 19) src/opnsense/mvc/app/models/OPNsense/Base/Menu/MenuSystem.php:185— MenuSystem.__construct has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (4 pts), error handling 1 (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.
Alias.searchConfig (cognitive 19) src/opnsense/mvc/app/models/OPNsense/Firewall/Alias.php:151— Alias.searchConfig has cognitive complexity 19 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 3 (9 pts) (nesting depth added 12). 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.
Bridge.performValidation (cognitive 19) src/opnsense/mvc/app/models/OPNsense/Interfaces/Bridge.php:39— Bridge.performValidation has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (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.
AliasReflector.setValue (cognitive 19) src/opnsense/mvc/app/models/OPNsense/Unbound/FieldTypes/AliasReflector.php:70— AliasReflector.setValue has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 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.
GEOIP.process_gzip (cognitive 19) src/opnsense/scripts/filter/lib/alias/geoip.py:103— GEOIP.process_gzip has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 2 (5 pts), boolean chains 2, loops 2, 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.
InterfaceParser._update (cognitive 19) src/opnsense/scripts/filter/lib/alias/interface.py:38— InterfaceParser._update has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (4 pts), boolean chains 3 (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.
kea_prefix_watcher.yield_lease_records (cognitive 19) src/opnsense/scripts/kea/kea_prefix_watcher.py:38— kea_prefix_watcher.yield_lease_records has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (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.
lib.parse_flow (cognitive 19) src/opnsense/scripts/shaper/lib/__init__.py:35— lib.parse_flow has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 8 (16 pts), boolean chains 2, if/else 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.
LogMatcher.live_match_records (cognitive 19) src/opnsense/scripts/syslog/log_matcher.py:56— LogMatcher.live_match_records has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 1 (2 pts), loops 1 (2 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.
crl_fetch.fetch_crl (cognitive 19) src/opnsense/scripts/system/crl_fetch.py:44— crl_fetch.fetch_crl has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (5 pts), error handling 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.
dropdownSelectionMove (cognitive 19) src/opnsense/www/js/tokenize2.js:814— dropdownSelectionMove has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 2 (7 pts) (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.
SessionController.connectAction (cognitive 18) src/opnsense/mvc/app/controllers/OPNsense/CaptivePortal/Api/SessionController.php:115— SessionController.connectAction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 1 (3 pts), boolean chains 1 (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.
PacketCaptureController.viewAction (cognitive 18) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/PacketCaptureController.php:120— PacketCaptureController.viewAction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 2 (6 pts), ternaries 1 (4 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.
SystemhealthController.getRrdListAction (cognitive 18) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/SystemhealthController.php:124— SystemhealthController.getRrdListAction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 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.
WirelessSettingsController.delItemAction (cognitive 18) src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/WirelessSettingsController.php:85— WirelessSettingsController.delItemAction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 2 (5 pts), ternaries 1 (5 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.
PortField.getValidators (cognitive 18) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/PortField.php:233— PortField.getValidators has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 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.
HostnameField.getValidators (cognitive 18) src/opnsense/mvc/app/models/OPNsense/Dnsmasq/FieldTypes/HostnameField.php:127— HostnameField.getValidators has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 2 (5 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.
VxLan.performValidation (cognitive 18) src/opnsense/mvc/app/models/OPNsense/Interfaces/VxLan.php:36— VxLan.performValidation has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 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.
KeaDhcpv4.setNodes (cognitive 18) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:45— KeaDhcpv4.setNodes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (8 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.
M1_0_0.run (cognitive 18) src/opnsense/mvc/app/models/OPNsense/Monit/Migrations/M1_0_0.php:37— M1_0_0.run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6, 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.
Gateways.convertType (cognitive 18) src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php:283— Gateways.convertType has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 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.
wg-service-control.get_vhid_status (cognitive 18) REDACTED:39— wg-service-control.get_vhid_status has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 4 (9 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.
Alias.expired (cognitive 18) src/opnsense/scripts/filter/lib/alias/__init__.py:137— Alias.expired has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 1 (3 pts), boolean chains 2 (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.
BGPASN.iter_addresses (cognitive 18) src/opnsense/scripts/filter/lib/alias/bgpasn.py:98— BGPASN.iter_addresses has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (4 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.
pfstatistics.pfctl_info (cognitive 18) src/opnsense/scripts/filter/pfstatistics.py:35— pfstatistics.pfctl_info has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (13 pts), ternaries 1 (4 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.
BlocklistParser.update_blocklist (cognitive 18) src/opnsense/scripts/unbound/blocklists/__init__.py:243— BlocklistParser.update_blocklist has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (7 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.
DefaultBlocklistHandler._blocklist_reader (cognitive 18) src/opnsense/scripts/unbound/blocklists/default_bl.py:52— DefaultBlocklistHandler._blocklist_reader has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 2 (4 pts), boolean chains 2, error handling 1 (2 pts), ternaries 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.
Action.execute (cognitive 18) REDACTED:37— Action.execute has cognitive complexity 18 (threshold 15). Drivers by points: error handling 5 (12 pts), if/else 2 (3 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.
bootstrap.Affix.getState (cognitive 18) src/opnsense/www/js/bootstrap.js:2461— bootstrap.Affix.getState has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 5 (6 pts), boolean chains 3 (nesting depth added 5). 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.
init (cognitive 18) src/opnsense/www/js/tokenize2.js:134— init 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: 6 of the 18 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 174, 218, 149, …). 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.
extend (cognitive 18) src/opnsense/www/js/smoothie.js:119— extend has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (3 pts), boolean chains 1 (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.
tree_delayed_live_search (cognitive 18) src/opnsense/www/js/opnsense-treeview.js:142— tree_delayed_live_search has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 9). None of this is in the body itself: all 18 points belong to 2 function literals inside it that branch (lines 152, 146). 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.
createDropdown (cognitive 18) src/opnsense/www/js/bootstrap-select.js:1057— createDropdown has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (9 pts), if/else 5, boolean chains 4 (nesting depth added 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.
IXR_Server.call (cognitive 17) contrib/IXR/IXR_Library.php:411— IXR_Server.call has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2 (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.
SystemController.dismissStatusAction (cognitive 17) src/opnsense/mvc/app/controllers/OPNsense/Core/Api/SystemController.php:180— SystemController.dismissStatusAction has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (15 pts), boolean chains 2 (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.
LogController.__call (cognitive 17) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/LogController.php:39— LogController.__call has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 3 (5 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.
NetflowController.setconfigAction (cognitive 17) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/NetflowController.php:79— NetflowController.setconfigAction has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), 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.
AliasController.listCountriesAction (cognitive 17) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/AliasController.php:246— AliasController.listCountriesAction has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, loops 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.
AliasController.exportAction (cognitive 17) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/AliasController.php:373— AliasController.exportAction has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (3 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.
FilterBaseController.getNetworks (cognitive 17) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterBaseController.php:101— FilterBaseController.getNetworks has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 4 (7 pts), ternaries 1 (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.
FilterBaseController.uploadRulesBase (cognitive 17) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterBaseController.php:530— FilterBaseController.uploadRulesBase has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 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.
VipSettingsController.setItemAction (cognitive 17) src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/VipSettingsController.php:121— VipSettingsController.setItemAction has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 4 (6 pts), boolean chains 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.
LeasesController.searchAction (cognitive 17) src/opnsense/mvc/app/controllers/OPNsense/Kea/Api/LeasesController.php:40— LeasesController.searchAction has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 3 (4 pts), boolean chains 2, loops 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.
CrlController.getOcspInfoDataAction (cognitive 17) src/opnsense/mvc/app/controllers/OPNsense/Trust/Api/CrlController.php:427— CrlController.getOcspInfoDataAction has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (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.
CSVListField.getValidators (cognitive 17) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/CSVListField.php:85— CSVListField.getValidators has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 1 (3 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.
Firmware.performValidation (cognitive 17) src/opnsense/mvc/app/models/OPNsense/Core/Firmware.php:98— Firmware.performValidation has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4 (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.
InitialSetup.flush_network_lan (cognitive 17) src/opnsense/mvc/app/models/OPNsense/Core/InitialSetup.php:374— InitialSetup.flush_network_lan has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (3 pts), boolean chains 2, 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.
Group.ruleIterator (cognitive 17) src/opnsense/mvc/app/models/OPNsense/Firewall/Group.php:40— Group.ruleIterator has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 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.
DUIDField.isValidDuid (cognitive 17) src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/DUIDField.php:38— DUIDField.isValidDuid has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (8 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.
flowd_aggregate.aggregate_flowd (cognitive 17) src/opnsense/scripts/netflow/flowd_aggregate.py:50— flowd_aggregate.aggregate_flowd has cognitive complexity 17 (threshold 15). Drivers by points: loops 6 (11 pts), if/else 2 (4 pts), boolean chains 2 (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.
BaseFlowAggregator.get_data (cognitive 17) src/opnsense/scripts/netflow/lib/aggregates/__init__.py:354— BaseFlowAggregator.get_data has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (6 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.
aggregates.get_aggregators (cognitive 17) src/opnsense/scripts/netflow/lib/aggregates/__init__.py:385— aggregates.get_aggregators has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (11 pts), loops 2 (4 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.
certctl.certificate_iterator (cognitive 17) src/opnsense/scripts/system/certctl.py:45— certctl.certificate_iterator has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 2 (4 pts), error handling 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.
DefaultBlocklistHandler._parse_config (cognitive 17) src/opnsense/scripts/unbound/blocklists/default_bl.py:102— DefaultBlocklistHandler._parse_config has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 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.
log_helper.reverse_log_reader (cognitive 17) src/opnsense/site-python/log_helper.py:29— log_helper.reverse_log_reader has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (3 pts), ternaries 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.
bootstrap-select.sanitizeHtml (cognitive 17) src/opnsense/www/js/bootstrap-select.js:116— bootstrap-select.sanitizeHtml has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (6 pts), boolean chains 3 (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.
UIBootgrid._onDataProcessed (cognitive 17) src/opnsense/www/js/opnsense_bootgrid.js:1009— UIBootgrid._onDataProcessed has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, 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.
opnsense_ui.initFormHelpUI (cognitive 17) REDACTED:423— opnsense_ui.initFormHelpUI has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 3). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 432, 476, 505, …). 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.
smoothie.SmoothieChart.resize (cognitive 17) src/opnsense/www/js/smoothie.js:679— smoothie.SmoothieChart.resize has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 1, ternaries 1 (nesting depth added 7). 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.
tokenize2.Tokenize2.calculatezindex (cognitive 17) src/opnsense/www/js/tokenize2.js:715— tokenize2.Tokenize2.calculatezindex has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 2, loops 1 (2 pts) (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.
BaseTableWidget.updateTable (cognitive 17) src/opnsense/www/js/widgets/BaseTableWidget.js:144— BaseTableWidget.updateTable has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 2, ternaries 1 (nesting depth added 2). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 163). 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.
_makeOptionField (cognitive 17) src/opnsense/www/js/opnsense_widgets.js:350— _makeOptionField has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (6 pts), other 5, boolean chains 4, loops 1 (2 pts) (nesting depth added 2). 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.
init (cognitive 17) src/opnsense/www/js/bootstrap-select.js:938— init has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 1 (nesting depth added 3). Of this number, 13 points are the body's own statements and 4 belong to 10 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.
processTunnels (cognitive 17) src/opnsense/www/js/widgets/Wireguard.js:77— processTunnels has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 7, boolean chains 2 (nesting depth added 1). None of this is in the body itself: all 17 points belong to 6 function literals inside it that branch (lines 82, 117, 140, …). 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.
BackupController.diffAction (cognitive 16) src/opnsense/mvc/app/controllers/OPNsense/Core/Api/BackupController.php:109— BackupController.diffAction has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 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.
SnapshotsController.addAction (cognitive 16) src/opnsense/mvc/app/controllers/OPNsense/Core/Api/SnapshotsController.php:214— SnapshotsController.addAction has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 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.
TunablesController.resetAction (cognitive 16) src/opnsense/mvc/app/controllers/OPNsense/Core/Api/TunablesController.php:70— TunablesController.resetAction has cognitive complexity 16 (threshold 15). Drivers by points: loops 2 (9 pts), if/else 4 (7 pts) (nesting depth added 10). 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.
DNatController.getConfiguredDestinationNatRules (cognitive 16) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/DNatController.php:93— DNatController.getConfiguredDestinationNatRules has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (5 pts), ternaries 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.
FilterBaseController.downloadRulesBase (cognitive 16) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterBaseController.php:479— FilterBaseController.downloadRulesBase has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 5 (7 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.
OverviewController.getInterfaceAction (cognitive 16) src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/OverviewController.php:255— OverviewController.getInterfaceAction has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 1 (3 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.
VlanSettingsController.setItemAction (cognitive 16) src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/VlanSettingsController.php:101— VlanSettingsController.setItemAction has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, loops 1, ternaries 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.
Radius.updateAccounting (cognitive 16) src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:411— Radius.updateAccounting has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), match/switch 1 (3 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.
Voucher._authenticate (cognitive 16) src/opnsense/mvc/app/library/OPNsense/Auth/Voucher.php:375— Voucher._authenticate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 1 (4 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.
Config.getBackups (cognitive 16) src/opnsense/mvc/app/library/OPNsense/Core/Config.php:609— Config.getBackups 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.
Util.getservbyname (cognitive 16) src/opnsense/mvc/app/library/OPNsense/Firewall/Util.php:342— Util.getservbyname has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (6 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.
Util.cidrRangeIterator (cognitive 16) src/opnsense/mvc/app/library/OPNsense/Firewall/Util.php:645— Util.cidrRangeIterator has cognitive complexity 16 (threshold 15). Drivers by points: loops 2 (6 pts), ternaries 2 (6 pts), if/else 3 (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.
Response.send (cognitive 16) src/opnsense/mvc/app/library/OPNsense/Mvc/Response.php:96— Response.send has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 2 (5 pts), ternaries 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.
Store.ocsp_validate (cognitive 16) src/opnsense/mvc/app/library/OPNsense/Trust/Store.php:656— Store.ocsp_validate 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.
MenuItem.getLinkClass (cognitive 16) src/opnsense/mvc/app/models/OPNsense/Base/Menu/MenuItem.php:281— MenuItem.getLinkClass has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 1 (3 pts), ternaries 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.
HostnameField.setValue (cognitive 16) src/opnsense/mvc/app/models/OPNsense/Dnsmasq/FieldTypes/HostnameField.php:78— HostnameField.setValue has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 1 (3 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.
AliasContentField.validateNetwork (cognitive 16) src/opnsense/mvc/app/models/OPNsense/Firewall/FieldTypes/AliasContentField.php:234— AliasContentField.validateNetwork has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 2 (5 pts), loops 2 (3 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.
BridgeMemberField.actionPostLoadingEvent (cognitive 16) src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/BridgeMemberField.php:37— BridgeMemberField.actionPostLoadingEvent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), ternaries 1 (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.
VipInterfaceField.actionPostLoadingEvent (cognitive 16) src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/VipInterfaceField.php:37— VipInterfaceField.actionPostLoadingEvent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), ternaries 1 (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.
Wlan.performValidation (cognitive 16) src/opnsense/mvc/app/models/OPNsense/Interfaces/Wlan.php:36— Wlan.performValidation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 2, 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.
OpenVPNServerField.actionPostLoadingEvent (cognitive 16) src/opnsense/mvc/app/models/OPNsense/OpenVPN/FieldTypes/OpenVPNServerField.php:41— OpenVPNServerField.actionPostLoadingEvent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (6 pts), loops 2 (5 pts), ternaries 1 (4 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.
RemoteHostField.getValidators (cognitive 16) src/opnsense/mvc/app/models/OPNsense/OpenVPN/FieldTypes/RemoteHostField.php:57— RemoteHostField.getValidators has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 2 (6 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.
read_log.fetch_rule_details (cognitive 16) src/opnsense/scripts/filter/read_log.py:75— read_log.fetch_rule_details has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 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.
lib.parse_ipfw_queues (cognitive 16) src/opnsense/scripts/shaper/lib/__init__.py:126— lib.parse_ipfw_queues has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 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.
DNSReader.run_logger (cognitive 16) src/opnsense/scripts/unbound/logger.py:203— DNSReader.run_logger has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), error handling 2 (4 pts), loops 3 (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.
Action.execute (cognitive 16) REDACTED:52— Action.execute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, boolean chains 3, error handling 2, loops 1 (2 pts), 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.
bootstrap-select.stringSearch (cognitive 16) src/opnsense/www/js/bootstrap-select.js:422— bootstrap-select.stringSearch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 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.
setSelected (cognitive 16) src/opnsense/www/js/bootstrap-select.js:2292— setSelected has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4 (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.
handleModalEvents (cognitive 16) src/opnsense/www/js/bootstrap-dialog.js:1023— handleModalEvents has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (8 pts) (nesting depth added 2). None of this is in the body itself: all 16 points belong to 6 function literals inside it that branch (lines 1024, 1040, 1052, …). 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.
FunctionTooLong: smoothie.SmoothieChart.render src/opnsense/www/js/smoothie.js:839— FunctionTooLong — SmoothieChart.render runs 197 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 97 over it, 1.97× 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· Near-duplicate member family (3 members, 127 shared lines) · ×1
Near-duplicate member family (3 members, 127 shared lines) src/opnsense/scripts/captiveportal/lib/daemonize.py:62— src/opnsense/scripts/captiveportal/lib/daemonize.py:62-211 | src/opnsense/service/modules/daemonize.py:76-242 | src/opnsense/site-python/daemonize.py:74-240 — These 3 members are variants of one another: a block of 127 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 (46 shared lines) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:184— src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:184-316 | src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:330-532 — These two members are variants of one another: 46 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· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (6 members, 50+ identical tokens) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/PacketCaptureController.php:77— src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/PacketCaptureController.php:77-84 | src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/PacketCaptureController.php:92-99 | src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/PacketCaptureController.php:107-114 | src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/PingController.php:76-83 | src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/PingController.php:91-98 | src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/PingController.php:106-113 — 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.
Duplicated block (50–51 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SadController.php:48— src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SadController.php:48-98 | src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SpdController.php:48-97 — before extracting anything, compare `src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SadController.php` and `src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/SpdController.php` as WHOLE FILES: this scan already matched 3 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.
Duplicated block (44–45 lines × 2) src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:409— src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:409-452 | src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:625-669 — before extracting anything, compare `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php` and `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 145 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 `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php:454` calls `foreach`, `getValues` and `src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv6.php:670` 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 (43 lines × 2) src/opnsense/mvc/app/models/OPNsense/Monit/Migrations/M1_0_6.php:37— src/opnsense/mvc/app/models/OPNsense/Monit/Migrations/M1_0_6.php:37-79 | src/opnsense/mvc/app/models/OPNsense/Monit/Migrations/M1_0_7.php:38-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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/opnsense/mvc/app/models/OPNsense/Monit/Migrations/M1_0_6.php:81` calls `run` and `src/opnsense/mvc/app/models/OPNsense/Monit/Migrations/M1_0_7.php:81` 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 (28 lines × 2) src/opnsense/mvc/app/models/OPNsense/Interfaces/Gif.php:44— src/opnsense/mvc/app/models/OPNsense/Interfaces/Gif.php:44-71 | src/opnsense/mvc/app/models/OPNsense/Interfaces/Gre.php:44-71 — before extracting anything, compare `src/opnsense/mvc/app/models/OPNsense/Interfaces/Gif.php` and `src/opnsense/mvc/app/models/OPNsense/Interfaces/Gre.php` as WHOLE FILES: 82% 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 `src/opnsense/mvc/app/models/OPNsense/Interfaces/Gif.php:44` 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 (25 lines × 2) src/opnsense/mvc/app/models/OPNsense/DHCRelay/Migrations/M1_0_0.php:48— src/opnsense/mvc/app/models/OPNsense/DHCRelay/Migrations/M1_0_0.php:48-72 | src/opnsense/mvc/app/models/OPNsense/DHCRelay/Migrations/M1_0_1.php:48-72 — before extracting anything, compare `src/opnsense/mvc/app/models/OPNsense/DHCRelay/Migrations/M1_0_0.php` and `src/opnsense/mvc/app/models/OPNsense/DHCRelay/Migrations/M1_0_1.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.
Duplicated block (24 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/PacketCaptureController.php:46— src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/PacketCaptureController.php:46-69 | src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/PingController.php:45-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 (21–22 lines × 2) src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:358— src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:358-378 | src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:450-471 — 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 `src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:358` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:378` calls `radius_strerror`, `elseif`, `radius_put_int` and `src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:471` 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–21 lines × 3) src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:290— src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:290-309 | src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:380-399 | src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:469-489 — 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 `src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:290` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:378` calls `radius_strerror`, `elseif`, `radius_put_int` and `src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php:469` 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 (19 lines × 2) src/opnsense/mvc/app/library/OPNsense/OpenVPN/ArchiveOpenVPN.php:76— src/opnsense/mvc/app/library/OPNsense/OpenVPN/ArchiveOpenVPN.php:76-94 | src/opnsense/mvc/app/library/OPNsense/OpenVPN/ViscosityVisz.php:107-125 — 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 `src/opnsense/mvc/app/library/OPNsense/OpenVPN/ArchiveOpenVPN.php:76` 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–17 lines × 3) src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:570— src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:570-585 | src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:635-650 | src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:661-677 — 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 (17 lines × 2) src/opnsense/mvc/app/models/OPNsense/Trust/FieldTypes/CAsField.php:95— src/opnsense/mvc/app/models/OPNsense/Trust/FieldTypes/CAsField.php:95-111 | src/opnsense/mvc/app/models/OPNsense/Trust/FieldTypes/CertificatesField.php:162-178 — 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 `src/opnsense/mvc/app/models/OPNsense/Trust/FieldTypes/CAsField.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 (15–16 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterBaseController.php:509— src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterBaseController.php:509-523 | src/opnsense/mvc/app/controllers/OPNsense/Firewall/Api/FilterBaseController.php:556-571 — 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) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/InterfaceController.php:81— src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/InterfaceController.php:81-95 | src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/InterfaceController.php:130-144 — 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 (12–13 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:401— src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:401-413 | src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php:783-794 — 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 × 3) src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GifSettingsController.php:97— src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GifSettingsController.php:97-108 | src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GreSettingsController.php:97-108 | src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/LaggSettingsController.php:97-108 — before extracting anything, compare `src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GifSettingsController.php` and `src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GreSettingsController.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 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 (8 lines × 6) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/PacketCaptureController.php:77— src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/PacketCaptureController.php:77-84 | src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/PacketCaptureController.php:92-99 | src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/PacketCaptureController.php:107-114 | src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/PingController.php:76-83 | src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/PingController.php:91-98 | src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/Api/PingController.php:106-113 — 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 lines × 4) src/opnsense/mvc/app/controllers/OPNsense/Core/Api/SystemController.php:136— src/opnsense/mvc/app/controllers/OPNsense/Core/Api/SystemController.php:136-141 | src/opnsense/mvc/app/controllers/OPNsense/Core/Api/SystemController.php:143-148 | src/opnsense/mvc/app/controllers/OPNsense/Core/Api/SystemController.php:150-155 | src/opnsense/mvc/app/controllers/OPNsense/Core/Api/SystemController.php:156-162 — 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 `src/opnsense/mvc/app/controllers/OPNsense/Core/Api/SystemController.php:136` 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. 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 (77 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/FirewallController.php:44— src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/FirewallController.php:44-120 | src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/InterfaceController.php:44-128 — 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 `src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/FirewallController.php:44` 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 × 3) src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/FirewallController.php:44— src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/FirewallController.php:44-120 | src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/InterfaceController.php:44-128 | src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/SystemController.php:44-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 all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/opnsense/mvc/app/controllers/OPNsense/Diagnostics/FirewallController.php:44` 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 (26 lines × 4) src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/ManualSpdController.php:44— src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/ManualSpdController.php:44-69 | src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/PreSharedKeysController.php:49-95 | src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/VtiController.php:44-69 | src/opnsense/mvc/app/controllers/OPNsense/Radvd/Api/SettingsController.php:40-65 — 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 `src/opnsense/mvc/app/controllers/OPNsense/IPsec/Api/ManualSpdController.php:44` 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 (32 lines × 2) src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/LoopbackSettingsController.php:41— src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/LoopbackSettingsController.php:41-72 | src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/VxlanSettingsController.php:41-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 both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/LoopbackSettingsController.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 (19 lines × 3) src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/DescriptionField.php:53— src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/DescriptionField.php:53-71 | src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/EmailField.php:49-68 | src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/MacAddressField.php:44-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 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/DescriptionField.php:53` 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 (33 lines × 2) src/opnsense/scripts/health/library/OPNsense/RRD/Types/Packets.php:46— src/opnsense/scripts/health/library/OPNsense/RRD/Types/Packets.php:46-78 | src/opnsense/scripts/health/library/OPNsense/RRD/Types/Traffic.php:46-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. Read the line range as the matched WINDOW rather than a finished unit: at `src/opnsense/scripts/health/library/OPNsense/RRD/Types/Packets.php:46` 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 (7 lines × 3) src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/BridgeSettingsController.php:131— src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/BridgeSettingsController.php:131-137 | src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GifSettingsController.php:173-179 | src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GreSettingsController.php:173-179 — before extracting anything, compare `src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GifSettingsController.php` and `src/opnsense/mvc/app/controllers/OPNsense/Interfaces/Api/GreSettingsController.php` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 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 (27 lines × 2) src/opnsense/mvc/app/models/OPNsense/Firewall/FieldTypes/AliasNameField.php:209— src/opnsense/mvc/app/models/OPNsense/Firewall/FieldTypes/AliasNameField.php:209-235 | src/opnsense/mvc/app/models/OPNsense/OpenVPN/FieldTypes/RemoteHostField.php:59-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.
Duplicated block (18 lines × 2) src/opnsense/mvc/app/models/OPNsense/Trust/FieldTypes/CAsField.php:47— src/opnsense/mvc/app/models/OPNsense/Trust/FieldTypes/CAsField.php:47-64 | src/opnsense/mvc/app/models/OPNsense/Trust/FieldTypes/CertificatesField.php:48-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.
Duplicated block (75 lines × 2) src/opnsense/service/modules/daemonize.py:145— src/opnsense/service/modules/daemonize.py:145-219 | src/opnsense/site-python/daemonize.py:143-217 — before extracting anything, compare `src/opnsense/service/modules/daemonize.py` and `src/opnsense/site-python/daemonize.py` as WHOLE FILES: this scan already matched 7 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.
Duplicated block (54 lines × 3) src/opnsense/scripts/captiveportal/lib/daemonize.py:88— src/opnsense/scripts/captiveportal/lib/daemonize.py:88-141 | src/opnsense/service/modules/daemonize.py:104-157 | src/opnsense/site-python/daemonize.py:102-155 — before extracting anything, compare `src/opnsense/scripts/captiveportal/lib/daemonize.py` and `src/opnsense/service/modules/daemonize.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 137 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 (34 lines × 3) src/opnsense/scripts/captiveportal/lib/daemonize.py:178— src/opnsense/scripts/captiveportal/lib/daemonize.py:178-211 | src/opnsense/service/modules/daemonize.py:209-242 | src/opnsense/site-python/daemonize.py:207-240 — before extracting anything, compare `src/opnsense/scripts/captiveportal/lib/daemonize.py` and `src/opnsense/service/modules/daemonize.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 137 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, `src/opnsense/service/modules/daemonize.py:205` calls `chown` and `src/opnsense/scripts/captiveportal/lib/daemonize.py:177` 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 × 3) src/opnsense/scripts/captiveportal/lib/daemonize.py:62— src/opnsense/scripts/captiveportal/lib/daemonize.py:62-85 | src/opnsense/service/modules/daemonize.py:76-99 | src/opnsense/site-python/daemonize.py:74-97 — before extracting anything, compare `src/opnsense/scripts/captiveportal/lib/daemonize.py` and `src/opnsense/service/modules/daemonize.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 137 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) src/opnsense/scripts/filter/lib/__init__.py:97— src/opnsense/scripts/filter/lib/__init__.py:97-119 | src/opnsense/scripts/filter/lib/alias/base.py:113-135 — before extracting anything, compare `src/opnsense/scripts/filter/lib/__init__.py` and `src/opnsense/scripts/filter/lib/alias/base.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 66 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 × 3) src/opnsense/scripts/captiveportal/lib/daemonize.py:146— src/opnsense/scripts/captiveportal/lib/daemonize.py:146-160 | src/opnsense/service/modules/daemonize.py:162-176 | src/opnsense/site-python/daemonize.py:160-174 — before extracting anything, compare `src/opnsense/scripts/captiveportal/lib/daemonize.py` and `src/opnsense/service/modules/daemonize.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 137 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–11 lines × 2) src/opnsense/scripts/dnsmasq/dnsmasq_watcher.py:52— src/opnsense/scripts/dnsmasq/dnsmasq_watcher.py:52-62 | src/opnsense/scripts/unbound/unbound_watcher.py:139-147 — 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, `src/opnsense/scripts/unbound/unbound_watcher.py:138` calls `UnboundLocalData` and `src/opnsense/scripts/dnsmasq/dnsmasq_watcher.py:51` 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 × 3) src/opnsense/scripts/captiveportal/lib/daemonize.py:34— src/opnsense/scripts/captiveportal/lib/daemonize.py:34-43 | src/opnsense/service/modules/daemonize.py:45-54 | src/opnsense/site-python/daemonize.py:45-54 — before extracting anything, compare `src/opnsense/scripts/captiveportal/lib/daemonize.py` and `src/opnsense/service/modules/daemonize.py` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 137 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.
M1 · Documentation (README)· README may be stale · ×1
README may be stale — 369 code files changed in the last 6 months but the README was not touched — it may no longer reflect the system.
Duplicated block (527 lines × 2 locations) src/opnsense/www/js/jquery-sortable.js:31— src/opnsense/www/js/jquery-sortable.js:31 · src/opnsense/www/js/tokenize2.js:2005 — 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 (49 matched lines × 2 locations) · ×1
Duplicated block with local edits (49 matched lines × 2 locations) src/opnsense/www/js/widgets/DnsmasqLeases.js:72— src/opnsense/www/js/widgets/DnsmasqLeases.js:72 · src/opnsense/www/js/widgets/KeaLeases.js:92 — the two spans are one implementation copied and then locally edited — 253 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 (21 lines × 2 locations) src/opnsense/www/js/opnsense_bootgrid.js:2215— src/opnsense/www/js/opnsense_bootgrid.js:2215 · src/opnsense/www/js/opnsense_bootgrid.js:2362 — 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 locations) src/opnsense/www/js/bootstrap-dialog.js:1192— src/opnsense/www/js/bootstrap-dialog.js:1192 · src/opnsense/www/js/bootstrap-dialog.js:1241 — 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 (17 lines × 2 locations) src/opnsense/www/js/opnsense_bootgrid.js:2486— src/opnsense/www/js/opnsense_bootgrid.js:2486 · src/opnsense/www/js/opnsense_bootgrid.js:2504 — 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 (16 matched lines × 2 locations) · ×1
Duplicated block with local edits (16 matched lines × 2 locations) src/opnsense/www/js/opnsense_theme.js:185— src/opnsense/www/js/opnsense_theme.js:185 · src/opnsense/www/js/opnsense_theme.js:207 — the two spans are one implementation copied and then locally edited — 73 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 (16 lines × 3 locations) src/opnsense/www/js/widgets/FirewallStates.js:27— src/opnsense/www/js/widgets/FirewallStates.js:27 · src/opnsense/www/js/widgets/Mbuf.js:27 · src/opnsense/www/js/widgets/Swap.js:27 — 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 (16 lines × 2 locations) src/opnsense/www/js/widgets/IpsecLeases.js:50— src/opnsense/www/js/widgets/IpsecLeases.js:50 · src/opnsense/www/js/widgets/IpsecTunnels.js:51 — 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 (15 matched lines × 2 locations) · ×1
Duplicated block with local edits (15 matched lines × 2 locations) src/opnsense/www/js/widgets/Certificates.js:27— src/opnsense/www/js/widgets/Certificates.js:27 · src/opnsense/www/js/widgets/LiveLog.js:27 — the two spans are one implementation copied and then locally edited — 51 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 (15 lines × 2 locations) src/opnsense/www/js/widgets/OpenVPNServers.js:27— src/opnsense/www/js/widgets/OpenVPNServers.js:27 · src/opnsense/www/js/widgets/Wireguard.js:28 — 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 (14 lines × 2 locations) REDACTED:722— REDACTED:722 · REDACTED:757 — 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 (12 lines × 2 locations) src/opnsense/www/js/opnsense_bootgrid.js:1873— src/opnsense/www/js/opnsense_bootgrid.js:1873 · src/opnsense/www/js/opnsense_bootgrid.js:1885 — 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.
R10 · Code Duplication· Duplicated block with local edits (7 matched lines × 2 locations) · ×1
Duplicated block with local edits (7 matched lines × 2 locations) src/opnsense/www/js/widgets/InterfaceStatistics.js:93— src/opnsense/www/js/widgets/InterfaceStatistics.js:93 · src/opnsense/www/js/widgets/InterfaceStatistics.js:194 — the two spans are one implementation copied and then locally edited — 73 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 (6 lines × 3 locations) REDACTED:364— REDACTED:364 · REDACTED:379 · REDACTED:407 — 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.
Complex function translateCompatOptions (cyclomatic 68, cognitive 78) src/opnsense/www/js/opnsense_bootgrid.js:244— translateCompatOptions has cyclomatic complexity 68 and cognitive complexity 78; 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 keydown (cyclomatic 66, cognitive 113) src/opnsense/www/js/bootstrap-select.js:2827— keydown has cyclomatic complexity 66 and cognitive complexity 113; 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 render (cyclomatic 61, cognitive 93) src/opnsense/www/js/smoothie.js:839— render has cyclomatic complexity 61 and cognitive complexity 93; 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 scroll (cyclomatic 55, cognitive 99) src/opnsense/www/js/bootstrap-select.js:1227— scroll has cyclomatic complexity 55 and cognitive complexity 99; 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 liHeight (cyclomatic 43, cognitive 46) src/opnsense/www/js/bootstrap-select.js:1878— liHeight has cyclomatic complexity 43 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 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 getLostPoint (cyclomatic 42, cognitive 84) src/opnsense/www/js/qrcode.js:1020— getLostPoint has cyclomatic complexity 42 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 99) src/opnsense/www/js/bootstrap-select.js:2454— (anonymous) has cyclomatic complexity 38 and cognitive complexity 99; 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 render (cyclomatic 37, cognitive 90) src/opnsense/www/js/bootstrap-select.js:1714— render has cyclomatic complexity 37 and cognitive complexity 90; 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 29, cognitive 82) src/opnsense/www/js/opnsense.js:155— (anonymous) has cyclomatic complexity 29 and cognitive complexity 82; 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 _parseGridView (cyclomatic 22, cognitive 33) src/opnsense/www/js/opnsense_bootgrid.js:476— _parseGridView has cyclomatic complexity 22 and cognitive complexity 33; 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 createSvgTag (cyclomatic 22, cognitive 24) src/opnsense/www/js/qrcode.js:495— createSvgTag has cyclomatic complexity 22 and cognitive complexity 24; 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 setupPositionProbePattern (cyclomatic 19, cognitive 19) src/opnsense/www/js/qrcode.js:75— setupPositionProbePattern has cyclomatic complexity 19 and cognitive complexity 19; 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 _parseColumns (cyclomatic 18, cognitive 31) src/opnsense/www/js/opnsense_bootgrid.js:536— _parseColumns has cyclomatic complexity 18 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 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 18, cognitive 28) src/opnsense/www/js/bootstrap-select.js:2672— (anonymous) has cyclomatic complexity 18 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 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 setMenuSize (cyclomatic 18, cognitive 23) src/opnsense/www/js/bootstrap-select.js:2030— setMenuSize has cyclomatic complexity 18 and cognitive complexity 23; 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 _createHalfASCII (cyclomatic 18, cognitive 19) src/opnsense/www/js/qrcode.js:620— _createHalfASCII has cyclomatic complexity 18 and cognitive complexity 19; 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 createDropdown (cyclomatic 18, cognitive 18) src/opnsense/www/js/bootstrap-select.js:1057— createDropdown has cyclomatic complexity 18 and cognitive complexity 18; 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 18, cognitive 15) REDACTED:694— (anonymous) has cyclomatic complexity 18 and cognitive complexity 15; 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 getLengthInBits (cyclomatic 17, cognitive 11) src/opnsense/www/js/qrcode.js:974— getLengthInBits has cyclomatic complexity 17 and cognitive complexity 11; 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 setStyle (cyclomatic 16, cognitive 21) src/opnsense/www/js/bootstrap-select.js:1841— setStyle has cyclomatic complexity 16 and cognitive complexity 21; 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.
R3 · Large Files· src/opnsense/www/js/bootstrap-select.js · ×1
src/opnsense/www/js/bootstrap-select.js: 2685 lines of code src/opnsense/www/js/bootstrap-select.js:1— src/opnsense/www/js/bootstrap-select.js has 2685 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· src/opnsense/www/js/tokenize2.js · ×1
src/opnsense/www/js/tokenize2.js: 2412 lines of code src/opnsense/www/js/tokenize2.js:1— src/opnsense/www/js/tokenize2.js has 2412 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· src/opnsense/www/js/opnsense_bootgrid.js · ×1
src/opnsense/www/js/opnsense_bootgrid.js: 2218 lines of code src/opnsense/www/js/opnsense_bootgrid.js:1— src/opnsense/www/js/opnsense_bootgrid.js has 2218 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· src/opnsense/www/js/qrcode.js · ×1
src/opnsense/www/js/qrcode.js: 1798 lines of code src/opnsense/www/js/qrcode.js:1— src/opnsense/www/js/qrcode.js has 1798 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· src/opnsense/www/js/bootstrap-dialog.js · ×1
src/opnsense/www/js/bootstrap-dialog.js: 1204 lines of code src/opnsense/www/js/bootstrap-dialog.js:1— src/opnsense/www/js/bootstrap-dialog.js has 1204 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: 1199 lines of code REDACTED:1— REDACTED has 1199 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· src/opnsense/www/js/opnsense_widgets.js · ×1
src/opnsense/www/js/opnsense_widgets.js: 1138 lines of code src/opnsense/www/js/opnsense_widgets.js:1— src/opnsense/www/js/opnsense_widgets.js has 1138 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· src/opnsense/www/js/smoothie.js · ×1
src/opnsense/www/js/smoothie.js: 1075 lines of code src/opnsense/www/js/smoothie.js:1— src/opnsense/www/js/smoothie.js has 1075 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· src/opnsense/www/js/chartjs-plugin-streaming.js · ×1
src/opnsense/www/js/chartjs-plugin-streaming.js: 939 lines of code src/opnsense/www/js/chartjs-plugin-streaming.js:1— src/opnsense/www/js/chartjs-plugin-streaming.js has 939 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· src/opnsense/www/js/jquery-sortable.js · ×1
src/opnsense/www/js/jquery-sortable.js: 631 lines of code src/opnsense/www/js/jquery-sortable.js:1— src/opnsense/www/js/jquery-sortable.js has 631 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· src/opnsense/www/js/opnsense.js · ×1
src/opnsense/www/js/opnsense.js: 411 lines of code src/opnsense/www/js/opnsense.js:1— src/opnsense/www/js/opnsense.js has 411 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
Test Coverage — 0% of 53 production file(s) reachable from 0 test file(s) via the import graph — 'production' here is the RESIDUE: every source file left once tests, tooling, generated output, config, declarations and declaration-only modules, fixture corpora, type fixtures, behaviour-free data modules, re-export barrels, registration/constant data modules and service workers are set aside, so the percentage is taken over a smaller denominator than the workspace's file count
Duplicated predicate src/opnsense/www/js/jquery-sortable.js:286— `!box || box.top - t > p.top || box.bottom + t < p.top || box.left - t > p.left || box.right + t < p.left` appears character-identically in 2 files — src/opnsense/www/js/jquery-sortable.js, src/opnsense/www/js/tokenize2.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 src/opnsense/www/js/jquery-sortable.js:328— `!distance || this.options.pullPlaceholder` appears character-identically in 2 files — src/opnsense/www/js/jquery-sortable.js, src/opnsense/www/js/tokenize2.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 src/opnsense/www/js/jquery-sortable.js:685— `!object && (methodOrOptions === undefined || typeof methodOrOptions === "object")` appears character-identically in 2 files — src/opnsense/www/js/jquery-sortable.js, src/opnsense/www/js/tokenize2.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 src/opnsense/www/js/widgets/IpsecTunnels.js:61— `!response || !response.rows || response.rows.length === 0` appears character-identically in 2 files — src/opnsense/www/js/widgets/IpsecTunnels.js, src/opnsense/www/js/widgets/Wireguard.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 src/opnsense/www/js/jquery-sortable.js:496— `!rootGroup.options.isValidTarget || rootGroup.options.isValidTarget(rootGroup.item, this)` appears character-identically in 2 files — src/opnsense/www/js/jquery-sortable.js, src/opnsense/www/js/tokenize2.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 src/opnsense/www/js/jquery-sortable.js:346— `!sameResultBox && lastAppendedItem && lastAppendedItem[0] === item[0]` appears character-identically in 2 files — src/opnsense/www/js/jquery-sortable.js, src/opnsense/www/js/tokenize2.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 src/opnsense/www/js/widgets/DnsmasqLeases.js:77— `!this.dataChanged('dhcp-leases', leaseRows) && !this.configChanged` appears character-identically in 2 files — src/opnsense/www/js/widgets/DnsmasqLeases.js, src/opnsense/www/js/widgets/KeaLeases.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 src/opnsense/www/js/jquery-sortable.js:479— `!this.disabled && !rootGroup.dragInitDone && this.options.drag && this.isValidDrag(e)` appears character-identically in 2 files — src/opnsense/www/js/jquery-sortable.js, src/opnsense/www/js/tokenize2.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 src/opnsense/www/js/bootstrap-dialog.js:99— `$.support.transition && this.$element.hasClass('fade')` appears character-identically in 2 files — src/opnsense/www/js/bootstrap-dialog.js, src/opnsense/www/js/bootstrap.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 src/opnsense/www/js/jquery-sortable.js:684— `API[methodOrOptions].apply(object, args) || this` appears character-identically in 2 files — src/opnsense/www/js/jquery-sortable.js, src/opnsense/www/js/tokenize2.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 src/opnsense/www/js/bootstrap-select.js:96— `attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)` appears character-identically in 2 files — src/opnsense/www/js/bootstrap-select.js, src/opnsense/www/js/bootstrap.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 src/opnsense/www/js/jquery-sortable.js:212— `b[1] - a[1] || b[2] - a[2] || b[0] - a[0]` appears character-identically in 2 files — src/opnsense/www/js/jquery-sortable.js, src/opnsense/www/js/tokenize2.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 src/opnsense/www/js/jquery-sortable.js:404— `e.originalEvent || e.originalEvent.touches && e.originalEvent.touches[0]` appears character-identically in 2 files — src/opnsense/www/js/jquery-sortable.js, src/opnsense/www/js/tokenize2.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 src/opnsense/www/js/jquery-sortable.js:487— `e.which == 1 || e.type == "touchstart" && e.originalEvent.touches.length == 1` appears character-identically in 2 files — src/opnsense/www/js/jquery-sortable.js, src/opnsense/www/js/tokenize2.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 src/opnsense/www/js/jquery-sortable.js:565— `el.css("position") === "relative" || el.css("position") === "absolute" || el.css("position") === "fixed"` appears character-identically in 2 files — src/opnsense/www/js/jquery-sortable.js, src/opnsense/www/js/tokenize2.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 src/opnsense/www/js/jquery-sortable.js:201— `lastPointer && [lastPointer.left, lastPointer.top]` appears character-identically in 2 files — src/opnsense/www/js/jquery-sortable.js, src/opnsense/www/js/tokenize2.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 src/opnsense/www/js/bootstrap-select.js:117— `sanitizeFn && typeof sanitizeFn === 'function'` appears character-identically in 2 files — src/opnsense/www/js/bootstrap-select.js, src/opnsense/www/js/bootstrap.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 src/opnsense/www/js/jquery-sortable.js:256— `this.item.is(this.options.exclude) || !this.options.onMousedown(this.item, groupDefaults.onMousedown, e)` appears character-identically in 2 files — src/opnsense/www/js/jquery-sortable.js, src/opnsense/www/js/tokenize2.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 src/opnsense/www/js/jquery-sortable.js:316— `this.lastRelativePointer || this.lastPointer` appears character-identically in 2 files — src/opnsense/www/js/jquery-sortable.js, src/opnsense/www/js/tokenize2.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 src/opnsense/www/js/jquery-sortable.js:572— `this.options.nested && this.getContainerGroup(index)` appears character-identically in 2 files — src/opnsense/www/js/jquery-sortable.js, src/opnsense/www/js/tokenize2.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 src/opnsense/www/js/jquery-sortable.js:464— `this.rootGroup.options.handle || this.rootGroup.options.itemSelector` appears character-identically in 2 files — src/opnsense/www/js/jquery-sortable.js, src/opnsense/www/js/tokenize2.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 src/opnsense/www/js/bootstrap-select.js:10— `typeof define === 'function' && define.amd` appears character-identically in 5 files — src/opnsense/www/js/bootstrap-select.js, src/opnsense/www/js/bootstrap3-typeahead.js, src/opnsense/www/js/chartjs-plugin-streaming.js, src/opnsense/www/js/qrcode.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 src/opnsense/mvc/script/run_migrations.php:59— `!empty($classprefix) && strpos($classname, $classprefix) !== 0` appears character-identically in 2 files — src/opnsense/mvc/script/run_migrations.php, src/opnsense/mvc/script/run_validations.php. 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 src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php:212— `!empty($config->gateways) && count($config->gateways->children()) > 0` appears character-identically in 2 files — src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php, src/opnsense/mvc/app/models/OPNsense/Routing/Migrations/M1_0_0.php. 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 src/opnsense/mvc/app/library/OPNsense/Auth/LDAP.php:282— `!empty($config[$confSetting]) && property_exists($this, $objectProperty)` appears character-identically in 2 files — src/opnsense/mvc/app/library/OPNsense/Auth/LDAP.php, src/opnsense/mvc/app/library/OPNsense/Auth/Radius.php. 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.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 41 significant file(s) lose their only recent owner: REDACTED, src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php, src/opnsense/scripts/shell/setaddr.php, contrib/parallel-lint/src/Manager.php, src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/InterfaceField.php, src/opnsense/mvc/app/controllers/OPNsense/Base/ApiMutableServiceControllerBase.php, src/opnsense/mvc/app/library/OPNsense/Backup/Base.php, src/opnsense/mvc/app/models/OPNsense/Core/Firmware.php (+33 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 27 significant file(s) lose their only recent owner: src/opnsense/scripts/netflow/lib/aggregates/__init__.py, src/opnsense/scripts/filter/lib/alias/__init__.py, src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/ArrayField.php, src/opnsense/scripts/filter/lib/states.py, src/opnsense/mvc/app/library/OPNsense/Auth/AuthenticationFactory.php, src/opnsense/scripts/filter/lib/alias/geoip.py, src/opnsense/mvc/app/library/OPNsense/Auth/TOTP.php, REDACTED (+19 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 9 significant file(s) lose their only recent owner: src/opnsense/mvc/app/models/OPNsense/Kea/FieldTypes/KeaOptionDataField.php, src/opnsense/mvc/app/library/OPNsense/Interface/Idassoc.php, src/opnsense/mvc/app/models/OPNsense/Firewall/FieldTypes/AliasNameField.php, src/opnsense/scripts/filter/list_legacy_outbound_nat.php, src/opnsense/mvc/app/models/OPNsense/Interfaces/FieldTypes/VlanInterfaceField.php, src/opnsense/scripts/dnsmasq/get_dnsmasq_leases.py, src/opnsense/scripts/interfaces/reconfigure_gifs.php, src/opnsense/scripts/kea/del_kea_leases.py (+1 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 9 significant file(s) lose their only recent owner: src/opnsense/scripts/captiveportal/lib/db.py, src/opnsense/scripts/captiveportal/cp-background-process.py, src/opnsense/scripts/captiveportal/lib/ipfw.py, src/opnsense/mvc/app/library/OPNsense/Firewall/DNatRule.php, src/opnsense/mvc/app/models/OPNsense/Unbound/Migrations/M1_0_13.php, src/opnsense/site-python/duckdb_helper.py, src/opnsense/mvc/app/models/OPNsense/Unbound/FieldTypes/AliasReflector.php, src/opnsense/scripts/captiveportal/lib/pf.py (+1 more). Pair on, review, or document these before any departure.
Silent fallback default on parse failure src/opnsense/scripts/filter/lib/alias/__init__.py:194— `read_alias_file` returns `False` when `UnicodeDecodeError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. 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 on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure src/opnsense/scripts/interfaces/capture.py:72— `load_settings` returns `{}` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. 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 on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure src/opnsense/scripts/interfaces/ping.py:59— `load_settings` returns `{}` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. 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 on the handler or in the docstring, and the row stops firing.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 2 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (88 single-owned of 544 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated and example/demo trees and test files identified by path convention, largest first; 544 of the 926 production source files in this repository met that bar). They are anonymized user #5 (1 file(s)), anonymized user #6 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: src/opnsense/mvc/app/models/OPNsense/Trust/FieldTypes/CAsField.php, src/opnsense/scripts/system/disk_info.py.
D28 · Secrets (history)· Rotate the exposed credentials · ×1
REDACTED
D34 · Knowledge Freshness· Orphaned files with no living knowledge · ×1
Orphaned files with no living knowledge — 1 of 556 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated and example/demo trees and test files identified by path convention, largest first; 556 of the 926 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: src/opnsense/mvc/app/models/OPNsense/Monit/Migrations/M1_0_7.php. Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
Orphaned file src/opnsense/mvc/app/models/OPNsense/Monit/Migrations/M1_0_7.php:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
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.
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/2 async functions that make a cancellable request (fetch, axios, ky, ofetch) 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.
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.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 2 file(s) — `src/opnsense/mvc/app/library/OPNsense/Auth/SSOProviders/Provider.php`, `src/opnsense/mvc/app/library/OPNsense/System/SystemStatusCode.php` — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.
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.
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 01a15b97-25ff-7e03-91de-18bdf085e98b · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 27 · Warnings: 1194 · Recommendations: 43 — Appendix A · all findings · full markdown report.
Generated by Watchdog — deterministic code-health analysis. 20-10-2026 @ 23:13 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.