Public report of jgraph/drawio, published 17 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 17 November 2026, 19:21 UTC · Survey ID cd_22234a49cfed4940aad2d9c099c0c7fd
jgraph/drawio
Measured 17 November 2026, 19:16 UTC, at code version f411a11
First survey, so nothing to compare with yet
CAI scoreWeak
CriticalWeakAdequateStrongExemplary
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A very large codebase: 524,550 lines of product code in 2 projects, tests not counted · Estimated rebuild effort: about 3.1 person-years · Weakest lens: Code Health, 14.6
Findings by how serious they are
130 critical3243 serious166 minor
8 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
17 November 2026, 19:16 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
70of 70 dimensions measured by tools.
3523of 3539 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.
70dimensions across 7 lenses, read from 524,550 lines of product code in 2 projects.
jgraph/drawio falls short of our standard for production, held back most by its Code Health lens, the quality of the code itself. It scores 25.4 out of 100 and is rated Weak, and 18 of its 130 critical findings are security problems.
Code Health, at 14.6, is the weakest lens and counts most in the score. The best first steps are replacing the 12 exposed passwords or keys and switching the old ones off and replacing the 14 packages under a banned licence, each worth about 8.3 points. Raising Code Health to 70 would lift the score to about 34.0.
Twelve passwords or keys in the code and one in the code's history are open to anyone who can read the repository. Four pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with, and thirty-six images have no description for people who can't see them. Replacing each exposed password or key, pinning each tool to an exact version and describing the images would close these risks. Fixing the weaknesses the scanner points to would fix the security weakness in the code. The 25 form fields without a label need a label.
The product code is 524,550 lines, about €450,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Code Health rose from 14.6 to 70, the lowest score rated Strong, the score would rise from 25.4 to about 34.0.
Code composition: what the lines of code are
Product code 100%
Rebuild cost: about €450,000 · Estimate
Cost to rebuild
€150,000 to €740,000, for 2,472 to 7,842 hours of work, about 3.1 person-years for 1 to 6 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 25. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Very large: 524,550 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 12 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (5), REDACTED, REDACTED.
Raises the score by about 8.3 points · Medium effort · REDACTED Scanning
2
Resolve the 14 Banned license finding(s) in License Compliance — start with package-lock.json (14).
Raises the score by about 8.3 points · Medium effort · License Compliance
3
Resolve the 1 No automated tests finding(s) in Code Coverage.
Raises the score by about 9.9 points · High effort · Code Coverage
Diagnosis: what the measurements show together
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 €450,000 to build again, about 3.1 person-years of work. Its weakest lens is Code Health, at 14.6 (Critical). Code Health is about how easy the code is to read and change safely, and code that is hard to read is slow and risky to change, so every future change costs more than it should. Because the weakest lens counts most in the score, work on Code Health also moves the score most.
Based on: the rebuild estimate · the Code Health grade · how much each lens counts
What to do: Start with the Code Health actions in Top priorities.
If you do one thing first · First action
Resolve the 12 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 8.3 points for medium effort, because it clears the 12 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.0 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 11% on every change. The history of the code shows how much it changes: about 323,841 lines over the last 90 days, which is about 1,313,355 lines a year. At that pace, the extra work comes to an estimated 165.1 to 990.7 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
At a glance — Code Health · 14.6 · Critical · gated by D1, D2, R1, R2, R3, R7, 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
27
High / Critical
A07:2025 — Authentication Failures
13
High / Critical
A03:2025 — Software Supply Chain Failures
7
Medium
Roadmap
Top priorities: Resolve the 1 No automated tests finding(s) in Code Coverage; Resolve the 12 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (5), REDACTED, REDACTED; Resolve the 14 Banned license finding(s) in License Compliance — start with package-lock.json (14).
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 12 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (5), REDACTED, REDACTED.
Bring the 713 bodies over 30 down to 30 or less in Cognitive Complexity — start with Menus.Menus.init (cognitive 1480), addCompositeShape (cognitive 1227), EditorUi.EditorUi.installMessageHandler (cognitive 759).
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.
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 — 130
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 — 3243
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 — 166
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 8
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 70 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.
Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.
What we checked — 70 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, 3523 of 3539 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D16 Bus Factor — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Single-maintainer repository — bus factor is not applicable (2 contributor(s) across 131 commit(s) sampled, automation and bot accounts excluded). One of them holds 99% of the history; the other 1 hold 1% each on average, below the 5% at which there is somebody to hand the work to. That is a single maintainer with drive-by contributors, not a team whose knowledge has concentrated — so the bus factor is not applicable and there is nothing here for the owner to act on.
D20 ADR Quality — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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. Read, stating neither a host nor a published package: `etc/imageResize/package.json`, `etc/dependencies/package.json`.
D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. D21's naming rules read C# through Roslyn and every other language through its sidecar model; these languages are left out (PHP's reading is its own change, a Roslyn-loaded VB or F# project has no population builder yet). Their declarations carry no naming verdict this run — this says nothing about whether their names are consistent.
D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is an ADMISSION gap, not an environment fault: no published-package marker D22 reads admitted any project here. D22 DOES collect the public API of every language in this tree, and admits a project only when its manifest makes that ecosystem's publication act in a form the marker recognises — so what is missing is not a collector but an admission rule for the publication act this repository makes, if it makes one. The remedy is a better discriminator for that marker — not a collector, and no change to the scan image can close it. The marker's rules are measured to refuse applications, so one refused repository is the rule working as calibrated; several are the evidence that it is too strict. For npm the surface is what a published package.json's entry points (exports, main, module, types) export, followed through the source; an entry that names build output the tree does not commit (dist/, build/) is not followed back to source, because only a tsconfig outDir/rootDir pair states that mapping and a bundler's input lives in executable configuration this engine does not evaluate.
D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
D26 Project Cohesion — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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.
D28 Secrets (history) — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. No commit of the history (2135 commits) was scanned. `gitleaks` TIMED OUT after 196.5s against a 196.5s budget, so we killed its process tree. The budget is ours; the work may simply be larger than it allows. The working tree WAS scanned in full, and every row of the scanned ranges is reported. Nothing about the unscanned commits is asserted by the absence of a result; the budget is ours to raise.
D28 Secrets (history) — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. D28's config-credential rule (WD-SECRET-0002) parses each committed `.json` config as a document and reads credential-named values; `src/main/webapp/monday-app-association.json` did not parse (JSON5, a template, several concatenated documents), so a credential bound there is UNMEASURED by that rule. gitleaks still scanned the same files as text.
D28 Secrets (history) — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. D28's history password rule (WD-SECRET-0005) walks the history with git, and walking the history with `git log -p` outran its 196 s budget — so its 0 row(s) are what was read before it stopped, not a statement that the rest of the history holds no such password.
D28 Secrets (history) — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. D28's history private-key rule (WD-SECRET-0006) walks the history with git, and walking the history with `git log -p` outran its 196 s budget — so its 0 row(s) are what was read before it stopped, not a statement that the rest of the history holds no such key.
D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `src/main/webapp/js/diagramly/Dialogs.js`, `REDACTED`, `src/main/webapp/js/embed.dev.js`, `src/main/webapp/js/grapheditor/Shapes.js`, `src/main/webapp/mxgraph/mxClient.js` 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This dimension reads a project's own statement about the platform it runs on: a TargetFramework in a .NET project file, a .nvmrc or .python-version, a capped requires-python, a Rust toolchain file or Cargo.toml rust-version, a .go-version, .java-version, .ruby-version, .tool-versions or .sdkmanrc, a go.mod go directive, a Maven or Gradle Java level or toolchain, a Gemfile's ruby directive, a mix.exs elixir requirement, a rebar.config minimum_otp_vsn, a pubspec.yaml SDK constraint, a build.sbt scalaVersion, or a framework major pinned by a dependency constraint. This repository carries none of them, so nothing about its platform was established. That is a gap in this analyzer's coverage, NOT a finding that the platform is supported — a language whose runtime is declared elsewhere (Package.swift, a Dockerfile) is simply not read here yet.
AC1 Text alternatives — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 2 further occurrence(s) are not listed individually; the score already reflects all 42.
AC2 Forms & labels — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 37 further occurrence(s) are not listed individually; the score already reflects all 77.
AXB1 Runtime evidence locked — no reproducible boot — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Subject: 72 markup document(s) — HTML, Razor, JSX, Vue, Svelte or server templates. The Runtime Evidence tier boots an app only via docker-compose, an Aspire AppHost, a Dockerfile, an npm dev script, a web service's own toolchain entry point (cargo, go, dotnet, Python, Spring Boot), or an Android app's own Gradle wrapper (run on an emulator); an Apple or Flutter app needs a host it lacks. None applied, so no live runtime a11y/egress/header evidence was collected. You can widen what we reach: add a docker-compose.yml (or an Aspire AppHost) that brings the app up with its dependencies. We then boot it in an isolated sandbox and gathers real runtime evidence — you change nothing in your pipeline (no CI step, no SDK).
GD1 Unfinished & placeholder code — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 52 further occurrence(s) are not listed individually; the score already reflects all 92.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
P1 CI/CD gates — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. A CI pipeline exists and the word "test" appears, but no explicit test-runner invocation (your stack's test command, or a test job) was matched — so either the gate runs tests through a step this pass could not recognise, or "test" is incidental here (a path, "latest", a reporter). Which of the two it is cannot be settled from this dimension's evidence; the coverage dimensions report whether a suite exists at all. You can widen what we reach: name the test runner explicitly in the pipeline step (your stack's test command, or a job named for the suite) so the gate is unambiguous to a reader and to this pass.
P5 DR & Backup — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
R10 Code Duplication — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 931 further occurrence(s) are not listed individually; the score already reflects all 971.
R2 Cyclomatic Complexity — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 1698 further occurrence(s) are not listed individually; the score already reflects all 1738.
R3 Large Files — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 142 further occurrence(s) are not listed individually; the score already reflects all 182.
R7 Dead Code — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 19 further occurrence(s) are not listed individually; the score already reflects all 59.
X10 Duplicated predicate — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 131 further occurrence(s) are not listed individually; the score already reflects all 171.
X24 Document value interpolated into markup unescaped — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 77 further occurrence(s) are not listed individually; the score already reflects all 117.
X27 Collection changed while being enumerated — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X3 Exception handling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 380 further occurrence(s) are not listed individually; the score already reflects all 420.
X4 Structured logging — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Python, PHP, Dart, Ruby, Scala, Rust, Go, Swift, Erlang, F# and Visual Basic source only, and no C# was loaded, and this repository's JavaScript/TypeScript, Python and PHP log through no library that carries a message's values as fields (pino, winston, bunyan, tslog, LogTape, roarr; Python's logging, structlog; PHP's PSR-3 loggers), so its log calls cannot be judged, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D8 Code Coverage: Coverage is measured by building and running the test suite inside our isolated image — the target repo is never modified, and nothing on your systems runs. So coverage exists only when the suite builds and runs within the inline time budget; one that needs external services, can't build, or exceeds the budget yields no coverage (D8 then degrades to not-measured, not a low score). Line coverage also says nothing about assertion quality.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
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").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
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").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
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.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
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.
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: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
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.
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.
1735 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was Menus.Menus.init at 1146. A further 16 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 EditorUi.EditorUi.createSpinner at 30 — they are counted neither in the figure above nor in this dimension's score.
+ 981 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 93 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with Menus.Menus.init (cyclomatic 1146), Extensions.addCompositeShape (cyclomatic 845), Actions.Actions.init (cyclomatic 359). — 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 93 together lifts Cyclomatic 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.
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.
+ 1465 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 713 bodies over 30 down to 30 or less in Cognitive Complexity — start with Menus.Menus.init (cognitive 1480), addCompositeShape (cognitive 1227), EditorUi.EditorUi.installMessageHandler (cognitive 759). — 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 713 together lifts Cognitive Complexity from 2.0 to about 5.6/10, projected with the scoring formula itself and assuming each lands exactly at 30; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes8.9 / 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 103 FileTooLong finding(s) in God Classes — start with REDACTED (2), REDACTED (2), Editor.js (2). — One of this dimension's main actionable groups (103 warning-level).
Resolve the 16 FunctionTooLong finding(s) in God Classes — start with export.js, P2PCollab.js, trees.js. — One of this dimension's main actionable groups (16 warning-level).
Resolve the 3 MethodTooLong finding(s) in God Classes — start with REDACTED, AbsAuth.java, EmbedServlet2.java. — One of this dimension's main actionable groups (3 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.
21 duplicated block group(s) detected. 0.1 % of the production lines (607 of 524,550) are in a reported copy. A further 5 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. Measured on part of this repository only: .js (99% of production source) was not exposed to THIS dimension's token comparison and is not in this count; duplication there is measured by R10 Code Duplication, the frontend lens's card running the same clone algorithm over the JS/TS token stream.
Duplicated block (8 lines × 3) · ×2REDACTED:489
Duplicated block (5 lines × 3) · ×2REDACTED:537
Members sharing a duplicated core (4 members, 50+ identical tokens)src/main/server/java/com/mxgraph/online/DropboxAuth.java:39
Edited copy of a member (49 corresponding lines)src/main/server/java/com/mxgraph/online/mxBase64.java:103
Edited copies of one member (3 members, 58+ corresponding lines)src/main/server/java/com/mxgraph/online/mxBase64.java:221
+ 19 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 2 Duplicated block (8 lines × 3) finding(s) in Code Duplication — start with REDACTED (2). — One of this dimension's main actionable groups (2 warning-level).
Resolve the 2 Duplicated block (5 lines × 3) finding(s) in Code Duplication — start with REDACTED (2). — One of this dimension's main actionable groups (2 warning-level).
Resolve the 1 Members sharing a duplicated core (4 members, 50+ identical tokens) finding(s) in Code Duplication — start with DropboxAuth.java. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.
Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.
Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.
2 production modules (npm), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations, and main-sequence distance (abstractness) is not computed for these modules yet.
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.
What it measures: How much of the code is actually exercised by tests.
Method: Coverage from the analyzer's own run of the suite, computed per-file with structured exclusions for generated, trivial, and glue code. A coverage report found in the repository is never read. When the suite can't be built/run in-image, coverage is reported NOT-MEASURED (excluded from the score) with the precondition to make it measurable — never a LoC-ratio proxy folded in as if measured. Deterministic.
What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.
2 outdated direct production npm dependency(ies) of 3 graded, 0 pinning defect(s), across 2 package.json (2 of them the product) and 1 committed lockfile(s). Development dependencies are deliberately not graded for currency: that grade is about what SHIPS. 1 direct dependency(ies) — production, development or optional — are marked DEPRECATED by their publisher (the registry's per-version mark, or the lockfile's copy of it when the registry could not be asked); deprecated transitive packages are listed but not charged. Whether any is UNMAINTAINED is not graded — the registry publishes no maintenance status, and release age does not stand in for one. Whether any is UNUSED is not graded either: that is a source question, and the frontend dependency lens (R8) answers it in this same run. Known CVEs in this dependency graph are D30's question, read from the manifest there.
Resolve the 1 Deprecated finding(s) in Dependency Hygiene — start with package.json. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d12_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 12 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED (5), REDACTED, REDACTED. — One of this dimension's main actionable groups (12 issue-level).
Detailed fixes: d13_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
14 of 46 shipped npm package(s) use a banned license. Licences were resolved from registry.npmjs.org over the 46 package(s) this repository's committed lockfile installs for a consumer — its 3 production, optional and peer dependency(ies), across 2 product package.json manifest(s), and everything those install in turn. Its 0 `devDependencies` declaration(s), and every package only they reach, are excluded: a consumer installs none of them. ★ Each licence is the one the registry publishes for the package's CURRENT release rather than for the pinned version, which is the same caveat the Hex and RubyGems arms carry. Third-party code that ships WITHOUT a manifest entry was read too: 19 component(s) whose licence travels in the tree (vendored or copied-in directories, licence comments preserved in committed bundles, compiled wasm modules) and 0 bundled package(s) named only by a bundle's module path, graded on the registry; 0 use a banned licence. 1 vendored, copied-in or compiled component(s) state no licence this pass can read — missing data, not charged. This repository publishes itself under Apache-2.0 / ISC, which is its own choice and is not judged here.
Resolve the 14 Banned license finding(s) in License Compliance — start with package-lock.json (14). — One of this dimension's main actionable groups (14 issue-level).
Detailed fixes: d14_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 56 Hotspot finding(s) in Churn × Complexity Hotspots — start with Menus.js (2), REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (56 warning-level).
Detailed fixes: d15_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.
5 deducted task-comment markers across 4153 LoC (0.1/KLoC) → score 9.8. 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 5 TodoComment finding(s) in Explicit Debt — start with AbsAuth.java (2), CacheFacade.java, EmbedServlet2.java. — One of this dimension's main actionable groups (5 warning-level).
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.
0 of 1 documentation facets pass in full; short on: F2 example. 11 document(s) read across 3 unit(s).
Documentation: no build, run or usage example · ×2README.md:1
What to do
Resolve the 2 Documentation finding(s) in Documentation Quality — start with README.md (2). — One of this dimension's main actionable groups (2 recommendation-level).
Detailed fixes: d19_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: Seven vocabulary-free rules (N1-N7) mine each naming convention from the repository and flag a name that breaks a convention its structural peers in the same unit follow; production C# and TypeScript, each its own population. Deterministic, no model, no sample. Advisory.
2 naming inconsistencies among 61 declarations measured against a convention their peers follow.
`mxGraphMlCodec` spells `Ml` where 43 names in the project spell it `ML`REDACTED:5
`mxShapeDFDDataStoreID` spells `ID` where 16 names in the project spell it `Id`src/main/webapp/shapes/mxDFD.js:243
What to do
Resolve the 1 `mxGraphMlCodec` spells `Ml` where 43 names in the project spell it `ML` finding(s) in Naming Consistency — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 `mxShapeDFDDataStoreID` spells `ID` where 16 names in the project spell… finding(s) in Naming Consistency — start with mxDFD.js. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d21_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether comments are worth it — explaining WHY (valuable) rather than WHAT (redundant).
Method: Every inline C# comment compared word by word with the identifiers, literals and constructs of the code it annotates (taken from the syntax); a comment whose words that code already contains is redundant, as are closing-brace labels and generator template text. Comments giving a reason or a reference are kept; other scripts and languages are not judged. Deterministic, exhaustive, advisory.
doc comments repeat the namessrc/main/webapp/js/diagramly/EditorUi.js:22742
What to do
Resolve the 62 redundant comment finding(s) in Comment Value — start with REDACTED (5), ElectronApp.js (3), Menus.js (3). — One of this dimension's main actionable groups (62 recommendation-level).
Detailed fixes: d24_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
59 % of calls cross a namespace and 0 % go through an interface, but 100 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated.
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. History coverage: No commit of the history (2135 commits) was scanned. `gitleaks` TIMED OUT after 196.5s against a 196.5s budget, so we killed its process tree. The budget is ours; the work may simply be larger than it allows.
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).
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).
27 finding(s): 0 critical, 5 high, 22 medium, 0 low. 4 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 70 file(s) — `src/main/webapp/js/diagramly/App.js`, `src/main/webapp/js/diagramly/ConfigEditor.js`, `src/main/webapp/js/diagramly/Dialogs.js`, `src/main/webapp/js/diagramly/DiffSync.js`, `REDACTED`, … (+65 more) — so no absence of findings in them is evidence of anything, and nothing in them was analysed. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them.
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
+ 5 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 10 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (10 warning-level).
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
No action in Static Analysis (SAST) — all 4 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (4 issue-level, 0 of them charged here).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
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.
Every significant source file has living knowledge — recently and meaningfully worked. Counted over 314 of the 376 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.
What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.
Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d36_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.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
No dependency in any ecosystem this repository declares is published as malicious.
✓ On the Gold path — maintain.
Detailed fixes: d43_recommendation.md.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC1 · Text alternatives2.6 / 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. (×36) — etc/dependencies/dompurify-smoke.js:122, etc/dependencies/dompurify-smoke.js:129, etc/dependencies/dompurify-smoke.js:142, …
A <object> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content. — etc/dependencies/dompurify-smoke.js:145
An <embed> has no fallback-content mechanism, so it needs an aria-label/aria-labelledby/title to be described. — etc/dependencies/dompurify-smoke.js:145
A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content. (×2) — src/main/webapp/js/diagramly/mxRuler.js:101, REDACTED:827
What to do
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Do you agree with this assessment?
AC2 · Forms & labels4.9 / 10Weak✓ Tool-verified
Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.
Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label. — src/main/webapp/js/diagramly/App.js:3313
This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×12) — src/main/webapp/js/diagramly/App.js:5880, src/main/webapp/js/diagramly/App.js:6061, src/main/webapp/js/diagramly/ConfigEditor.js:1965, …
This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label. (×13) — src/main/webapp/js/diagramly/ConfigEditor.js:1905, src/main/webapp/js/diagramly/ConfigEditor.js:1938, src/main/webapp/js/diagramly/ConfigEditor.js:2154, …
This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id. (×13) — src/main/webapp/js/diagramly/ConfigEditor.js:1935, src/main/webapp/js/diagramly/ConfigEditor.js:2151, src/main/webapp/js/diagramly/ConfigEditor.js:2160, …
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). — src/main/webapp/js/diagramly/ConfigEditor.js:1939
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.2 / 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.
A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope). (×9) — etc/dependencies/dompurify-smoke.js:120, src/main/webapp/js/diagramly/App.js:9627, src/main/webapp/js/diagramly/Editor.js:14882, …
An iframe with no title (or an empty one) is announced only as "frame". Add a non-empty title describing its content, or an aria-label. — etc/dependencies/dompurify-smoke.js:136
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. (×7) — src/main/webapp/clear.html:2, src/main/webapp/index.html:2, src/main/webapp/js/diagramly/Dialogs.js:781, …
The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en"). (×6) — src/main/webapp/index.html:2, src/main/webapp/js/diagramly/Dialogs.js:781, src/main/webapp/js/diagramly/Menus.js:829, …
user-scalable=no/0 or a maximum-scale below 2 stops low-vision users zooming to 200%. Remove the zoom restriction from the viewport meta. (×2) — src/main/webapp/index.html:14, src/main/webapp/teams.html:14
An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative. (×3) — REDACTED:2900, REDACTED:2915, src/main/webapp/plugins/props.js:123
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. (×18) — src/main/webapp/js/diagramly/App.js:1630, src/main/webapp/js/diagramly/App.js:7955, src/main/webapp/js/diagramly/App.js:8013, …
The repo's own CSS styles .closeBtn 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. — src/main/webapp/js/diagramly/App.js:8309
The repo's own CSS styles .notification with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. — src/main/webapp/js/diagramly/App.js:8367
The repo's own CSS styles .geLibraryButton with `cursor: pointer`, so this <img> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. (×2) — src/main/webapp/js/diagramly/Dialogs.js:12672, src/main/webapp/js/diagramly/Dialogs.js:12983
The repo's own CSS styles .geSwitcherDot with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. (×2) — src/main/webapp/js/diagramly/Editor.js:10159, src/main/webapp/js/grapheditor/Format.js:9641
This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, 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/main/webapp/js/diagramly/tidy/TidyWindow.js:341
The repo's own CSS styles .geFormatTitle with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. — src/main/webapp/js/grapheditor/Format.js:323
The repo's own CSS styles .geColorDropper with `cursor: pointer`, so this <img> 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. — src/main/webapp/js/grapheditor/Format.js:1527
A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler. (×2) — src/main/webapp/js/onedrive/mxODPicker.js:531, src/main/webapp/js/onedrive/mxODPicker.js:656
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.
The radio role requires aria-checked to convey its state. Add it. (×2) — src/main/webapp/js/diagramly/LightboxModern.js:261, src/main/webapp/js/diagramly/LightboxModern.js:2987
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.
`span.geCommentsBadge` sets color: #ffffff on background-color: #d74134 — 4.4:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — src/main/webapp/styles/grapheditor.css:4697
`.geDarkMode .mxPopupMenuItem>div:not(:has(img))` 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/main/webapp/styles/grapheditor.css:449
`.geGenerateDiagramDescription` 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/main/webapp/styles/grapheditor.css:887
`.geDiagramContainer` 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/main/webapp/styles/grapheditor.css:1194
`.geFocusLabel:focus-visible` 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/main/webapp/styles/grapheditor.css:1454
`.geTidyPanel: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/main/webapp/styles/grapheditor.css:3644
`.geOmnibox .geOmniboxBar input:not(.geButton)` 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/main/webapp/styles/grapheditor.css:5347
`.mxCellEditor` 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/main/webapp/mxgraph/css/common.css:20
`.geToolbarContainer.geVerticalToolbar` moves (`transition: transform 0.1s ease-out`) 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/main/webapp/styles/grapheditor.css:1776
`.geCollapsibleTitle::before` moves (`transition: transform 0.15s 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. — src/main/webapp/styles/grapheditor.css:2076
`.geSidebar .geItem` moves (`transition: transform 100ms ease-out`) 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/main/webapp/styles/grapheditor.css:2357
`.geTidyPanel .geTidyToggle input[type="checkbox"]::after` moves (`transition: left 0.15s`) 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/main/webapp/styles/grapheditor.css:3871
`.geTextOutlineToggle img` moves (`transition: transform 0.15s 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. — src/main/webapp/styles/grapheditor.css:4006
`.geNotification-bell` moves (`animation: geBellAnim 1s 1s both`) 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/main/webapp/styles/grapheditor.css:4798
`.geBell-rad` moves (`animation: geRadAnim 1s 2s both`) 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/main/webapp/styles/grapheditor.css:4853
`.geNotification-count` moves (`animation: geZoomAnim 1s 1s both`) 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/main/webapp/styles/grapheditor.css:4868
`.geNotifPanel .notifications .notification:nth-child(n+1)` moves (`animation: geHere-am-i 0.5s ease-out 0.4s`) 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/main/webapp/styles/grapheditor.css:4998
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.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.
Other · Code Health — Unreviewed-generation residue in this repository's JavaScript/TypeScript: functions whose whole body still throws a "not implemented" error, and placeholder text (lorem ipsum, changeme/replace_me…) left in strings and JSX of non-test, non-generated code. Scored as a quality signature, never as a claim about authorship.
Method: Roslyn syntax scan: NotImplementedException throws and placeholder string literals in non-test, non-generated shipped code. Deterministic, code-shape signature.
A placeholder string ("<font style="font-size: 14px">Lorem ipsu…") is still in shipped code — typical of generated boilerplate that was never filled in. — REDACTED:39
A placeholder string ("<span style="font-family: "open san…") is still in shipped code — typical of generated boilerplate that was never filled in. — REDACTED:42
A placeholder string ("Lorem ipsum dolor sit amet, consectetur …") is still in shipped code — typical of generated boilerplate that was never filled in. (×33) — REDACTED:553, src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:89, src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:208, …
A placeholder string ("<font style="font-size: 18px">Lorem ipsu…") is still in shipped code — typical of generated boilerplate that was never filled in. (×3) — REDACTED:1190, REDACTED:1204, REDACTED:1219
A placeholder string (" - Lorem ipsum dolor sit amet<br>") is still in shipped code — typical of generated boilerplate that was never filled in. (×2) — src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:72, src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:137
What to do
Finish or delete the functions that still throw "not implemented", and replace placeholder text before shipping.
Other · Code Health — Unfinished work detected by code SHAPE, not keywords, in this repository's JavaScript/TypeScript: functions that only throw a "not implemented" error, functions that take inputs and return a constant or do nothing, async functions that never await, dead `if (false)` branches, and skeleton classes most of whose methods are holes.
Method: Roslyn syntax scan: incompleteness by code shape (constant-returning methods, async-never-await, #if false branches, guards that return what the code already falls through to, tests an earlier guard already decided, comparisons against NaN, skeleton types), not keyword-gated. Deterministic, code-shape heuristic.
Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition. (×6) — REDACTED:14, src/main/webapp/js/grapheditor/Shapes.js:10014, src/main/webapp/js/grapheditor/Shapes.js:10015, …
The guard above `return style;` also returns `style`, so no input can make it matter. Implement the distinction that was intended, or delete the guard. — src/main/webapp/js/diagramly/miro/MiroImporter.js:183
What to do
Remove the dead code that looks live: delete dead if(false) branches, which read as logic that runs, and either do the real async work or drop the async keyword from fake-async functions, which promise work they never wait for.
Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
What to do
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Maturity · Maturity — Whether 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 repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
Do you agree with this assessment?
P1 · CI/CD gates8.5 / 10Strong✓ 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.
What to do
Run the test suite in CI via an explicit runner step for your stack, and gate merges on it.
Do you agree with this assessment?
P2 · Observability7.5 / 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 spotbugs with find-sec-bugs (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 3 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.
`etc/dependencies/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — etc/dependencies/package.json:11
What to do
Add a SAST step to CI running what this repository's stack ships: spotbugs with find-sec-bugs — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing.
Enable Dependabot/Renovate or a dependency-review gate.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
The release is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever the release trigger points at is published to users unreviewed, so a mistagged or unverified commit ships and the only remedy is a follow-up release. — REDACTED:28
What to do
Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
Do you agree with this assessment?
R1 · Type Safety0.0 / 10Critical✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
0 typed · 352 plain JS — the untyped files are etc/dependencies/dompurify-smoke.js, etc/imageResize/drawImageResize.js, etc/integrate/Integrate.js, src/main/webapp/connect/common/js/mxReader.js, src/main/webapp/js/PostConfig.js, src/main/webapp/js/PreConfig.js (+346 more).
What to do
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
React / JS · Code Health — The share of the scored frontend lines inside a near-exact copy-pasted block of substantial extent (the D4 clone algorithm over JS/TS tokens, D-386; each line once, 10 at none and 0 at a quarter of the lines, as D4): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Scored on the share of the scored frontend lines inside a reported copy, on the same curve as D4. Deterministic.
16 duplicated blocks under src/main/webapp/js/ have copies in at least two of the sibling directories diagramly, grapheditor — 4 of them are reported below, and 12 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 16 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 16 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 16 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — src/main/webapp/js/diagramly/ForceExplorer.js:1089
src/main/webapp/js/diagramly/GitHubClient.js:135 · src/main/webapp/js/diagramly/GitLabClient.js:94 — the two spans are one implementation copied and then locally edited — 2048 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/main/webapp/js/diagramly/GitHubClient.js:135
src/main/webapp/js/diagramly/GitHubClient.js:950 · src/main/webapp/js/diagramly/GitLabClient.js:845 — the two spans are one implementation copied and then locally edited — 2460 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/main/webapp/js/diagramly/GitHubClient.js:950
REDACTED:5 · src/main/webapp/js/embed.dev.js:5 — these 2 files are line-for-line copies of one another — 375 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — REDACTED:5
src/main/webapp/js/diagramly/Editor.js:13312 · src/main/webapp/js/diagramly/gif/AnimationExport.js:894 — the two spans are one implementation copied and then locally edited — 733 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/main/webapp/js/diagramly/Editor.js:13312
src/main/webapp/js/diagramly/GitHubClient.js:776 · src/main/webapp/js/diagramly/GitLabClient.js:647 — the two spans are one implementation copied and then locally edited — 708 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/main/webapp/js/diagramly/GitHubClient.js:776
src/main/webapp/js/diagramly/GitHubFile.js:151 · src/main/webapp/js/diagramly/OneDriveFile.js:470 — the two spans are one implementation copied and then locally edited — 558 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/main/webapp/js/diagramly/GitHubFile.js:151
src/main/webapp/js/diagramly/DriveFile.js:275 · src/main/webapp/js/diagramly/OneDriveFile.js:667 — the two spans are one implementation copied and then locally edited — 352 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/main/webapp/js/diagramly/DriveFile.js:275
src/main/webapp/js/diagramly/Dialogs.js:7650 · src/main/webapp/js/diagramly/Dialogs.js:7803 — 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/main/webapp/js/diagramly/Dialogs.js:7650
src/main/webapp/js/diagramly/Pages.js:742 · src/main/webapp/js/diagramly/Pages.js:843 — the two spans are one implementation copied and then locally edited — 204 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/main/webapp/js/diagramly/Pages.js:742
src/main/webapp/js/diagramly/LightboxModern.js:2709 · src/main/webapp/js/diagramly/ViewerModern.js:2264 — the two spans are one implementation copied and then locally edited — 348 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/main/webapp/js/diagramly/LightboxModern.js:2709
src/main/webapp/js/diagramly/Minimal.js:60 · src/main/webapp/js/diagramly/Minimal.js:129 — the two spans are one implementation copied and then locally edited — 239 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/main/webapp/js/diagramly/Minimal.js:60
src/main/webapp/js/diagramly/App.js:6241 · src/main/webapp/js/diagramly/ElectronApp.js:2518 — 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/main/webapp/js/diagramly/App.js:6241
etc/integrate/Integrate.js:35 · src/main/webapp/js/diagramly/Editor.js:6227 — the two spans are one implementation copied and then locally edited — 164 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. — etc/integrate/Integrate.js:35
src/main/webapp/js/diagramly/DriveClient.js:2058 · src/main/webapp/js/diagramly/OneDriveClient.js:746 — 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/main/webapp/js/diagramly/DriveClient.js:2058
src/main/webapp/js/diagramly/Dialogs.js:27360 · src/main/webapp/js/diagramly/Dialogs.js:28323 — 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/main/webapp/js/diagramly/Dialogs.js:27360
REDACTED:8537 · REDACTED:8752 — 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:8537
src/main/webapp/js/diagramly/Dialogs.js:157 · src/main/webapp/js/diagramly/Dialogs.js:5184 — 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/main/webapp/js/diagramly/Dialogs.js:157
src/main/webapp/js/diagramly/DiffSync.js:647 · src/main/webapp/js/diagramly/DiffSync.js:784 — 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/main/webapp/js/diagramly/DiffSync.js:647
src/main/webapp/js/diagramly/Editor.js:2563 · src/main/webapp/js/diagramly/util/mxJsCanvas.js:463 — the two spans are one implementation copied and then locally edited — 326 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/main/webapp/js/diagramly/Editor.js:2563
src/main/webapp/js/diagramly/LightboxModern.js:2465 · src/main/webapp/js/diagramly/ViewerModern.js:2099 — 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/main/webapp/js/diagramly/LightboxModern.js:2465
REDACTED:617 · REDACTED:655 — 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. — REDACTED:617
src/main/webapp/js/diagramly/sidebar/Sidebar-UML25.js:85 · src/main/webapp/js/diagramly/sidebar/Sidebar-UML25.js:257 — the two spans are one implementation copied and then locally edited — 300 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/main/webapp/js/diagramly/sidebar/Sidebar-UML25.js:85
src/main/webapp/js/diagramly/util/mxAsyncCanvas.js:90 · src/main/webapp/js/diagramly/util/mxJsCanvas.js:320 — 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/main/webapp/js/diagramly/util/mxAsyncCanvas.js:90
REDACTED:7534 · REDACTED:11810 — 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. — REDACTED:7534
REDACTED:886 · REDACTED:2314 — 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. — REDACTED:886
src/main/webapp/js/export.js:292 · src/main/webapp/js/export.js:364 — the two spans are one implementation copied and then locally edited — 157 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/main/webapp/js/export.js:292
src/main/webapp/js/diagramly/EditorUi.js:10992 · src/main/webapp/js/diagramly/EditorUi.js:11283 — 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/main/webapp/js/diagramly/EditorUi.js:10992
src/main/webapp/js/diagramly/ElectronApp.js:2148 · src/main/webapp/js/diagramly/ElectronApp.js:2254 — 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/main/webapp/js/diagramly/ElectronApp.js:2148
REDACTED:8031 · REDACTED:8069 — 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:8031
REDACTED:13086 · REDACTED:13169 — 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:13086
src/main/webapp/js/diagramly/LibavoidRouting.js:2007 · src/main/webapp/js/diagramly/LibavoidRouting.js:3732 — the two spans are one implementation copied and then locally edited — 354 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/main/webapp/js/diagramly/LibavoidRouting.js:2007
REDACTED:1868 · REDACTED:1935 — 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:1868
src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:898 · src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:933 — 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/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:898
src/main/webapp/js/diagramly/util/mxAsyncCanvas.js:51 · src/main/webapp/js/diagramly/util/mxJsCanvas.js:97 — 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/main/webapp/js/diagramly/util/mxAsyncCanvas.js:51
src/main/webapp/js/diagramly/Dialogs.js:27286 · src/main/webapp/js/diagramly/Dialogs.js:28226 — 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/main/webapp/js/diagramly/Dialogs.js:27286
src/main/webapp/js/diagramly/EditorUi.js:9681 · src/main/webapp/js/diagramly/EditorUi.js:13847 — 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/main/webapp/js/diagramly/EditorUi.js:9681
src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:572 · src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:606 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:572
REDACTED:2405 · REDACTED:2525 — 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. — REDACTED:2405
src/main/webapp/js/diagramly/EditorUi.js:21424 · src/main/webapp/js/diagramly/EditorUi.js:21641 — 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/main/webapp/js/diagramly/EditorUi.js:21424
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.
addCompositeShape has cyclomatic complexity 842 and cognitive complexity 1222; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:7711
doImportCsv has cyclomatic complexity 319 and cognitive complexity 732; 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/main/webapp/js/diagramly/EditorUi.js:39560
configure has cyclomatic complexity 202 and cognitive complexity 415; 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/main/webapp/js/diagramly/Editor.js:3441
(anonymous) has cyclomatic complexity 176 and cognitive complexity 415; 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/main/webapp/js/diagramly/EditorUi.js:32406
strictDrawShape has cyclomatic complexity 165 and cognitive complexity 211; 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/main/webapp/js/grapheditor/Shapes.js:6106
renderPage has cyclomatic complexity 124 and cognitive complexity 217; 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/main/webapp/js/export.js:1626
(anonymous) has cyclomatic complexity 124 and cognitive complexity 193; 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/main/webapp/js/grapheditor/Sidebar.js:6836
getHexagonPerimeterPoint has cyclomatic complexity 114 and cognitive complexity 187; 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/main/webapp/mxgraph/src/view/mxPerimeter.js:487
OrthConnector has cyclomatic complexity 106 and cognitive complexity 152; 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/main/webapp/mxgraph/src/view/mxEdgeStyle.js:1141
SegmentConnector has cyclomatic complexity 105 and cognitive complexity 162; 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/main/webapp/mxgraph/src/view/mxEdgeStyle.js:600
main has cyclomatic complexity 103 and cognitive complexity 179; 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/main/webapp/js/diagramly/App.js:1006
(anonymous) has cyclomatic complexity 102 and cognitive complexity 262; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:643
(anonymous) has cyclomatic complexity 101 and cognitive complexity 305; 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/main/webapp/js/diagramly/Editor.js:13055
render has cyclomatic complexity 101 and cognitive complexity 158; 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/main/webapp/js/export.js:234
(anonymous) has cyclomatic complexity 90 and cognitive complexity 157; 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/main/webapp/js/diagramly/Menus.js:7058
drawNode has cyclomatic complexity 85 and cognitive complexity 202; 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/main/webapp/mxgraph/src/shape/mxStencil.js:650
paintVertexShape has cyclomatic complexity 81 and cognitive complexity 119; 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/main/webapp/shapes/mxKubernetes.js:196
executeBatch has cyclomatic complexity 80 and cognitive complexity 201; 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/main/webapp/js/diagramly/gif/AnimationExport.js:714
extract has cyclomatic complexity 79 and cognitive complexity 116; 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/main/webapp/js/diagramly/tidy/TidyFeatures.js:133
init has cyclomatic complexity 79 and cognitive complexity 101; 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/main/webapp/js/diagramly/EditorUi.js:22767
getControlPoints has cyclomatic complexity 78 and cognitive complexity 124; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:13860
search has cyclomatic complexity 77 and cognitive complexity 138; 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/main/webapp/js/diagramly/Dialogs.js:10115
applyEdgesText has cyclomatic complexity 76 and cognitive complexity 122; 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/main/webapp/js/diagramly/EditorUi.js:36312
showExportDialog has cyclomatic complexity 76 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/main/webapp/js/diagramly/EditorUi.js:11787
handleCompoundShape has cyclomatic complexity 72 and cognitive complexity 124; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:1267
mouseMove has cyclomatic complexity 69 and cognitive complexity 157; 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/main/webapp/mxgraph/src/handler/mxConnectionHandler.js:1248
mouseMove has cyclomatic complexity 69 and cognitive complexity 112; 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/main/webapp/mxgraph/src/handler/mxGraphHandler.js:1237
fireMouseEvent has cyclomatic complexity 69 and cognitive complexity 102; 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/main/webapp/mxgraph/src/view/mxGraph.js:14371
plan has cyclomatic complexity 68 and cognitive complexity 61; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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/main/webapp/js/diagramly/tidy/Tidy.js:1412
addLabels has cyclomatic complexity 67 and cognitive complexity 170; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:2486
execute has cyclomatic complexity 67 and cognitive complexity 139; 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/main/webapp/js/diagramly/EditorUi.js:22110
NewDialog has cyclomatic complexity 67 and cognitive complexity 73; 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/main/webapp/js/diagramly/Dialogs.js:2386
setTextColor has cyclomatic complexity 66 and cognitive complexity 108; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:3297
init has cyclomatic complexity 66 and cognitive complexity 89; 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/main/webapp/js/diagramly/App.js:2032
addFont has cyclomatic complexity 66 and cognitive complexity 79; 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/main/webapp/js/grapheditor/Format.js:5025
updateCell has cyclomatic complexity 65 and cognitive complexity 196; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:5951
dropAndConnect has cyclomatic complexity 65 and cognitive complexity 121; 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/main/webapp/js/grapheditor/Sidebar.js:5793
applyTableText has cyclomatic complexity 65 and cognitive complexity 119; 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/main/webapp/js/diagramly/EditorUi.js:37416
parse has cyclomatic complexity 64 and cognitive complexity 171; 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/main/webapp/js/diagramly/Dialogs.js:1520
handleError has cyclomatic complexity 64 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/main/webapp/js/diagramly/EditorUi.js:7701
Do you agree with this assessment?
R3 · Large Files0.0 / 10Critical✓ Tool-verified
React / JS · Code Health — How many source files exceed the large-file threshold.
Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.
src/main/webapp/js/diagramly/Dialogs.js has 24518 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/main/webapp/js/diagramly/Dialogs.js:1
REDACTED has 14753 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/main/webapp/js/diagramly/Editor.js has 14132 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/main/webapp/js/diagramly/Editor.js:1
src/main/webapp/mxgraph/src/view/mxGraph.js has 13127 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/main/webapp/mxgraph/src/view/mxGraph.js:1
REDACTED has 12679 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
REDACTED has 10530 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/main/webapp/js/grapheditor/Shapes.js has 9956 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/main/webapp/js/grapheditor/Shapes.js:1
src/main/webapp/js/diagramly/App.js has 8813 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/main/webapp/js/diagramly/App.js:1
src/main/webapp/js/grapheditor/Format.js has 8694 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/main/webapp/js/grapheditor/Format.js:1
src/main/webapp/shapes/mxAWS3D.js has 8646 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/main/webapp/shapes/mxAWS3D.js:1
src/main/webapp/js/grapheditor/Sidebar.js has 7034 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/main/webapp/js/grapheditor/Sidebar.js:1
src/main/webapp/js/diagramly/Menus.js has 6575 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/main/webapp/js/diagramly/Menus.js:1
src/main/webapp/mxgraph/src/util/mxUtils.js has 6081 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/main/webapp/mxgraph/src/util/mxUtils.js:1
src/main/webapp/shapes/mockup/mxMockupiOS.js has 6028 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/main/webapp/shapes/mockup/mxMockupiOS.js:1
REDACTED has 5347 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/main/webapp/shapes/mxElectrical.js has 5027 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/main/webapp/shapes/mxElectrical.js:1
src/main/webapp/js/grapheditor/Editor.js has 4602 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/main/webapp/js/grapheditor/Editor.js:1
src/main/webapp/js/grapheditor/InlineToolbar.js has 4571 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/main/webapp/js/grapheditor/InlineToolbar.js:1
src/main/webapp/mxgraph/src/view/mxGraphView.js has 4527 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/main/webapp/mxgraph/src/view/mxGraphView.js:1
src/main/webapp/js/diagramly/ForceExplorer.js has 4391 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/main/webapp/js/diagramly/ForceExplorer.js:1
REDACTED has 4213 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/main/webapp/js/diagramly/DrawioFileSync.js has 4162 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/main/webapp/js/diagramly/DrawioFileSync.js:1
REDACTED has 4024 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/main/webapp/js/diagramly/Pages.js has 3978 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/main/webapp/js/diagramly/Pages.js:1
REDACTED has 3946 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/main/webapp/shapes/mxArchiMate3.js has 3882 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/main/webapp/shapes/mxArchiMate3.js:1
src/main/webapp/js/diagramly/LibavoidRouting.js has 3838 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/main/webapp/js/diagramly/LibavoidRouting.js:1
REDACTED has 3516 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/main/webapp/js/diagramly/LayoutPicker.js has 3473 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/main/webapp/js/diagramly/LayoutPicker.js:1
src/main/webapp/js/diagramly/LightboxModern.js has 3321 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/main/webapp/js/diagramly/LightboxModern.js:1
src/main/webapp/shapes/mxBasic.js has 3180 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/main/webapp/shapes/mxBasic.js:1
src/main/webapp/js/diagramly/emf/emf-svg.js has 2997 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/main/webapp/js/diagramly/emf/emf-svg.js:1
REDACTED has 2955 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
src/main/webapp/js/diagramly/DriveClient.js has 2933 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/main/webapp/js/diagramly/DriveClient.js:1
src/main/webapp/js/diagramly/tidy/Tidy.js has 2863 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/main/webapp/js/diagramly/tidy/Tidy.js:1
src/main/webapp/js/diagramly/DiffSync.js has 2846 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/main/webapp/js/diagramly/DiffSync.js:1
src/main/webapp/shapes/mxSysML.js has 2805 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/main/webapp/shapes/mxSysML.js:1
src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js has 2754 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/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:1
src/main/webapp/js/diagramly/ElectronApp.js has 2689 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/main/webapp/js/diagramly/ElectronApp.js:1
src/main/webapp/js/diagramly/sidebar/Sidebar-Sysml.js has 2609 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/main/webapp/js/diagramly/sidebar/Sidebar-Sysml.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 345 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).
React / JS · Readiness — How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D30 (JS/npm Dependency Vulnerabilities).
Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D30, which answers dependency vulnerabilities for every ecosystem). Deterministic.
Do you agree with this assessment?
R6 · Tooling0.0 / 10Critical✓ Tool-verified
React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.
Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.
test ✗ · lint ✗ · typecheck ✗ — read from this repository's package.json scripts and corroborated against its CI workflows. A script counts when its name or command matches the step: `test` for the suite, `lint` or `prettier` for linting, `typecheck`/`type-check`/`tsc` for type checking. ✗ therefore means no script or CI step under those names was found, NOT that the step is absent from your pipeline — a task invoked by a runner this check does not read, or named something else entirely, is not seen and is worth confirming before acting on a cross. A ✓ means the wiring is DECLARED — a script or CI step under those names exists. It is not a statement that the step passes, or that it runs at all: nothing here installs a dependency or executes a suite.
What to do
Add a test runner (vitest / jest / playwright) and eslint and type checking (adopt TypeScript, or type-check the existing JavaScript with `checkJs`) as package.json scripts and run them in CI.
Do you agree with this assessment?
R7 · Dead Code0.0 / 10Critical✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
Unreachable from the 287 application, 0 tooling and 0 test entry point(s) detected in this repo. Nothing this repository declares compiles or type-checks these files, so a wrong deletion here would raise no compile error — gate removals on `npm test`, which loads the modules, and note that it only covers what it exercises. An undetected custom entry would make these reachable.
no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make (×39) — REDACTED, REDACTED, REDACTED, …
What to do
Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.
Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.
Declared in etc/dependencies/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it. (×9) — etc/dependencies/package.json:16, etc/dependencies/package.json:17, etc/dependencies/package.json:14, …
What to do
Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.
Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.
Other · Security — Read from this repository's JavaScript/TypeScript source: cryptographic hygiene (weak hash or cipher, key material fixed in the source) and outbound TLS (certificate validation, protocol version) — facts about code that hold whether or not it serves anything itself. Markup this repository SHIPS is scored for third-party script integrity whether or not the repository serves it itself, since a page handed to a consumer runs in that consumer’s origin. Of the server controls, two are read where the source shows them: every session or sign-in cookie the code sets is read for HttpOnly, Secure and SameSite at the line that sets it (a raw `Set-Cookie` header, Express, Fastify, Hono, Koa, Next.js, `cookie.serialize`, express-session and cookie-session), and every Node listener for HTTPS enforcement. HSTS, security response headers and input validation are NOT assessed for JavaScript/TypeScript: each is scored as an absence, an absence is only reportable over the production HTTP server, and in this ecosystem the file that opens the port is build output or a framework launcher rather than a file in the source tree. Their absence here is not a finding about this repository.
Method: Roslyn plus filesystem scan: HSTS/security headers, secure cookies, input validation, middleware order, weak crypto (MD5/SHA1/DES); HTTPS-metadata context-aware. On a repository with no .NET source it reads JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Elixir source itself (test, vendored, generated and minified paths not) for the arms that hold whether or not the code serves HTTP: a weak hash or cipher, key material fixed in the source, a TLS client that accepts any certificate, and (JavaScript/TypeScript, Ruby, Scala, Rust and Elixir) an obsolete TLS version; the server controls are not assessed there, and a Dart, Ruby, Scala, Rust or Elixir repository that serves no HTTP of its own is N/A on them. Deterministic.
MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`createHash("sha256")`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call. (×4) — src/main/webapp/js/diagramly/DrawioFileSync.js:3935, src/main/webapp/js/diagramly/OneDriveFile.js:114, src/main/webapp/js/diagramly/OneDriveFile.js:553, …
`https://js.live.net/v7.2/OneDrive.js` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session. — src/main/webapp/onedrive3.html:5
What to do
Review each MD5/SHA1 use by what it protects: replace it with SHA-256+ (or a KDF for passwords) where the digest is security-relevant, and switch it to a non-cryptographic hash (xxhash, murmurhash) where it only derives an identifier such as a cache key. This repository constructs a collision-broken hash (MD5/SHA1) at 4 sites, not one: `src/main/webapp/js/diagramly/DrawioFileSync.js:3935` (crypto-js MD5), `src/main/webapp/js/diagramly/OneDriveFile.js:114` (crypto-js MD5), `src/main/webapp/js/diagramly/OneDriveFile.js:553` (crypto-js MD5), `src/main/webapp/plugins/nextcloud.js:415` (crypto-js MD5). Each is a separate decision — fixing only the line this row cites leaves the others in place.
Pin third-party scripts and verify them: name an exact version in the URL and add an `integrity="sha384-…"` hash alongside `crossorigin="anonymous"` (both are required — an integrity hash on a cross-origin script without `crossorigin` is not evaluated, it blocks the script). Where the vendor ships a continuously-updated loader and publishes no stable hash (tag managers, analytics, chat widgets), Subresource Integrity is not available: constrain it instead with a `Content-Security-Policy` that names the exact origins allowed to execute, and drop the script from the pages that do not need it. Where the page is shipped inside a package that others host, prefer vendoring the asset and serving it from the app’s own origin, so no consumer inherits a third-party dependency they did not choose.
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.
`DEBUG` can never be true where it stands: it is decided by constants. The branch it guards never runs — whatever it was meant to handle is silently handled elsewhere or not at all. Remove it, or fix the test it repeats or the guard that decides it. — src/main/server/java/com/mxgraph/online/AbsAuth.java:665
`message == null` can never be true where it stands: control only reaches it when `message != null` (line 83). The conditional arm it guards never runs — whatever it was meant to handle is silently handled elsewhere or not at all. Remove it, or fix the test it repeats or the guard that decides it. — REDACTED:95
What to do
Each finding names the span that makes the branch dead and the span it is dead because of. Confirm from the two, then delete the dead arm or fix the predicate that was meant to be reachable.
Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.
Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.
Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.
Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.
`debug` at line 940 is called with an argument built by `args.join(' ')` (line 940), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — src/main/webapp/js/diagramly/EditorUi.js:940
What to do
Each finding names the diagnostic call and the expression inside its argument whose cost scales with a collection. Confirm from the two that the argument is built before the call — that is JavaScript's evaluation order, not a guess — then put the construction behind the level check the logger offers (`if (logger.isLevelEnabled('debug'))` for pino and winston, `isDebugEnabled()` for log4js, the repository's own debug flag where it has one), or hand the logger the object and a format string (`logger.debug({ payload }, 'raw request')`) so the serialising happens only when the line is written. Moving the call is not the fix: it is the join/projection/stringify in the argument that is paid, wherever the call sits.
Do you agree with this assessment?
X24 · Document value interpolated into markup unescaped4.9 / 10Weak✓ 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.
`tmp` carries text this program read out of a document — an attribute or a text node, which the DOM hands back already decoded, so an entity its author wrote is a live character again — and it is written straight into the text of an element of markup built here with nothing escaping it on the way. The value is chosen by whoever authored that document, not by this program, so it can close the attribute or element it sits in and open another — a crafted document becomes markup in what this code renders. Escape `tmp` at this site, or validate it against the shape the position accepts before interpolating it. — REDACTED:22462
`v` 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. — etc/dependencies/dompurify-smoke.js:72
`html` 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. — etc/dependencies/dompurify-smoke.js:156
`div.innerHTML` 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. — etc/dependencies/dompurify-smoke.js:158
`msg` 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/main/webapp/connect/common/js/mxReader.js:668
`src` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `document.write` 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. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. — src/main/webapp/js/bootstrap.js:215
`((dataAppKey!=null)?' data-app-key="'+dataAppKey+'" ':'')` is text this program did not author, and it is written into an unquoted attribute through `document.write` 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. HTML text encoding does not help in an unquoted attribute — whitespace ends it; quote the attribute and encode the value. — src/main/webapp/js/bootstrap.js:216
`message` 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/main/webapp/js/diagramly/App.js:4230
`mxResources.get('close')` 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/main/webapp/js/diagramly/App.js:4238
`mxUtils.htmlEntities(mxResources.get('timeAgo',[str],'{1} ago'))` 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/main/webapp/js/diagramly/App.js:8378
`mxUtils.htmlEntities(notif.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/main/webapp/js/diagramly/App.js:8379
`DrawioConfigEditor.html` 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/main/webapp/js/diagramly/ConfigEditor.js:54
`toggle.helpLink` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup built here 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. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. — src/main/webapp/js/diagramly/ConfigEditor.js:438
`toggle.key` is text this program did not author, and it is written into the text of an element through markup built here 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/main/webapp/js/diagramly/ConfigEditor.js:446
`toggle.key` is text this program did not author, and it is written into a quoted attribute value through markup built here 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/main/webapp/js/diagramly/ConfigEditor.js:448
`((url!=null)?' title="'+escapeAttr(url)+'"':'')` is text this program did not author, and it is written into an unquoted attribute through markup built here 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. HTML text encoding does not help in an unquoted attribute — whitespace ends it; quote the attribute and encode the value. — src/main/webapp/js/diagramly/ConfigEditor.js:685
`listKey` is text this program did not author, and it is written into a quoted attribute value through markup built here 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. (×2) — src/main/webapp/js/diagramly/ConfigEditor.js:688, src/main/webapp/js/diagramly/ConfigEditor.js:1012
`mxGraph.prototype.warningImage.src` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme 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. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. — src/main/webapp/js/diagramly/Dialogs.js:323
`mxResources.get('googleDriveMissingClickHere')` 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/main/webapp/js/diagramly/Dialogs.js:324
`mxUtils.htmlEntities(title)+dash+mxUtils.htmlEntities(mxResources.get('pickFolder'))+'...'+state` 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/main/webapp/js/diagramly/Dialogs.js:4622
`mxUtils.htmlEntities(title)+((shortPath!=null)?dash+mxUtils.htmlEntities(shortPath):'')+state` 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/main/webapp/js/diagramly/Dialogs.js:4672
`mxResources.get('current')` 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/main/webapp/js/diagramly/Dialogs.js:8881
`mxUtils.htmlEntities(resolveWindowTitle())` 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/main/webapp/js/diagramly/Dialogs.js:17621
`mxUtils.htmlEntities(pageName)` 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/main/webapp/js/diagramly/Dialogs.js:24394
`mxUtils.htmlEntities(layerName)` 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/main/webapp/js/diagramly/Dialogs.js:24437
`mxUtils.htmlEntities(mxUtils.safeDecodeURIComponent(pValue))` 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. (×2) — src/main/webapp/js/diagramly/Editor.js:9741, src/main/webapp/js/diagramly/Editor.js:9875
`mxUtils.htmlEntities(mxResources.get(key))` is text this program did not author, and it is written into a quoted attribute value 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/main/webapp/js/diagramly/EditorUi.js:25388
`Editor.tailSpin` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme 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. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. — src/main/webapp/js/diagramly/EditorUi.js:25389
`mxUtils.htmlEntities(Graph.rewriteGoogleFontUrl(fontUrl))` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `document.write` 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. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. — src/main/webapp/js/diagramly/EditorUi.js:30214
`'@font-face {\n'+'font-family: "'+mxUtils.htmlEntities(Graph.escapeCssString(fontName))+'";\n'+'src: url("'+mxUtils.h…` is text this program did not author, and it is written into the text of an element through `document.write` 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/main/webapp/js/diagramly/EditorUi.js:30220
`IMAGE_PATH` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme 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. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path. (×3) — src/main/webapp/js/diagramly/EditorUi.js:42381, src/main/webapp/js/diagramly/EditorUi.js:45921, src/main/webapp/js/diagramly/EditorUi.js:46076
`mxUtils.htmlEntities(mxResources.get('noLibraries'))` 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/main/webapp/js/diagramly/EditorUi.js:42413
`mxUtils.htmlEntities(mxResources.get('loading'))` 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/main/webapp/js/diagramly/EditorUi.js:46077
`mxUtils.htmlEntities(mxResources.get('error')+(err&&err.message?': '+err.message:''))` 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/main/webapp/js/diagramly/EditorUi.js:46094
`mxUtils.htmlEntities(mxResources.get('error'))` 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/main/webapp/js/diagramly/EditorUi.js:46102
`cancelImg` 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/main/webapp/js/diagramly/EditorUi.js:46234
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.
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.
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. (×40) — src/main/webapp/shapes/mxBasic.js:3366, src/main/webapp/shapes/mxBasic.js:3425, src/main/webapp/shapes/mxBasic.js:3576, …
What to do
Swallowed exception (empty catch)
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether Java packages are null-marked and not undermined by heavy nullness suppression — a package under `@NullMarked` (or `@NonNullApi`, `@ParametersAreNonnullByDefault`, `@NonNullByDefault`, or a NullAway/Checker Framework configuration naming it) makes an unannotated reference exclude null, and `@SuppressWarnings("NullAway")`, `("nullness")`, `("null")` and `castToNonNull(…)` 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.
0/1 of this repository's Java package directories are under a non-null default: a `package-info.java` declaring `@NullMarked` (JSpecify) or `@NonNullApi`, `@ParametersAreNonnullByDefault`, `@NonNullByDefault`, `@DefaultQualifier(NonNull.class)`; a `module-info.java` declaring `@NullMarked`; every type in it `@NullMarked`; or a build that runs NullAway with the package in `AnnotatedPackages`, or the Checker Framework's `NullnessChecker`. Elsewhere every reference admits null and no checker warns on the dereference that throws a `NullPointerException`.
What to do
Declare the default where Java declares it: `@NullMarked` (org.jspecify.annotations) in each package's `package-info.java`, or once in `module-info.java`, and run NullAway (Error Prone) or the Checker Framework so the declaration is enforced. Then annotate the real exceptions `@Nullable` and resolve the suppressions rather than adding to them: a `@SuppressWarnings("NullAway")` or `castToNonNull(x)` on a value the checker could show to be null is a `NullPointerException` waiting for the path that makes it true — where the value genuinely cannot be null, say something the checker can see instead (a null check, `Objects.requireNonNull`, a non-null field initialised in the constructor).
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 — 4 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.
SC1 Supply-chain hygiene — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X6 Hand-rolled structured-format parsing — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 4 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 1 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.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 52 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 applicable: this repository's Java imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's JavaScript imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No class in this Java code is a Spring, JSR-330 or CDI singleton bean. 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. 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).
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
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — no test/production split to check
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
AXB1 Runtime evidence locked — no reproducible boot — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
C1 Data Protection — No personal data detected in a persisted data model — no PII-named field (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a TypeORM/MikroORM/sequelize-typescript/NestJS-Mongoose entity, a Mongoose schema, a Sequelize or Drizzle table, a Knex migration or a Prisma model — and no database or data-store client in the source either, so this repository keeps no data at rest for these controls to protect. If it does persist personal data (through a hosted backend configured outside this repository, for instance), the controls belong to wherever that data is stored.
C2 Access Controls — No access-control surface detected in the analyzed source — this repository stands up no server (no Express, Fastify, Koa, Hono, NestJS or similar app, no Next.js/SvelteKit/Nuxt server route, no edge function), creates no Supabase tables and talks to no hosted backend. Access control is therefore N/A here — a browser application or library is authorized by the server it calls, not by itself; a client-side route guard hides a page and authorizes nothing. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a TypeORM/MikroORM/sequelize-typescript/NestJS-Mongoose entity, a Mongoose schema, a Sequelize or Drizzle table, a Knex migration or a Prisma model — and no database or data-store client in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a hosted backend configured outside this repository, for instance), the trail belongs to wherever that data is stored.
C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a TypeORM/MikroORM/sequelize-typescript/NestJS-Mongoose entity, a Mongoose schema, a Sequelize or Drizzle table, a Knex migration or a Prisma model — and no database or data-store client in the source either, so this repository keeps no personal data whose lifetime a retention limit would bound. If it does (through a hosted backend configured outside this repository, for instance), the limit belongs wherever that data is stored.
C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a TypeORM/MikroORM/sequelize-typescript/NestJS-Mongoose entity, a Mongoose schema, a Sequelize or Drizzle table, a Knex migration or a Prisma model — and no database or data-store client in the source either, so this repository keeps no personal data for a data subject to erase, export or consent over. If it does (through a hosted backend configured outside this repository, for instance), the rights are served wherever that data is stored.
D10 Test Quality — No tests were found in the analyzed repository to assess for quality.
D11 Test Reliability — No test suite was found to re-run, so reliability couldn't be assessed. Two searches produced that zero and both came back empty: the classifier that reads the loaded workspace recognised no suite it could run, and a walk of the source on disk — which covers the JS/TS `*.test.*` and `*.spec.*` conventions and probes for a Pester suite — found no test source in any other ecosystem either. Neither search reaches a suite that is missing from the loaded workspace and carries no name either walk recognises, so this is 'no suite found by those two searches', not a verdict that the repository has none.
D16 Bus Factor — single-maintainer repository — bus factor is not applicable
D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
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, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D25 ADR Conformance — no ADRs to check
D26 Project Cohesion — D26 measured no build unit over this repository's .java, .js source. Not scored: this is a gap in the analyzer, not a verdict about this repository.
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) — 5 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
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.
D44 Platform End-of-Life — Platform end-of-life not assessed — this repository declares no platform this pass reads
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
DM1 Domain Modelling — not scored — this repository shows none of the 3 signals this lens looks for
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
P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the JVM, JavaScript/TypeScript, Python source, so there is no service whose uptime a failing dependency could take down
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for tinybench, mitata, benchmark.js, benny or vitest `bench(...)` calls in files that import them (or `*.bench.*` files), or one of those in a package.json, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X18 Disposal-pattern correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X2 Cancellation propagation — no C# was loaded; this repository's Java and Python were read, and no request in it can be cancelled by a caller — a Java request off Android takes no token: it is cancelled through the handle it returns (Future.cancel, Call.cancel, a Disposable), ambiently (io.grpc.Context) or by interrupting its thread, not through a parameter; a Python request takes no token: asyncio cancels the task and trio or anyio the scope that made it, from outside the call, and requests, httpx, aiohttp and gRPC take a timeout, not a cancellation
X20 Mistyped argument guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X27 Collection changed while being enumerated — X27 reached only 1% of this repository's production lines — javascript (516,389 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X4 Structured logging — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
Critical — 130 finding(s)
AC1 · Text alternatives· <img> without a text alternative · ×36
<img> without a text alternative etc/dependencies/dompurify-smoke.js:122— 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 etc/dependencies/dompurify-smoke.js:129— 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 etc/dependencies/dompurify-smoke.js:142— 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/main/webapp/clear.html:77— 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/main/webapp/connect/common/js/mxReader.js:547— 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/main/webapp/js/diagramly/App.js:1022— 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/main/webapp/js/diagramly/App.js:2417— 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/main/webapp/js/diagramly/App.js:9458— 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/main/webapp/js/diagramly/App.js:9641— 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/main/webapp/js/diagramly/Dialogs.js:323— 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/main/webapp/js/diagramly/Dialogs.js:5109— 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/main/webapp/js/diagramly/Dialogs.js:831— 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/main/webapp/js/diagramly/Dialogs.js:10574— 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/main/webapp/js/diagramly/Dialogs.js:12672— 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/main/webapp/js/diagramly/Dialogs.js:12983— 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/main/webapp/js/diagramly/Dialogs.js:13359— 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/main/webapp/js/diagramly/Dialogs.js:13518— 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/main/webapp/js/diagramly/GitHubClient.js:1146— 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/main/webapp/js/diagramly/GitLabClient.js:1039— 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/main/webapp/js/diagramly/Menus.js:4758— 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/main/webapp/js/diagramly/Menus.js:7394— 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/main/webapp/js/diagramly/P2PCollab.js:809— 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/main/webapp/js/diagramly/Pages.js:3435— 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/main/webapp/js/diagramly/sidebar/Sidebar.js:1710— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
<img> without a text alternative REDACTED:5044— An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative.
+ 11 more in this group — see findings.md.
AC2 · Forms & labels· <input> without a programmatic label · ×25
<input> without a programmatic label src/main/webapp/js/diagramly/App.js:5880— 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/main/webapp/js/diagramly/App.js:6061— 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/main/webapp/js/diagramly/ConfigEditor.js:1905— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label src/main/webapp/js/diagramly/ConfigEditor.js:1938— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label src/main/webapp/js/diagramly/ConfigEditor.js:1965— 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/main/webapp/js/diagramly/ConfigEditor.js:1972— 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/main/webapp/js/diagramly/ConfigEditor.js:2022— 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/main/webapp/js/diagramly/ConfigEditor.js:2029— 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/main/webapp/js/diagramly/ConfigEditor.js:2046— 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/main/webapp/js/diagramly/ConfigEditor.js:2068— 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/main/webapp/js/diagramly/ConfigEditor.js:2081— 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/main/webapp/js/diagramly/ConfigEditor.js:2154— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label src/main/webapp/js/diagramly/ConfigEditor.js:2163— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label src/main/webapp/js/diagramly/ConfigEditor.js:2176— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label src/main/webapp/js/diagramly/ConfigEditor.js:2203— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label src/main/webapp/js/diagramly/ConfigEditor.js:2204— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label src/main/webapp/js/diagramly/ConfigEditor.js:2213— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label src/main/webapp/js/diagramly/ConfigEditor.js:2214— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label src/main/webapp/js/diagramly/ConfigEditor.js:2235— 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/main/webapp/js/diagramly/ConfigEditor.js:2236— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label src/main/webapp/js/diagramly/ConfigEditor.js:2244— 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/main/webapp/js/diagramly/ConfigEditor.js:2245— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label src/main/webapp/js/diagramly/ConfigEditor.js:2254— 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/main/webapp/js/diagramly/ConfigEditor.js:2255— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label src/main/webapp/js/diagramly/ConfigEditor.js:2363— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
Banned license: @img/sharp-libvips-darwin-arm64 etc/imageResize/package-lock.json:102— `@img/sharp-libvips-darwin-arm64` 1.3.4 is published on registry.npmjs.org under `LGPL-3.0-or-later`, which this policy bans, and it is not declared by this repository but is installed by one of its production, optional or peer dependencies, as its committed lockfile resolves — a transitive dependency ships its licence just the same — so it is installed by everything that depends on this repository, not just by its build toolchain. A package offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package (or the dependency that pulls it in), or record an accepted exception. ★ The licence that makes this row is LGPL-3.0, and unmodified use is often permitted: the LGPL lets your code use an UNMODIFIED copy of the library that stays a separately installed package (its own entry in node_modules, site-packages or the gem path, which a user can replace) without your code coming under the LGPL. What it then asks is that you pass on its licence and notices and let users swap in their own build of it (LGPL-3.0 section 4). Modifying it, copying its code into yours, or merging it into one bundled or statically linked artifact is where the obligations grow, and this policy cannot see which you do — that is why it denies LGPL-3.0 by default. If you use it unmodified and separately installed, allow it in your repository's licence policy rather than replacing it: add `LGPL-3.0-only` / `LGPL-3.0-or-later` to the allow-list of the licence check your CI runs (`license-checker --onlyAllow`, the `allow-licenses` input of GitHub's dependency-review-action, `[licenses] allow` in cargo-deny's deny.toml), record why in the same change, and hide this row on the findings page with that reason. This scan's banned set is not read from that file, so the row stays until it is hidden.
Banned license: @img/sharp-libvips-darwin-x64 etc/imageResize/package-lock.json:118— `@img/sharp-libvips-darwin-x64` 1.3.4 is published on registry.npmjs.org under `LGPL-3.0-or-later`, which this policy bans, and it is not declared by this repository but is installed by one of its production, optional or peer dependencies, as its committed lockfile resolves — a transitive dependency ships its licence just the same — so it is installed by everything that depends on this repository, not just by its build toolchain. A package offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package (or the dependency that pulls it in), or record an accepted exception. ★ The licence that makes this row is LGPL-3.0, and unmodified use is often permitted: the LGPL lets your code use an UNMODIFIED copy of the library that stays a separately installed package (its own entry in node_modules, site-packages or the gem path, which a user can replace) without your code coming under the LGPL. What it then asks is that you pass on its licence and notices and let users swap in their own build of it (LGPL-3.0 section 4). Modifying it, copying its code into yours, or merging it into one bundled or statically linked artifact is where the obligations grow, and this policy cannot see which you do — that is why it denies LGPL-3.0 by default. If you use it unmodified and separately installed, allow it in your repository's licence policy rather than replacing it: add `LGPL-3.0-only` / `LGPL-3.0-or-later` to the allow-list of the licence check your CI runs (`license-checker --onlyAllow`, the `allow-licenses` input of GitHub's dependency-review-action, `[licenses] allow` in cargo-deny's deny.toml), record why in the same change, and hide this row on the findings page with that reason. This scan's banned set is not read from that file, so the row stays until it is hidden.
Banned license: @img/sharp-libvips-linux-arm etc/imageResize/package-lock.json:134— `@img/sharp-libvips-linux-arm` 1.3.4 is published on registry.npmjs.org under `LGPL-3.0-or-later`, which this policy bans, and it is not declared by this repository but is installed by one of its production, optional or peer dependencies, as its committed lockfile resolves — a transitive dependency ships its licence just the same — so it is installed by everything that depends on this repository, not just by its build toolchain. A package offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package (or the dependency that pulls it in), or record an accepted exception. ★ The licence that makes this row is LGPL-3.0, and unmodified use is often permitted: the LGPL lets your code use an UNMODIFIED copy of the library that stays a separately installed package (its own entry in node_modules, site-packages or the gem path, which a user can replace) without your code coming under the LGPL. What it then asks is that you pass on its licence and notices and let users swap in their own build of it (LGPL-3.0 section 4). Modifying it, copying its code into yours, or merging it into one bundled or statically linked artifact is where the obligations grow, and this policy cannot see which you do — that is why it denies LGPL-3.0 by default. If you use it unmodified and separately installed, allow it in your repository's licence policy rather than replacing it: add `LGPL-3.0-only` / `LGPL-3.0-or-later` to the allow-list of the licence check your CI runs (`license-checker --onlyAllow`, the `allow-licenses` input of GitHub's dependency-review-action, `[licenses] allow` in cargo-deny's deny.toml), record why in the same change, and hide this row on the findings page with that reason. This scan's banned set is not read from that file, so the row stays until it is hidden.
Banned license: @img/sharp-libvips-linux-arm64 etc/imageResize/package-lock.json:153— `@img/sharp-libvips-linux-arm64` 1.3.4 is published on registry.npmjs.org under `LGPL-3.0-or-later`, which this policy bans, and it is not declared by this repository but is installed by one of its production, optional or peer dependencies, as its committed lockfile resolves — a transitive dependency ships its licence just the same — so it is installed by everything that depends on this repository, not just by its build toolchain. A package offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package (or the dependency that pulls it in), or record an accepted exception. ★ The licence that makes this row is LGPL-3.0, and unmodified use is often permitted: the LGPL lets your code use an UNMODIFIED copy of the library that stays a separately installed package (its own entry in node_modules, site-packages or the gem path, which a user can replace) without your code coming under the LGPL. What it then asks is that you pass on its licence and notices and let users swap in their own build of it (LGPL-3.0 section 4). Modifying it, copying its code into yours, or merging it into one bundled or statically linked artifact is where the obligations grow, and this policy cannot see which you do — that is why it denies LGPL-3.0 by default. If you use it unmodified and separately installed, allow it in your repository's licence policy rather than replacing it: add `LGPL-3.0-only` / `LGPL-3.0-or-later` to the allow-list of the licence check your CI runs (`license-checker --onlyAllow`, the `allow-licenses` input of GitHub's dependency-review-action, `[licenses] allow` in cargo-deny's deny.toml), record why in the same change, and hide this row on the findings page with that reason. This scan's banned set is not read from that file, so the row stays until it is hidden.
Banned license: @img/sharp-libvips-linux-ppc64 etc/imageResize/package-lock.json:172— `@img/sharp-libvips-linux-ppc64` 1.3.4 is published on registry.npmjs.org under `LGPL-3.0-or-later`, which this policy bans, and it is not declared by this repository but is installed by one of its production, optional or peer dependencies, as its committed lockfile resolves — a transitive dependency ships its licence just the same — so it is installed by everything that depends on this repository, not just by its build toolchain. A package offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package (or the dependency that pulls it in), or record an accepted exception. ★ The licence that makes this row is LGPL-3.0, and unmodified use is often permitted: the LGPL lets your code use an UNMODIFIED copy of the library that stays a separately installed package (its own entry in node_modules, site-packages or the gem path, which a user can replace) without your code coming under the LGPL. What it then asks is that you pass on its licence and notices and let users swap in their own build of it (LGPL-3.0 section 4). Modifying it, copying its code into yours, or merging it into one bundled or statically linked artifact is where the obligations grow, and this policy cannot see which you do — that is why it denies LGPL-3.0 by default. If you use it unmodified and separately installed, allow it in your repository's licence policy rather than replacing it: add `LGPL-3.0-only` / `LGPL-3.0-or-later` to the allow-list of the licence check your CI runs (`license-checker --onlyAllow`, the `allow-licenses` input of GitHub's dependency-review-action, `[licenses] allow` in cargo-deny's deny.toml), record why in the same change, and hide this row on the findings page with that reason. This scan's banned set is not read from that file, so the row stays until it is hidden.
Banned license: @img/sharp-libvips-linux-riscv64 etc/imageResize/package-lock.json:191— `@img/sharp-libvips-linux-riscv64` 1.3.4 is published on registry.npmjs.org under `LGPL-3.0-or-later`, which this policy bans, and it is not declared by this repository but is installed by one of its production, optional or peer dependencies, as its committed lockfile resolves — a transitive dependency ships its licence just the same — so it is installed by everything that depends on this repository, not just by its build toolchain. A package offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package (or the dependency that pulls it in), or record an accepted exception. ★ The licence that makes this row is LGPL-3.0, and unmodified use is often permitted: the LGPL lets your code use an UNMODIFIED copy of the library that stays a separately installed package (its own entry in node_modules, site-packages or the gem path, which a user can replace) without your code coming under the LGPL. What it then asks is that you pass on its licence and notices and let users swap in their own build of it (LGPL-3.0 section 4). Modifying it, copying its code into yours, or merging it into one bundled or statically linked artifact is where the obligations grow, and this policy cannot see which you do — that is why it denies LGPL-3.0 by default. If you use it unmodified and separately installed, allow it in your repository's licence policy rather than replacing it: add `LGPL-3.0-only` / `LGPL-3.0-or-later` to the allow-list of the licence check your CI runs (`license-checker --onlyAllow`, the `allow-licenses` input of GitHub's dependency-review-action, `[licenses] allow` in cargo-deny's deny.toml), record why in the same change, and hide this row on the findings page with that reason. This scan's banned set is not read from that file, so the row stays until it is hidden.
Banned license: @img/sharp-libvips-linux-s390x etc/imageResize/package-lock.json:210— `@img/sharp-libvips-linux-s390x` 1.3.4 is published on registry.npmjs.org under `LGPL-3.0-or-later`, which this policy bans, and it is not declared by this repository but is installed by one of its production, optional or peer dependencies, as its committed lockfile resolves — a transitive dependency ships its licence just the same — so it is installed by everything that depends on this repository, not just by its build toolchain. A package offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package (or the dependency that pulls it in), or record an accepted exception. ★ The licence that makes this row is LGPL-3.0, and unmodified use is often permitted: the LGPL lets your code use an UNMODIFIED copy of the library that stays a separately installed package (its own entry in node_modules, site-packages or the gem path, which a user can replace) without your code coming under the LGPL. What it then asks is that you pass on its licence and notices and let users swap in their own build of it (LGPL-3.0 section 4). Modifying it, copying its code into yours, or merging it into one bundled or statically linked artifact is where the obligations grow, and this policy cannot see which you do — that is why it denies LGPL-3.0 by default. If you use it unmodified and separately installed, allow it in your repository's licence policy rather than replacing it: add `LGPL-3.0-only` / `LGPL-3.0-or-later` to the allow-list of the licence check your CI runs (`license-checker --onlyAllow`, the `allow-licenses` input of GitHub's dependency-review-action, `[licenses] allow` in cargo-deny's deny.toml), record why in the same change, and hide this row on the findings page with that reason. This scan's banned set is not read from that file, so the row stays until it is hidden.
Banned license: @img/sharp-libvips-linux-x64 etc/imageResize/package-lock.json:229— `@img/sharp-libvips-linux-x64` 1.3.4 is published on registry.npmjs.org under `LGPL-3.0-or-later`, which this policy bans, and it is not declared by this repository but is installed by one of its production, optional or peer dependencies, as its committed lockfile resolves — a transitive dependency ships its licence just the same — so it is installed by everything that depends on this repository, not just by its build toolchain. A package offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package (or the dependency that pulls it in), or record an accepted exception. ★ The licence that makes this row is LGPL-3.0, and unmodified use is often permitted: the LGPL lets your code use an UNMODIFIED copy of the library that stays a separately installed package (its own entry in node_modules, site-packages or the gem path, which a user can replace) without your code coming under the LGPL. What it then asks is that you pass on its licence and notices and let users swap in their own build of it (LGPL-3.0 section 4). Modifying it, copying its code into yours, or merging it into one bundled or statically linked artifact is where the obligations grow, and this policy cannot see which you do — that is why it denies LGPL-3.0 by default. If you use it unmodified and separately installed, allow it in your repository's licence policy rather than replacing it: add `LGPL-3.0-only` / `LGPL-3.0-or-later` to the allow-list of the licence check your CI runs (`license-checker --onlyAllow`, the `allow-licenses` input of GitHub's dependency-review-action, `[licenses] allow` in cargo-deny's deny.toml), record why in the same change, and hide this row on the findings page with that reason. This scan's banned set is not read from that file, so the row stays until it is hidden.
Banned license: @img/sharp-libvips-linuxmusl-arm64 etc/imageResize/package-lock.json:248— `@img/sharp-libvips-linuxmusl-arm64` 1.3.4 is published on registry.npmjs.org under `LGPL-3.0-or-later`, which this policy bans, and it is not declared by this repository but is installed by one of its production, optional or peer dependencies, as its committed lockfile resolves — a transitive dependency ships its licence just the same — so it is installed by everything that depends on this repository, not just by its build toolchain. A package offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package (or the dependency that pulls it in), or record an accepted exception. ★ The licence that makes this row is LGPL-3.0, and unmodified use is often permitted: the LGPL lets your code use an UNMODIFIED copy of the library that stays a separately installed package (its own entry in node_modules, site-packages or the gem path, which a user can replace) without your code coming under the LGPL. What it then asks is that you pass on its licence and notices and let users swap in their own build of it (LGPL-3.0 section 4). Modifying it, copying its code into yours, or merging it into one bundled or statically linked artifact is where the obligations grow, and this policy cannot see which you do — that is why it denies LGPL-3.0 by default. If you use it unmodified and separately installed, allow it in your repository's licence policy rather than replacing it: add `LGPL-3.0-only` / `LGPL-3.0-or-later` to the allow-list of the licence check your CI runs (`license-checker --onlyAllow`, the `allow-licenses` input of GitHub's dependency-review-action, `[licenses] allow` in cargo-deny's deny.toml), record why in the same change, and hide this row on the findings page with that reason. This scan's banned set is not read from that file, so the row stays until it is hidden.
Banned license: @img/sharp-libvips-linuxmusl-x64 etc/imageResize/package-lock.json:267— `@img/sharp-libvips-linuxmusl-x64` 1.3.4 is published on registry.npmjs.org under `LGPL-3.0-or-later`, which this policy bans, and it is not declared by this repository but is installed by one of its production, optional or peer dependencies, as its committed lockfile resolves — a transitive dependency ships its licence just the same — so it is installed by everything that depends on this repository, not just by its build toolchain. A package offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package (or the dependency that pulls it in), or record an accepted exception. ★ The licence that makes this row is LGPL-3.0, and unmodified use is often permitted: the LGPL lets your code use an UNMODIFIED copy of the library that stays a separately installed package (its own entry in node_modules, site-packages or the gem path, which a user can replace) without your code coming under the LGPL. What it then asks is that you pass on its licence and notices and let users swap in their own build of it (LGPL-3.0 section 4). Modifying it, copying its code into yours, or merging it into one bundled or statically linked artifact is where the obligations grow, and this policy cannot see which you do — that is why it denies LGPL-3.0 by default. If you use it unmodified and separately installed, allow it in your repository's licence policy rather than replacing it: add `LGPL-3.0-only` / `LGPL-3.0-or-later` to the allow-list of the licence check your CI runs (`license-checker --onlyAllow`, the `allow-licenses` input of GitHub's dependency-review-action, `[licenses] allow` in cargo-deny's deny.toml), record why in the same change, and hide this row on the findings page with that reason. This scan's banned set is not read from that file, so the row stays until it is hidden.
Banned license: @img/sharp-wasm32 etc/imageResize/package-lock.json:486— `@img/sharp-wasm32` 0.35.5 is published on registry.npmjs.org under `Apache-2.0 AND LGPL-3.0-or-later AND MIT`, which this policy bans, and it is not declared by this repository but is installed by one of its production, optional or peer dependencies, as its committed lockfile resolves — a transitive dependency ships its licence just the same — so it is installed by everything that depends on this repository, not just by its build toolchain. A package offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package (or the dependency that pulls it in), or record an accepted exception. ★ The licence that makes this row is LGPL-3.0, and unmodified use is often permitted: the LGPL lets your code use an UNMODIFIED copy of the library that stays a separately installed package (its own entry in node_modules, site-packages or the gem path, which a user can replace) without your code coming under the LGPL. What it then asks is that you pass on its licence and notices and let users swap in their own build of it (LGPL-3.0 section 4). Modifying it, copying its code into yours, or merging it into one bundled or statically linked artifact is where the obligations grow, and this policy cannot see which you do — that is why it denies LGPL-3.0 by default. If you use it unmodified and separately installed, allow it in your repository's licence policy rather than replacing it: add `LGPL-3.0-only` / `LGPL-3.0-or-later` to the allow-list of the licence check your CI runs (`license-checker --onlyAllow`, the `allow-licenses` input of GitHub's dependency-review-action, `[licenses] allow` in cargo-deny's deny.toml), record why in the same change, and hide this row on the findings page with that reason. This scan's banned set is not read from that file, so the row stays until it is hidden.
Banned license: @img/sharp-win32-arm64 etc/imageResize/package-lock.json:521— `@img/sharp-win32-arm64` 0.35.5 is published on registry.npmjs.org under `Apache-2.0 AND LGPL-3.0-or-later`, which this policy bans, and it is not declared by this repository but is installed by one of its production, optional or peer dependencies, as its committed lockfile resolves — a transitive dependency ships its licence just the same — so it is installed by everything that depends on this repository, not just by its build toolchain. A package offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package (or the dependency that pulls it in), or record an accepted exception. ★ The licence that makes this row is LGPL-3.0, and unmodified use is often permitted: the LGPL lets your code use an UNMODIFIED copy of the library that stays a separately installed package (its own entry in node_modules, site-packages or the gem path, which a user can replace) without your code coming under the LGPL. What it then asks is that you pass on its licence and notices and let users swap in their own build of it (LGPL-3.0 section 4). Modifying it, copying its code into yours, or merging it into one bundled or statically linked artifact is where the obligations grow, and this policy cannot see which you do — that is why it denies LGPL-3.0 by default. If you use it unmodified and separately installed, allow it in your repository's licence policy rather than replacing it: add `LGPL-3.0-only` / `LGPL-3.0-or-later` to the allow-list of the licence check your CI runs (`license-checker --onlyAllow`, the `allow-licenses` input of GitHub's dependency-review-action, `[licenses] allow` in cargo-deny's deny.toml), record why in the same change, and hide this row on the findings page with that reason. This scan's banned set is not read from that file, so the row stays until it is hidden.
Banned license: @img/sharp-win32-ia32 etc/imageResize/package-lock.json:540— `@img/sharp-win32-ia32` 0.35.5 is published on registry.npmjs.org under `Apache-2.0 AND LGPL-3.0-or-later`, which this policy bans, and it is not declared by this repository but is installed by one of its production, optional or peer dependencies, as its committed lockfile resolves — a transitive dependency ships its licence just the same — so it is installed by everything that depends on this repository, not just by its build toolchain. A package offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package (or the dependency that pulls it in), or record an accepted exception. ★ The licence that makes this row is LGPL-3.0, and unmodified use is often permitted: the LGPL lets your code use an UNMODIFIED copy of the library that stays a separately installed package (its own entry in node_modules, site-packages or the gem path, which a user can replace) without your code coming under the LGPL. What it then asks is that you pass on its licence and notices and let users swap in their own build of it (LGPL-3.0 section 4). Modifying it, copying its code into yours, or merging it into one bundled or statically linked artifact is where the obligations grow, and this policy cannot see which you do — that is why it denies LGPL-3.0 by default. If you use it unmodified and separately installed, allow it in your repository's licence policy rather than replacing it: add `LGPL-3.0-only` / `LGPL-3.0-or-later` to the allow-list of the licence check your CI runs (`license-checker --onlyAllow`, the `allow-licenses` input of GitHub's dependency-review-action, `[licenses] allow` in cargo-deny's deny.toml), record why in the same change, and hide this row on the findings page with that reason. This scan's banned set is not read from that file, so the row stays until it is hidden.
Banned license: @img/sharp-win32-x64 etc/imageResize/package-lock.json:559— `@img/sharp-win32-x64` 0.35.5 is published on registry.npmjs.org under `Apache-2.0 AND LGPL-3.0-or-later`, which this policy bans, and it is not declared by this repository but is installed by one of its production, optional or peer dependencies, as its committed lockfile resolves — a transitive dependency ships its licence just the same — so it is installed by everything that depends on this repository, not just by its build toolchain. A package offering SEVERAL licences is a choice and is only charged when every one of them is banned. Replace the package (or the dependency that pulls it in), or record an accepted exception. ★ The licence that makes this row is LGPL-3.0, and unmodified use is often permitted: the LGPL lets your code use an UNMODIFIED copy of the library that stays a separately installed package (its own entry in node_modules, site-packages or the gem path, which a user can replace) without your code coming under the LGPL. What it then asks is that you pass on its licence and notices and let users swap in their own build of it (LGPL-3.0 section 4). Modifying it, copying its code into yours, or merging it into one bundled or statically linked artifact is where the obligations grow, and this policy cannot see which you do — that is why it denies LGPL-3.0 by default. If you use it unmodified and separately installed, allow it in your repository's licence policy rather than replacing it: add `LGPL-3.0-only` / `LGPL-3.0-or-later` to the allow-list of the licence check your CI runs (`license-checker --onlyAllow`, the `allow-licenses` input of GitHub's dependency-review-action, `[licenses] allow` in cargo-deny's deny.toml), record why in the same change, and hide this row on the findings page with that reason. This scan's banned set is not read from that file, so the row stays until it is hidden.
AC2 · Forms & labels· <label> that labels no control · ×13
<label> that labels no control src/main/webapp/js/diagramly/ConfigEditor.js:1935— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/main/webapp/js/diagramly/ConfigEditor.js:2151— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/main/webapp/js/diagramly/ConfigEditor.js:2160— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/main/webapp/js/diagramly/ConfigEditor.js:2173— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/main/webapp/js/diagramly/ConfigEditor.js:2200— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/main/webapp/js/diagramly/ConfigEditor.js:2210— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/main/webapp/js/diagramly/ConfigEditor.js:2232— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/main/webapp/js/diagramly/ConfigEditor.js:2241— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/main/webapp/js/diagramly/ConfigEditor.js:2251— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/main/webapp/js/diagramly/ConfigEditor.js:2272— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/main/webapp/js/diagramly/ConfigEditor.js:2280— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/main/webapp/js/diagramly/ConfigEditor.js:2360— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
<label> that labels no control src/main/webapp/js/diagramly/ConfigEditor.js:2369— This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
AC4 · Keyboard semantics· Clickable element isn't keyboard-operable · ×8
Clickable element isn't keyboard-operable src/main/webapp/js/diagramly/App.js:8309— The repo's own CSS styles .closeBtn 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 src/main/webapp/js/diagramly/App.js:8367— The repo's own CSS styles .notification with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable src/main/webapp/js/diagramly/Dialogs.js:12672— The repo's own CSS styles .geLibraryButton with `cursor: pointer`, so this <img> 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 src/main/webapp/js/diagramly/Dialogs.js:12983— The repo's own CSS styles .geLibraryButton with `cursor: pointer`, so this <img> 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 src/main/webapp/js/diagramly/Editor.js:10159— The repo's own CSS styles .geSwitcherDot with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable src/main/webapp/js/grapheditor/Format.js:323— The repo's own CSS styles .geFormatTitle with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Clickable element isn't keyboard-operable src/main/webapp/js/grapheditor/Format.js:1527— The repo's own CSS styles .geColorDropper with `cursor: pointer`, so this <img> 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 src/main/webapp/js/grapheditor/Format.js:9641— The repo's own CSS styles .geSwitcherDot with `cursor: pointer`, so this <div> is a control — but it has no role, no tabindex="0" and no key handler, so it can only be reached with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
<html> without a lang src/main/webapp/index.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang src/main/webapp/js/diagramly/Dialogs.js:781— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang src/main/webapp/js/diagramly/Menus.js:829— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang src/main/webapp/open.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang src/main/webapp/teams.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang src/main/webapp/vsdxImporter.html:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
Viewport restricts zoom src/main/webapp/index.html:14— user-scalable=no/0 or a maximum-scale below 2 stops low-vision users zooming to 200%. Remove the zoom restriction from the viewport meta.
Viewport restricts zoom src/main/webapp/teams.html:14— user-scalable=no/0 or a maximum-scale below 2 stops low-vision users zooming to 200%. Remove the zoom restriction from the viewport meta.
role="radio" missing required aria-checked src/main/webapp/js/diagramly/LightboxModern.js:261— The radio role requires aria-checked to convey its state. Add it.
role="radio" missing required aria-checked src/main/webapp/js/diagramly/LightboxModern.js:2987— The radio role requires aria-checked to convey its state. Add it.
AC2 · Forms & labels· Link with no accessible name · ×1
Link with no accessible name src/main/webapp/js/diagramly/App.js:3313— A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label.
AC2 · Forms & labels· <button> with no accessible text · ×1
<button> with no accessible text src/main/webapp/js/diagramly/ConfigEditor.js:1939— 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).
AC3 · Page structure· <iframe> without a title · ×1
<iframe> without a title etc/dependencies/dompurify-smoke.js:136— An iframe with no title (or an empty one) is announced only as "frame". Add a non-empty title describing its content, or an aria-label.
AC4 · Keyboard semantics· Click handler on a non-interactive <span> · ×1
Click handler on a non-interactive <span> src/main/webapp/js/onedrive/mxODPicker.js:531— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
AC4 · Keyboard semantics· Click handler on a non-interactive <tr> · ×1
Click handler on a non-interactive <tr> src/main/webapp/js/onedrive/mxODPicker.js:656— A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
No automated tests — No automated tests — no test code was found in this repository. Untested code is the largest single risk to changing it safely. Start with the code you change most often: add a suite in a framework a runner can collect (JUnit (with Kotest or MockK on Kotlin)), and run it in CI so the gap cannot reopen.
FileTooLong: REDACTED REDACTED— FileTooLong — 23592 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 23092 over it, 47.18× 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: diagramly/EditorUi.js src/main/webapp/js/diagramly/EditorUi.js— FileTooLong — 20743 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 20243 over it, 41.49× 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: diagramly/Dialogs.js src/main/webapp/js/diagramly/Dialogs.js— FileTooLong — 15211 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 14711 over it, 30.42× 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 — 9757 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 8257 over it, 6.50× 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 — 9750 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 8250 over it, 6.50× 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: diagramly/Editor.js src/main/webapp/js/diagramly/Editor.js— FileTooLong — 7444 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 5944 over it, 4.96× 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: shapes/mxAWS3D.js src/main/webapp/shapes/mxAWS3D.js— FileTooLong — 6705 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 6205 over it, 13.41× 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: grapheditor/Shapes.js src/main/webapp/js/grapheditor/Shapes.js— FileTooLong — 6432 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 4932 over it, 4.29× 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 — 5409 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 3909 over it, 3.61× 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: grapheditor/Format.js src/main/webapp/js/grapheditor/Format.js— FileTooLong — 5355 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 3855 over it, 3.57× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: diagramly/App.js src/main/webapp/js/diagramly/App.js— FileTooLong — 4433 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 2933 over it, 2.96× 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: view/mxGraph.js src/main/webapp/mxgraph/src/view/mxGraph.js— FileTooLong — 4179 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 2679 over it, 2.79× 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: grapheditor/Sidebar.js src/main/webapp/js/grapheditor/Sidebar.js— FileTooLong — 3937 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 2437 over it, 2.62× 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: diagramly/Menus.js src/main/webapp/js/diagramly/Menus.js— FileTooLong — 3867 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 2367 over it, 2.58× 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 — 3815 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 2315 over it, 2.54× 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 — 3347 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 2847 over it, 6.69× 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: shapes/mxElectrical.js src/main/webapp/shapes/mxElectrical.js— FileTooLong — 3343 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 2843 over it, 6.69× 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: grapheditor/InlineToolbar.js src/main/webapp/js/grapheditor/InlineToolbar.js— FileTooLong — 2667 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 1167 over it, 1.78× 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: grapheditor/Editor.js src/main/webapp/js/grapheditor/Editor.js— FileTooLong — 2567 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 2067 over it, 5.13× 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: shapes/mxArchiMate3.js src/main/webapp/shapes/mxArchiMate3.js— FileTooLong — 2514 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 2014 over it, 5.03× 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: diagramly/ForceExplorer.js src/main/webapp/js/diagramly/ForceExplorer.js— FileTooLong — 2438 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 938 over it, 1.63× 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: util/mxUtils.js src/main/webapp/mxgraph/src/util/mxUtils.js— FileTooLong — 2429 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 100% of them inside a single declaration: mxUtils (5-6919). The bar is 1500 significant lines; this is 929 over it, 1.62× 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: sidebar/Sidebar-Sysml.js src/main/webapp/js/diagramly/sidebar/Sidebar-Sysml.js— FileTooLong — 2331 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 831 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: sidebar/Sidebar-AWS4.js src/main/webapp/js/diagramly/sidebar/Sidebar-AWS4.js— FileTooLong — 2320 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 820 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: diagramly/LightboxModern.js src/main/webapp/js/diagramly/LightboxModern.js— FileTooLong — 2133 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 633 over it, 1.42× 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.
(anonymous)::getControlPoints (cognitive 124) REDACTED:13860— (anonymous)::getControlPoints has cognitive complexity 124 (threshold 15). Drivers by points: if/else 27 (50 pts), boolean chains 39, ternaries 8 (26 pts), loops 5 (9 pts) (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.
(anonymous)::addGroup (cognitive 112) REDACTED:1012— (anonymous)::addGroup has cognitive complexity 112 (threshold 15). Drivers by points: if/else 32 (73 pts), boolean chains 20, loops 8 (17 pts), ternaries 1 (2 pts) (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.
(anonymous)::evenOddPath (cognitive 101) REDACTED:1429— (anonymous)::evenOddPath has cognitive complexity 101 (threshold 15). Drivers by points: if/else 20 (38 pts), ternaries 8 (27 pts), loops 12 (22 pts), boolean chains 14 (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.
(anonymous)::addSibling (cognitive 92) src/main/webapp/plugins/trees/trees.js:514— (anonymous)::addSibling has cognitive complexity 92 (threshold 15). Drivers by points: if/else 16 (50 pts), ternaries 7 (25 pts), boolean chains 11, loops 2 (6 pts) (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.
(anonymous)::encodeCell (cognitive 76) src/main/webapp/mxgraph/src/io/mxGraphViewCodec.js:54— (anonymous)::encodeCell has cognitive complexity 76 (threshold 15). Drivers by points: if/else 20 (57 pts), loops 3 (12 pts), boolean chains 7 (nesting depth added 46). 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)::moveCells (cognitive 66) src/main/webapp/plugins/trees/trees.js:326— (anonymous)::moveCells has cognitive complexity 66 (threshold 15). Drivers by points: if/else 16 (56 pts), boolean chains 6, loops 2 (4 pts) (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.
(anonymous)::decode (cognitive 66) src/main/webapp/mxgraph/src/io/mxStylesheetCodec.js:120— (anonymous)::decode has cognitive complexity 66 (threshold 15). Drivers by points: if/else 14 (53 pts), loops 2 (5 pts), boolean chains 4, ternaries 1 (4 pts) (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.
(anonymous)::fitStencilBounds (cognitive 64) REDACTED:1835— (anonymous)::fitStencilBounds has cognitive complexity 64 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 16, ternaries 10 (13 pts), loops 6 (9 pts), error handling 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.
(anonymous)::addConnectedEdge (cognitive 61) REDACTED:2233— (anonymous)::addConnectedEdge has cognitive complexity 61 (threshold 15). Drivers by points: if/else 26 (40 pts), loops 4 (9 pts), boolean chains 8, ternaries 3 (4 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.
(anonymous)::handle (cognitive 61) REDACTED:9147— (anonymous)::handle has cognitive complexity 61 (threshold 15). Drivers by points: loops 10 (25 pts), if/else 9 (21 pts), boolean chains 15 (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.
(anonymous)::addShape (cognitive 57) REDACTED:881— (anonymous)::addShape has cognitive complexity 57 (threshold 15). Drivers by points: if/else 11 (28 pts), ternaries 2 (9 pts), boolean chains 8, loops 2 (8 pts), error handling 1 (4 pts) (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
(anonymous)::processExtras (cognitive 54) REDACTED:5679— (anonymous)::processExtras has cognitive complexity 54 (threshold 15). Drivers by points: loops 10 (37 pts), match/switch 4 (14 pts), if/else 1 (3 pts) (nesting depth added 39). 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.
(anonymous)::initThemes (cognitive 53) REDACTED:4663— (anonymous)::initThemes has cognitive complexity 53 (threshold 15). Drivers by points: if/else 9 (37 pts), loops 4 (11 pts), boolean chains 5 (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.
(anonymous)::parseNodes (cognitive 46) REDACTED:5044— (anonymous)::parseNodes has cognitive complexity 46 (threshold 15). Drivers by points: if/else 9 (24 pts), ternaries 2 (10 pts), boolean chains 6, loops 3 (6 pts) (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
(anonymous)::setLabelOffset (cognitive 44) REDACTED:13309— (anonymous)::setLabelOffset has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (35 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::initPages (cognitive 43) REDACTED:4805— (anonymous)::initPages has cognitive complexity 43 (threshold 15). Drivers by points: if/else 6 (26 pts), loops 3 (15 pts), boolean chains 2 (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.
(anonymous)::beforeDecode (cognitive 43) src/main/webapp/mxgraph/src/io/mxCellCodec.js:167— (anonymous)::beforeDecode has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (34 pts), boolean chains 5, loops 1 (2 pts), ternaries 1 (2 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.
(anonymous)::onKeyDown (cognitive 42) src/main/webapp/plugins/trees/trees.js:852— (anonymous)::onKeyDown has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (33 pts), boolean chains 4, ternaries 1 (4 pts), error handling 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
(anonymous)::getRoutingPoints (cognitive 41) REDACTED:4117— (anonymous)::getRoutingPoints has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 5 (21 pts), if/else 5 (13 pts), loops 2 (4 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.
(anonymous)::processTheme (cognitive 40) REDACTED:5551— (anonymous)::processTheme has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (33 pts), loops 2 (4 pts), boolean chains 2, error handling 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)::addEdgeSublabel (cognitive 37) REDACTED:2165— (anonymous)::addEdgeSublabel has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 5 (16 pts), if/else 6 (14 pts), boolean chains 7 (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.
(anonymous)::getControlPoints::nurbsSegsTo (cognitive 37) REDACTED:14097— (anonymous)::getControlPoints::nurbsSegsTo has cognitive complexity 37 (threshold 15). Drivers by points: loops 10 (13 pts), boolean chains 12, if/else 7 (8 pts), ternaries 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous)::parseSection (cognitive 35) REDACTED:10942— (anonymous)::parseSection has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 2 (6 pts), match/switch 1 (5 pts), 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.
(anonymous)::processColors (cognitive 34) REDACTED:5843— (anonymous)::processColors has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 2 (5 pts), ternaries 1 (5 pts), boolean chains 1 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
(anonymous)::getCellElement$java_lang_String (cognitive 34) REDACTED:9690— (anonymous)::getCellElement$java_lang_String has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 13 (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.
Hotspot: src/main/webapp/js/diagramly/Menus.js src/main/webapp/js/diagramly/Menus.js:313— src/main/webapp/js/diagramly/Menus.js changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 1146 in Menus.Menus.init at line 313. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00:00' --full-history --no-merges -- src/main/webapp/js/diagramly/Menus.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/main/webapp/js/diagramly/EditorUi.js src/main/webapp/js/diagramly/EditorUi.js:39560— src/main/webapp/js/diagramly/EditorUi.js changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 473 in EditorUi.EditorUi.doImportCsv at line 39560. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00:00' --full-history --no-merges -- src/main/webapp/js/diagramly/EditorUi.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/main/webapp/js/diagramly/Dialogs.js src/main/webapp/js/diagramly/Dialogs.js:14088— src/main/webapp/js/diagramly/Dialogs.js changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 552 in Dialogs.AnimationDialog at line 14088. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00:00' --full-history --no-merges -- src/main/webapp/js/diagramly/Dialogs.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: REDACTED REDACTED:5648— REDACTED changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 327 in EditorUi.EditorUi.initCanvas at line 5648. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00: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/main/webapp/js/export.js src/main/webapp/js/export.js:234— src/main/webapp/js/export.js changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 408 in export.render at line 234. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00:00' --full-history --no-merges -- src/main/webapp/js/export.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/main/webapp/js/diagramly/Editor.js src/main/webapp/js/diagramly/Editor.js:3441— src/main/webapp/js/diagramly/Editor.js changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 202 in Editor.Editor.configure at line 3441. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00:00' --full-history --no-merges -- src/main/webapp/js/diagramly/Editor.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/main/webapp/js/grapheditor/Actions.js src/main/webapp/js/grapheditor/Actions.js:17— src/main/webapp/js/grapheditor/Actions.js changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 359 in Actions.Actions.init at line 17. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00:00' --full-history --no-merges -- src/main/webapp/js/grapheditor/Actions.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/main/webapp/js/grapheditor/Format.js src/main/webapp/js/grapheditor/Format.js:5025— src/main/webapp/js/grapheditor/Format.js changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 286 in Format.TextFormatPanel.addFont at line 5025. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00:00' --full-history --no-merges -- src/main/webapp/js/grapheditor/Format.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/main/webapp/js/diagramly/App.js src/main/webapp/js/diagramly/App.js:1006— src/main/webapp/js/diagramly/App.js changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 209 in App.App.main at line 1006. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00:00' --full-history --no-merges -- src/main/webapp/js/diagramly/App.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: REDACTED REDACTED:348— REDACTED changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 236 in Dialogs.ColorDialog at line 348. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00: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:7711— REDACTED changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 845 in Extensions.addCompositeShape at line 7711. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00: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/main/webapp/js/grapheditor/Sidebar.js src/main/webapp/js/grapheditor/Sidebar.js:6440— src/main/webapp/js/grapheditor/Sidebar.js changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 206 in Sidebar.Sidebar.createDragSource at line 6440. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00:00' --full-history --no-merges -- src/main/webapp/js/grapheditor/Sidebar.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/main/webapp/js/diagramly/Trees.js src/main/webapp/js/diagramly/Trees.js:221— src/main/webapp/js/diagramly/Trees.js changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 356 in Trees.EditorUi.addTrees at line 221. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00:00' --full-history --no-merges -- src/main/webapp/js/diagramly/Trees.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: REDACTED REDACTED:17522— REDACTED changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 95 in Graph.Graph.connectVertex at line 17522. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00: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:163— REDACTED changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 154 in GraphViewer.GraphViewer.init at line 163. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00: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/main/webapp/js/diagramly/P2PCollab.js src/main/webapp/js/diagramly/P2PCollab.js:11— src/main/webapp/js/diagramly/P2PCollab.js changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 262 in P2PCollab.P2PCollab at line 11. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00:00' --full-history --no-merges -- src/main/webapp/js/diagramly/P2PCollab.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/main/webapp/js/diagramly/DriveClient.js src/main/webapp/js/diagramly/DriveClient.js:2183— src/main/webapp/js/diagramly/DriveClient.js changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 109 in DriveClient.DriveClient.saveFile at line 2183. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00:00' --full-history --no-merges -- src/main/webapp/js/diagramly/DriveClient.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/main/webapp/js/onedrive/mxODPicker.js src/main/webapp/js/onedrive/mxODPicker.js:11— src/main/webapp/js/onedrive/mxODPicker.js changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 186 in mxODPicker.mxODPicker at line 11. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00:00' --full-history --no-merges -- src/main/webapp/js/onedrive/mxODPicker.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/main/webapp/js/grapheditor/Editor.js src/main/webapp/js/grapheditor/Editor.js:3471— src/main/webapp/js/grapheditor/Editor.js changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 65 in Editor.PageSetupDialog at line 3471. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00:00' --full-history --no-merges -- src/main/webapp/js/grapheditor/Editor.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/main/webapp/mxgraph/src/view/mxGraph.js src/main/webapp/mxgraph/src/view/mxGraph.js:14371— src/main/webapp/mxgraph/src/view/mxGraph.js changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 70 in mxGraph.mxGraph.fireMouseEvent at line 14371. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00:00' --full-history --no-merges -- src/main/webapp/mxgraph/src/view/mxGraph.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/main/webapp/js/diagramly/Pages.js src/main/webapp/js/diagramly/Pages.js:3484— src/main/webapp/js/diagramly/Pages.js changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 52 in Pages.EditorUi.addTabDragListeners at line 3484. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00:00' --full-history --no-merges -- src/main/webapp/js/diagramly/Pages.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: REDACTED REDACTED:1374— REDACTED changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 61 in DrawioFile.DrawioFile.patch at line 1374. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00: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/main/webapp/js/diagramly/DrawioFileSync.js src/main/webapp/js/diagramly/DrawioFileSync.js:3614— src/main/webapp/js/diagramly/DrawioFileSync.js changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 55 in DrawioFileSync.DrawioFileSync.catchup at line 3614. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00:00' --full-history --no-merges -- src/main/webapp/js/diagramly/DrawioFileSync.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/main/webapp/js/diagramly/LibavoidRouting.js src/main/webapp/js/diagramly/LibavoidRouting.js:360— src/main/webapp/js/diagramly/LibavoidRouting.js changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 65 in LibavoidRouting.LibavoidRouting.installAutoRouting at line 360. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00:00' --full-history --no-merges -- src/main/webapp/js/diagramly/LibavoidRouting.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/main/webapp/js/libavoid-js/libavoid-routing.js src/main/webapp/js/libavoid-js/libavoid-routing.js:1055— src/main/webapp/js/libavoid-js/libavoid-routing.js changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 95 in libavoid-routing.AvoidRouting.computeRoutes at line 1055. 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-08-19..2026-11-17, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-19 15:42:43 +00:00' --until='2026-11-17 15:42:43 +00:00' --full-history --no-merges -- src/main/webapp/js/libavoid-js/libavoid-routing.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.
(anonymous)::getControlPoints (cyclomatic 78) REDACTED:13860— (anonymous)::getControlPoints has cyclomatic complexity 78 (threshold 15). To reduce it, separate the cases: extract each independent 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)::addGroup (cyclomatic 62) REDACTED:1012— (anonymous)::addGroup has cyclomatic complexity 62 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::evenOddPath (cyclomatic 62) REDACTED:1429— (anonymous)::evenOddPath has cyclomatic complexity 62 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::fitStencilBounds (cyclomatic 58) REDACTED:1835— (anonymous)::fitStencilBounds has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent 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)::addConnectedEdge (cyclomatic 42) REDACTED:2233— (anonymous)::addConnectedEdge 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.
(anonymous)::handle (cyclomatic 34) REDACTED:9147— (anonymous)::handle has cyclomatic complexity 34 (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.
(anonymous)::addSibling (cyclomatic 34) src/main/webapp/plugins/trees/trees.js:514— (anonymous)::addSibling 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)::getControlPoints::nurbsSegsTo (cyclomatic 33) REDACTED:14097— (anonymous)::getControlPoints::nurbsSegsTo has cyclomatic complexity 33 (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.
(anonymous)::encodeCell (cyclomatic 30) src/main/webapp/mxgraph/src/io/mxGraphViewCodec.js:54— (anonymous)::encodeCell 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)::getRowObj (cyclomatic 27) REDACTED:3250— (anonymous)::getRowObj has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
(anonymous)::getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$boolean (cyclomatic 26) REDACTED:5993— (anonymous)::getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$boolean has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::getStyleFromShape (cyclomatic 26) REDACTED:12830— (anonymous)::getStyleFromShape has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
(anonymous)::setLabelOffset (cyclomatic 26) REDACTED:13309— (anonymous)::setLabelOffset has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::handle (cyclomatic 24) REDACTED:9068— (anonymous)::handle has cyclomatic complexity 24 (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.
(anonymous)::VsdxShape (cyclomatic 24) REDACTED:11624— (anonymous)::VsdxShape has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
(anonymous)::moveCells (cyclomatic 24) src/main/webapp/plugins/trees/trees.js:326— (anonymous)::moveCells 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.
(anonymous)::addShape (cyclomatic 23) REDACTED:881— (anonymous)::addShape has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::getCellElement$java_lang_String (cyclomatic 23) REDACTED:9690— (anonymous)::getCellElement$java_lang_String has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::onKeyDown (cyclomatic 23) src/main/webapp/plugins/trees/trees.js:852— (anonymous)::onKeyDown has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::processExtras (cyclomatic 22) REDACTED:5679— (anonymous)::processExtras has cyclomatic complexity 22 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
(anonymous)::getFontColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList (cyclomatic 22) REDACTED:6263— (anonymous)::getFontColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::decode (cyclomatic 22) src/main/webapp/mxgraph/src/io/mxStylesheetCodec.js:120— (anonymous)::decode has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous)::addEdgeSublabel (cyclomatic 21) REDACTED:2165— (anonymous)::addEdgeSublabel 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.
(anonymous)::sanitiseCell (cyclomatic 20) REDACTED:2717— (anonymous)::sanitiseCell 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.
(anonymous)::getTransformedRoutingPoints (cyclomatic 20) REDACTED:4177— (anonymous)::getTransformedRoutingPoints 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.
Swallowed exception (empty catch) src/main/webapp/shapes/mxBasic.js:3366— 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/main/webapp/shapes/mxBasic.js:3425— 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/main/webapp/shapes/mxBasic.js:3576— 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/main/webapp/plugins/nextcloud.js:34— 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/main/webapp/plugins/nextcloud.js:519— 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/main/webapp/mxgraph/src/view/mxPrintPreview.js:826— 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/main/webapp/mxgraph/src/util/mxEvent.js:53— 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/main/webapp/mxgraph/src/util/mxEvent.js:354— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) src/main/webapp/mxgraph/src/util/mxPopupMenu.js:412— 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/main/webapp/mxgraph/src/util/mxResources.js:241— 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/main/webapp/mxgraph/src/util/mxResources.js:279— 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:1989— 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:4090— 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/main/webapp/mxgraph/src/util/mxUtils.js:126— 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/main/webapp/mxgraph/src/util/mxUtils.js:2232— 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/main/webapp/mxgraph/src/util/mxUtils.js:4846— 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/main/webapp/mxgraph/src/shape/mxShape.js:1788— 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/main/webapp/mxgraph/src/shape/mxText.js:623— 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/main/webapp/mxgraph/src/io/mxCodec.js:621— 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/main/webapp/mxgraph/src/io/mxCodecRegistry.js:127— 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/main/webapp/mxgraph/src/io/mxObjectCodec.js:1287— 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/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:2958— 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/main/webapp/js/bootstrap.js:65— 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/main/webapp/js/bootstrap.js:155— 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/main/webapp/js/bootstrap.js:260— 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.
+ 15 more in this group — see findings.md.
X24 · Document value interpolated into markup unescaped· Untrusted text written into markup unescaped · ×39
Untrusted text written into markup unescaped etc/dependencies/dompurify-smoke.js:72— `v` 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 etc/dependencies/dompurify-smoke.js:156— `html` 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 etc/dependencies/dompurify-smoke.js:158— `div.innerHTML` 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/main/webapp/connect/common/js/mxReader.js:668— `msg` 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/main/webapp/js/bootstrap.js:215— `src` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through `document.write` 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. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
Untrusted text written into markup unescaped src/main/webapp/js/bootstrap.js:216— `((dataAppKey!=null)?' data-app-key="'+dataAppKey+'" ':'')` is text this program did not author, and it is written into an unquoted attribute through `document.write` 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. HTML text encoding does not help in an unquoted attribute — whitespace ends it; quote the attribute and encode the value.
Untrusted text written into markup unescaped src/main/webapp/js/diagramly/App.js:4230— `message` 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/main/webapp/js/diagramly/App.js:4238— `mxResources.get('close')` 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/main/webapp/js/diagramly/App.js:8378— `mxUtils.htmlEntities(mxResources.get('timeAgo',[str],'{1} ago'))` 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/main/webapp/js/diagramly/App.js:8379— `mxUtils.htmlEntities(notif.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/main/webapp/js/diagramly/ConfigEditor.js:54— `DrawioConfigEditor.html` 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/main/webapp/js/diagramly/ConfigEditor.js:438— `toggle.helpLink` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme through markup built here 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. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
Untrusted text written into markup unescaped src/main/webapp/js/diagramly/ConfigEditor.js:446— `toggle.key` is text this program did not author, and it is written into the text of an element through markup built here 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/main/webapp/js/diagramly/ConfigEditor.js:448— `toggle.key` is text this program did not author, and it is written into a quoted attribute value through markup built here 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/main/webapp/js/diagramly/ConfigEditor.js:685— `((url!=null)?' title="'+escapeAttr(url)+'"':'')` is text this program did not author, and it is written into an unquoted attribute through markup built here 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. HTML text encoding does not help in an unquoted attribute — whitespace ends it; quote the attribute and encode the value.
Untrusted text written into markup unescaped src/main/webapp/js/diagramly/ConfigEditor.js:688— `listKey` is text this program did not author, and it is written into a quoted attribute value through markup built here 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/main/webapp/js/diagramly/ConfigEditor.js:1012— `listKey` is text this program did not author, and it is written into a quoted attribute value through markup built here 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/main/webapp/js/diagramly/Dialogs.js:323— `mxGraph.prototype.warningImage.src` is text this program did not author, and it is written into the start of a URL attribute, where it chooses the scheme 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. HTML encoding does not help here — a `javascript:` URL contains nothing it changes; allow only http(s) or a relative path.
Untrusted text written into markup unescaped src/main/webapp/js/diagramly/Dialogs.js:324— `mxResources.get('googleDriveMissingClickHere')` 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/main/webapp/js/diagramly/Dialogs.js:4622— `mxUtils.htmlEntities(title)+dash+mxUtils.htmlEntities(mxResources.get('pickFolder'))+'...'+state` 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/main/webapp/js/diagramly/Dialogs.js:4672— `mxUtils.htmlEntities(title)+((shortPath!=null)?dash+mxUtils.htmlEntities(shortPath):'')+state` 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/main/webapp/js/diagramly/Dialogs.js:8881— `mxResources.get('current')` 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/main/webapp/js/diagramly/Dialogs.js:17621— `mxUtils.htmlEntities(resolveWindowTitle())` 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/main/webapp/js/diagramly/Dialogs.js:24394— `mxUtils.htmlEntities(pageName)` 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/main/webapp/js/diagramly/Dialogs.js:24437— `mxUtils.htmlEntities(layerName)` 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.
+ 14 more in this group — see findings.md.
AC4 · Keyboard semantics· Anchor without href · ×18
Anchor without href src/main/webapp/js/diagramly/App.js:1630— 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/main/webapp/js/diagramly/App.js:7955— 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/main/webapp/js/diagramly/App.js:8013— 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/main/webapp/js/diagramly/App.js:9093— 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/main/webapp/js/diagramly/App.js:9170— 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/main/webapp/js/diagramly/App.js:9207— 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/main/webapp/js/diagramly/Dialogs.js:12950— 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/main/webapp/js/diagramly/GitHubClient.js:960— 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/main/webapp/js/diagramly/GitLabClient.js:855— 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/main/webapp/js/diagramly/Minimal.js:486— 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/main/webapp/js/diagramly/SimpleClassic.js:288— 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:483— 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:595— 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:3961— 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:2742— 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/main/webapp/js/grapheditor/Sidebar.js:4680— 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/main/webapp/js/grapheditor/Sidebar.js:5256— 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/main/webapp/js/open.js:113— 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.
FunctionTooLong: export.render src/main/webapp/js/export.js:234— FunctionTooLong — render runs 1014 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 914 over it, 10.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.
FunctionTooLong: P2PCollab.P2PCollab src/main/webapp/js/diagramly/P2PCollab.js:11— FunctionTooLong — P2PCollab runs 705 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 605 over it, 7.05× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: trees.Draw.loadPlugin() src/main/webapp/plugins/trees/trees.js:14— FunctionTooLong — Draw.loadPlugin() runs 686 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 586 over it, 6.86× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mxODPicker.mxODPicker src/main/webapp/js/onedrive/mxODPicker.js:11— FunctionTooLong — mxODPicker runs 677 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 577 over it, 6.77× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: MiroImporter.MiroImporter src/main/webapp/js/diagramly/miro/MiroImporter.js:5— FunctionTooLong — MiroImporter runs 347 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 247 over it, 3.47× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: Embed.initGraph REDACTED:154— FunctionTooLong — initGraph runs 322 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 222 over it, 3.22× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mxRuler.mxRuler src/main/webapp/js/diagramly/mxRuler.js:20— FunctionTooLong — mxRuler runs 304 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 204 over it, 3.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.
FunctionTooLong: mxFreehand.mxFreehand src/main/webapp/js/diagramly/mxFreehand.js:5— FunctionTooLong — mxFreehand runs 284 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 184 over it, 2.84× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: random.Draw.loadPlugin() src/main/webapp/plugins/random.js:8— FunctionTooLong — Draw.loadPlugin() runs 260 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 160 over it, 2.60× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: nextcloud.Draw.loadPlugin() src/main/webapp/plugins/nextcloud.js:8— FunctionTooLong — Draw.loadPlugin() runs 206 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 106 over it, 2.06× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: replay.Draw.loadPlugin() src/main/webapp/plugins/replay.js:10— FunctionTooLong — Draw.loadPlugin() runs 150 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 50 over it, 1.50× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: mxPanningManager.mxPanningManager src/main/webapp/mxgraph/src/util/mxPanningManager.js:10— FunctionTooLong — mxPanningManager runs 139 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 39 over it, 1.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.
FunctionTooLong: InlineToolbar.InlineToolbar.createPopover.position src/main/webapp/js/grapheditor/InlineToolbar.js:1602— FunctionTooLong — InlineToolbar.createPopover.position 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.
FunctionTooLong: update.Draw.loadPlugin() src/main/webapp/plugins/update.js:74— FunctionTooLong — Draw.loadPlugin() runs 112 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 12 over it, 1.12× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: open.main src/main/webapp/js/open.js:44— FunctionTooLong — main 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.
FunctionTooLong: ConfigEditor.DrawioConfigEditor.install.renderSchemeEditor src/main/webapp/js/diagramly/ConfigEditor.js:842— FunctionTooLong — DrawioConfigEditor.install.renderSchemeEditor 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.
AC3 · Page structure· Data table has no header cells · ×9
Data table has no header cells etc/dependencies/dompurify-smoke.js:120— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells src/main/webapp/js/diagramly/App.js:9627— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells src/main/webapp/js/diagramly/Editor.js:14882— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells REDACTED:647— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells src/main/webapp/js/embed.dev.js:647— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells src/main/webapp/js/grapheditor/Format.js:8619— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells src/main/webapp/js/grapheditor/Sidebar.js:4317— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells src/main/webapp/js/onedrive/mxODPicker.js:626— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
Data table has no header cells src/main/webapp/open.html:12— A <table> with data cells but no <th> gives assistive technology no way to associate cells with their headers. Mark the header row/column cells as <th> (with a scope).
AC6 · Visual & motion safety· Animation without a prefers-reduced-motion guard · ×9
Animation without a prefers-reduced-motion guard src/main/webapp/styles/grapheditor.css:1776— `.geToolbarContainer.geVerticalToolbar` moves (`transition: transform 0.1s ease-out`) 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/main/webapp/styles/grapheditor.css:2076— `.geCollapsibleTitle::before` moves (`transition: transform 0.15s 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/main/webapp/styles/grapheditor.css:2357— `.geSidebar .geItem` moves (`transition: transform 100ms ease-out`) 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/main/webapp/styles/grapheditor.css:3871— `.geTidyPanel .geTidyToggle input[type="checkbox"]::after` moves (`transition: left 0.15s`) 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/main/webapp/styles/grapheditor.css:4006— `.geTextOutlineToggle img` moves (`transition: transform 0.15s 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/main/webapp/styles/grapheditor.css:4798— `.geNotification-bell` moves (`animation: geBellAnim 1s 1s both`) 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/main/webapp/styles/grapheditor.css:4853— `.geBell-rad` moves (`animation: geRadAnim 1s 2s both`) 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/main/webapp/styles/grapheditor.css:4868— `.geNotification-count` moves (`animation: geZoomAnim 1s 1s both`) 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/main/webapp/styles/grapheditor.css:4998— `.geNotifPanel .notifications .notification:nth-child(n+1)` moves (`animation: geHere-am-i 0.5s ease-out 0.4s`) 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.
AC3 · Page structure· Page without a main landmark · ×7
Page without a main landmark src/main/webapp/clear.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark src/main/webapp/index.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark src/main/webapp/js/diagramly/Dialogs.js:781— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark src/main/webapp/js/diagramly/Menus.js:829— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark src/main/webapp/open.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark src/main/webapp/teams.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
Page without a main landmark src/main/webapp/vsdxImporter.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
AC6 · Visual & motion safety· Focus outline removed in CSS without a · ×7
Focus outline removed in CSS without a :focus replacement src/main/webapp/styles/grapheditor.css:449— `.geDarkMode .mxPopupMenuItem>div:not(:has(img))` 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/main/webapp/styles/grapheditor.css:887— `.geGenerateDiagramDescription` 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/main/webapp/styles/grapheditor.css:1194— `.geDiagramContainer` 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/main/webapp/styles/grapheditor.css:1454— `.geFocusLabel:focus-visible` 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/main/webapp/styles/grapheditor.css:3644— `.geTidyPanel: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/main/webapp/styles/grapheditor.css:5347— `.geOmnibox .geOmniboxBar input:not(.geButton)` 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/main/webapp/mxgraph/css/common.css:20— `.mxCellEditor` 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.
addTrees::addSibling (cognitive 92) src/main/webapp/js/diagramly/Trees.js:1150— addTrees::addSibling has cognitive complexity 92 (threshold 15). Drivers by points: if/else 16 (50 pts), ternaries 7 (25 pts), boolean chains 11, loops 2 (6 pts) (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.
addTrees::moveCells (cognitive 81) src/main/webapp/js/diagramly/Trees.js:853— addTrees::moveCells has cognitive complexity 81 (threshold 15). Drivers by points: if/else 18 (59 pts), boolean chains 11, loops 4 (8 pts), ternaries 1 (3 pts) (nesting depth added 47). 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.
addTrees::onKeyDown (cognitive 48) src/main/webapp/js/diagramly/Trees.js:1549— addTrees::onKeyDown has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (33 pts), boolean chains 10, ternaries 2 (4 pts), error handling 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addTrees::selectCell (cognitive 31) src/main/webapp/js/diagramly/Trees.js:1492— addTrees::selectCell has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 7, ternaries 1 (5 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.
addTrees::duplicateCells (cognitive 19) src/main/webapp/js/diagramly/Trees.js:796— addTrees::duplicateCells has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 pts), boolean chains 2, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addTrees::addChild (cognitive 18) src/main/webapp/js/diagramly/Trees.js:1369— addTrees::addChild has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 4 (8 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addTrees::styleDroppedConnection (cognitive 18) src/main/webapp/js/diagramly/Trees.js:1715— addTrees::styleDroppedConnection has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, 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.
Duplicated block (28 lines × 2 locations) src/main/webapp/js/diagramly/EditorUi.js:10992— src/main/webapp/js/diagramly/EditorUi.js:10992 · src/main/webapp/js/diagramly/EditorUi.js:11283 — 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 (28 lines × 2 locations) src/main/webapp/js/diagramly/ElectronApp.js:2148— src/main/webapp/js/diagramly/ElectronApp.js:2148 · src/main/webapp/js/diagramly/ElectronApp.js:2254 — 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 (28 lines × 2 locations) REDACTED:8031— REDACTED:8031 · REDACTED:8069 — 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 (28 lines × 2 locations) REDACTED:13086— REDACTED:13086 · REDACTED:13169 — 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 (28 lines × 2 locations) REDACTED:1868— REDACTED:1868 · REDACTED:1935 — 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 (28 lines × 2 locations) src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:898— src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:898 · src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:933 — 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 (28 lines × 2 locations) src/main/webapp/js/diagramly/util/mxAsyncCanvas.js:51— src/main/webapp/js/diagramly/util/mxAsyncCanvas.js:51 · src/main/webapp/js/diagramly/util/mxJsCanvas.js:97 — 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.
IC1 · Incompleteness & stubs· Both branches are identical · ×6
Both branches are identical — the condition decides nothing REDACTED:14— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Both branches are identical — the condition decides nothing src/main/webapp/js/grapheditor/Shapes.js:10014— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Both branches are identical — the condition decides nothing src/main/webapp/js/grapheditor/Shapes.js:10015— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Both branches are identical — the condition decides nothing src/main/webapp/js/grapheditor/Shapes.js:10037— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Both branches are identical — the condition decides nothing src/main/webapp/js/grapheditor/Shapes.js:10038— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Both branches are identical — the condition decides nothing src/main/webapp/mxgraph/src/view/mxCellRenderer.js:1646— Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
Dialogs.AnimationDialog::renderStepField (cyclomatic 51) src/main/webapp/js/diagramly/Dialogs.js:15950— Dialogs.AnimationDialog::renderStepField has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 5 other methods here (Dialogs.AnimationDialog, Dialogs.AnimationDialog::loadFromContext, Dialogs.AnimationDialog::formatSelectorText, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.AnimationDialog::makeStepRow (cyclomatic 43) src/main/webapp/js/diagramly/Dialogs.js:16367— Dialogs.AnimationDialog::makeStepRow has cyclomatic complexity 43 (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. This shape REPEATS in the file: 5 other methods here (Dialogs.AnimationDialog, Dialogs.AnimationDialog::loadFromContext, Dialogs.AnimationDialog::formatSelectorText, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.AnimationDialog::formatSelectorText (cyclomatic 22) src/main/webapp/js/diagramly/Dialogs.js:14697— Dialogs.AnimationDialog::formatSelectorText 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. This shape REPEATS in the file: 5 other methods here (Dialogs.AnimationDialog, Dialogs.AnimationDialog::loadFromContext, Dialogs.AnimationDialog::renderStepField, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.AnimationDialog::buildStepObject (cyclomatic 20) src/main/webapp/js/diagramly/Dialogs.js:17015— Dialogs.AnimationDialog::buildStepObject 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. This shape REPEATS in the file: 5 other methods here (Dialogs.AnimationDialog, Dialogs.AnimationDialog::loadFromContext, Dialogs.AnimationDialog::formatSelectorText, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.AnimationDialog::loadFromContext (cyclomatic 16) src/main/webapp/js/diagramly/Dialogs.js:14411— Dialogs.AnimationDialog::loadFromContext has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 5 other methods here (Dialogs.AnimationDialog, Dialogs.AnimationDialog::formatSelectorText, Dialogs.AnimationDialog::renderStepField, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
TodoComment src/main/server/java/com/mxgraph/online/AbsAuth.java:270— //Chrome blocks this cookie when draw.io is running in an iframe. The cookie is added to parent frame. TODO FIXME — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment src/main/server/java/com/mxgraph/online/AbsAuth.java:368— //TODO This code should be removed when new code is propagated — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment src/main/server/java/com/mxgraph/online/CacheFacade.java:79— //TODO implement this for memcached — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment src/main/server/java/com/mxgraph/online/EmbedServlet2.java:341— // TODO: Add JS to Javascript code inline. This had to be done to quickly — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment REDACTED:605— // TODO: Add check for .eot fonts — 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.
AnimationDialog::renderStepField (cognitive 72) src/main/webapp/js/diagramly/Dialogs.js:15950— AnimationDialog::renderStepField has cognitive complexity 72 (threshold 15). Drivers by points: if/else 23 (32 pts), ternaries 10 (24 pts), boolean chains 14, loops 1 (2 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnimationDialog::makeStepRow (cognitive 45) src/main/webapp/js/diagramly/Dialogs.js:16367— AnimationDialog::makeStepRow has cognitive complexity 45 (threshold 15). Drivers by points: boolean chains 22, if/else 14 (19 pts), loops 1 (3 pts), ternaries 1 (nesting depth added 7). 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.
AnimationDialog::buildStepObject (cognitive 44) src/main/webapp/js/diagramly/Dialogs.js:17015— AnimationDialog::buildStepObject has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (28 pts), ternaries 4 (11 pts), loops 1 (3 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.
AnimationDialog::loadFromContext (cognitive 23) src/main/webapp/js/diagramly/Dialogs.js:14411— AnimationDialog::loadFromContext has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (15 pts), ternaries 2 (4 pts), boolean chains 2, error handling 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.
AnimationDialog::keepExploreLast (cognitive 19) src/main/webapp/js/diagramly/Dialogs.js:14808— AnimationDialog::keepExploreLast has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, loops 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Trees.EditorUi.addTrees::addSibling (cyclomatic 34) src/main/webapp/js/diagramly/Trees.js:1150— Trees.EditorUi.addTrees::addSibling 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. This shape REPEATS in the file: 4 other methods here (Trees.EditorUi.addTrees, Trees.EditorUi.addTrees::collectTreeRemoval, Trees.EditorUi.addTrees::getTreeDirection, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Trees.EditorUi.addTrees::getTreeDirection (cyclomatic 22) src/main/webapp/js/diagramly/Trees.js:1031— Trees.EditorUi.addTrees::getTreeDirection 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. This shape REPEATS in the file: 4 other methods here (Trees.EditorUi.addTrees, Trees.EditorUi.addTrees::collectTreeRemoval, Trees.EditorUi.addTrees::addSibling, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Trees.EditorUi.addTrees::collectTreeRemoval (cyclomatic 16) src/main/webapp/js/diagramly/Trees.js:536— Trees.EditorUi.addTrees::collectTreeRemoval has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (Trees.EditorUi.addTrees, Trees.EditorUi.addTrees::getTreeDirection, Trees.EditorUi.addTrees::addSibling, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Trees.EditorUi.addTrees::selectCell (cyclomatic 16) src/main/webapp/js/diagramly/Trees.js:1492— Trees.EditorUi.addTrees::selectCell has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (Trees.EditorUi.addTrees, Trees.EditorUi.addTrees::collectTreeRemoval, Trees.EditorUi.addTrees::getTreeDirection, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
FindWindow::search (cognitive 138) src/main/webapp/js/diagramly/Dialogs.js:10115— FindWindow::search has cognitive complexity 138 (threshold 15). Drivers by points: if/else 32 (83 pts), boolean chains 35, loops 4 (11 pts), ternaries 3 (9 pts) (nesting depth added 64). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FindWindow::replacePlaceholderMatch (cognitive 37) src/main/webapp/js/diagramly/Dialogs.js:10752— FindWindow::replacePlaceholderMatch has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 6, loops 2 (5 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.
FindWindow::updateCount (cognitive 36) src/main/webapp/js/diagramly/Dialogs.js:10409— FindWindow::updateCount has cognitive complexity 36 (threshold 15). Drivers by points: if/else 6 (18 pts), ternaries 3 (7 pts), boolean chains 5, loops 2 (5 pts), error handling 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.
FindWindow::isMatch (cognitive 20) src/main/webapp/js/diagramly/Dialogs.js:10377— FindWindow::isMatch has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, ternaries 2 (5 pts), if/else 3 (4 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.
EditorUi.CommentsWindow::addComment (cognitive 30) src/main/webapp/js/diagramly/EditorUi.js:45460— EditorUi.CommentsWindow::addComment has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 9, ternaries 2 (3 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: 3 other methods here (EditorUi.CommentsWindow::renderAnchorRow, EditorUi.CommentsWindow::getCommentEditorValue::walk, EditorUi.CommentsWindow::installMentionHandler::updateMenu) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
EditorUi.CommentsWindow::renderAnchorRow (cognitive 24) src/main/webapp/js/diagramly/EditorUi.js:44646— EditorUi.CommentsWindow::renderAnchorRow has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 3 (7 pts), boolean chains 3, loops 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. This shape REPEATS in the file: 3 other methods here (EditorUi.CommentsWindow::getCommentEditorValue::walk, EditorUi.CommentsWindow::installMentionHandler::updateMenu, EditorUi.CommentsWindow::addComment) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
EditorUi.CommentsWindow::installMentionHandler::updateMenu (cognitive 22) src/main/webapp/js/diagramly/EditorUi.js:45050— EditorUi.CommentsWindow::installMentionHandler::updateMenu has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (EditorUi.CommentsWindow::renderAnchorRow, EditorUi.CommentsWindow::getCommentEditorValue::walk, EditorUi.CommentsWindow::addComment) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
EditorUi.CommentsWindow::getCommentEditorValue::walk (cognitive 16) src/main/webapp/js/diagramly/EditorUi.js:44913— EditorUi.CommentsWindow::getCommentEditorValue::walk has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, 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. This shape REPEATS in the file: 3 other methods here (EditorUi.CommentsWindow::renderAnchorRow, EditorUi.CommentsWindow::installMentionHandler::updateMenu, EditorUi.CommentsWindow::addComment) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
init::(anonymous)::(anonymous)::checkModel (cognitive 30) src/main/webapp/js/diagramly/Menus.js:2501— init::(anonymous)::(anonymous)::checkModel has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 1, loops 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.
init::(anonymous)::setSharedState (cognitive 25) src/main/webapp/js/diagramly/Menus.js:5082— init::(anonymous)::setSharedState has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 3 (8 pts), boolean chains 6 (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.
init::click (cognitive 18) src/main/webapp/connect/common/js/mxReader.js:254— init::click has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (16 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.
init::(anonymous)::keydownHandler (cognitive 16) src/main/webapp/js/diagramly/Menus.js:5214— init::(anonymous)::keydownHandler has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Duplicated block (27 lines × 2 locations) src/main/webapp/js/diagramly/Dialogs.js:27286— src/main/webapp/js/diagramly/Dialogs.js:27286 · src/main/webapp/js/diagramly/Dialogs.js:28226 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (27 lines × 2 locations) src/main/webapp/js/diagramly/EditorUi.js:9681— src/main/webapp/js/diagramly/EditorUi.js:9681 · src/main/webapp/js/diagramly/EditorUi.js:13847 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (27 lines × 2 locations) src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:572— src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:572 · src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:606 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (27 lines × 2 locations) REDACTED:2405— REDACTED:2405 · REDACTED:2525 — 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.
Weak hash algorithm src/main/webapp/js/diagramly/DrawioFileSync.js:3935— MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`createHash("sha256")`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
Weak hash algorithm src/main/webapp/js/diagramly/OneDriveFile.js:114— MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`createHash("sha256")`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
Weak hash algorithm src/main/webapp/js/diagramly/OneDriveFile.js:553— MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`createHash("sha256")`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
Weak hash algorithm src/main/webapp/plugins/nextcloud.js:415— MD5/SHA1 is computed here, and both are collision-broken. If this digest protects anything — a signature, an integrity or tamper check, a credential, or any value an attacker can influence — that is a real weakness: use SHA-256+ (`createHash("sha256")`) for content integrity, or a KDF (bcrypt/Argon2/scrypt) for password storage. If it only derives a non-security identifier (a cache key, an avatar URL, an ETag), collision resistance carries no security consequence here; make that intent explicit instead — a non-cryptographic hash such as xxhash or murmurhash says it in code — since the algorithm alone cannot distinguish the two uses. Where a protocol this code does not own fixes the digest (a k-anonymity range query, a legacy signature format), the protocol decides; say so beside the call.
Dialogs.NewDialog::filterTemplates (cyclomatic 24) src/main/webapp/js/diagramly/Dialogs.js:3723— Dialogs.NewDialog::filterTemplates 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. This shape REPEATS in the file: 3 other methods here (Dialogs.NewDialog, Dialogs.NewDialog::create, Dialogs.NewDialog::addButton) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.NewDialog::create (cyclomatic 23) src/main/webapp/js/diagramly/Dialogs.js:2783— Dialogs.NewDialog::create 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. This shape REPEATS in the file: 3 other methods here (Dialogs.NewDialog, Dialogs.NewDialog::addButton, Dialogs.NewDialog::filterTemplates) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.NewDialog::addButton (cyclomatic 22) src/main/webapp/js/diagramly/Dialogs.js:3325— Dialogs.NewDialog::addButton 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. This shape REPEATS in the file: 3 other methods here (Dialogs.NewDialog, Dialogs.NewDialog::create, Dialogs.NewDialog::filterTemplates) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.FindWindow::replacePlaceholderMatch (cyclomatic 22) src/main/webapp/js/diagramly/Dialogs.js:10752— Dialogs.FindWindow::replacePlaceholderMatch 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. This shape REPEATS in the file: 2 other methods here (Dialogs.FindWindow::isMatch, Dialogs.FindWindow::updateCount) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.FindWindow::updateCount (cyclomatic 18) src/main/webapp/js/diagramly/Dialogs.js:10409— Dialogs.FindWindow::updateCount 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. This shape REPEATS in the file: 2 other methods here (Dialogs.FindWindow::isMatch, Dialogs.FindWindow::replacePlaceholderMatch) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.FindWindow::isMatch (cyclomatic 17) src/main/webapp/js/diagramly/Dialogs.js:10377— Dialogs.FindWindow::isMatch has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 2 other methods here (Dialogs.FindWindow::updateCount, Dialogs.FindWindow::replacePlaceholderMatch) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxBase64.decodeFast (cyclomatic 16) src/main/server/java/com/mxgraph/online/mxBase64.java:409— mxBase64.decodeFast has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (mxBase64.decodeFast, mxBase64.decodeFast) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxBase64.decodeFast (cyclomatic 16) src/main/server/java/com/mxgraph/online/mxBase64.java:220— mxBase64.decodeFast has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (mxBase64.decodeFast, mxBase64.decodeFast) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxBase64.decodeFast (cyclomatic 16) src/main/server/java/com/mxgraph/online/mxBase64.java:556— mxBase64.decodeFast has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (mxBase64.decodeFast, mxBase64.decodeFast) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
render::renderPage (cognitive 217) src/main/webapp/js/export.js:1626— render::renderPage has cognitive complexity 217 (threshold 15). Drivers by points: if/else 65 (122 pts), boolean chains 45, ternaries 14 (40 pts), loops 3 (8 pts), error handling 1 (2 pts) (nesting depth added 89). 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::redraw (cognitive 32) src/main/webapp/js/export.js:456— render::redraw has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (15 pts), ternaries 3 (10 pts), boolean chains 7 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
render::getGlobalVariable (cognitive 18) src/main/webapp/js/export.js:2271— render::getGlobalVariable has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 3 (8 pts), boolean chains 5, if/else 4 (5 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.
P2PCollab::processMsg (cognitive 91) src/main/webapp/js/diagramly/P2PCollab.js:689— P2PCollab::processMsg has cognitive complexity 91 (threshold 15). Drivers by points: if/else 25 (59 pts), boolean chains 10, ternaries 4 (10 pts), loops 2 (8 pts), error handling 2 (3 pts), match/switch 1 (nesting depth added 47). 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.
P2PCollab::sendMessage (cognitive 26) src/main/webapp/js/diagramly/P2PCollab.js:171— P2PCollab::sendMessage has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 10, loops 1 (2 pts), error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
P2PCollab::joinFile::messageListener (cognitive 19) src/main/webapp/js/diagramly/P2PCollab.js:1277— P2PCollab::joinFile::messageListener has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 6, ternaries 1 (3 pts), error handling 1, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
trees.Draw.loadPlugin()::addSibling (cognitive 67) src/main/webapp/plugins/trees/trees.js:514— trees.Draw.loadPlugin()::addSibling has cognitive complexity 67 (threshold 15). Drivers by points: if/else 16 (50 pts), boolean chains 11, loops 2 (6 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. This shape REPEATS in the file: 3 other methods here (trees.Draw.loadPlugin(), trees.Draw.loadPlugin()::getTreeDirection, trees.Draw.loadPlugin()::selectCell) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
trees.Draw.loadPlugin()::getTreeDirection (cognitive 26) src/main/webapp/plugins/trees/trees.js:471— trees.Draw.loadPlugin()::getTreeDirection has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (23 pts), boolean chains 3 (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. This shape REPEATS in the file: 3 other methods here (trees.Draw.loadPlugin(), trees.Draw.loadPlugin()::addSibling, trees.Draw.loadPlugin()::selectCell) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
trees.Draw.loadPlugin()::selectCell (cognitive 26) src/main/webapp/plugins/trees/trees.js:798— trees.Draw.loadPlugin()::selectCell has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 7 (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. This shape REPEATS in the file: 3 other methods here (trees.Draw.loadPlugin(), trees.Draw.loadPlugin()::getTreeDirection, trees.Draw.loadPlugin()::addSibling) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.NewDialog::filterTemplates (cognitive 64) src/main/webapp/js/diagramly/Dialogs.js:3723— Dialogs.NewDialog::filterTemplates has cognitive complexity 64 (threshold 15). Drivers by points: if/else 11 (34 pts), loops 8 (26 pts), boolean chains 3, ternaries 1 (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. This shape REPEATS in the file: 2 other methods here (Dialogs.NewDialog::initUi, Dialogs.NewDialog::addTemplateEntry) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.NewDialog::initUi (cognitive 33) src/main/webapp/js/diagramly/Dialogs.js:3860— Dialogs.NewDialog::initUi has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 3 (7 pts), ternaries 2 (6 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. This shape REPEATS in the file: 2 other methods here (Dialogs.NewDialog::filterTemplates, Dialogs.NewDialog::addTemplateEntry) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.NewDialog::addTemplateEntry (cognitive 31) src/main/webapp/js/diagramly/Dialogs.js:4111— Dialogs.NewDialog::addTemplateEntry has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (29 pts), boolean chains 2 (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. This shape REPEATS in the file: 2 other methods here (Dialogs.NewDialog::filterTemplates, Dialogs.NewDialog::initUi) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
convertHtmlBlocksToSvg::processBlockInlineContent (cognitive 61) src/main/webapp/mxgraph/src/util/mxUtils.js:6184— convertHtmlBlocksToSvg::processBlockInlineContent has cognitive complexity 61 (threshold 15). Drivers by points: if/else 24 (53 pts), loops 2 (5 pts), boolean chains 2, ternaries 1 (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.
convertHtmlBlocksToSvg::processAnonymousInlineRun (cognitive 25) src/main/webapp/mxgraph/src/util/mxUtils.js:6366— convertHtmlBlocksToSvg::processAnonymousInlineRun has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (7 pts), boolean chains 4, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
convertHtmlBlocksToSvg::processChildren (cognitive 20) src/main/webapp/mxgraph/src/util/mxUtils.js:6477— convertHtmlBlocksToSvg::processChildren has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 5, loops 2 (4 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.
Trees.EditorUi.addTrees::getTreeDirection (cognitive 54) src/main/webapp/js/diagramly/Trees.js:1031— Trees.EditorUi.addTrees::getTreeDirection has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 4 (25 pts), if/else 9 (24 pts), boolean chains 5 (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. This shape REPEATS in the file: 3 other methods here (Trees.EditorUi.addTrees, Trees.EditorUi.addTrees::collectTreeRemoval, Trees.EditorUi.addTrees::hasConnectedSurvivor) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Trees.EditorUi.addTrees::collectTreeRemoval (cognitive 28) src/main/webapp/js/diagramly/Trees.js:536— Trees.EditorUi.addTrees::collectTreeRemoval has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (Trees.EditorUi.addTrees, Trees.EditorUi.addTrees::hasConnectedSurvivor, Trees.EditorUi.addTrees::getTreeDirection) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Trees.EditorUi.addTrees::hasConnectedSurvivor (cognitive 16) src/main/webapp/js/diagramly/Trees.js:653— Trees.EditorUi.addTrees::hasConnectedSurvivor has cognitive complexity 16 (threshold 15). Drivers by points: if/else 2 (8 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. This shape REPEATS in the file: 3 other methods here (Trees.EditorUi.addTrees, Trees.EditorUi.addTrees::collectTreeRemoval, Trees.EditorUi.addTrees::getTreeDirection) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
addProperties::applyStyleVal (cognitive 41) src/main/webapp/js/diagramly/Editor.js:9276— addProperties::applyStyleVal has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (28 pts), loops 3 (11 pts), boolean chains 2 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
addProperties::createPropertyRow (cognitive 30) src/main/webapp/js/diagramly/Editor.js:9534— addProperties::createPropertyRow has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (16 pts), ternaries 6 (9 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
addProperties::createPropertyRow::(anonymous)::setInputVal (cognitive 20) src/main/webapp/js/diagramly/Editor.js:9778— addProperties::createPropertyRow::(anonymous)::setInputVal has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (8 pts), if/else 5 (6 pts), boolean chains 5, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
initCanvas::lazyZoom (cognitive 40) REDACTED:6945— initCanvas::lazyZoom has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 7 (15 pts), if/else 9 (14 pts), boolean chains 9, 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.
initCanvas::zoomGraph (cognitive 33) REDACTED:7326— initCanvas::zoomGraph has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 8, ternaries 2 (6 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.
initCanvas::validate (cognitive 24) REDACTED:6612— initCanvas::validate has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 6 (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.
NewDialog::create (cognitive 37) src/main/webapp/js/diagramly/Dialogs.js:2783— NewDialog::create has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 12, ternaries 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.
NewDialog::addButton (cognitive 31) src/main/webapp/js/diagramly/Dialogs.js:3325— NewDialog::addButton has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 7, ternaries 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.
NewDialog::selectElement (cognitive 28) src/main/webapp/js/diagramly/Dialogs.js:3011— NewDialog::selectElement has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (20 pts), ternaries 2 (8 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
mxODPicker::fillFolderFiles::renderList (cognitive 30) src/main/webapp/js/onedrive/mxODPicker.js:622— mxODPicker::fillFolderFiles::renderList has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 4 (9 pts), boolean chains 7, 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.
mxODPicker::fillFolderFiles (cognitive 29) src/main/webapp/js/onedrive/mxODPicker.js:591— mxODPicker::fillFolderFiles has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 8 (15 pts), if/else 7 (9 pts), boolean chains 2, loops 1 (2 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxODPicker::getDrawioFileDoc::onreadystatechange (cognitive 17) src/main/webapp/js/onedrive/mxODPicker.js:364— mxODPicker::getDrawioFileDoc::onreadystatechange has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 1 (3 pts), ternaries 1 (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.
Dialogs.ColorDialog::addCurrentToRecent (cognitive 28) REDACTED:862— Dialogs.ColorDialog::addCurrentToRecent has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 8 (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. This shape REPEATS in the file: 3 other methods here (Dialogs.ColorDialog, Dialogs.ColorDialog::setDefaultSelected, Dialogs.ColorDialog::inputChanged) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.ColorDialog::inputChanged (cognitive 19) REDACTED:730— Dialogs.ColorDialog::inputChanged has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (Dialogs.ColorDialog, Dialogs.ColorDialog::setDefaultSelected, Dialogs.ColorDialog::addCurrentToRecent) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.ColorDialog::setDefaultSelected (cognitive 17) REDACTED:647— Dialogs.ColorDialog::setDefaultSelected has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (Dialogs.ColorDialog, Dialogs.ColorDialog::inputChanged, Dialogs.ColorDialog::addCurrentToRecent) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
(anonymous) (cognitive 27) REDACTED:6873— (anonymous) has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 8 (13 pts) (nesting depth added 7). None of this is in the body itself: all 27 points belong to 15 function items inside it that branch (toHsl, toHsv, toHexStr, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cognitive 27) src/main/webapp/js/diagramly/Editor.js:5— (anonymous) has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 10, if/else 7 (9 pts), ternaries 4, loops 2 (3 pts), error handling 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
(anonymous) (cognitive 27) src/main/webapp/mxgraph/src/io/mxChildChangeCodec.js:5— (anonymous) has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 10, loops 1 (2 pts) (nesting depth added 7). None of this is in the body itself: all 27 points belong to 5 function items inside it that branch (beforeDecode, isExcluded, afterDecode, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cognitive 23) REDACTED:3224— (anonymous) has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (11 pts), match/switch 2 (5 pts), boolean chains 3, error handling 2, loops 1 (2 pts) (nesting depth added 8). None of this is in the body itself: all 23 points belong to 5 function items inside it that branch (getRowObj, getDoubleVal, a function literal at line 3254, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cognitive 23) REDACTED:6756— (anonymous) has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 12). None of this is in the body itself: all 23 points belong to 4 function items inside it that branch (getIndexedCell, a function literal at line 6775, a function literal at line 6785, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cognitive 23) REDACTED:7648— (anonymous) has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 8 (nesting depth added 5). None of this is in the body itself: all 23 points belong to 33 function items inside it that branch (calcColor, getColor, getColor$int$com_mxgraph_io_vsdx_mxVsdxTheme, …). 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.
mxBase64.decodeFast (cognitive 20) src/main/server/java/com/mxgraph/online/mxBase64.java:409— mxBase64.decodeFast has cognitive complexity 20 (threshold 15). Drivers by points: loops 5 (7 pts), ternaries 4 (6 pts), if/else 3 (4 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (mxBase64.decodeFast, mxBase64.decodeFast) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxBase64.decodeFast (cognitive 20) src/main/server/java/com/mxgraph/online/mxBase64.java:220— mxBase64.decodeFast has cognitive complexity 20 (threshold 15). Drivers by points: loops 5 (7 pts), ternaries 4 (6 pts), if/else 3 (4 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (mxBase64.decodeFast, mxBase64.decodeFast) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxBase64.decodeFast (cognitive 20) src/main/server/java/com/mxgraph/online/mxBase64.java:556— mxBase64.decodeFast has cognitive complexity 20 (threshold 15). Drivers by points: loops 5 (7 pts), ternaries 4 (6 pts), if/else 3 (4 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (mxBase64.decodeFast, mxBase64.decodeFast) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
MethodTooLong: Utils.checkStreamContent REDACTED:444— MethodTooLong — checkStreamContent runs 112 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 12 over it, 1.12× 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: AbsAuth.contactOAuthServer src/main/server/java/com/mxgraph/online/AbsAuth.java:493— MethodTooLong — contactOAuthServer runs 105 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 5 over it, 1.05× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: EmbedServlet2.createEmbedJavaScript src/main/server/java/com/mxgraph/online/EmbedServlet2.java:273— MethodTooLong — createEmbedJavaScript 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.
Duplicated block (33 lines × 2 locations) src/main/webapp/js/diagramly/Dialogs.js:157— src/main/webapp/js/diagramly/Dialogs.js:157 · src/main/webapp/js/diagramly/Dialogs.js:5184 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (33 lines × 2 locations) src/main/webapp/js/diagramly/DiffSync.js:647— src/main/webapp/js/diagramly/DiffSync.js:647 · src/main/webapp/js/diagramly/DiffSync.js:784 — 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 (33 lines × 2 locations) src/main/webapp/js/diagramly/LightboxModern.js:2465— src/main/webapp/js/diagramly/LightboxModern.js:2465 · src/main/webapp/js/diagramly/ViewerModern.js:2099 — 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.
AC1 · Text alternatives· <canvas> without a text alternative · ×2
<canvas> without a text alternative src/main/webapp/js/diagramly/mxRuler.js:101— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
<canvas> without a text alternative REDACTED:827— A <canvas> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
Empty <h1> heading REDACTED:2900— An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative.
Empty <h1> heading REDACTED:2915— An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative.
P2PCollab.P2PCollab::processMsg (cyclomatic 50) src/main/webapp/js/diagramly/P2PCollab.js:689— P2PCollab.P2PCollab::processMsg has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (P2PCollab.P2PCollab, P2PCollab.P2PCollab::sendMessage) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
P2PCollab.P2PCollab::sendMessage (cyclomatic 28) src/main/webapp/js/diagramly/P2PCollab.js:171— P2PCollab.P2PCollab::sendMessage has cyclomatic complexity 28 (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. This shape REPEATS in the file: 2 other methods here (P2PCollab.P2PCollab, P2PCollab.P2PCollab::processMsg) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Extensions.convertTxt2Html::startBlockTag (cyclomatic 45) REDACTED:4102— Extensions.convertTxt2Html::startBlockTag 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. This shape REPEATS in the file: one other method here (Extensions.convertTxt2Html::startTag) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Extensions.convertTxt2Html::startTag (cyclomatic 25) REDACTED:4292— Extensions.convertTxt2Html::startTag has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (Extensions.convertTxt2Html::startBlockTag) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: Extensions.addStyle (cyclomatic 26) 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.
Dialogs.SaveDialog::addStorageEntry (cyclomatic 39) src/main/webapp/js/diagramly/Dialogs.js:4595— Dialogs.SaveDialog::addStorageEntry 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. This shape REPEATS in the file: 2 other methods here (Dialogs.SaveDialog, Dialogs.SaveDialog::addStorageEntries) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.SaveDialog::addStorageEntries (cyclomatic 23) src/main/webapp/js/diagramly/Dialogs.js:4792— Dialogs.SaveDialog::addStorageEntries 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. This shape REPEATS in the file: 2 other methods here (Dialogs.SaveDialog, Dialogs.SaveDialog::addStorageEntry) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
EditorUi.EditorUi.createKeyHandler (cyclomatic 37) src/main/webapp/js/diagramly/EditorUi.js:2471— EditorUi.EditorUi.createKeyHandler has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 11 of the 37 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 2481, 2494, 2504, …). 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.
EditorUi.EditorUi.createKeyHandler (cyclomatic 37) REDACTED:10922— EditorUi.EditorUi.createKeyHandler has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (EditorUi.EditorUi.createKeyHandler::nudge) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
addTrees::moveCells (cyclomatic 35) src/main/webapp/js/diagramly/Trees.js:853— addTrees::moveCells 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.
addTrees::onKeyDown (cyclomatic 34) src/main/webapp/js/diagramly/Trees.js:1549— addTrees::onKeyDown 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.
EditorUi.CommentsWindow::addComment (cyclomatic 34) src/main/webapp/js/diagramly/EditorUi.js:45460— EditorUi.CommentsWindow::addComment has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (EditorUi.CommentsWindow::installMentionHandler::updateMenu) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
EditorUi.CommentsWindow::installMentionHandler::updateMenu (cyclomatic 18) src/main/webapp/js/diagramly/EditorUi.js:45050— EditorUi.CommentsWindow::installMentionHandler::updateMenu 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. This shape REPEATS in the file: one other method here (EditorUi.CommentsWindow::addComment) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
trees.Draw.loadPlugin()::addSibling (cyclomatic 34) src/main/webapp/plugins/trees/trees.js:514— trees.Draw.loadPlugin()::addSibling 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. This shape REPEATS in the file: 2 other methods here (trees.Draw.loadPlugin(), trees.Draw.loadPlugin()::selectCell) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
trees.Draw.loadPlugin()::selectCell (cyclomatic 16) src/main/webapp/plugins/trees/trees.js:798— trees.Draw.loadPlugin()::selectCell has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (trees.Draw.loadPlugin(), trees.Draw.loadPlugin()::addSibling) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
EditorUi.EditorUi.showExportDialog::setPresetValues (cyclomatic 30) src/main/webapp/js/diagramly/EditorUi.js:12622— EditorUi.EditorUi.showExportDialog::setPresetValues has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 2 other methods here (EditorUi.EditorUi.showExportDialog, EditorUi.EditorUi.showExportDialog::getPresetValues) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
EditorUi.EditorUi.showExportDialog::getPresetValues (cyclomatic 19) src/main/webapp/js/diagramly/EditorUi.js:12537— EditorUi.EditorUi.showExportDialog::getPresetValues has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 2 other methods here (EditorUi.EditorUi.showExportDialog, EditorUi.EditorUi.showExportDialog::setPresetValues) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
Graph.Graph.computeShapeInsideSpacer::run (cyclomatic 30) REDACTED:7726— Graph.Graph.computeShapeInsideSpacer::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. This shape REPEATS in the file: 2 other methods here (Graph.Graph.computeShapeInsideSpacer, Graph.Graph.computeShapeInsideSpacer::run::probe) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Graph.Graph.computeShapeInsideSpacer::run::probe (cyclomatic 20) REDACTED:7738— Graph.Graph.computeShapeInsideSpacer::run::probe 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. This shape REPEATS in the file: 2 other methods here (Graph.Graph.computeShapeInsideSpacer, Graph.Graph.computeShapeInsideSpacer::run) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Dialogs.ChatWindow::renderResponseData (cyclomatic 28) src/main/webapp/js/diagramly/Dialogs.js:12744— Dialogs.ChatWindow::renderResponseData 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. This shape REPEATS in the file: 2 other methods here (Dialogs.ChatWindow, Dialogs.ChatWindow::addExchange) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.ChatWindow::addExchange (cyclomatic 19) src/main/webapp/js/diagramly/Dialogs.js:13323— Dialogs.ChatWindow::addExchange 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. This shape REPEATS in the file: 2 other methods here (Dialogs.ChatWindow, Dialogs.ChatWindow::renderResponseData) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
convertHtmlBlocksToSvg::processBlockInlineContent (cyclomatic 28) src/main/webapp/mxgraph/src/util/mxUtils.js:6184— convertHtmlBlocksToSvg::processBlockInlineContent 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.
convertHtmlBlocksToSvg::processAnonymousInlineRun (cyclomatic 16) src/main/webapp/mxgraph/src/util/mxUtils.js:6366— convertHtmlBlocksToSvg::processAnonymousInlineRun 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.
Graph.Graph.getCollapsedTableBorders::process (cyclomatic 27) REDACTED:26353— Graph.Graph.getCollapsedTableBorders::process 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. This shape REPEATS in the file: one other method here (Graph.Graph.getCollapsedTableBorders::resolve) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Graph.Graph.getCollapsedTableBorders::resolve (cyclomatic 19) REDACTED:26315— Graph.Graph.getCollapsedTableBorders::resolve 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. This shape REPEATS in the file: one other method here (Graph.Graph.getCollapsedTableBorders::process) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
createKeyHandler::isEventIgnored (cyclomatic 27) REDACTED:10929— createKeyHandler::isEventIgnored has cyclomatic complexity 27 (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.
createKeyHandler::getFunction (cyclomatic 27) REDACTED:11243— createKeyHandler::getFunction 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.
initCanvas::lazyZoom (cyclomatic 25) REDACTED:6945— initCanvas::lazyZoom 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.
initCanvas::zoomGraph (cyclomatic 23) REDACTED:7326— initCanvas::zoomGraph 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.
mxODPicker.mxODPicker::fillFolderFiles (cyclomatic 24) src/main/webapp/js/onedrive/mxODPicker.js:591— mxODPicker.mxODPicker::fillFolderFiles 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. This shape REPEATS in the file: 2 other methods here (mxODPicker.mxODPicker, mxODPicker.mxODPicker::fillFolderFiles::renderList) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxODPicker.mxODPicker::fillFolderFiles::renderList (cyclomatic 20) src/main/webapp/js/onedrive/mxODPicker.js:622— mxODPicker.mxODPicker::fillFolderFiles::renderList 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. This shape REPEATS in the file: 2 other methods here (mxODPicker.mxODPicker, mxODPicker.mxODPicker::fillFolderFiles) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
EditorUi.EditorUi.doImportCsv::updateListItems (cyclomatic 22) src/main/webapp/js/diagramly/EditorUi.js:40297— EditorUi.EditorUi.doImportCsv::updateListItems 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. This shape REPEATS in the file: 2 other methods here (EditorUi.EditorUi.doImportCsv, EditorUi.EditorUi.doImportCsv::getEdgeLabel) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.doImportCsv::getEdgeLabel (cyclomatic 17) src/main/webapp/js/diagramly/EditorUi.js:40916— EditorUi.EditorUi.doImportCsv::getEdgeLabel has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 2 other methods here (EditorUi.EditorUi.doImportCsv, EditorUi.EditorUi.doImportCsv::updateListItems) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
Dialogs.ColorDialog::buildFinalColor (cyclomatic 22) REDACTED:798— Dialogs.ColorDialog::buildFinalColor 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. This shape REPEATS in the file: 2 other methods here (Dialogs.ColorDialog, Dialogs.ColorDialog::addCurrentToRecent) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.ColorDialog::addCurrentToRecent (cyclomatic 21) REDACTED:862— Dialogs.ColorDialog::addCurrentToRecent 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. This shape REPEATS in the file: 2 other methods here (Dialogs.ColorDialog, Dialogs.ColorDialog::buildFinalColor) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
addProperties::createPropertyRow (cyclomatic 22) src/main/webapp/js/diagramly/Editor.js:9534— addProperties::createPropertyRow has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
addProperties::createPropertyRow::(anonymous)::setInputVal (cyclomatic 19) src/main/webapp/js/diagramly/Editor.js:9778— addProperties::createPropertyRow::(anonymous)::setInputVal has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
init::(anonymous)::setSharedState (cyclomatic 22) src/main/webapp/js/diagramly/Menus.js:5082— init::(anonymous)::setSharedState 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.
init::funct (cyclomatic 16) src/main/webapp/js/diagramly/Menus.js:3488— init::funct 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.
(anonymous) (cyclomatic 19) REDACTED:8305— (anonymous) has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 7 function items inside it that branch (isReflexAngle, handle, EllipticalArcTo, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 19) src/main/webapp/mxgraph/src/io/mxChildChangeCodec.js:5— (anonymous) has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 5 function items inside it that branch (isExcluded, beforeDecode, afterDecode, …). 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.
initMinimalTheme::init (cyclomatic 19) src/main/webapp/js/diagramly/Minimal.js:418— initMinimalTheme::init has cyclomatic complexity 19 (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.
initMinimalTheme::init::refreshMenu (cyclomatic 16) src/main/webapp/js/diagramly/Minimal.js:707— initMinimalTheme::init::refreshMenu 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.
(anonymous) (cyclomatic 18) REDACTED:7648— (anonymous) 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 33 function items inside it that branch (getColor, calcColor, getColor$int$com_mxgraph_io_vsdx_mxVsdxTheme, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 18) src/main/webapp/plugins/props.js:8— (anonymous) has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to 9 function items inside it that branch (cellClicked, extractData, a function literal at line 41, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 17) REDACTED:6873— (anonymous) has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 15 function items inside it that branch (toHsl, toHsv, toHexStr, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 17) REDACTED:319— (anonymous) has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
createKeyHandler::nudge (cognitive 119) REDACTED:11074— createKeyHandler::nudge has cognitive complexity 119 (threshold 15). Drivers by points: if/else 26 (92 pts), ternaries 4 (13 pts), boolean chains 10, loops 1 (4 pts) (nesting depth added 78). 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.
createKeyHandler::getFunction (cognitive 34) REDACTED:11243— createKeyHandler::getFunction has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 10, ternaries 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.
positionBoxes::visitorEdgeFunc (cognitive 118) src/main/webapp/js/orgchart/mxOrgChartLayout.js:708— positionBoxes::visitorEdgeFunc has cognitive complexity 118 (threshold 15). Drivers by points: if/else 21 (63 pts), loops 12 (40 pts), boolean chains 14, ternaries 1 (nesting depth added 70). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
positionBoxes::visitorEdgeFunc::walk (cognitive 16) src/main/webapp/js/orgchart/mxOrgChartLayout.js:936— positionBoxes::visitorEdgeFunc::walk has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (7 pts), if/else 3 (6 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ColorDialog::setColor (cognitive 70) REDACTED:1685— ColorDialog::setColor has cognitive complexity 70 (threshold 15). Drivers by points: if/else 29 (55 pts), ternaries 5 (10 pts), boolean chains 5 (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.
ColorDialog::buildFinalColor (cognitive 40) REDACTED:798— ColorDialog::buildFinalColor has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 8, ternaries 2 (8 pts) (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.
computeRoutes::solveWith (cognitive 66) src/main/webapp/js/libavoid-js/libavoid-routing.js:1203— computeRoutes::solveWith has cognitive complexity 66 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 17, ternaries 6 (14 pts), loops 7 (8 pts), error handling 4 (6 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.
computeRoutes::solve (cognitive 29) src/main/webapp/js/libavoid-js/libavoid-routing.js:1563— computeRoutes::solve has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 5 (14 pts), loops 5 (10 pts), if/else 2 (4 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
convertTxt2Html::startBlockTag (cognitive 61) REDACTED:4102— convertTxt2Html::startBlockTag has cognitive complexity 61 (threshold 15). Drivers by points: if/else 25 (42 pts), boolean chains 7, ternaries 4 (7 pts), match/switch 1 (3 pts), error handling 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
convertTxt2Html::startTag (cognitive 25) REDACTED:4292— convertTxt2Html::startTag has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 9, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Graph.Graph.getCollapsedTableBorders::process (cognitive 57) REDACTED:26353— Graph.Graph.getCollapsedTableBorders::process has cognitive complexity 57 (threshold 15). Drivers by points: if/else 15 (38 pts), loops 5 (11 pts), boolean chains 4, ternaries 1 (4 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Graph.Graph.getCollapsedTableBorders::resolve) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Graph.Graph.getCollapsedTableBorders::resolve (cognitive 17) REDACTED:26315— Graph.Graph.getCollapsedTableBorders::resolve has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 4 (6 pts), ternaries 2 (3 pts), loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Graph.Graph.getCollapsedTableBorders::process) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
authenticateStep2 (cognitive 55) src/main/webapp/js/diagramly/GitLabClient.js:109— authenticateStep2 has cognitive complexity 55 (threshold 15). Drivers by points: if/else 18 (50 pts), error handling 1 (4 pts), boolean chains 1 (nesting depth added 35). Most of this is not in the body itself: 2 of the 55 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 167, 123, 113, …). 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.
authenticateStep2 (cognitive 55) src/main/webapp/js/diagramly/GitHubClient.js:150— authenticateStep2 has cognitive complexity 55 (threshold 15). Drivers by points: if/else 18 (50 pts), error handling 1 (4 pts), boolean chains 1 (nesting depth added 35). Most of this is not in the body itself: 2 of the 55 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 207, 164, 154, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
mxRuler::drawRuler (cognitive 50) src/main/webapp/js/diagramly/mxRuler.js:143— mxRuler::drawRuler has cognitive complexity 50 (threshold 15). Drivers by points: if/else 19 (33 pts), ternaries 11 (12 pts), boolean chains 3, loops 1, match/switch 1 (nesting depth added 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.
mxRuler::move (cognitive 18) src/main/webapp/js/diagramly/mxRuler.js:422— mxRuler::move has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 2 (5 pts), boolean chains 4 (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.
EditorUi.EditorUi.doImportCsv::updateListItems (cognitive 43) src/main/webapp/js/diagramly/EditorUi.js:40297— EditorUi.EditorUi.doImportCsv::updateListItems has cognitive complexity 43 (threshold 15). Drivers by points: if/else 8 (23 pts), ternaries 3 (11 pts), loops 3 (5 pts), boolean chains 4 (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. This shape REPEATS in the file: 2 other methods here (EditorUi.EditorUi.doImportCsv, EditorUi.EditorUi.doImportCsv::moveToInsertPoint) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
EditorUi.EditorUi.doImportCsv::moveToInsertPoint (cognitive 16) src/main/webapp/js/diagramly/EditorUi.js:41348— EditorUi.EditorUi.doImportCsv::moveToInsertPoint has cognitive complexity 16 (threshold 15). Drivers by points: loops 3 (7 pts), if/else 2 (5 pts), ternaries 1 (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. This shape REPEATS in the file: 2 other methods here (EditorUi.EditorUi.doImportCsv, EditorUi.EditorUi.doImportCsv::updateListItems) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
ChatWindow::renderResponseData (cognitive 42) src/main/webapp/js/diagramly/Dialogs.js:12744— ChatWindow::renderResponseData has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 8, ternaries 3 (7 pts), error handling 1 (2 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.
ChatWindow::threadHistory (cognitive 18) src/main/webapp/js/diagramly/Dialogs.js:13241— ChatWindow::threadHistory has cognitive complexity 18 (threshold 15). Drivers by points: loops 2 (6 pts), boolean chains 4, if/else 3 (4 pts), ternaries 1 (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.
Graph.Graph.exploreFromCell::exploreFromHere::rootChanged (cognitive 40) REDACTED:4204— Graph.Graph.exploreFromCell::exploreFromHere::rootChanged has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 11, loops 3 (5 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (Graph.Graph.exploreFromCell::exploreFromHere::load) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Graph.Graph.exploreFromCell::exploreFromHere::load (cognitive 25) REDACTED:4101— Graph.Graph.exploreFromCell::exploreFromHere::load has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Graph.Graph.exploreFromCell::exploreFromHere::rootChanged) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.AnimationDialog::formatSelectorText (cognitive 38) src/main/webapp/js/diagramly/Dialogs.js:14697— Dialogs.AnimationDialog::formatSelectorText has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 7, loops 3 (7 pts), ternaries 1 (4 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. This shape REPEATS in the file: 2 other methods here (Dialogs.AnimationDialog, Dialogs.AnimationDialog::stepLabel) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.AnimationDialog::stepLabel (cognitive 16) src/main/webapp/js/diagramly/Dialogs.js:14633— Dialogs.AnimationDialog::stepLabel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (Dialogs.AnimationDialog, Dialogs.AnimationDialog::formatSelectorText) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
EditorUi.EditorUi.showExportDialog::setPresetValues (cognitive 34) src/main/webapp/js/diagramly/EditorUi.js:12622— EditorUi.EditorUi.showExportDialog::setPresetValues has cognitive complexity 34 (threshold 15). Drivers by points: if/else 19 (24 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: 2 other methods here (EditorUi.EditorUi.showExportDialog, EditorUi.EditorUi.showExportDialog::getPresetValues) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
EditorUi.EditorUi.showExportDialog::getPresetValues (cognitive 19) src/main/webapp/js/diagramly/EditorUi.js:12537— EditorUi.EditorUi.showExportDialog::getPresetValues has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 6 (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. This shape REPEATS in the file: 2 other methods here (EditorUi.EditorUi.showExportDialog, EditorUi.EditorUi.showExportDialog::setPresetValues) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
main::doMain (cognitive 30) src/main/webapp/js/diagramly/App.js:1643— main::doMain has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 6, error handling 2, 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.
main::doLoad::(anonymous)::realMain (cognitive 28) src/main/webapp/js/diagramly/App.js:1466— main::doLoad::(anonymous)::realMain has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 10, error handling 2, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
mouseUp (cognitive 29) src/main/webapp/mxgraph/src/handler/mxConnectionHandler.js:1738— mouseUp has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 10, 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.
mouseUp (cognitive 29) src/main/webapp/mxgraph/src/handler/mxGraphHandler.js:1880— mouseUp has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 13 (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.
paintVertexShape (cognitive 24) src/main/webapp/shapes/mxBasic.js:2642— paintVertexShape has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 8 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
paintVertexShape (cognitive 24) src/main/webapp/mxgraph/src/shape/mxImageShape.js:178— paintVertexShape has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 2, 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.
mxBase64.decode (cognitive 22) src/main/server/java/com/mxgraph/online/mxBase64.java:159— mxBase64.decode has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 4 (5 pts), boolean chains 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (mxBase64.decode) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxBase64.decode (cognitive 22) src/main/server/java/com/mxgraph/online/mxBase64.java:494— mxBase64.decode has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 4 (5 pts), boolean chains 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (mxBase64.decode) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
initGraph::mouseMove (cognitive 21) REDACTED:348— initGraph::mouseMove has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 4 (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.
initGraph::mouseMove (cognitive 21) src/main/webapp/js/embed.dev.js:348— initGraph::mouseMove has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 4 (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.
initMinimalTheme::init::refreshMenu (cognitive 19) src/main/webapp/js/diagramly/Minimal.js:707— initMinimalTheme::init::refreshMenu has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (11 pts), if/else 4 (5 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
initMinimalTheme::init (cognitive 17) src/main/webapp/js/diagramly/Minimal.js:418— initMinimalTheme::init has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 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.
ClassTooLong: P2PCollab src/main/webapp/js/diagramly/P2PCollab.js:1— ClassTooLong — 705 significant lines (blank, comment-only and punctuation-only lines excluded), 2 methods. The bar is 400 significant lines; this is 305 over it, 1.76× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: mxODPicker src/main/webapp/js/onedrive/mxODPicker.js:1— ClassTooLong — 677 significant lines (blank, comment-only and punctuation-only lines excluded), 1 methods. The bar is 400 significant lines; this is 277 over it, 1.69× 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 (8 lines × 3) REDACTED:489— REDACTED:489-498 | REDACTED:558-565 | REDACTED:615-624 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:489` 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 (8 lines × 3) REDACTED:571— REDACTED:571-579 | REDACTED:639-647 | REDACTED:652-659 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:571` 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 (5 lines × 3) REDACTED:537— REDACTED:537-542 | REDACTED:548-553 | REDACTED:678-682 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:537` 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.
Duplicated block (5 lines × 3) REDACTED:537— REDACTED:537-541 | REDACTED:548-552 | REDACTED:670-674 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:537` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (31 lines × 2 locations) REDACTED:617— REDACTED:617 · REDACTED:655 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (31 lines × 2 locations) src/main/webapp/js/diagramly/util/mxAsyncCanvas.js:90— src/main/webapp/js/diagramly/util/mxAsyncCanvas.js:90 · src/main/webapp/js/diagramly/util/mxJsCanvas.js:320 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
Duplicated block (29 lines × 2 locations) REDACTED:7534— REDACTED:7534 · REDACTED:11810 — 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 (29 lines × 2 locations) REDACTED:886— REDACTED:886 · REDACTED:2314 — 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.
X12 · Unreachable branch· Branch is unreachable · ×2
Branch is unreachable — its condition cannot hold here src/main/server/java/com/mxgraph/online/AbsAuth.java:665— `DEBUG` can never be true where it stands: it is decided by constants. The branch it guards never runs — whatever it was meant to handle is silently handled elsewhere or not at all. Remove it, or fix the test it repeats or the guard that decides it.
Branch is unreachable — its condition cannot hold here REDACTED:95— `message == null` can never be true where it stands: control only reaches it when `message != null` (line 83). The conditional arm it guards never runs — whatever it was meant to handle is silently handled elsewhere or not at all. Remove it, or fix the test it repeats or the guard that decides it.
AC1 · Text alternatives· <object> without a text alternative · ×1
<object> without a text alternative etc/dependencies/dompurify-smoke.js:145— A <object> with no aria-label/title and no inner fallback content can't be described by assistive tech. Add a name or fallback content.
AC1 · Text alternatives· <embed> without a text alternative · ×1
<embed> without a text alternative etc/dependencies/dompurify-smoke.js:145— An <embed> has no fallback-content mechanism, so it needs an aria-label/aria-labelledby/title to be described.
Empty <h2> heading src/main/webapp/plugins/props.js:123— 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/main/webapp/js/diagramly/tidy/TidyWindow.js:341— This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, 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.
Low contrast colour pair in CSS (4.4:1) src/main/webapp/styles/grapheditor.css:4697— `span.geCommentsBadge` sets color: #ffffff on background-color: #d74134 — 4.4:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Menus.Menus.init (cyclomatic 1146) src/main/webapp/js/diagramly/Menus.js:313— Menus.Menus.init has cyclomatic complexity 1146 (threshold 15). Of this number, 113 points are the body's own statements and 1033 belong to 244 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Extensions.addCompositeShape (cyclomatic 845) REDACTED:7711— Extensions.addCompositeShape has cyclomatic complexity 845 (threshold 15). Of this number, 842 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Actions.Actions.init (cyclomatic 359) src/main/webapp/js/grapheditor/Actions.js:17— Actions.Actions.init has cyclomatic complexity 359 (threshold 15). Of this number, 33 points are the body's own statements and 326 belong to 101 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.installMessageHandler (cyclomatic 338) src/main/webapp/js/diagramly/EditorUi.js:32341— EditorUi.EditorUi.installMessageHandler has cyclomatic complexity 338 (threshold 15). Most of this is not in the body itself: 7 of the 338 points are its own statements and the rest belongs to 36 function literals inside it that branch (lines 32406, 33033, 33879, …). 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.
EditorUi.EditorUi.init (cyclomatic 327) src/main/webapp/js/diagramly/EditorUi.js:22767— EditorUi.EditorUi.init has cyclomatic complexity 327 (threshold 15). Of this number, 131 points are the body's own statements and 196 belong to 49 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.initCanvas (cyclomatic 327) REDACTED:5648— EditorUi.EditorUi.initCanvas has cyclomatic complexity 327 (threshold 15). Of this number, 86 points are the body's own statements and 241 belong to 46 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.doImportCsv (cyclomatic 321) src/main/webapp/js/diagramly/EditorUi.js:39560— EditorUi.EditorUi.doImportCsv has cyclomatic complexity 321 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (EditorUi.EditorUi.doImportCsv::updateListItems, EditorUi.EditorUi.doImportCsv::getEdgeLabel) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Format.TextFormatPanel.addFont (cyclomatic 286) src/main/webapp/js/grapheditor/Format.js:5025— Format.TextFormatPanel.addFont has cyclomatic complexity 286 (threshold 15). Of this number, 66 points are the body's own statements and 220 belong to 45 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Sidebar.Sidebar.createDragSource (cyclomatic 206) src/main/webapp/js/grapheditor/Sidebar.js:6440— Sidebar.Sidebar.createDragSource has cyclomatic complexity 206 (threshold 15). Of this number, 76 points are the body's own statements and 130 belong to 10 function items inside it that branch. 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.
Editor.Editor.configure (cyclomatic 202) src/main/webapp/js/diagramly/Editor.js:3441— Editor.Editor.configure has cyclomatic complexity 202 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Shapes.mxShapeBasicRect2.strictDrawShape (cyclomatic 165) src/main/webapp/js/grapheditor/Shapes.js:6106— Shapes.mxShapeBasicRect2.strictDrawShape has cyclomatic complexity 165 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Sidebar.Sidebar.addSearchPalette (cyclomatic 161) src/main/webapp/js/grapheditor/Sidebar.js:2838— Sidebar.Sidebar.addSearchPalette has cyclomatic complexity 161 (threshold 15). Most of this is not in the body itself: 8 of the 161 points are its own statements and the rest belongs to 24 function items inside it that branch (a function literal at line 3594, a function literal at line 3052, a function literal at line 2958, …). 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.
GraphViewer.GraphViewer.init (cyclomatic 154) REDACTED:163— GraphViewer.GraphViewer.init has cyclomatic complexity 154 (threshold 15). Of this number, 43 points are the body's own statements and 111 belong to 13 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.
export.render::renderPage (cyclomatic 124) src/main/webapp/js/export.js:1626— export.render::renderPage has cyclomatic complexity 124 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (export.render) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
App.App.start (cyclomatic 121) src/main/webapp/js/diagramly/App.js:4281— App.App.start has cyclomatic complexity 121 (threshold 15). Of this number, 52 points are the body's own statements and 69 belong to 13 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.
export.render (cyclomatic 117) src/main/webapp/js/export.js:234— export.render 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. This shape REPEATS in the file: one other method here (export.render::renderPage) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
getHexagonPerimeterPoint (cyclomatic 114) src/main/webapp/mxgraph/src/view/mxPerimeter.js:487— getHexagonPerimeterPoint has cyclomatic complexity 114 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Embed.initGraph (cyclomatic 112) REDACTED:154— Embed.initGraph has cyclomatic complexity 112 (threshold 15). Of this number, 58 points are the body's own statements and 54 belong to 11 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
executeCustomActions (cyclomatic 112) src/main/webapp/js/diagramly/Editor.js:12980— executeCustomActions has cyclomatic complexity 112 (threshold 15). Most of this is not in the body itself: 4 of the 112 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 13055, needsView, a function literal at line 13042, …). 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.
initGraph (cyclomatic 112) src/main/webapp/js/embed.dev.js:154— initGraph has cyclomatic complexity 112 (threshold 15). Of this number, 50 points are the body's own statements and 62 belong to 21 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Dialogs.DataSourceDialog (cyclomatic 111) src/main/webapp/js/diagramly/Dialogs.js:23065— Dialogs.DataSourceDialog has cyclomatic complexity 111 (threshold 15). Of this number, 16 points are the body's own statements and 95 belong to 25 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.
DriveClient.DriveClient.saveFile (cyclomatic 109) src/main/webapp/js/diagramly/DriveClient.js:2183— DriveClient.DriveClient.saveFile has cyclomatic complexity 109 (threshold 15). Of this number, 20 points are the body's own statements and 89 belong to 14 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.
Minimal.EditorUi.initMinimalTheme (cyclomatic 108) src/main/webapp/js/diagramly/Minimal.js:18— Minimal.EditorUi.initMinimalTheme has cyclomatic complexity 108 (threshold 15). Of this number, 27 points are the body's own statements and 81 belong to 25 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.
SegmentConnector (cyclomatic 108) src/main/webapp/mxgraph/src/view/mxEdgeStyle.js:600— SegmentConnector has cyclomatic complexity 108 (threshold 15). Of this number, 105 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.libraryLoaded (cyclomatic 106) src/main/webapp/js/diagramly/EditorUi.js:6149— EditorUi.EditorUi.libraryLoaded has cyclomatic complexity 106 (threshold 15). Of this number, 27 points are the body's own statements and 79 belong to 17 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.
OrthConnector (cyclomatic 106) src/main/webapp/mxgraph/src/view/mxEdgeStyle.js:1141— OrthConnector has cyclomatic complexity 106 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
App.App.loadFile (cyclomatic 105) src/main/webapp/js/diagramly/App.js:7011— App.App.loadFile has cyclomatic complexity 105 (threshold 15). Most of this is not in the body itself: 11 of the 105 points are its own statements and the rest belongs to 21 function literals inside it that branch (lines 7020, 7272, 7384, …). 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.
Dialogs.LayersWindow (cyclomatic 105) REDACTED:5350— Dialogs.LayersWindow has cyclomatic complexity 105 (threshold 15). Most of this is not in the body itself: 4 of the 105 points are its own statements and the rest belongs to 31 function items inside it that branch (a function literal at line 5619, refresh::addLayer, renameLayer, …). 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.
App.App.main (cyclomatic 104) src/main/webapp/js/diagramly/App.js:1006— App.App.main has cyclomatic complexity 104 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (App.App.main::doMain) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxSvgCanvas2D.mxSvgCanvas2D.wrapSvgTextElement (cyclomatic 103) REDACTED:2589— mxSvgCanvas2D.mxSvgCanvas2D.wrapSvgTextElement has cyclomatic complexity 103 (threshold 15). Of this number, 56 points are the body's own statements and 47 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Dialogs.ConnectionPointsDialog (cyclomatic 100) src/main/webapp/js/diagramly/Dialogs.js:24961— Dialogs.ConnectionPointsDialog has cyclomatic complexity 100 (threshold 15). Of this number, 29 points are the body's own statements and 71 belong to 17 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.
Format.DiagramStylePanel.addGraphStyles (cyclomatic 97) src/main/webapp/js/grapheditor/Format.js:9130— Format.DiagramStylePanel.addGraphStyles has cyclomatic complexity 97 (threshold 15). Most of this is not in the body itself: 10 of the 97 points are its own statements and the rest belongs to 17 function items inside it that branch (a function literal at line 9249, a function literal at line 9147, a function literal at line 9216, …). 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.
Graph.Graph.connectVertex (cyclomatic 95) REDACTED:17522— Graph.Graph.connectVertex has cyclomatic complexity 95 (threshold 15). Of this number, 58 points are the body's own statements and 37 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
App.App.init (cyclomatic 93) src/main/webapp/js/diagramly/App.js:2032— App.App.init has cyclomatic complexity 93 (threshold 15). Of this number, 66 points are the body's own statements and 27 belong to 7 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.
Dialogs.StyleRulesDialog (cyclomatic 93) src/main/webapp/js/diagramly/Dialogs.js:21321— Dialogs.StyleRulesDialog has cyclomatic complexity 93 (threshold 15). Most of this is not in the body itself: 2 of the 93 points are its own statements and the rest belongs to 29 function items inside it that branch (render, createKeySelect, createValueControl, …). 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.
EditorUi.repairHasParentCycle (cyclomatic 92) src/main/webapp/js/diagramly/EditorUi.js:21720— EditorUi.repairHasParentCycle has cyclomatic complexity 92 (threshold 15). Of this number, 40 points are the body's own statements and 52 belong to 17 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TidyFeatures.TidyFeatures.extract (cyclomatic 91) src/main/webapp/js/diagramly/tidy/TidyFeatures.js:133— TidyFeatures.TidyFeatures.extract has cyclomatic complexity 91 (threshold 15). Of this number, 79 points are the body's own statements and 12 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Dialogs.TextOutlineWindow (cyclomatic 89) REDACTED:4781— Dialogs.TextOutlineWindow has cyclomatic complexity 89 (threshold 15). Most of this is not in the body itself: 1 of the 89 points is its own statement and the rest belongs to 19 function items inside it that branch (a function literal at line 5192, a function literal at line 5019, a function literal at line 5111, …). 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.
Dialogs.CreateDialog (cyclomatic 88) src/main/webapp/js/diagramly/Dialogs.js:5029— Dialogs.CreateDialog has cyclomatic complexity 88 (threshold 15). Of this number, 60 points are the body's own statements and 28 belong to 9 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.print (cyclomatic 87) src/main/webapp/js/diagramly/EditorUi.js:29906— EditorUi.EditorUi.print has cyclomatic complexity 87 (threshold 15). Of this number, 36 points are the body's own statements and 51 belong to 6 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.
EditorUi.EditorUi.applyEdgesText (cyclomatic 86) src/main/webapp/js/diagramly/EditorUi.js:36312— EditorUi.EditorUi.applyEdgesText has cyclomatic complexity 86 (threshold 15). Of this number, 76 points are the body's own statements and 10 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Graph.Graph.prefixSvgIds (cyclomatic 85) REDACTED:5474— Graph.Graph.prefixSvgIds has cyclomatic complexity 85 (threshold 15). Of this number, 22 points are the body's own statements and 63 belong to 11 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxStencil.mxStencil.drawNode (cyclomatic 85) src/main/webapp/mxgraph/src/shape/mxStencil.js:650— mxStencil.mxStencil.drawNode has cyclomatic complexity 85 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Editor.Editor.convertImages (cyclomatic 84) src/main/webapp/js/diagramly/Editor.js:6329— Editor.Editor.convertImages has cyclomatic complexity 84 (threshold 15). Most of this is not in the body itself: 3 of the 84 points are its own statements and the rest belongs to 17 function items inside it that branch (a function literal at line 6527, a function literal at line 6709, a function literal at line 6676, …). 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.
Dialogs.EditDataDialog (cyclomatic 82) REDACTED:3880— Dialogs.EditDataDialog has cyclomatic complexity 82 (threshold 15). Of this number, 38 points are the body's own statements and 44 belong to 11 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Format.ArrangePanel.addGeometry (cyclomatic 82) src/main/webapp/js/grapheditor/Format.js:3383— Format.ArrangePanel.addGeometry has cyclomatic complexity 82 (threshold 15). Of this number, 35 points are the body's own statements and 47 belong to 9 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxKubernetes.mxShapeKubernetesIcon2.paintVertexShape (cyclomatic 81) src/main/webapp/shapes/mxKubernetes.js:196— mxKubernetes.mxShapeKubernetesIcon2.paintVertexShape has cyclomatic complexity 81 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AnimationExport.AnimationExport.Player.executeBatch (cyclomatic 80) src/main/webapp/js/diagramly/gif/AnimationExport.js:714— AnimationExport.AnimationExport.Player.executeBatch has cyclomatic complexity 80 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.importFiles (cyclomatic 79) src/main/webapp/js/diagramly/EditorUi.js:17625— EditorUi.EditorUi.importFiles has cyclomatic complexity 79 (threshold 15). Most of this is not in the body itself: 15 of the 79 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 17773, 17765, 17667, …). 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.
Extensions.updateCell (cyclomatic 78) REDACTED:5951— Extensions.updateCell has cyclomatic complexity 78 (threshold 15). Of this number, 65 points are the body's own statements and 13 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Utils.checkStreamContent (cyclomatic 78) REDACTED:444— Utils.checkStreamContent has cyclomatic complexity 78 (threshold 15). To reduce it, separate the cases: extract each independent 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 78) REDACTED:2801— (anonymous) has cyclomatic complexity 78 (threshold 15). Most of this is not in the body itself: 1 of the 78 points is its own statement and the rest belongs to 46 function items inside it that branch (decodeVssx::(anonymous)::_loop_1, normalizeGraph, applyUncroppedImages, …). 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.
Dialogs.LinkDialog (cyclomatic 77) src/main/webapp/js/diagramly/Dialogs.js:6051— Dialogs.LinkDialog has cyclomatic complexity 77 (threshold 15). Of this number, 35 points are the body's own statements and 42 belong to 15 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Dialogs.RevisionDialog (cyclomatic 77) src/main/webapp/js/diagramly/Dialogs.js:8653— Dialogs.RevisionDialog has cyclomatic complexity 77 (threshold 15). Of this number, 19 points are the body's own statements and 58 belong to 21 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.
GraphViewer.GraphViewer.addToolbar (cyclomatic 77) REDACTED:1843— GraphViewer.GraphViewer.addToolbar has cyclomatic complexity 77 (threshold 15). Of this number, 36 points are the body's own statements and 41 belong to 18 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.
FindWindow::search (cyclomatic 77) src/main/webapp/js/diagramly/Dialogs.js:10115— FindWindow::search has cyclomatic complexity 77 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.showExportDialog (cyclomatic 76) src/main/webapp/js/diagramly/EditorUi.js:11787— EditorUi.EditorUi.showExportDialog has cyclomatic complexity 76 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (EditorUi.EditorUi.showExportDialog::getPresetValues, EditorUi.EditorUi.showExportDialog::setPresetValues) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
EditorUi.EditorUi.installNativeClipboardHandler (cyclomatic 76) src/main/webapp/js/diagramly/EditorUi.js:24873— EditorUi.EditorUi.installNativeClipboardHandler has cyclomatic complexity 76 (threshold 15). Most of this is not in the body itself: 2 of the 76 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 24957, 25104, 24923, …). 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.
DiffSync.EditorUi.patchPages (cyclomatic 75) src/main/webapp/js/diagramly/DiffSync.js:454— DiffSync.EditorUi.patchPages has cyclomatic complexity 75 (threshold 15). Of this number, 41 points are the body's own statements and 34 belong to 2 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.
GitLabClient.GitLabClient.showGitLabDialog (cyclomatic 75) src/main/webapp/js/diagramly/GitLabClient.js:808— GitLabClient.GitLabClient.showGitLabDialog has cyclomatic complexity 75 (threshold 15). Most of this is not in the body itself: 5 of the 75 points are its own statements and the rest belongs to 27 function literals inside it that branch (lines 1309, 1133, 987, …). 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.
mxGraphMlCodec.mxGraphMlCodec.addLabels (cyclomatic 75) REDACTED:2486— mxGraphMlCodec.mxGraphMlCodec.addLabels has cyclomatic complexity 75 (threshold 15). Of this number, 67 points are the body's own statements and 8 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxFreehand.mxFreehand (cyclomatic 75) src/main/webapp/js/diagramly/mxFreehand.js:5— mxFreehand.mxFreehand has cyclomatic complexity 75 (threshold 15). Most of this is not in the body itself: 11 of the 75 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 236, a function literal at line 396, a function literal at line 158, …). 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.
Graph.Graph.setTextColor (cyclomatic 73) REDACTED:3297— Graph.Graph.setTextColor has cyclomatic complexity 73 (threshold 15). Of this number, 66 points are the body's own statements and 7 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxGraphMlCodec.mxGraphMlCodec.handleCompoundShape (cyclomatic 72) REDACTED:1267— mxGraphMlCodec.mxGraphMlCodec.handleCompoundShape has cyclomatic complexity 72 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Tidy.Tidy.measure (cyclomatic 72) src/main/webapp/js/diagramly/tidy/Tidy.js:1023— Tidy.Tidy.measure has cyclomatic complexity 72 (threshold 15). Of this number, 50 points are the body's own statements and 22 belong to 4 function literals inside it that branch. 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.
Dialogs.BackgroundImageDialog (cyclomatic 70) src/main/webapp/js/diagramly/Dialogs.js:927— Dialogs.BackgroundImageDialog has cyclomatic complexity 70 (threshold 15). Of this number, 30 points are the body's own statements and 40 belong to 19 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.handleError (cyclomatic 70) src/main/webapp/js/diagramly/EditorUi.js:7701— EditorUi.EditorUi.handleError has cyclomatic complexity 70 (threshold 15). Of this number, 64 points are the body's own statements and 6 belong to 6 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.
mxGraph.mxGraph.fireMouseEvent (cyclomatic 70) src/main/webapp/mxgraph/src/view/mxGraph.js:14371— mxGraph.mxGraph.fireMouseEvent has cyclomatic complexity 70 (threshold 15). Of this number, 69 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxConnectionHandler.mxConnectionHandler.mouseMove (cyclomatic 69) src/main/webapp/mxgraph/src/handler/mxConnectionHandler.js:1248— mxConnectionHandler.mxConnectionHandler.mouseMove has cyclomatic complexity 69 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxGraphHandler.mxGraphHandler.mouseMove (cyclomatic 69) src/main/webapp/mxgraph/src/handler/mxGraphHandler.js:1237— mxGraphHandler.mxGraphHandler.mouseMove has cyclomatic complexity 69 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Dialogs.NewDialog (cyclomatic 68) src/main/webapp/js/diagramly/Dialogs.js:2386— Dialogs.NewDialog has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 3 other methods here (Dialogs.NewDialog::create, Dialogs.NewDialog::addButton, Dialogs.NewDialog::filterTemplates) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Tidy.Tidy.plan (cyclomatic 68) src/main/webapp/js/diagramly/tidy/Tidy.js:1412— Tidy.Tidy.plan has cyclomatic complexity 68 (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.
Format.StyleFormatPanel.addStroke (cyclomatic 68) src/main/webapp/js/grapheditor/Format.js:7782— Format.StyleFormatPanel.addStroke has cyclomatic complexity 68 (threshold 15). Most of this is not in the body itself: 9 of the 68 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 8257, a function literal at line 7857, a function literal at line 7814, …). 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.
EditorUi.mxChildChange.execute (cyclomatic 67) src/main/webapp/js/diagramly/EditorUi.js:22110— EditorUi.mxChildChange.execute has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (EditorUi.mxChildChange.execute::collect) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
EditorUi.EditorUi.applyTableText (cyclomatic 67) src/main/webapp/js/diagramly/EditorUi.js:37416— EditorUi.EditorUi.applyTableText has cyclomatic complexity 67 (threshold 15). Of this number, 65 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GraphViewer.GraphViewer.addSizeHandler (cyclomatic 67) REDACTED:1317— GraphViewer.GraphViewer.addSizeHandler has cyclomatic complexity 67 (threshold 15). Of this number, 24 points are the body's own statements and 43 belong to 4 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.
random.Draw.loadPlugin() (cyclomatic 67) src/main/webapp/plugins/random.js:8— random.Draw.loadPlugin() has cyclomatic complexity 67 (threshold 15). Most of this is not in the body itself: 2 of the 67 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 205, 102, 435, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
(anonymous) (cyclomatic 67) src/main/webapp/plugins/random.js:8— (anonymous) has cyclomatic complexity 67 (threshold 15). Most of this is not in the body itself: 2 of the 67 points are its own statements and the rest belongs to 13 function items inside it that branch (a function literal at line 205, a function literal at line 102, a function literal at line 435, …). 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.
Sidebar.Sidebar.dropAndConnect (cyclomatic 66) src/main/webapp/js/grapheditor/Sidebar.js:5793— Sidebar.Sidebar.dropAndConnect has cyclomatic complexity 66 (threshold 15). Of this number, 65 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Dialogs.ParseDialog::parse (cyclomatic 64) src/main/webapp/js/diagramly/Dialogs.js:1520— Dialogs.ParseDialog::parse has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Dialogs.ParseDialog) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
(anonymous) (cyclomatic 64) REDACTED:6410— (anonymous) has cyclomatic complexity 64 (threshold 15). Most of this is not in the body itself: 1 of the 64 points is its own statement and the rest belongs to 37 function items inside it that branch (getIntAttr, getStyleString, isInsideTriangle, …). 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.
EditorUi.EditorUi.createDockManager (cyclomatic 63) src/main/webapp/js/diagramly/EditorUi.js:25819— EditorUi.EditorUi.createDockManager has cyclomatic complexity 63 (threshold 15). Of this number, 18 points are the body's own statements and 45 belong to 10 function literals 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.
Menus.Menus.addInsertTableItem (cyclomatic 63) src/main/webapp/js/grapheditor/Menus.js:805— Menus.Menus.addInsertTableItem has cyclomatic complexity 63 (threshold 15). Most of this is not in the body itself: 11 of the 63 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 1076, a function literal at line 831, extendPicker, …). 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.
DiffSync.EditorUi.patchPage (cyclomatic 62) src/main/webapp/js/diagramly/DiffSync.js:1111— DiffSync.EditorUi.patchPage has cyclomatic complexity 62 (threshold 15). Of this number, 50 points are the body's own statements and 12 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.
Editor.PrintDialog.create (cyclomatic 62) src/main/webapp/js/diagramly/Editor.js:14624— Editor.PrintDialog.create has cyclomatic complexity 62 (threshold 15). Of this number, 50 points are the body's own statements and 12 belong to 6 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.
mxSvgCanvas2D.mxSvgCanvas2D.plainText (cyclomatic 62) REDACTED:3758— mxSvgCanvas2D.mxSvgCanvas2D.plainText has cyclomatic complexity 62 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Dialogs.MoreShapesDialog (cyclomatic 61) src/main/webapp/js/diagramly/Dialogs.js:18275— Dialogs.MoreShapesDialog has cyclomatic complexity 61 (threshold 15). Of this number, 25 points are the body's own statements and 36 belong to 11 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.
DrawioFile.DrawioFile.patch (cyclomatic 61) REDACTED:1374— DrawioFile.DrawioFile.patch has cyclomatic complexity 61 (threshold 15). Of this number, 52 points are the body's own statements and 9 belong to 2 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.
DriveClient.DriveClient.executeRequest (cyclomatic 61) src/main/webapp/js/diagramly/DriveClient.js:356— DriveClient.DriveClient.executeRequest has cyclomatic complexity 61 (threshold 15). Most of this is not in the body itself: 9 of the 61 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 450, 382, 429, …). 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.
EditorUi.EditorUi.applyOutline (cyclomatic 61) src/main/webapp/js/diagramly/EditorUi.js:35311— EditorUi.EditorUi.applyOutline has cyclomatic complexity 61 (threshold 15). Of this number, 46 points are the body's own statements and 15 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GitHubClient.GitHubClient.showGitHubDialog (cyclomatic 60) src/main/webapp/js/diagramly/GitHubClient.js:896— GitHubClient.GitHubClient.showGitHubDialog has cyclomatic complexity 60 (threshold 15). Most of this is not in the body itself: 3 of the 60 points are its own statements and the rest belongs to 19 function literals inside it that branch (lines 1241, 1094, 1137, …). 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.
Sidebar.Sidebar.createTooltip (cyclomatic 60) src/main/webapp/js/grapheditor/Sidebar.js:564— Sidebar.Sidebar.createTooltip has cyclomatic complexity 60 (threshold 15). Of this number, 38 points are the body's own statements and 22 belong to 6 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.
EditorUi.EditorUi.addMenuHandler (cyclomatic 59) REDACTED:11542— EditorUi.EditorUi.addMenuHandler has cyclomatic complexity 59 (threshold 15). Most of this is not in the body itself: 6 of the 59 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 11702, 11550, 11762, …). 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.
Graph.mxGraphView.updateLineJumps (cyclomatic 59) REDACTED:31567— Graph.mxGraphView.updateLineJumps has cyclomatic complexity 59 (threshold 15). Of this number, 55 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Dialogs.FilePropertiesDialog (cyclomatic 58) src/main/webapp/js/diagramly/Dialogs.js:24473— Dialogs.FilePropertiesDialog has cyclomatic complexity 58 (threshold 15). Of this number, 38 points are the body's own statements and 20 belong to 10 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.
Extensions.createOrgChart (cyclomatic 57) REDACTED:14078— Extensions.createOrgChart has cyclomatic complexity 57 (threshold 15). Of this number, 39 points are the body's own statements and 18 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.fileLoaded (cyclomatic 56) src/main/webapp/js/diagramly/EditorUi.js:5256— EditorUi.EditorUi.fileLoaded has cyclomatic complexity 56 (threshold 15). Of this number, 38 points are the body's own statements and 18 belong to 4 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.
EditorUi.EditorUi.showConfigurationEditorDialog (cyclomatic 56) src/main/webapp/js/diagramly/EditorUi.js:6918— EditorUi.EditorUi.showConfigurationEditorDialog has cyclomatic complexity 56 (threshold 15). Of this number, 22 points are the body's own statements and 34 belong to 10 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.
Graph.Graph.initLayoutManager (cyclomatic 56) REDACTED:12824— Graph.Graph.initLayoutManager has cyclomatic complexity 56 (threshold 15). Of this number, 20 points are the body's own statements and 36 belong to 4 function literals 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.
DrawioFileSync.DrawioFileSync.catchup (cyclomatic 55) src/main/webapp/js/diagramly/DrawioFileSync.js:3614— DrawioFileSync.DrawioFileSync.catchup has cyclomatic complexity 55 (threshold 15). Of this number, 16 points are the body's own statements and 39 belong to 2 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.
EditorUi.EditorUi.pasteCells (cyclomatic 55) src/main/webapp/js/diagramly/EditorUi.js:28720— EditorUi.EditorUi.pasteCells has cyclomatic complexity 55 (threshold 15). Of this number, 52 points are the body's own statements and 3 belong to 2 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.
SimpleClassic.EditorUi.createMenubarForTheme (cyclomatic 55) src/main/webapp/js/diagramly/SimpleClassic.js:580— SimpleClassic.EditorUi.createMenubarForTheme has cyclomatic complexity 55 (threshold 15). Of this number, 30 points are the body's own statements and 25 belong to 4 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.
Graph.Graph.pasteCellStyles (cyclomatic 55) REDACTED:11443— Graph.Graph.pasteCellStyles has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ElectronApp.EditorUi.init (cyclomatic 54) src/main/webapp/js/diagramly/ElectronApp.js:451— ElectronApp.EditorUi.init has cyclomatic complexity 54 (threshold 15). Most of this is not in the body itself: 3 of the 54 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 544, a function literal at line 522, a function literal at line 458, …). 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.
MiroImporter.MiroImporter::parseStyles (cyclomatic 54) src/main/webapp/js/diagramly/miro/MiroImporter.js:218— MiroImporter.MiroImporter::parseStyles has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.createShapePicker (cyclomatic 54) REDACTED:2675— EditorUi.EditorUi.createShapePicker has cyclomatic complexity 54 (threshold 15). Most of this is not in the body itself: 15 of the 54 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 2778, 2739, 2924, …). 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.
Graph.Graph.replacePlaceholders (cyclomatic 54) REDACTED:16602— Graph.Graph.replacePlaceholders has cyclomatic complexity 54 (threshold 15). Of this number, 49 points are the body's own statements and 5 belong to 2 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.
Graph.mxConnector.paintCutCurve (cyclomatic 54) REDACTED:32018— Graph.mxConnector.paintCutCurve has cyclomatic complexity 54 (threshold 15). Of this number, 30 points are the body's own statements and 24 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Sidebar.Sidebar.createDropHandler (cyclomatic 54) src/main/webapp/js/grapheditor/Sidebar.js:5466— Sidebar.Sidebar.createDropHandler has cyclomatic complexity 54 (threshold 15). Most of this is not in the body itself: 2 of the 54 points are its own statements and the rest belongs to one function literal inside it that branches (line 5471). 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.
mxElectrical.mxShapeElectricalQFPIC.paintVertexShape (cyclomatic 54) src/main/webapp/shapes/mxElectrical.js:1168— mxElectrical.mxShapeElectricalQFPIC.paintVertexShape has cyclomatic complexity 54 (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.
Dialogs.ColorDialog (cyclomatic 53) REDACTED:348— Dialogs.ColorDialog has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (Dialogs.ColorDialog::buildFinalColor, Dialogs.ColorDialog::addCurrentToRecent) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
App.App.loadLibraries (cyclomatic 52) src/main/webapp/js/diagramly/App.js:7633— App.App.loadLibraries has cyclomatic complexity 52 (threshold 15). Most of this is not in the body itself: 7 of the 52 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 7701, 7658, 7737, …). 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.
ElkLayout.ElkLayoutBindings.runWithDialog (cyclomatic 52) src/main/webapp/js/diagramly/ElkLayout.js:291— ElkLayout.ElkLayoutBindings.runWithDialog has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (ElkLayout.ElkLayoutBindings.runWithDialog::collect) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Pages.EditorUi.addTabDragListeners (cyclomatic 52) src/main/webapp/js/diagramly/Pages.js:3484— Pages.EditorUi.addTabDragListeners has cyclomatic complexity 52 (threshold 15). Most of this is not in the body itself: 1 of the 52 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 3648, 3575, 3489, …). 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.
Dialogs.MarkupDialog (cyclomatic 52) REDACTED:2571— Dialogs.MarkupDialog has cyclomatic complexity 52 (threshold 15). Most of this is not in the body itself: 6 of the 52 points are its own statements and the rest belongs to 20 function items inside it that branch (applyFormat, a function literal at line 2774, a function literal at line 2946, …). 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.
Graph.Graph.isLabelBoxFree (cyclomatic 52) REDACTED:29346— Graph.Graph.isLabelBoxFree has cyclomatic complexity 52 (threshold 15). Most of this is not in the body itself: 3 of the 52 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 29414, hitsOutline, overlaps, …). 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.
nextcloud.Draw.loadPlugin() (cyclomatic 52) src/main/webapp/plugins/nextcloud.js:8— nextcloud.Draw.loadPlugin() has cyclomatic complexity 52 (threshold 15). Most of this is not in the body itself: 11 of the 52 points are its own statements and the rest belongs to 21 function literals inside it that branch (lines 183, 13, 200, …). 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.
positionBoxes::visitorEdgeFunc (cyclomatic 52) src/main/webapp/js/orgchart/mxOrgChartLayout.js:708— positionBoxes::visitorEdgeFunc has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
(anonymous) (cyclomatic 52) src/main/webapp/plugins/nextcloud.js:8— (anonymous) has cyclomatic complexity 52 (threshold 15). Most of this is not in the body itself: 1 of the 52 points is its own statement and the rest belongs to 48 function items inside it that branch (saveFile, a function literal at line 13, a function literal at line 200, …). 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.
App.App.toggleUserPanel (cyclomatic 51) src/main/webapp/js/diagramly/App.js:9379— App.App.toggleUserPanel has cyclomatic complexity 51 (threshold 15). Of this number, 20 points are the body's own statements and 31 belong to 9 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.
SimpleClassic.EditorUi.createPickerMenuForTheme (cyclomatic 51) src/main/webapp/js/diagramly/SimpleClassic.js:271— SimpleClassic.EditorUi.createPickerMenuForTheme has cyclomatic complexity 51 (threshold 15). Most of this is not in the body itself: 12 of the 51 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 308, 343, 326, …). 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.
mxGuide.mxGuide.move (cyclomatic 51) src/main/webapp/mxgraph/src/util/mxGuide.js:204— mxGuide.mxGuide.move has cyclomatic complexity 51 (threshold 15). Of this number, 31 points are the body's own statements and 20 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.updateDiagram (cyclomatic 50) src/main/webapp/js/diagramly/EditorUi.js:4913— EditorUi.EditorUi.updateDiagram has cyclomatic complexity 50 (threshold 15). Of this number, 49 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LayoutPicker.EditorUi.keepLockedGeometries.<returned closure> (cyclomatic 50) src/main/webapp/js/diagramly/LayoutPicker.js:734— LayoutPicker.EditorUi.keepLockedGeometries.<returned closure> has cyclomatic complexity 50 (threshold 15). Of this number, 20 points are the body's own statements and 30 belong to 7 function items inside it that branch. 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.
LibavoidRouting.LibavoidRouting.solveMovePreview (cyclomatic 50) src/main/webapp/js/diagramly/LibavoidRouting.js:3638— LibavoidRouting.LibavoidRouting.solveMovePreview has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
createPopover (cyclomatic 50) src/main/webapp/js/grapheditor/InlineToolbar.js:1517— createPopover has cyclomatic complexity 50 (threshold 15). Most of this is not in the body itself: 4 of the 50 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 1602, a function literal at line 1821, a function literal at line 1585, …). 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.
Dialogs.EmbedDialog (cyclomatic 49) src/main/webapp/js/diagramly/Dialogs.js:645— Dialogs.EmbedDialog has cyclomatic complexity 49 (threshold 15). Of this number, 28 points are the body's own statements and 21 belong to 6 function literals 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.
Dialogs.FreehandWindow (cyclomatic 49) src/main/webapp/js/diagramly/Dialogs.js:11181— Dialogs.FreehandWindow has cyclomatic complexity 49 (threshold 15). Most of this is not in the body itself: 10 of the 49 points are its own statements and the rest belongs to 11 function items inside it that branch (updateMode, updateName, getActiveMode, …). 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.
EditorUi.EditorUi.focusTabStopInDirection (cyclomatic 49) REDACTED:4456— EditorUi.EditorUi.focusTabStopInDirection has cyclomatic complexity 49 (threshold 15). Of this number, 43 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxArchiMate3.mxArchiMate3Application.foreground (cyclomatic 49) src/main/webapp/shapes/mxArchiMate3.js:181— mxArchiMate3.mxArchiMate3Application.foreground has cyclomatic complexity 49 (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.
mxElectrical.mxShapeElectricalDualInLineIC.paintVertexShape (cyclomatic 49) src/main/webapp/shapes/mxElectrical.js:770— mxElectrical.mxShapeElectricalDualInLineIC.paintVertexShape has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DriveClient.DriveClient.getXmlFile (cyclomatic 48) src/main/webapp/js/diagramly/DriveClient.js:1964— DriveClient.DriveClient.getXmlFile has cyclomatic complexity 48 (threshold 15). Most of this is not in the body itself: 5 of the 48 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 1986, 2112, 1983, …). 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.
EditorUi.EditorUi.showAnimatedGifExportDialog (cyclomatic 48) src/main/webapp/js/diagramly/EditorUi.js:8300— EditorUi.EditorUi.showAnimatedGifExportDialog has cyclomatic complexity 48 (threshold 15). Of this number, 17 points are the body's own statements and 31 belong to 5 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.
EditorUi.EditorUi.getEmbedCellChange (cyclomatic 48) src/main/webapp/js/diagramly/EditorUi.js:20282— EditorUi.EditorUi.getEmbedCellChange has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.installShapePicker (cyclomatic 48) REDACTED:2165— EditorUi.EditorUi.installShapePicker has cyclomatic complexity 48 (threshold 15). Most of this is not in the body itself: 7 of the 48 points are its own statements and the rest belongs to 16 function items inside it that branch (a function literal at line 2202, a function literal at line 2427, a function literal at line 2245, …). 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.
Graph.Graph.addFlowRingsToNode (cyclomatic 48) REDACTED:23688— Graph.Graph.addFlowRingsToNode has cyclomatic complexity 48 (threshold 15). Of this number, 47 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
convertHtmlInlineToSvg (cyclomatic 48) src/main/webapp/mxgraph/src/util/mxUtils.js:6552— convertHtmlInlineToSvg has cyclomatic complexity 48 (threshold 15). Of this number, 46 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.mxTerminalChange.execute (cyclomatic 47) src/main/webapp/js/diagramly/EditorUi.js:21407— EditorUi.mxTerminalChange.execute 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.
libavoid-routing.AvoidRouting.computeRoutes::solveWith (cyclomatic 47) src/main/webapp/js/libavoid-js/libavoid-routing.js:1203— libavoid-routing.AvoidRouting.computeRoutes::solveWith 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. This shape REPEATS in the file: one other method here (libavoid-routing.AvoidRouting.computeRoutes) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxStackLayout.mxStackLayout.execute (cyclomatic 47) src/main/webapp/mxgraph/src/layout/mxStackLayout.js:370— mxStackLayout.mxStackLayout.execute 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.
(anonymous) (cyclomatic 47) REDACTED:7268— (anonymous) has cyclomatic complexity 47 (threshold 15). Most of this is not in the body itself: 1 of the 47 points is its own statement and the rest belongs to 11 function items inside it that branch (a function literal at line 7303, getLineEndType, LineStyle, …). 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.
Editor.Editor.exportToCanvas (cyclomatic 46) src/main/webapp/js/diagramly/Editor.js:8005— Editor.Editor.exportToCanvas has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 13 of the 46 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 8060, 8049, 8167, …). 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.
EditorUi.EditorUi.exportSvg (cyclomatic 46) src/main/webapp/js/diagramly/EditorUi.js:9661— EditorUi.EditorUi.exportSvg has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 15 of the 46 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 9729, 9819, 9867, …). 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.
Pages.EditorUi.updateTabContainer (cyclomatic 46) src/main/webapp/js/diagramly/Pages.js:3176— Pages.EditorUi.updateTabContainer has cyclomatic complexity 46 (threshold 15). Of this number, 42 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
createTagsDialog (cyclomatic 46) src/main/webapp/js/diagramly/Editor.js:11069— createTagsDialog has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 4 of the 46 points are its own statements and the rest belongs to 16 function items inside it that branch (a function literal at line 11144, a function literal at line 11199, refreshTags, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 46) src/main/webapp/mxgraph/src/io/mxModelCodec.js:5— (anonymous) has cyclomatic complexity 46 (threshold 15). Most of this is not in the body itself: 1 of the 46 points is its own statement and the rest belongs to 13 function items inside it that branch (decompressCellStyle, selectRoot, compressCellStyle, …). 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.
Dialogs.SelectorChips.create.cellListField (cyclomatic 45) src/main/webapp/js/diagramly/Dialogs.js:7103— Dialogs.SelectorChips.create.cellListField has cyclomatic complexity 45 (threshold 15). Most of this is not in the body itself: 9 of the 45 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 7223, updateChip, missingIds, …). 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.
EditorUi.EditorUi.updateActionStates (cyclomatic 45) src/main/webapp/js/diagramly/EditorUi.js:41885— EditorUi.EditorUi.updateActionStates has cyclomatic complexity 45 (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.
EditorUi.EditorUi.openDatabase (cyclomatic 45) src/main/webapp/js/diagramly/EditorUi.js:42714— EditorUi.EditorUi.openDatabase has cyclomatic complexity 45 (threshold 15). Of this number, 16 points are the body's own statements and 29 belong to 8 function literals 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.
LibavoidRouting.LibavoidRouting.connectionPreview (cyclomatic 45) src/main/webapp/js/diagramly/LibavoidRouting.js:3297— LibavoidRouting.LibavoidRouting.connectionPreview has cyclomatic complexity 45 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Shapes.mxEdgeStyle.SequenceMessage (cyclomatic 45) src/main/webapp/js/grapheditor/Shapes.js:4257— Shapes.mxEdgeStyle.SequenceMessage 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.
mxEdgeHandler.mxEdgeHandler.mouseMove (cyclomatic 45) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:1865— mxEdgeHandler.mxEdgeHandler.mouseMove 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.
mxEdgeHandler.mxEdgeHandler.mouseUp (cyclomatic 45) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:2023— mxEdgeHandler.mxEdgeHandler.mouseUp 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.
mxPopupMenu.mxPopupMenu.addItem (cyclomatic 45) src/main/webapp/mxgraph/src/util/mxPopupMenu.js:217— mxPopupMenu.mxPopupMenu.addItem has cyclomatic complexity 45 (threshold 15). Of this number, 19 points are the body's own statements and 26 belong to 7 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.
mxGraph.mxGraph.getEdgeShapeOutline (cyclomatic 45) src/main/webapp/mxgraph/src/view/mxGraph.js:12416— mxGraph.mxGraph.getEdgeShapeOutline has cyclomatic complexity 45 (threshold 15). Of this number, 38 points are the body's own statements and 7 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
create.cellListField (cyclomatic 45) src/main/webapp/js/diagramly/Dialogs.js:7103— create.cellListField has cyclomatic complexity 45 (threshold 15). Most of this is not in the body itself: 9 of the 45 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 7223, updateChip, missingIds, …). 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.
App.App.updateButtonContainer (cyclomatic 44) src/main/webapp/js/diagramly/App.js:7908— App.App.updateButtonContainer has cyclomatic complexity 44 (threshold 15). Of this number, 43 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Dialogs.ImageDialog (cyclomatic 44) src/main/webapp/js/diagramly/Dialogs.js:5614— Dialogs.ImageDialog has cyclomatic complexity 44 (threshold 15). Most of this is not in the body itself: 9 of the 44 points are its own statements and the rest belongs to 14 function items inside it that branch (insertImage, a function literal at line 5683, a function literal at line 5924, …). 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.
EditorUi.EditorUi.downloadRequestBuilder (cyclomatic 44) src/main/webapp/js/diagramly/EditorUi.js:4425— EditorUi.EditorUi.downloadRequestBuilder has cyclomatic complexity 44 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
EditorUi.EditorUi.replaceLockedGroupChildren (cyclomatic 44) src/main/webapp/js/diagramly/EditorUi.js:14827— EditorUi.EditorUi.replaceLockedGroupChildren 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.
EditorUi.EditorUi.applyExternalImages (cyclomatic 44) src/main/webapp/js/diagramly/EditorUi.js:19959— EditorUi.EditorUi.applyExternalImages has cyclomatic complexity 44 (threshold 15). Of this number, 43 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Dialogs.ColorPicker (cyclomatic 44) REDACTED:29— Dialogs.ColorPicker has cyclomatic complexity 44 (threshold 15). Most of this is not in the body itself: 3 of the 44 points are its own statements and the rest belongs to 8 function items inside it that branch (fromHSV, hsv2rgb, a function literal at line 277, …). 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.
EditorUi.EditorUi.updateSelectionStateForCell (cyclomatic 44) REDACTED:2047— EditorUi.EditorUi.updateSelectionStateForCell 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.
Graph.Graph.getLoopAroundPoints (cyclomatic 44) REDACTED:10898— Graph.Graph.getLoopAroundPoints has cyclomatic complexity 44 (threshold 15). Of this number, 36 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Graph.mxGraphView.updateTieLayout (cyclomatic 44) REDACTED:33655— Graph.mxGraphView.updateTieLayout has cyclomatic complexity 44 (threshold 15). Of this number, 40 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
libavoid-routing.AvoidRouting.withOutsideLabels (cyclomatic 44) src/main/webapp/js/libavoid-js/libavoid-routing.js:602— libavoid-routing.AvoidRouting.withOutsideLabels has cyclomatic complexity 44 (threshold 15). Of this number, 25 points are the body's own statements and 19 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxVertexHandler.mxVertexHandler.union (cyclomatic 44) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:1692— mxVertexHandler.mxVertexHandler.union 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.
mxPopupMenu.mxPopupMenu.keyDown (cyclomatic 44) src/main/webapp/mxgraph/src/util/mxPopupMenu.js:1052— mxPopupMenu.mxPopupMenu.keyDown 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.
(anonymous) (cyclomatic 44) REDACTED:3794— (anonymous) has cyclomatic complexity 44 (threshold 15). Most of this is not in the body itself: 1 of the 44 points is its own statement and the rest belongs to 26 function items inside it that branch (processGeoElem, mxVsdxGeometry, getIndex, …). 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.
Editor.Editor.readGraphState (cyclomatic 43) src/main/webapp/js/grapheditor/Editor.js:1779— Editor.Editor.readGraphState has cyclomatic complexity 43 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
mxVertexHandler.mxVertexHandler.redrawHandles (cyclomatic 43) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:1947— mxVertexHandler.mxVertexHandler.redrawHandles 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.
DiffSync.EditorUi.diffCell (cyclomatic 42) src/main/webapp/js/diagramly/DiffSync.js:2563— DiffSync.EditorUi.diffCell has cyclomatic complexity 42 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Extensions.importLucidPage (cyclomatic 42) REDACTED:6641— Extensions.importLucidPage 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. This shape REPEATS in the file: one other method here (Extensions.importLucidPage::addLine) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxConnectionHandler.mxConnectionHandler.connect (cyclomatic 42) src/main/webapp/mxgraph/src/handler/mxConnectionHandler.js:1918— mxConnectionHandler.mxConnectionHandler.connect 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.
App.App.saveFile (cyclomatic 41) src/main/webapp/js/diagramly/App.js:6303— App.App.saveFile has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 13 of the 41 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 6363, 6311, 6438, …). 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.
App.App.convertFile (cyclomatic 41) src/main/webapp/js/diagramly/App.js:8893— App.App.convertFile has cyclomatic complexity 41 (threshold 15). Of this number, 18 points are the body's own statements and 23 belong to 6 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.
Dialogs.StorageDialog (cyclomatic 41) src/main/webapp/js/diagramly/Dialogs.js:6— Dialogs.StorageDialog has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 9 of the 41 points are its own statements and the rest belongs to 8 function items inside it that branch (addLogo, addButtons, a function literal at line 126, …). 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.
Editor.Editor.initMath (cyclomatic 41) src/main/webapp/js/diagramly/Editor.js:5317— Editor.Editor.initMath has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 13 of the 41 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 5527, a function literal at line 5328, a function literal at line 5416, …). 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.
EditorUi.EditorUi.insertCellEditorDrop (cyclomatic 41) src/main/webapp/js/diagramly/EditorUi.js:29230— EditorUi.EditorUi.insertCellEditorDrop has cyclomatic complexity 41 (threshold 15). Of this number, 25 points are the body's own statements and 16 belong to 5 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.
Extensions.convertText (cyclomatic 41) REDACTED:4549— Extensions.convertText has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ForceExplorer.ForceExplorer.applySharedState (cyclomatic 41) src/main/webapp/js/diagramly/ForceExplorer.js:1700— ForceExplorer.ForceExplorer.applySharedState has cyclomatic complexity 41 (threshold 15). Of this number, 39 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Trees.EditorUi.addTrees (cyclomatic 41) src/main/webapp/js/diagramly/Trees.js:221— Trees.EditorUi.addTrees has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 4 other methods here (Trees.EditorUi.addTrees::collectTreeRemoval, Trees.EditorUi.addTrees::getTreeDirection, Trees.EditorUi.addTrees::addSibling, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 5 times rather than 5 independent problems. Splitting this body alone leaves the other 4 exactly as they are. Where these are variations on one operation, the change that clears all 5 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
EditorUi.EditorUi.createKeyHandler::nudge (cyclomatic 41) REDACTED:11074— EditorUi.EditorUi.createKeyHandler::nudge has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (EditorUi.EditorUi.createKeyHandler) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxAtlassian.mxAtlassianJiraIssue.paintForeground (cyclomatic 41) src/main/webapp/shapes/mxAtlassian.js:73— mxAtlassian.mxAtlassianJiraIssue.paintForeground has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxAtlassian2.mxShapeAtlassian2Icon.styleChanged (cyclomatic 41) src/main/webapp/shapes/mxAtlassian2.js:611— mxAtlassian2.mxShapeAtlassian2Icon.styleChanged has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
convertTxt2Html (cyclomatic 41) REDACTED:3986— convertTxt2Html has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.showPublishLinkDialog (cyclomatic 40) src/main/webapp/js/diagramly/EditorUi.js:11056— EditorUi.EditorUi.showPublishLinkDialog has cyclomatic complexity 40 (threshold 15). Of this number, 25 points are the body's own statements and 15 belong to 5 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.
LibavoidRouting.LibavoidRouting.previewEndpointDrag (cyclomatic 40) src/main/webapp/js/diagramly/LibavoidRouting.js:2970— LibavoidRouting.LibavoidRouting.previewEndpointDrag has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
OneDriveClient.OneDriveClient.getFile (cyclomatic 40) src/main/webapp/js/diagramly/OneDriveClient.js:690— OneDriveClient.OneDriveClient.getFile 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 6 function literals inside it that branch (lines 694, 719, 837, …). 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.
Menus.Menus.addInsertTableCellItem (cyclomatic 40) src/main/webapp/js/grapheditor/Menus.js:589— Menus.Menus.addInsertTableCellItem has cyclomatic complexity 40 (threshold 15). Of this number, 17 points are the body's own statements and 23 belong to 7 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.
mxGraph.mxGraph.cellsRemoved (cyclomatic 40) src/main/webapp/mxgraph/src/view/mxGraph.js:5177— mxGraph.mxGraph.cellsRemoved has cyclomatic complexity 40 (threshold 15). Of this number, 16 points are the body's own statements and 24 belong to 2 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.
DiffSync.EditorUi.patchCellRecursive (cyclomatic 39) src/main/webapp/js/diagramly/DiffSync.js:1527— DiffSync.EditorUi.patchCellRecursive has cyclomatic complexity 39 (threshold 15). Of this number, 21 points are the body's own statements and 18 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.replaceAlternateContent (cyclomatic 39) src/main/webapp/js/diagramly/EditorUi.js:9921— EditorUi.EditorUi.replaceAlternateContent has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 4 of the 39 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 9979, a function literal at line 9937, replaceElt, …). 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.
Pages.Graph.saveViewState (cyclomatic 39) src/main/webapp/js/diagramly/Pages.js:1672— Pages.Graph.saveViewState 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.
Tidy.Tidy.ops.removeOverlaps (cyclomatic 39) src/main/webapp/js/diagramly/tidy/Tidy.js:2004— Tidy.Tidy.ops.removeOverlaps has cyclomatic complexity 39 (threshold 15). Of this number, 27 points are the body's own statements and 12 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InlineToolbar.InlineToolbar.getCellOptions (cyclomatic 39) src/main/webapp/js/grapheditor/InlineToolbar.js:4345— InlineToolbar.InlineToolbar.getCellOptions has cyclomatic complexity 39 (threshold 15). Of this number, 38 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Menus.Menus.addPopupMenuCellItems (cyclomatic 39) src/main/webapp/js/grapheditor/Menus.js:1781— Menus.Menus.addPopupMenuCellItems 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.
Sidebar.Sidebar.searchEntries (cyclomatic 39) src/main/webapp/js/grapheditor/Sidebar.js:2582— Sidebar.Sidebar.searchEntries has cyclomatic complexity 39 (threshold 15). Of this number, 37 points are the body's own statements and 2 belong to 2 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.
mxSvgCanvas2D.mxSvgCanvas2D.createCss (cyclomatic 39) REDACTED:2351— mxSvgCanvas2D.mxSvgCanvas2D.createCss 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.
getColorSchemeStyles (cyclomatic 39) src/main/webapp/js/diagramly/Editor.js:10410— getColorSchemeStyles 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.
installInputHandler (cyclomatic 39) src/main/webapp/js/grapheditor/Format.js:683— installInputHandler has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 7 of the 39 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 698, 802, 847, …). 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.
ColorDialog::setColor (cyclomatic 39) REDACTED:1685— ColorDialog::setColor 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.
Dialogs.DraftDialog (cyclomatic 38) src/main/webapp/js/diagramly/Dialogs.js:9516— Dialogs.DraftDialog has cyclomatic complexity 38 (threshold 15). Of this number, 17 points are the body's own statements and 21 belong to 8 function literals 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.
EditorUi.EditorUi.showBanner (cyclomatic 38) src/main/webapp/js/diagramly/EditorUi.js:8042— EditorUi.EditorUi.showBanner has cyclomatic complexity 38 (threshold 15). Of this number, 26 points are the body's own statements and 12 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.
EditorUi.EditorUi.encodeEmbedPng (cyclomatic 38) src/main/webapp/js/diagramly/EditorUi.js:19703— EditorUi.EditorUi.encodeEmbedPng 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.
GraphViewer.GraphViewer.showLightbox (cyclomatic 38) REDACTED:2610— GraphViewer.GraphViewer.showLightbox has cyclomatic complexity 38 (threshold 15). Of this number, 36 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.getImageForMarker (cyclomatic 38) REDACTED:5257— EditorUi.EditorUi.getImageForMarker has cyclomatic complexity 38 (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.
Format.ArrangePanel.addTable (cyclomatic 38) src/main/webapp/js/grapheditor/Format.js:2460— Format.ArrangePanel.addTable has cyclomatic complexity 38 (threshold 15). Of this number, 26 points are the body's own statements and 12 belong to 6 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.
Format.StyleFormatPanel.addFill (cyclomatic 38) src/main/webapp/js/grapheditor/Format.js:7450— Format.StyleFormatPanel.addFill has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 11 of the 38 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 7572, a function literal at line 7670, a function literal at line 7477, …). 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.
mxOrgChartLayout.mxOrgChartLayout.getRoutePoints (cyclomatic 38) src/main/webapp/js/orgchart/mxOrgChartLayout.js:149— mxOrgChartLayout.mxOrgChartLayout.getRoutePoints has cyclomatic complexity 38 (threshold 15). Of this number, 28 points are the body's own statements and 10 belong to 3 function items inside it that branch. 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.
mxGraphHandler.mxGraphHandler.updateLivePreview (cyclomatic 38) src/main/webapp/mxgraph/src/handler/mxGraphHandler.js:1490— mxGraphHandler.mxGraphHandler.updateLivePreview has cyclomatic complexity 38 (threshold 15). Of this number, 22 points are the body's own statements and 16 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxPanningManager.mxPanningManager (cyclomatic 38) src/main/webapp/mxgraph/src/util/mxPanningManager.js:10— mxPanningManager.mxPanningManager has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 9 of the 38 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 100, 198, 236, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
(anonymous) (cyclomatic 38) src/main/webapp/js/diagramly/App.js:458— (anonymous) 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.
TrianglePerimeter (cyclomatic 38) src/main/webapp/mxgraph/src/view/mxPerimeter.js:313— TrianglePerimeter 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.
DrawioFileSync.DrawioFileSync.fileSaved (cyclomatic 37) src/main/webapp/js/diagramly/DrawioFileSync.js:4262— DrawioFileSync.DrawioFileSync.fileSaved has cyclomatic complexity 37 (threshold 15). Of this number, 30 points are the body's own statements and 7 belong to one function literal inside it that branches. This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
GraphViewer.GraphViewer.showLocalLightbox (cyclomatic 37) REDACTED:2733— GraphViewer.GraphViewer.showLocalLightbox has cyclomatic complexity 37 (threshold 15). Of this number, 25 points are the body's own statements and 12 belong to 5 function literals 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.
SpringMove.SpringMove.tick (cyclomatic 37) src/main/webapp/js/diagramly/SpringMove.js:1039— SpringMove.SpringMove.tick has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.updateActionStates (cyclomatic 37) REDACTED:8945— EditorUi.EditorUi.updateActionStates has cyclomatic complexity 37 (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.
Shapes.MermaidBlockArrowShape.redrawPath (cyclomatic 37) src/main/webapp/js/grapheditor/Shapes.js:9486— Shapes.MermaidBlockArrowShape.redrawPath has cyclomatic complexity 37 (threshold 15). Of this number, 34 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
mxSvgCanvas2D.mxSvgCanvas2D.updateTextNodes (cyclomatic 37) REDACTED:2204— mxSvgCanvas2D.mxSvgCanvas2D.updateTextNodes has cyclomatic complexity 37 (threshold 15). Of this number, 21 points are the body's own statements and 16 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
mxGraph.mxGraph.isEventIgnored (cyclomatic 37) src/main/webapp/mxgraph/src/view/mxGraph.js:14060— mxGraph.mxGraph.isEventIgnored has cyclomatic complexity 37 (threshold 15). Of this number, 35 points are the body's own statements and 2 belong to 2 function literals inside it that branch. 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.
mxGraphView.mxGraphView.installListeners (cyclomatic 37) src/main/webapp/mxgraph/src/view/mxGraphView.js:4691— mxGraphView.mxGraphView.installListeners has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 13 of the 37 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 4796, a function literal at line 4722, a function literal at line 4812, …). 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.
update.Draw.loadPlugin() (cyclomatic 37) src/main/webapp/plugins/update.js:74— update.Draw.loadPlugin() has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 7 of the 37 points are its own statements and the rest belongs to 6 function items inside it that branch (createDemoResponse, scheduleUpdates, parseResponse, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 37) src/main/webapp/plugins/update.js:74— (anonymous) has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 7 of the 37 points are its own statements and the rest belongs to 9 function items inside it that branch (createDemoResponse, scheduleUpdates, parseResponse, …). 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.
Editor.Editor.extractGraphModelFromPdf (cyclomatic 36) src/main/webapp/js/diagramly/Editor.js:3120— Editor.Editor.extractGraphModelFromPdf has cyclomatic complexity 36 (threshold 15). Of this number, 34 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Editor.Editor.drawSvgWithHtmlInCanvas (cyclomatic 36) src/main/webapp/js/diagramly/Editor.js:7735— Editor.Editor.drawSvgWithHtmlInCanvas has cyclomatic complexity 36 (threshold 15). Of this number, 21 points are the body's own statements and 15 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.installResizeHandler (cyclomatic 36) src/main/webapp/js/diagramly/EditorUi.js:26160— EditorUi.EditorUi.installResizeHandler has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 7 of the 36 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 26280, 26200, 26345, …). 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.
GraphViewer.GraphViewer.getModelNodeBounds (cyclomatic 36) REDACTED:3430— GraphViewer.GraphViewer.getModelNodeBounds has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (GraphViewer.GraphViewer.getModelNodeBounds::getOrigin) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxRuler.mxRuler::drawRuler (cyclomatic 36) src/main/webapp/js/diagramly/mxRuler.js:143— mxRuler.mxRuler::drawRuler has cyclomatic complexity 36 (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.
Format.StyleFormatPanel.addEffects (cyclomatic 36) src/main/webapp/js/grapheditor/Format.js:8612— Format.StyleFormatPanel.addEffects has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 1 of the 36 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 8650, 8684, 8640, …). 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.
Graph.Graph.parseStyleRule (cyclomatic 36) REDACTED:18071— Graph.Graph.parseStyleRule has cyclomatic complexity 36 (threshold 15). Of this number, 32 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Graph.HoverIcons.repaint (cyclomatic 36) REDACTED:24638— Graph.HoverIcons.repaint has cyclomatic complexity 36 (threshold 15). Of this number, 22 points are the body's own statements and 14 belong to 2 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.
Graph.HoverIcons.update (cyclomatic 36) REDACTED:24907— Graph.HoverIcons.update has cyclomatic complexity 36 (threshold 15). Of this number, 34 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxArrowConnector.mxArrowConnector.paintEdgeShape (cyclomatic 36) src/main/webapp/mxgraph/src/shape/mxArrowConnector.js:124— mxArrowConnector.mxArrowConnector.paintEdgeShape has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxGuide.mxGuide.snapDistance (cyclomatic 36) src/main/webapp/mxgraph/src/util/mxGuide.js:573— mxGuide.mxGuide.snapDistance has cyclomatic complexity 36 (threshold 15). Of this number, 34 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxGraph.mxGraph.getBoundingBoxFromGeometry (cyclomatic 36) src/main/webapp/mxgraph/src/view/mxGraph.js:8095— mxGraph.mxGraph.getBoundingBoxFromGeometry has cyclomatic complexity 36 (threshold 15). Of this number, 34 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi (cyclomatic 36) REDACTED:7— EditorUi has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Dialogs.SaveDialog (cyclomatic 35) src/main/webapp/js/diagramly/Dialogs.js:4424— Dialogs.SaveDialog 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. This shape REPEATS in the file: 2 other methods here (Dialogs.SaveDialog::addStorageEntry, Dialogs.SaveDialog::addStorageEntries) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DrawioFile.DrawioFile.handleWriteRevoked (cyclomatic 35) REDACTED:2338— DrawioFile.DrawioFile.handleWriteRevoked 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.
DrawioFileSync.DrawioFileSync.stripPendingInserts (cyclomatic 35) src/main/webapp/js/diagramly/DrawioFileSync.js:1983— DrawioFileSync.DrawioFileSync.stripPendingInserts has cyclomatic complexity 35 (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.
DrawioFileSync.DrawioFileSync.merge (cyclomatic 35) src/main/webapp/js/diagramly/DrawioFileSync.js:3246— DrawioFileSync.DrawioFileSync.merge has cyclomatic complexity 35 (threshold 15). Of this number, 33 points are the body's own statements and 2 belong to 2 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.
Editor.Graph.createTagsDialog.refreshTags (cyclomatic 35) src/main/webapp/js/diagramly/Editor.js:11124— Editor.Graph.createTagsDialog.refreshTags has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 5 of the 35 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 11144, 11199, 11297, …). 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.
EditorUi.EditorUi.createFileData (cyclomatic 35) src/main/webapp/js/diagramly/EditorUi.js:3015— EditorUi.EditorUi.createFileData 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.
EditorUi.EditorUi.importXml (cyclomatic 35) src/main/webapp/js/diagramly/EditorUi.js:13999— EditorUi.EditorUi.importXml 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.
EditorUi.EditorUi.collectCellImages (cyclomatic 35) src/main/webapp/js/diagramly/EditorUi.js:18631— EditorUi.EditorUi.collectCellImages has cyclomatic complexity 35 (threshold 15). Of this number, 34 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.addFileDropHandler (cyclomatic 35) src/main/webapp/js/diagramly/EditorUi.js:30495— EditorUi.EditorUi.addFileDropHandler has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 3 of the 35 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 30531, 30517, 30622, …). 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.
Tidy.Tidy.collect::visit (cyclomatic 35) src/main/webapp/js/diagramly/tidy/Tidy.js:327— Tidy.Tidy.collect::visit 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. This shape REPEATS in the file: one other method here (Tidy.Tidy.collect) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Tidy.Tidy.getStructure (cyclomatic 35) src/main/webapp/js/diagramly/tidy/Tidy.js:498— Tidy.Tidy.getStructure has cyclomatic complexity 35 (threshold 15). Of this number, 32 points are the body's own statements and 3 belong to one function item inside it that branches. 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.
Dialogs.ExportDialog (cyclomatic 35) REDACTED:3340— Dialogs.ExportDialog has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 5 of the 35 points are its own statements and the rest belongs to 8 function items inside it that branch (formatChanged, a function literal at line 3725, checkValues, …). 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.
Graph.mxText.paint (cyclomatic 35) REDACTED:8131— Graph.mxText.paint 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.
Graph.Graph.getAutoLabelPlacement (cyclomatic 35) REDACTED:29813— Graph.Graph.getAutoLabelPlacement 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.
mxEdgeHandler.mxEdgeHandler.updatePreviewState (cyclomatic 35) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:1465— mxEdgeHandler.mxEdgeHandler.updatePreviewState 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.
mxCellEditor.mxCellEditor.resize (cyclomatic 35) src/main/webapp/mxgraph/src/view/mxCellEditor.js:540— mxCellEditor.mxCellEditor.resize 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.
mxPrintPreview.mxPrintPreview.open (cyclomatic 35) src/main/webapp/mxgraph/src/view/mxPrintPreview.js:531— mxPrintPreview.mxPrintPreview.open has cyclomatic complexity 35 (threshold 15). Of this number, 32 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxBpmnShape2.mxShapeBpmn2Task2.paintVertexShape (cyclomatic 35) src/main/webapp/shapes/bpmn/mxBpmnShape2.js:1880— mxBpmnShape2.mxShapeBpmn2Task2.paintVertexShape has cyclomatic complexity 35 (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.
addStyles (cyclomatic 35) src/main/webapp/js/diagramly/Editor.js:10137— addStyles has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 9 of the 35 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 10202, 10191, 10176, …). 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.
App.App.pickFolder (cyclomatic 34) src/main/webapp/js/diagramly/App.js:8574— App.App.pickFolder has cyclomatic complexity 34 (threshold 15). Of this number, 21 points are the body's own statements and 13 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.
Dialogs.CropImageDialog (cyclomatic 34) src/main/webapp/js/diagramly/Dialogs.js:19129— Dialogs.CropImageDialog has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 2 of the 34 points are its own statements and the rest belongs to 10 function items inside it that branch (init, applyInputs, calcClipPath, …). 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.
DiffSync.EditorUi.diffPages (cyclomatic 34) src/main/webapp/js/diagramly/DiffSync.js:1944— DiffSync.EditorUi.diffPages 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.
Editor.Editor.extractGraphModel (cyclomatic 34) src/main/webapp/js/diagramly/Editor.js:2926— Editor.Editor.extractGraphModel 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.
EditorUi.EditorUi.createEmbedSvg (cyclomatic 34) src/main/webapp/js/diagramly/EditorUi.js:13101— EditorUi.EditorUi.createEmbedSvg has cyclomatic complexity 34 (threshold 15). Of this number, 33 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
EditorUi.EditorUi.insertTextAt (cyclomatic 34) src/main/webapp/js/diagramly/EditorUi.js:16965— EditorUi.EditorUi.insertTextAt has cyclomatic complexity 34 (threshold 15). Of this number, 31 points are the body's own statements and 3 belong to 2 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.
LibavoidRouting.LibavoidRouting.snapPoints (cyclomatic 34) src/main/webapp/js/diagramly/LibavoidRouting.js:1650— LibavoidRouting.LibavoidRouting.snapPoints has cyclomatic complexity 34 (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.
Graph.Graph.writeContainerLayoutGeometries (cyclomatic 34) REDACTED:14733— Graph.Graph.writeContainerLayoutGeometries has cyclomatic complexity 34 (threshold 15). Of this number, 33 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Shapes.CurvedTextShape.paintForeground (cyclomatic 34) src/main/webapp/js/grapheditor/Shapes.js:8621— Shapes.CurvedTextShape.paintForeground 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.
App (cyclomatic 34) src/main/webapp/js/diagramly/App.js:10— App has cyclomatic complexity 34 (threshold 15). Of this number, 16 points are the body's own statements and 18 belong to 6 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.
App.App.getThumbnail (cyclomatic 33) src/main/webapp/js/diagramly/App.js:3638— App.App.getThumbnail has cyclomatic complexity 33 (threshold 15). Of this number, 23 points are the body's own statements and 10 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.
App.App.executeCreateObject (cyclomatic 33) src/main/webapp/js/diagramly/App.js:4794— App.App.executeCreateObject has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 13 of the 33 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 4822, 4937, 4807, …). 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.
App.App.saveLibrary (cyclomatic 33) src/main/webapp/js/diagramly/App.js:6150— App.App.saveLibrary has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 11 of the 33 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 6179, 6159, 6247, …). 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.
App.App.createFile (cyclomatic 33) src/main/webapp/js/diagramly/App.js:6718— App.App.createFile has cyclomatic complexity 33 (threshold 15). Of this number, 28 points are the body's own statements and 5 belong to 2 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.
DrawioFile.DrawioFile.mergeFile (cyclomatic 33) REDACTED:644— DrawioFile.DrawioFile.mergeFile has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.importFile (cyclomatic 33) src/main/webapp/js/diagramly/EditorUi.js:17474— EditorUi.EditorUi.importFile has cyclomatic complexity 33 (threshold 15). Of this number, 26 points are the body's own statements and 7 belong to 2 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.
EditorUi.EditorUi.setOutlineOrder (cyclomatic 33) src/main/webapp/js/diagramly/EditorUi.js:35653— EditorUi.EditorUi.setOutlineOrder has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.applyListText (cyclomatic 33) src/main/webapp/js/diagramly/EditorUi.js:36892— EditorUi.EditorUi.applyListText has cyclomatic complexity 33 (threshold 15). Of this number, 28 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ForceExplorer.ForceExplorer.updateBullets (cyclomatic 33) src/main/webapp/js/diagramly/ForceExplorer.js:4632— ForceExplorer.ForceExplorer.updateBullets has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LibavoidRouting.LibavoidRouting.createRouteEdges (cyclomatic 33) src/main/webapp/js/diagramly/LibavoidRouting.js:1990— LibavoidRouting.LibavoidRouting.createRouteEdges has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TidyStyle.Tidy.getRole (cyclomatic 33) src/main/webapp/js/diagramly/tidy/TidyStyle.js:608— TidyStyle.Tidy.getRole has cyclomatic complexity 33 (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.
Editor.FilenameDialog (cyclomatic 33) src/main/webapp/js/grapheditor/Editor.js:4410— Editor.FilenameDialog has cyclomatic complexity 33 (threshold 15). Of this number, 18 points are the body's own statements and 15 belong to 7 function literals 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.
EditorUi.EditorUi.findCommonProperties (cyclomatic 33) REDACTED:1614— EditorUi.EditorUi.findCommonProperties has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 15 of the 33 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1616, 1676). 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.
Graph.TableLayout.execute (cyclomatic 33) REDACTED:27179— Graph.TableLayout.execute has cyclomatic complexity 33 (threshold 15). Of this number, 27 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxODPicker.mxODPicker (cyclomatic 33) src/main/webapp/js/onedrive/mxODPicker.js:11— mxODPicker.mxODPicker has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: 2 other methods here (mxODPicker.mxODPicker::fillFolderFiles, mxODPicker.mxODPicker::fillFolderFiles::renderList) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxSvgCanvas2D.mxSvgCanvas2D.getAlternateTextLines (cyclomatic 33) REDACTED:489— mxSvgCanvas2D.mxSvgCanvas2D.getAlternateTextLines has cyclomatic complexity 33 (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.
mxGraph.mxGraph.cloneCells (cyclomatic 33) src/main/webapp/mxgraph/src/view/mxGraph.js:4596— mxGraph.mxGraph.cloneCells has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxBpmnShape2.mxShapeBpmn2Task.paintVertexShape (cyclomatic 33) src/main/webapp/shapes/bpmn/mxBpmnShape2.js:1578— mxBpmnShape2.mxShapeBpmn2Task.paintVertexShape has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ProxyServlet.doGet (cyclomatic 33) REDACTED:68— ProxyServlet.doGet has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
createDragSource::dragOver (cyclomatic 33) src/main/webapp/js/grapheditor/Sidebar.js:6700— createDragSource::dragOver has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Dialogs.ParseDialog (cyclomatic 32) src/main/webapp/js/diagramly/Dialogs.js:1514— Dialogs.ParseDialog has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Dialogs.ParseDialog::parse) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.PluginsDialog (cyclomatic 32) src/main/webapp/js/diagramly/Dialogs.js:18811— Dialogs.PluginsDialog has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 13 of the 32 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 18949, refreshAddOptions, refresh, …). 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.
Dialogs.FontDialog (cyclomatic 32) src/main/webapp/js/diagramly/Dialogs.js:23963— Dialogs.FontDialog has cyclomatic complexity 32 (threshold 15). Of this number, 17 points are the body's own statements and 15 belong to 4 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.
EditorUi.EditorUi.editContainerLayout (cyclomatic 32) src/main/webapp/js/diagramly/EditorUi.js:37848— EditorUi.EditorUi.editContainerLayout has cyclomatic complexity 32 (threshold 15). Of this number, 27 points are the body's own statements and 5 belong to 2 function literals inside it that branch. 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.
LightboxModern.LightboxModern.updateLanguages (cyclomatic 32) src/main/webapp/js/diagramly/LightboxModern.js:2240— LightboxModern.LightboxModern.updateLanguages has cyclomatic complexity 32 (threshold 15). Of this number, 30 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Format.BaseFormatPanel.installInputHandler.update (cyclomatic 32) src/main/webapp/js/grapheditor/Format.js:698— Format.BaseFormatPanel.installInputHandler.update has cyclomatic complexity 32 (threshold 15). Of this number, 31 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Format.ArrangePanel.init (cyclomatic 32) src/main/webapp/js/grapheditor/Format.js:2310— Format.ArrangePanel.init has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Graph.LabelBoxIndex.add (cyclomatic 32) REDACTED:29570— Graph.LabelBoxIndex.add has cyclomatic complexity 32 (threshold 15). Of this number, 19 points are the body's own statements and 13 belong to 3 function items inside it that branch. 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.
Graph.mxGraphView.updateCurveLineJumps (cyclomatic 32) REDACTED:31777— Graph.mxGraphView.updateCurveLineJumps has cyclomatic complexity 32 (threshold 15). Of this number, 26 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Graph.mxGraphView.updateFixedPointSpacing (cyclomatic 32) REDACTED:32573— Graph.mxGraphView.updateFixedPointSpacing has cyclomatic complexity 32 (threshold 15). Of this number, 24 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InlineToolbar.InlineToolbar.createPopover.position (cyclomatic 32) src/main/webapp/js/grapheditor/InlineToolbar.js:1602— InlineToolbar.InlineToolbar.createPopover.position has cyclomatic complexity 32 (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.
mxLeanMap.mxShapeLeanTimeline.paintVertexShape (cyclomatic 32) src/main/webapp/shapes/mxLeanMap.js:1999— mxLeanMap.mxShapeLeanTimeline.paintVertexShape has cyclomatic complexity 32 (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.
main::doLoad::(anonymous)::realMain (cyclomatic 32) src/main/webapp/js/diagramly/App.js:1466— main::doLoad::(anonymous)::realMain has cyclomatic complexity 32 (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.
App.App.fileCreated (cyclomatic 31) src/main/webapp/js/diagramly/App.js:6832— App.App.fileCreated has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 14 of the 31 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 6887, 6900, 6937, …). 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.
Dialogs.LibraryDialog::addButton (cyclomatic 31) src/main/webapp/js/diagramly/Dialogs.js:20059— Dialogs.LibraryDialog::addButton 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. This shape REPEATS in the file: one other method here (Dialogs.LibraryDialog) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
EditorUi.EditorUi.applySharedViewMode (cyclomatic 31) src/main/webapp/js/diagramly/EditorUi.js:1901— EditorUi.EditorUi.applySharedViewMode 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.
EditorUi.EditorUi.getCsvStyle (cyclomatic 31) src/main/webapp/js/diagramly/EditorUi.js:39307— EditorUi.EditorUi.getCsvStyle has cyclomatic complexity 31 (threshold 15). Of this number, 19 points are the body's own statements and 12 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ForceExplorer.ForceExplorer.predictBounds (cyclomatic 31) src/main/webapp/js/diagramly/ForceExplorer.js:2092— ForceExplorer.ForceExplorer.predictBounds 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.
Dialogs.ColorWindow (cyclomatic 31) REDACTED:1989— Dialogs.ColorWindow has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 4 of the 31 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 2134, 2068, 2094, …). 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.
Editor.Editor.createKeyboardGrid (cyclomatic 31) src/main/webapp/js/grapheditor/Editor.js:1260— Editor.Editor.createKeyboardGrid has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 2 of the 31 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1340, 1329). 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.
Editor.mxGraphView.validateBackgroundStyles (cyclomatic 31) src/main/webapp/js/grapheditor/Editor.js:4874— Editor.mxGraphView.validateBackgroundStyles has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
EditorUi.EditorUi.onKeyDown (cyclomatic 31) REDACTED:3556— EditorUi.EditorUi.onKeyDown has cyclomatic complexity 31 (threshold 15). Of this number, 21 points are the body's own statements and 10 belong to 2 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.
EditorUi.EditorUi.installLineMarkerMenu (cyclomatic 31) REDACTED:7826— EditorUi.EditorUi.installLineMarkerMenu has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 1 of the 31 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 7834, 7876). 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.
Format.BaseFormatPanel.createColorOption::apply (cyclomatic 31) src/main/webapp/js/grapheditor/Format.js:1542— Format.BaseFormatPanel.createColorOption::apply 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. This shape REPEATS in the file: one other method here (Format.BaseFormatPanel.createColorOption) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Graph.Graph.optimizeNode (cyclomatic 31) REDACTED:4580— Graph.Graph.optimizeNode has cyclomatic complexity 31 (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.
Graph.Graph.clipSvgDataUri (cyclomatic 31) REDACTED:5184— Graph.Graph.clipSvgDataUri 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.
Graph.Graph.createLayouts (cyclomatic 31) REDACTED:14364— Graph.Graph.createLayouts 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.
Graph.Graph.removeTieReferences (cyclomatic 31) REDACTED:21131— Graph.Graph.removeTieReferences 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.
InlineToolbar.InlineToolbar.showTextMenu (cyclomatic 31) src/main/webapp/js/grapheditor/InlineToolbar.js:2863— InlineToolbar.InlineToolbar.showTextMenu has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 14 of the 31 points are its own statements and the rest belongs to 7 function items inside it that branch (getValue, a function literal at line 3087, a function literal at line 2930, …). 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.
InlineToolbar.InlineToolbar.showShapeMenu (cyclomatic 31) src/main/webapp/js/grapheditor/InlineToolbar.js:4733— InlineToolbar.InlineToolbar.showShapeMenu has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 8 of the 31 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 4784, 4901, 4826, …). 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.
Sidebar.Sidebar.getDropAndConnectGeometry (cyclomatic 31) src/main/webapp/js/grapheditor/Sidebar.js:6038— Sidebar.Sidebar.getDropAndConnectGeometry 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.
mxSvgCanvas2D.mxSvgCanvas2D.addNode (cyclomatic 31) REDACTED:1172— mxSvgCanvas2D.mxSvgCanvas2D.addNode 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.
mxSvgCanvas2D.mxSvgCanvas2D.image (cyclomatic 31) REDACTED:1743— mxSvgCanvas2D.mxSvgCanvas2D.image 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.
mxSvgCanvas2D.mxSvgCanvas2D.text (cyclomatic 31) REDACTED:3327— mxSvgCanvas2D.mxSvgCanvas2D.text 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.
mxCellRenderer.mxCellRenderer.redrawLabel (cyclomatic 31) src/main/webapp/mxgraph/src/view/mxCellRenderer.js:1151— mxCellRenderer.mxCellRenderer.redrawLabel has cyclomatic complexity 31 (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.
mxGraph.mxGraph.fit (cyclomatic 31) src/main/webapp/mxgraph/src/view/mxGraph.js:3039— mxGraph.mxGraph.fit 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.
mxGraph.mxGraph.moveCells (cyclomatic 31) src/main/webapp/mxgraph/src/view/mxGraph.js:6660— mxGraph.mxGraph.moveCells has cyclomatic complexity 31 (threshold 15). Of this number, 29 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxBpmnShape2.mxBpmnShape.redrawPath (cyclomatic 31) src/main/webapp/shapes/bpmn/mxBpmnShape2.js:135— mxBpmnShape2.mxBpmnShape.redrawPath 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.
AbsAuth.doGetAbst (cyclomatic 31) src/main/server/java/com/mxgraph/online/AbsAuth.java:259— AbsAuth.doGetAbst 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.
(anonymous) (cyclomatic 31) src/main/webapp/js/diagramly/Editor.js:5— (anonymous) has cyclomatic complexity 31 (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.
App.App.isModeEnabled (cyclomatic 30) src/main/webapp/js/diagramly/App.js:6619— App.App.isModeEnabled has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DriveClient.DriveClient.authorizeStep2 (cyclomatic 30) src/main/webapp/js/diagramly/DriveClient.js:1010— DriveClient.DriveClient.authorizeStep2 has cyclomatic complexity 30 (threshold 15). Of this number, 18 points are the body's own statements and 12 belong to 2 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.
EditorUi.EditorUi.setFileData (cyclomatic 30) src/main/webapp/js/diagramly/EditorUi.js:3932— EditorUi.EditorUi.setFileData 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.
EditorUi.EditorUi.createLink (cyclomatic 30) src/main/webapp/js/diagramly/EditorUi.js:10579— EditorUi.EditorUi.createLink has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
EditorUi.EditorUi.createHtml (cyclomatic 30) src/main/webapp/js/diagramly/EditorUi.js:10671— EditorUi.EditorUi.createHtml has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ElectronApp.App.readGraphFile (cyclomatic 30) src/main/webapp/js/diagramly/ElectronApp.js:1389— ElectronApp.App.readGraphFile has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 7 of the 30 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 1437, 1444, 1578, …). 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.
GraphViewer.GraphViewer.getLazySize (cyclomatic 30) REDACTED:3362— GraphViewer.GraphViewer.getLazySize 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.
TidyStyle.Tidy.styleEdges (cyclomatic 30) src/main/webapp/js/diagramly/tidy/TidyStyle.js:1721— TidyStyle.Tidy.styleEdges 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.
TidyWindow.TidyWindow.createThumbnail (cyclomatic 30) src/main/webapp/js/diagramly/tidy/TidyWindow.js:1518— TidyWindow.TidyWindow.createThumbnail has cyclomatic complexity 30 (threshold 15). Of this number, 20 points are the body's own statements and 10 belong to 5 function literals 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.
EditorUi.EditorUi.destroy (cyclomatic 30) REDACTED:12049— EditorUi.EditorUi.destroy has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Graph.Graph.exploreFromCell::exploreFromHere::rootChanged (cyclomatic 30) REDACTED:4204— Graph.Graph.exploreFromCell::exploreFromHere::rootChanged 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.
Menus.Menus.init (cyclomatic 30) src/main/webapp/js/grapheditor/Menus.js:50— Menus.Menus.init has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to 12 function literals inside it that branch (lines 227, 59, 317, …). 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.
Omnibox.Omnibox.recordMenus (cyclomatic 30) src/main/webapp/js/grapheditor/Omnibox.js:1026— Omnibox.Omnibox.recordMenus has cyclomatic complexity 30 (threshold 15). Of this number, 27 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Omnibox.Omnibox.getFormatControl (cyclomatic 30) src/main/webapp/js/grapheditor/Omnibox.js:1543— Omnibox.Omnibox.getFormatControl 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.
Shapes.TableShape.paintCollapsedOutline (cyclomatic 30) src/main/webapp/js/grapheditor/Shapes.js:754— Shapes.TableShape.paintCollapsedOutline has cyclomatic complexity 30 (threshold 15). Of this number, 25 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxEdgeHandler.mxEdgeHandler.getPreviewPoints (cyclomatic 30) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:1311— mxEdgeHandler.mxEdgeHandler.getPreviewPoints has cyclomatic complexity 30 (threshold 15). Of this number, 27 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxVertexHandler.mxVertexHandler.start (cyclomatic 30) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:647— mxVertexHandler.mxVertexHandler.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.
mxGraph.mxGraph.getConnectionPoint (cyclomatic 30) src/main/webapp/mxgraph/src/view/mxGraph.js:7439— mxGraph.mxGraph.getConnectionPoint 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.
mxGraph.mxGraph.getCells (cyclomatic 30) src/main/webapp/mxgraph/src/view/mxGraph.js:13126— mxGraph.mxGraph.getCells 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.
mxGraphView.mxGraphView.updateFixedPointSpacing (cyclomatic 30) src/main/webapp/mxgraph/src/view/mxGraphView.js:3353— mxGraphView.mxGraphView.updateFixedPointSpacing has cyclomatic complexity 30 (threshold 15). Of this number, 22 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EntityRelation (cyclomatic 30) src/main/webapp/mxgraph/src/view/mxEdgeStyle.js:98— EntityRelation 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.
Editor.Editor.replaceLightDarkFunctions (cyclomatic 29) src/main/webapp/js/diagramly/Editor.js:1742— Editor.Editor.replaceLightDarkFunctions has cyclomatic complexity 29 (threshold 15). Of this number, 20 points are the body's own statements and 9 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.openFileHandle (cyclomatic 29) src/main/webapp/js/diagramly/EditorUi.js:30752— EditorUi.EditorUi.openFileHandle has cyclomatic complexity 29 (threshold 15). Of this number, 22 points are the body's own statements and 7 belong to 2 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.initializeEmbedMode (cyclomatic 29) src/main/webapp/js/diagramly/EditorUi.js:31217— EditorUi.EditorUi.initializeEmbedMode has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 6 of the 29 points are its own statements and the rest belongs to one function literal inside it that branches (line 31228). 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: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
ForceExplorer.ForceExplorer.update (cyclomatic 29) src/main/webapp/js/diagramly/ForceExplorer.js:2457— ForceExplorer.ForceExplorer.update 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.
LayoutPicker.LayoutPreviews.run (cyclomatic 29) src/main/webapp/js/diagramly/LayoutPicker.js:1558— LayoutPicker.LayoutPreviews.run has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 10 of the 29 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 1581, next, a function literal at line 1681, …). 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.
Sidebar.Sidebar.installPaletteDragReorder (cyclomatic 29) src/main/webapp/js/diagramly/sidebar/Sidebar.js:801— Sidebar.Sidebar.installPaletteDragReorder has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 4 of the 29 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 824, 928, 812). 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.
Tidy.Tidy.tryCandidate (cyclomatic 29) src/main/webapp/js/diagramly/tidy/Tidy.js:2871— Tidy.Tidy.tryCandidate has cyclomatic complexity 29 (threshold 15). Of this number, 18 points are the body's own statements and 11 belong to 2 function literals 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.
Graph.Graph.sanitizeElkLayoutOptions (cyclomatic 29) REDACTED:14995— Graph.Graph.sanitizeElkLayoutOptions 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.
Graph.Graph.parseDataSource (cyclomatic 29) REDACTED:18831— Graph.Graph.parseDataSource has cyclomatic complexity 29 (threshold 15). Of this number, 27 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Graph.Graph.addTextOutlineButton (cyclomatic 29) REDACTED:23234— Graph.Graph.addTextOutlineButton has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 2 of the 29 points are its own statements and the rest belongs to 9 function items inside it that branch (escape, setVisible, keydown, …). 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.
InlineToolbar.InlineToolbar.getPosition (cyclomatic 29) src/main/webapp/js/grapheditor/InlineToolbar.js:1238— InlineToolbar.InlineToolbar.getPosition has cyclomatic complexity 29 (threshold 15). Of this number, 16 points are the body's own statements and 13 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
InlineToolbar.InlineToolbar.showTableMenu (cyclomatic 29) src/main/webapp/js/grapheditor/InlineToolbar.js:4103— InlineToolbar.InlineToolbar.showTableMenu has cyclomatic complexity 29 (threshold 15). Of this number, 17 points are the body's own statements and 12 belong to 7 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.
InlineToolbar.InlineToolbar.getShapeSelection (cyclomatic 29) src/main/webapp/js/grapheditor/InlineToolbar.js:4619— InlineToolbar.InlineToolbar.getShapeSelection has cyclomatic complexity 29 (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.
Omnibox.Omnibox.keyDown (cyclomatic 29) src/main/webapp/js/grapheditor/Omnibox.js:740— Omnibox.Omnibox.keyDown 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.
libavoid-routing.AvoidRouting.shapePin (cyclomatic 29) src/main/webapp/js/libavoid-js/libavoid-routing.js:430— libavoid-routing.AvoidRouting.shapePin 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.
mxEdgeHandler.mxEdgeHandler.redrawHandles (cyclomatic 29) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:2654— mxEdgeHandler.mxEdgeHandler.redrawHandles 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.
mxSvgCanvas2D.mxSvgCanvas2D.addTextBackground (cyclomatic 29) REDACTED:4163— mxSvgCanvas2D.mxSvgCanvas2D.addTextBackground 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.
mxPidMisc.mxShapePidColumn.foreground (cyclomatic 29) src/main/webapp/shapes/pid2/mxPidMisc.js:187— mxPidMisc.mxShapePidColumn.foreground 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.
EmbedServlet2.createEmbedJavaScript (cyclomatic 29) src/main/server/java/com/mxgraph/online/EmbedServlet2.java:273— EmbedServlet2.createEmbedJavaScript 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.
Dialogs.EditGeometryDialog (cyclomatic 28) src/main/webapp/js/diagramly/Dialogs.js:19615— Dialogs.EditGeometryDialog has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 13 of the 28 points are its own statements and the rest belongs to 3 function items inside it that branch (applyFn, createInlineField, a function literal at line 19839). 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.
DiffSync.EditorUi.patchCell (cyclomatic 28) src/main/webapp/js/diagramly/DiffSync.js:1731— DiffSync.EditorUi.patchCell 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.
Editor.Editor.addMathTextLayer (cyclomatic 28) src/main/webapp/js/diagramly/Editor.js:5631— Editor.Editor.addMathTextLayer 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.
EditorUi.EditorUi.addChromelessToolbarItems (cyclomatic 28) src/main/webapp/js/diagramly/EditorUi.js:8992— EditorUi.EditorUi.addChromelessToolbarItems has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 9 of the 28 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 9022, 9035, 9123, …). 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: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.generateOpenAiMermaidDiagram.fn (cyclomatic 28) src/main/webapp/js/diagramly/EditorUi.js:15377— EditorUi.EditorUi.generateOpenAiMermaidDiagram.fn has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 2 of the 28 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 15446, 15384, 15440, …). 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: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.refreshDataSources (cyclomatic 28) src/main/webapp/js/diagramly/EditorUi.js:39101— EditorUi.EditorUi.refreshDataSources has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 6 of the 28 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 39119, 39153, 39134, …). 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: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
LayoutPicker.EditorUi.getLayoutFormValues (cyclomatic 28) src/main/webapp/js/diagramly/LayoutPicker.js:213— LayoutPicker.EditorUi.getLayoutFormValues has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
LayoutPicker.EditorUi.applyLayoutList (cyclomatic 28) src/main/webapp/js/diagramly/LayoutPicker.js:941— LayoutPicker.EditorUi.applyLayoutList has cyclomatic complexity 28 (threshold 15). Of this number, 17 points are the body's own statements and 11 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LightboxModern.LightboxModern.createExportPanel (cyclomatic 28) src/main/webapp/js/diagramly/LightboxModern.js:2914— LightboxModern.LightboxModern.createExportPanel has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 9 of the 28 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 2958, 3012, 2932, …). 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.
LightboxModern.LightboxModern.keyDown (cyclomatic 28) src/main/webapp/js/diagramly/LightboxModern.js:3648— LightboxModern.LightboxModern.keyDown has cyclomatic complexity 28 (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.
Pages.EditorUi.addTabListeners (cyclomatic 28) src/main/webapp/js/diagramly/Pages.js:4440— Pages.EditorUi.addTabListeners has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 1 of the 28 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 4537, 4490, 4514). 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.
mxGraphMlCodec.mxGraphMlCodec.mapObject (cyclomatic 28) REDACTED:545— mxGraphMlCodec.mxGraphMlCodec.mapObject 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.
Editor.Editor.repairTruncatedXml (cyclomatic 28) src/main/webapp/js/grapheditor/Editor.js:779— Editor.Editor.repairTruncatedXml 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.
EditorUi.EditorUi.getCellsForShapePicker (cyclomatic 28) REDACTED:2975— EditorUi.EditorUi.getCellsForShapePicker has cyclomatic complexity 28 (threshold 15). Of this number, 17 points are the body's own statements and 11 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Graph.Graph.createSvgImageSymbol (cyclomatic 28) REDACTED:6381— Graph.Graph.createSvgImageSymbol 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.
Graph.Graph.getTextOutline (cyclomatic 28) REDACTED:23064— Graph.Graph.getTextOutline has cyclomatic complexity 28 (threshold 15). Of this number, 15 points are the body's own statements and 13 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxConnectionHandler.mxConnectionHandler.updateCurrentState (cyclomatic 28) src/main/webapp/mxgraph/src/handler/mxConnectionHandler.js:1076— mxConnectionHandler.mxConnectionHandler.updateCurrentState 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.
mxSvgCanvas2D.mxSvgCanvas2D.getFillPattern (cyclomatic 28) REDACTED:901— mxSvgCanvas2D.mxSvgCanvas2D.getFillPattern has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
mxGraph.mxGraph.alignCells (cyclomatic 28) src/main/webapp/mxgraph/src/view/mxGraph.js:3741— mxGraph.mxGraph.alignCells 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.
mxGraph.mxGraph.cellsAdded (cyclomatic 28) src/main/webapp/mxgraph/src/view/mxGraph.js:4951— mxGraph.mxGraph.cellsAdded has cyclomatic complexity 28 (threshold 15). Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxGraphView.mxGraphView.getLabelPerimeterPoint (cyclomatic 28) src/main/webapp/mxgraph/src/view/mxGraphView.js:3735— mxGraphView.mxGraphView.getLabelPerimeterPoint 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.
mxBasic.mxShapeBasicPatternFillRect.paintVertexShape (cyclomatic 28) src/main/webapp/shapes/mxBasic.js:3642— mxBasic.mxShapeBasicPatternFillRect.paintVertexShape 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.
addProperties (cyclomatic 28) src/main/webapp/js/diagramly/Editor.js:9265— addProperties 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.
getPortConstraints (cyclomatic 28) src/main/webapp/mxgraph/src/util/mxUtils.js:3142— getPortConstraints 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.
App.App.pickFile (cyclomatic 27) src/main/webapp/js/diagramly/App.js:5834— App.App.pickFile has cyclomatic complexity 27 (threshold 15). Of this number, 14 points are the body's own statements and 13 belong to 6 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.
Dialogs.EditShapeDialog (cyclomatic 27) src/main/webapp/js/diagramly/Dialogs.js:20938— Dialogs.EditShapeDialog has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 7 of the 27 points are its own statements and the rest belongs to 3 function items inside it that branch (updateConstraints, updateShape, a function literal at line 21165). 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.
DrawioFile.DrawioFile.checksumError (cyclomatic 27) REDACTED:890— DrawioFile.DrawioFile.checksumError has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 11 of the 27 points are its own statements and the rest belongs to one function literal inside it that branches (line 938). 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.
DrawioFileSync.DrawioFileSync.handleMessageData (cyclomatic 27) src/main/webapp/js/diagramly/DrawioFileSync.js:985— DrawioFileSync.DrawioFileSync.handleMessageData has cyclomatic complexity 27 (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.
Editor.Editor.AnimationPlayer.play (cyclomatic 27) src/main/webapp/js/diagramly/Editor.js:15978— Editor.Editor.AnimationPlayer.play has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 8 of the 27 points are its own statements and the rest belongs to 3 function items inside it that branch (runStep, iter, a function literal at line 16111). 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.
EditorUi.EditorUi.logError (cyclomatic 27) src/main/webapp/js/diagramly/EditorUi.js:606— EditorUi.EditorUi.logError has cyclomatic complexity 27 (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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.downloadFile (cyclomatic 27) src/main/webapp/js/diagramly/EditorUi.js:4244— EditorUi.EditorUi.downloadFile has cyclomatic complexity 27 (threshold 15). Of this number, 23 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.parseTableRows (cyclomatic 27) src/main/webapp/js/diagramly/EditorUi.js:37089— EditorUi.EditorUi.parseTableRows has cyclomatic complexity 27 (threshold 15). Of this number, 24 points are the body's own statements and 3 belong to one function item inside it that branches. 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
Extensions.createGroup (cyclomatic 27) REDACTED:6507— Extensions.createGroup has cyclomatic complexity 27 (threshold 15). Of this number, 18 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LibavoidRouting.LibavoidRouting.installAutoRouting::collectRestyled (cyclomatic 27) src/main/webapp/js/diagramly/LibavoidRouting.js:500— LibavoidRouting.LibavoidRouting.installAutoRouting::collectRestyled 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.
LibavoidRouting.LibavoidRouting.livePreviewMove (cyclomatic 27) src/main/webapp/js/diagramly/LibavoidRouting.js:3842— LibavoidRouting.LibavoidRouting.livePreviewMove 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.
LightboxModern.LightboxModern.update (cyclomatic 27) src/main/webapp/js/diagramly/LightboxModern.js:1993— LightboxModern.LightboxModern.update has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TrelloClient.TrelloClient.showTrelloDialog (cyclomatic 27) REDACTED:448— TrelloClient.TrelloClient.showTrelloDialog has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 2 of the 27 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 616, 475, 579, …). 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.
Sidebar.Sidebar.addCustomEntries (cyclomatic 27) src/main/webapp/js/diagramly/sidebar/Sidebar.js:1680— Sidebar.Sidebar.addCustomEntries has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 9 of the 27 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 1696, 1714, 1761, …). 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.
Editor.mxGraph.updatePageBreaks (cyclomatic 27) src/main/webapp/js/grapheditor/Editor.js:5108— Editor.mxGraph.updatePageBreaks has cyclomatic complexity 27 (threshold 15). Of this number, 14 points are the body's own statements and 13 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Graph.Graph.copyCellStyles (cyclomatic 27) REDACTED:11322— Graph.Graph.copyCellStyles 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.
Graph.Graph.runAsyncLayout (cyclomatic 27) REDACTED:14147— Graph.Graph.runAsyncLayout has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 12 of the 27 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 14225, next, finish). 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.
Graph.HoverIcons.init (cyclomatic 27) REDACTED:24196— Graph.HoverIcons.init has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 2 of the 27 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 24311, 24290, 24268, …). 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.
Graph.moveTextBox (cyclomatic 27) REDACTED:30261— Graph.moveTextBox 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.
Sidebar.Sidebar.addClickHandler (cyclomatic 27) src/main/webapp/js/grapheditor/Sidebar.js:7406— Sidebar.Sidebar.addClickHandler has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 5 of the 27 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 7416, 7498, 7466, …). 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.
mxConstraintHandler.mxConstraintHandler.update (cyclomatic 27) src/main/webapp/mxgraph/src/handler/mxConstraintHandler.js:256— mxConstraintHandler.mxConstraintHandler.update has cyclomatic complexity 27 (threshold 15). Of this number, 26 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxGraphHandler.mxGraphHandler.start (cyclomatic 27) src/main/webapp/mxgraph/src/handler/mxGraphHandler.js:1010— mxGraphHandler.mxGraphHandler.start has cyclomatic complexity 27 (threshold 15). Of this number, 24 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
mxGuide.mxGuide.moveDistance (cyclomatic 27) src/main/webapp/mxgraph/src/util/mxGuide.js:506— mxGuide.mxGuide.moveDistance has cyclomatic complexity 27 (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.
mxCellEditor.mxCellEditor.updateTextAreaStyle (cyclomatic 27) src/main/webapp/mxgraph/src/view/mxCellEditor.js:704— mxCellEditor.mxCellEditor.updateTextAreaStyle has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
mxGraph.mxGraph.constrainChild (cyclomatic 27) src/main/webapp/mxgraph/src/view/mxGraph.js:6979— mxGraph.mxGraph.constrainChild 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.
replay.Draw.loadPlugin() (cyclomatic 27) src/main/webapp/plugins/replay.js:10— replay.Draw.loadPlugin() has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 4 of the 27 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 191, a function literal at line 146, decodeChanges, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cyclomatic 27) src/main/webapp/plugins/replay.js:10— (anonymous) has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 4 of the 27 points are its own statements and the rest belongs to 18 function items inside it that branch (a function literal at line 191, a function literal at line 146, decodeChanges, …). 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.
App.App.nextDriveUse (cyclomatic 26) src/main/webapp/js/diagramly/App.js:3178— App.App.nextDriveUse has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 6 of the 26 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 3201, 3225, 3261). 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.
Dialogs.SplashDialog (cyclomatic 26) src/main/webapp/js/diagramly/Dialogs.js:347— Dialogs.SplashDialog has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Dialogs.PolygonDialog::renderPolygon (cyclomatic 26) src/main/webapp/js/diagramly/Dialogs.js:26244— Dialogs.PolygonDialog::renderPolygon 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. This shape REPEATS in the file: one other method here (Dialogs.PolygonDialog) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.TieTool.init (cyclomatic 26) src/main/webapp/js/diagramly/Dialogs.js:28223— Dialogs.TieTool.init has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 3 of the 26 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 28270, 28228, 28262, …). 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.
EditorUi.EditorUi.parseHtmlData (cyclomatic 26) src/main/webapp/js/diagramly/EditorUi.js:29788— EditorUi.EditorUi.parseHtmlData 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
ForceExplorer.ForceExplorer.installListeners (cyclomatic 26) src/main/webapp/js/diagramly/ForceExplorer.js:945— ForceExplorer.ForceExplorer.installListeners has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 9 of the 26 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 1008, 1059, 974, …). 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.
ForceExplorer.ForceExplorer.tick (cyclomatic 26) src/main/webapp/js/diagramly/ForceExplorer.js:3833— ForceExplorer.ForceExplorer.tick 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.
LibavoidRouting.LibavoidRouting.installFlaggedCells (cyclomatic 26) src/main/webapp/js/diagramly/LibavoidRouting.js:978— LibavoidRouting.LibavoidRouting.installFlaggedCells has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 2 of the 26 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 1018, update). 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.
SimpleClassic.EditorUi.createFooterMenuForTheme (cyclomatic 26) src/main/webapp/js/diagramly/SimpleClassic.js:106— SimpleClassic.EditorUi.createFooterMenuForTheme has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 9 of the 26 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 203, 148, 172, …). 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.
Editor.Editor.getGraphXml (cyclomatic 26) src/main/webapp/js/grapheditor/Editor.js:1977— Editor.Editor.getGraphXml 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.
Format.Format.addLineMarkerItems (cyclomatic 26) src/main/webapp/js/grapheditor/Format.js:102— Format.Format.addLineMarkerItems has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Format.BaseFormatPanel.createCellColorOption (cyclomatic 26) src/main/webapp/js/grapheditor/Format.js:1881— Format.BaseFormatPanel.createCellColorOption has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 5 of the 26 points are its own statements and the rest belongs to 6 function items inside it that branch (getValue, a function literal at line 1932, a function literal at line 1961, …). 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.
Graph.Graph.updateFollowingEdges (cyclomatic 26) REDACTED:13636— Graph.Graph.updateFollowingEdges has cyclomatic complexity 26 (threshold 15). Of this number, 19 points are the body's own statements and 7 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.
Graph.Graph.isLiveLayoutLimited (cyclomatic 26) REDACTED:13892— Graph.Graph.isLiveLayoutLimited 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.
Graph.Graph.formatDate (cyclomatic 26) REDACTED:16127— Graph.Graph.formatDate has cyclomatic complexity 26 (threshold 15). Of this number, 23 points are the body's own statements and 3 belong to 2 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.
Graph.Graph.updateShapes (cyclomatic 26) REDACTED:17212— Graph.Graph.updateShapes 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.
Graph.Graph.getFirstLine::visit (cyclomatic 26) REDACTED:22600— Graph.Graph.getFirstLine::visit 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.
Shapes.TableShape.paintCollapsedTable (cyclomatic 26) src/main/webapp/js/grapheditor/Shapes.js:595— Shapes.TableShape.paintCollapsedTable has cyclomatic complexity 26 (threshold 15). Of this number, 24 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
Shapes.PartialRectangleShape.paintVertexShape (cyclomatic 26) src/main/webapp/js/grapheditor/Shapes.js:5787— Shapes.PartialRectangleShape.paintVertexShape 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.
Shapes.mxShapeBasicRect2.paintFolds (cyclomatic 26) src/main/webapp/js/grapheditor/Shapes.js:7461— Shapes.mxShapeBasicRect2.paintFolds has cyclomatic complexity 26 (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.
Sidebar.Sidebar (cyclomatic 26) src/main/webapp/js/grapheditor/Sidebar.js:7— Sidebar.Sidebar has cyclomatic complexity 26 (threshold 15). Of this number, 17 points are the body's own statements and 9 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.
Sidebar.Sidebar.itemClicked (cyclomatic 26) src/main/webapp/js/grapheditor/Sidebar.js:7306— Sidebar.Sidebar.itemClicked 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.
mxConnectionHandler.mxConnectionHandler.createMarker (cyclomatic 26) src/main/webapp/mxgraph/src/handler/mxConnectionHandler.js:548— mxConnectionHandler.mxConnectionHandler.createMarker has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 10 of the 26 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 555, 619, 633, …). 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.
mxEdgeHandler.mxEdgeHandler.redrawPreviewHandles (cyclomatic 26) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:1764— mxEdgeHandler.mxEdgeHandler.redrawPreviewHandles 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.
mxVertexHandler.mxVertexHandler.updateParentHighlight (cyclomatic 26) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:2206— mxVertexHandler.mxVertexHandler.updateParentHighlight has cyclomatic complexity 26 (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.
mxBpmnShape2.mxShapeBpmnEvent.strictDrawShape (cyclomatic 26) src/main/webapp/shapes/bpmn/mxBpmnShape2.js:903— mxBpmnShape2.mxShapeBpmnEvent.strictDrawShape 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.
App.App.pickLibrary (cyclomatic 25) src/main/webapp/js/diagramly/App.js:5996— App.App.pickLibrary has cyclomatic complexity 25 (threshold 15). Of this number, 17 points are the body's own statements and 8 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.
Editor.Editor.getClassicStyleEntries (cyclomatic 25) src/main/webapp/js/diagramly/Editor.js:120— Editor.Editor.getClassicStyleEntries has cyclomatic complexity 25 (threshold 15). Of this number, 16 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.getXmlFileData (cyclomatic 25) src/main/webapp/js/diagramly/EditorUi.js:3173— EditorUi.EditorUi.getXmlFileData has cyclomatic complexity 25 (threshold 15). Of this number, 16 points are the body's own statements and 9 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.saveRequest (cyclomatic 25) src/main/webapp/js/diagramly/EditorUi.js:9327— EditorUi.EditorUi.saveRequest has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 4 of the 25 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 9331, 9346, 9368). 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: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.getEmbeddedSvg (cyclomatic 25) src/main/webapp/js/diagramly/EditorUi.js:13624— EditorUi.EditorUi.getEmbeddedSvg has cyclomatic complexity 25 (threshold 15). Of this number, 13 points are the body's own statements and 12 belong to 4 function literals 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.installSettings (cyclomatic 25) src/main/webapp/js/diagramly/EditorUi.js:28009— EditorUi.EditorUi.installSettings has cyclomatic complexity 25 (threshold 15). Of this number, 21 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.pasteXml (cyclomatic 25) src/main/webapp/js/diagramly/EditorUi.js:28576— EditorUi.EditorUi.pasteXml 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
ElectronApp.LocalFile.saveFile (cyclomatic 25) src/main/webapp/js/diagramly/ElectronApp.js:2019— ElectronApp.LocalFile.saveFile has cyclomatic complexity 25 (threshold 15). Of this number, 14 points are the body's own statements and 11 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.
LibavoidRouting.LibavoidRouting.edgeRouteBounds (cyclomatic 25) src/main/webapp/js/diagramly/LibavoidRouting.js:2813— LibavoidRouting.LibavoidRouting.edgeRouteBounds has cyclomatic complexity 25 (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.
LightboxModern.LightboxModern.createToggleGroup (cyclomatic 25) src/main/webapp/js/diagramly/LightboxModern.js:211— LightboxModern.LightboxModern.createToggleGroup has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 3 of the 25 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 282, setIndex, choose, …). 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.
Pages.EditorUi.updateDiagramData (cyclomatic 25) src/main/webapp/js/diagramly/Pages.js:2076— Pages.EditorUi.updateDiagramData has cyclomatic complexity 25 (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.
ViewerModern.ViewerModern.createControls (cyclomatic 25) src/main/webapp/js/diagramly/ViewerModern.js:1143— ViewerModern.ViewerModern.createControls has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxGraphMlCodec.mxGraphMlCodec.importNode (cyclomatic 25) REDACTED:739— mxGraphMlCodec.mxGraphMlCodec.importNode 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.
mxJsCanvas.mxJsCanvas.text (cyclomatic 25) src/main/webapp/js/diagramly/util/mxJsCanvas.js:638— mxJsCanvas.mxJsCanvas.text 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.
Dialogs.EditDiagramDialog (cyclomatic 25) REDACTED:3062— Dialogs.EditDiagramDialog has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 12 of the 25 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 3217, a function literal at line 3267, handleDrop, …). 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.
Editor.Dialog.installFocusTrap (cyclomatic 25) src/main/webapp/js/grapheditor/Editor.js:2715— Editor.Dialog.installFocusTrap has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 3 of the 25 points are its own statements and the rest belongs to 6 function items inside it that branch (isSameTabStop, a function literal at line 2732, isTab, …). 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.
EditorUi.EditorUi.hideDialog (cyclomatic 25) REDACTED:9873— EditorUi.EditorUi.hideDialog has cyclomatic complexity 25 (threshold 15). Of this number, 15 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Format.StyleFormatPanel.addEditOps (cyclomatic 25) src/main/webapp/js/grapheditor/Format.js:7309— Format.StyleFormatPanel.addEditOps has cyclomatic complexity 25 (threshold 15). Of this number, 18 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Graph.Graph.computeShapeInsideSpacer (cyclomatic 25) REDACTED:7669— Graph.Graph.computeShapeInsideSpacer 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. This shape REPEATS in the file: 2 other methods here (Graph.Graph.computeShapeInsideSpacer::run, Graph.Graph.computeShapeInsideSpacer::run::probe) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Graph.Graph.applyDataStyles (cyclomatic 25) REDACTED:18471— Graph.Graph.applyDataStyles 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.
Graph.mxGraphView.validateCellState (cyclomatic 25) REDACTED:30676— Graph.mxGraphView.validateCellState has cyclomatic complexity 25 (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.
Graph.mxGraphView.getMultiplePerimeterPoint (cyclomatic 25) REDACTED:31020— Graph.mxGraphView.getMultiplePerimeterPoint has cyclomatic complexity 25 (threshold 15). Of this number, 21 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InlineToolbar.InlineToolbar.getOptions (cyclomatic 25) src/main/webapp/js/grapheditor/InlineToolbar.js:5015— InlineToolbar.InlineToolbar.getOptions has cyclomatic complexity 25 (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.
mxGeometry.mxGeometry.equals (cyclomatic 25) src/main/webapp/mxgraph/src/model/mxGeometry.js:407— mxGeometry.mxGeometry.equals has cyclomatic complexity 25 (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.
mxText.mxText.updateBoundingBox (cyclomatic 25) src/main/webapp/mxgraph/src/shape/mxText.js:554— mxText.mxText.updateBoundingBox 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.
mxCellRenderer.mxCellRenderer.resolveColor (cyclomatic 25) src/main/webapp/mxgraph/src/view/mxCellRenderer.js:479— mxCellRenderer.mxCellRenderer.resolveColor 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.
mxCellRenderer.mxCellRenderer.redrawShape (cyclomatic 25) src/main/webapp/mxgraph/src/view/mxCellRenderer.js:1788— mxCellRenderer.mxCellRenderer.redrawShape 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.
mxGraph.mxGraph.processChange (cyclomatic 25) src/main/webapp/mxgraph/src/view/mxGraph.js:2071— mxGraph.mxGraph.processChange 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.
mxGraph.mxGraph.click (cyclomatic 25) src/main/webapp/mxgraph/src/view/mxGraph.js:2644— mxGraph.mxGraph.click has cyclomatic complexity 25 (threshold 15). Of this number, 21 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxGraph.mxGraph.getEdgeValidationError (cyclomatic 25) src/main/webapp/mxgraph/src/view/mxGraph.js:9286— mxGraph.mxGraph.getEdgeValidationError 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.
addMouseWheelListener (cyclomatic 25) src/main/webapp/mxgraph/src/util/mxEvent.js:390— addMouseWheelListener 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 8 function items inside it that branch (wheelHandler, a function literal at line 487, a function literal at line 474, …). 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.
App.App.sanityCheck (cyclomatic 24) src/main/webapp/js/diagramly/App.js:2519— App.App.sanityCheck has cyclomatic complexity 24 (threshold 15). Of this number, 22 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
App.App.checkReleaseChannel (cyclomatic 24) src/main/webapp/js/diagramly/App.js:2796— App.App.checkReleaseChannel has cyclomatic complexity 24 (threshold 15). Of this number, 17 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
App.App.exportFile (cyclomatic 24) src/main/webapp/js/diagramly/App.js:8664— App.App.exportFile 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.
Dialogs.CustomActionDialog (cyclomatic 24) src/main/webapp/js/diagramly/Dialogs.js:8082— Dialogs.CustomActionDialog has cyclomatic complexity 24 (threshold 15). Of this number, 21 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DriveClient.DriveClient.pickDiagrams (cyclomatic 24) src/main/webapp/js/diagramly/DriveClient.js:1650— DriveClient.DriveClient.pickDiagrams has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 5 of the 24 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1663, 1752, 1738). 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.
EditorUi.EditorUi.replaceFileData (cyclomatic 24) src/main/webapp/js/diagramly/EditorUi.js:2875— EditorUi.EditorUi.replaceFileData 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.createFormatWindow (cyclomatic 24) src/main/webapp/js/diagramly/EditorUi.js:26727— EditorUi.EditorUi.createFormatWindow has cyclomatic complexity 24 (threshold 15). Of this number, 15 points are the body's own statements and 9 belong to 4 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.createContainerChildLayout (cyclomatic 24) src/main/webapp/js/diagramly/EditorUi.js:31886— EditorUi.EditorUi.createContainerChildLayout 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
Extensions.LucidImporter.importState (cyclomatic 24) REDACTED:7300— Extensions.LucidImporter.importState has cyclomatic complexity 24 (threshold 15). Of this number, 16 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Extensions.addStyle (cyclomatic 26) 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.
LibavoidRouting.LibavoidRouting.getLabelBox (cyclomatic 24) src/main/webapp/js/diagramly/LibavoidRouting.js:2671— LibavoidRouting.LibavoidRouting.getLabelBox 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.
LocalFile.LocalFile.saveFile (cyclomatic 24) src/main/webapp/js/diagramly/LocalFile.js:157— LocalFile.LocalFile.saveFile has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 5 of the 24 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 326, 174, 172, …). 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.
emf-svg.emitTextOut (cyclomatic 24) src/main/webapp/js/diagramly/emf/emf-svg.js:2877— emf-svg.emitTextOut 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.
Sidebar.Sidebar.showEntries (cyclomatic 24) src/main/webapp/js/diagramly/sidebar/Sidebar.js:372— Sidebar.Sidebar.showEntries 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.
Tidy.Tidy.classify (cyclomatic 24) src/main/webapp/js/diagramly/tidy/Tidy.js:620— Tidy.Tidy.classify 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.
Dialogs.TextareaDialog (cyclomatic 24) REDACTED:2404— Dialogs.TextareaDialog has cyclomatic complexity 24 (threshold 15). Of this number, 19 points are the body's own statements and 5 belong to 4 function literals 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.
EditorUi.EditorUi.createZoomInput (cyclomatic 24) REDACTED:11869— EditorUi.EditorUi.createZoomInput has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 3 of the 24 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 11962, 11892, 11912, …). 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.
Graph.Graph.getBorderContainer (cyclomatic 24) REDACTED:20055— Graph.Graph.getBorderContainer 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.
Graph.Graph.getTooltipForCell (cyclomatic 24) REDACTED:22474— Graph.Graph.getTooltipForCell has cyclomatic complexity 24 (threshold 15). Of this number, 22 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Graph.mxGraphView.updateAutoLabelPlacements (cyclomatic 24) REDACTED:30328— Graph.mxGraphView.updateAutoLabelPlacements 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.
Graph.mxConnector.paintLine (cyclomatic 24) REDACTED:32335— Graph.mxConnector.paintLine 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.
Graph.mxEdgeStyle.TopToBottom (cyclomatic 24) REDACTED:32776— Graph.mxEdgeStyle.TopToBottom 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.
Sidebar.Sidebar.getClosestKeys (cyclomatic 24) src/main/webapp/js/grapheditor/Sidebar.js:1426— Sidebar.Sidebar.getClosestKeys has cyclomatic complexity 24 (threshold 15). Of this number, 22 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
mxVertexHandler.mxVertexHandler.resizeVertex (cyclomatic 24) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:1029— mxVertexHandler.mxVertexHandler.resizeVertex 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.
mxDragSource.mxDragSource.dragOver (cyclomatic 24) src/main/webapp/mxgraph/src/util/mxDragSource.js:654— mxDragSource.mxDragSource.dragOver 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.
mxGraph.mxGraph.cellSizeUpdated (cyclomatic 24) src/main/webapp/mxgraph/src/view/mxGraph.js:5878— mxGraph.mxGraph.cellSizeUpdated 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.
mxBasic.mxShapeBasicArc.paintVertexShape (cyclomatic 24) src/main/webapp/shapes/mxBasic.js:2642— mxBasic.mxShapeBasicArc.paintVertexShape 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.
mxBasic.createPolygonHandles (cyclomatic 24) src/main/webapp/shapes/mxBasic.js:3435— mxBasic.createPolygonHandles has cyclomatic complexity 24 (threshold 15). Of this number, 12 points are the body's own statements and 12 belong to 5 function items inside it that branch. 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.
ExportProxyServlet.doRequest (cyclomatic 24) REDACTED:49— ExportProxyServlet.doRequest 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.
(anonymous) (cyclomatic 24) REDACTED:3523— (anonymous) has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to 11 function items inside it that branch (addFromCell, findToPart, mxVsdxConnect, …). 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.
getSizeForString (cyclomatic 24) src/main/webapp/mxgraph/src/util/mxUtils.js:5135— getSizeForString 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.
TopToBottom (cyclomatic 24) src/main/webapp/mxgraph/src/view/mxEdgeStyle.js:497— TopToBottom 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.
mxFreehand::stopDrawing (cyclomatic 24) src/main/webapp/js/diagramly/mxFreehand.js:236— mxFreehand::stopDrawing 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.
parse (cyclomatic 24) src/main/webapp/js/diagramly/Settings.js:416— parse 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.
App.App.showNotification (cyclomatic 23) src/main/webapp/js/diagramly/App.js:8210— App.App.showNotification has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 10 of the 23 points are its own statements and the rest belongs to 4 function items inside it that branch (shouldAnimate, a function literal at line 8360, a function literal at line 8255, …). 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.
App.App.save (cyclomatic 23) src/main/webapp/js/diagramly/App.js:8401— App.App.save has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 5 of the 23 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 8421, 8429, 8407, …). 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.
App.App.updateHeader (cyclomatic 23) src/main/webapp/js/diagramly/App.js:9088— App.App.updateHeader has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 10 of the 23 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 9107, 9140, 9175, …). 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.
Dialogs.StyleRulesDialog.createLegend (cyclomatic 23) src/main/webapp/js/diagramly/Dialogs.js:22624— Dialogs.StyleRulesDialog.createLegend 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.
DrawioFile.DrawioFile.addUnsavedStatus (cyclomatic 23) REDACTED:3256— DrawioFile.DrawioFile.addUnsavedStatus has cyclomatic complexity 23 (threshold 15). Of this number, 14 points are the body's own statements and 9 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DrawioFileSync.DrawioFileSync.patchRealtime (cyclomatic 23) src/main/webapp/js/diagramly/DrawioFileSync.js:2240— DrawioFileSync.DrawioFileSync.patchRealtime 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.
DrawioFileSync.DrawioFileSync.getPageIdForChange (cyclomatic 23) src/main/webapp/js/diagramly/DrawioFileSync.js:2555— DrawioFileSync.DrawioFileSync.getPageIdForChange 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.
DrawioFileSync.DrawioFileSync.sendLocalChanges (cyclomatic 23) src/main/webapp/js/diagramly/DrawioFileSync.js:3042— DrawioFileSync.DrawioFileSync.sendLocalChanges 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.
DriveFile.DriveFile.saveFile (cyclomatic 23) src/main/webapp/js/diagramly/DriveFile.js:165— DriveFile.DriveFile.saveFile has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 8 of the 23 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 195, 263, 184, …). 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.
Editor.Editor.setGraphXml (cyclomatic 23) src/main/webapp/js/diagramly/Editor.js:5098— Editor.Editor.setGraphXml 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.
Editor.Editor.embedCssFonts (cyclomatic 23) src/main/webapp/js/diagramly/Editor.js:7108— Editor.Editor.embedCssFonts has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 5 of the 23 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 7153, 7119, 7193). 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.
Editor.Graph.getSvg (cyclomatic 23) src/main/webapp/js/diagramly/Editor.js:11732— Editor.Graph.getSvg 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.
EditorUi.EditorUi.doSaveLocalFile (cyclomatic 23) src/main/webapp/js/diagramly/EditorUi.js:8751— EditorUi.EditorUi.doSaveLocalFile 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.saveLocalFile (cyclomatic 23) src/main/webapp/js/diagramly/EditorUi.js:8860— EditorUi.EditorUi.saveLocalFile has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 9 of the 23 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 8867, 8906). 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: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.windowResized (cyclomatic 23) src/main/webapp/js/diagramly/EditorUi.js:24673— EditorUi.EditorUi.windowResized 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.openLocalFile (cyclomatic 23) src/main/webapp/js/diagramly/EditorUi.js:30960— EditorUi.EditorUi.openLocalFile has cyclomatic complexity 23 (threshold 15). Of this number, 15 points are the body's own statements and 8 belong to 2 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
ElectronApp.EditorUi.saveData (cyclomatic 23) src/main/webapp/js/diagramly/ElectronApp.js:2907— ElectronApp.EditorUi.saveData has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 6 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 2918). 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.
ElkLayout.ElkLayoutBindings.runWithDialog::collect (cyclomatic 23) src/main/webapp/js/diagramly/ElkLayout.js:640— ElkLayout.ElkLayoutBindings.runWithDialog::collect 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. This shape REPEATS in the file: one other method here (ElkLayout.ElkLayoutBindings.runWithDialog) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Extensions.getFontStyleString (cyclomatic 23) REDACTED:5060— Extensions.getFontStyleString 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. This is NOT this file's highest cyclomatic complexity: Extensions.addStyle (cyclomatic 26) 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.
ForceExplorer.ForceExplorer.keyDown (cyclomatic 23) src/main/webapp/js/diagramly/ForceExplorer.js:1150— ForceExplorer.ForceExplorer.keyDown has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
GitHubClient.GitHubClient.executeRequest (cyclomatic 23) src/main/webapp/js/diagramly/GitHubClient.js:313— GitHubClient.GitHubClient.executeRequest has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 327, 422, 433). 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.
GraphViewer.GraphViewer.addClickHandler (cyclomatic 23) REDACTED:2543— GraphViewer.GraphViewer.addClickHandler has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 2547, 2589). 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.
ViewerModern.GraphViewer.getDiagramLanguages (cyclomatic 23) src/main/webapp/js/diagramly/ViewerModern.js:416— ViewerModern.GraphViewer.getDiagramLanguages has cyclomatic complexity 23 (threshold 15). Of this number, 21 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TidyStyle.Tidy.getPalettes (cyclomatic 23) src/main/webapp/js/diagramly/tidy/TidyStyle.js:259— TidyStyle.Tidy.getPalettes has cyclomatic complexity 23 (threshold 15). Of this number, 19 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TidyStyle.Tidy.keepFixedRoleColors (cyclomatic 23) src/main/webapp/js/diagramly/tidy/TidyStyle.js:829— TidyStyle.Tidy.keepFixedRoleColors 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.
TidyStyle.Tidy.styleMindmap (cyclomatic 23) src/main/webapp/js/diagramly/tidy/TidyStyle.js:1145— TidyStyle.Tidy.styleMindmap has cyclomatic complexity 23 (threshold 15). Of this number, 20 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Editor.PageSetupDialog::applyFn (cyclomatic 23) src/main/webapp/js/grapheditor/Editor.js:3959— Editor.PageSetupDialog::applyFn has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (Editor.PageSetupDialog) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
EditorUi.EditorUi.installResizeHandler (cyclomatic 23) REDACTED:8585— EditorUi.EditorUi.installResizeHandler has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 10 of the 23 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 8589, 8616, 8658). 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.
Graph.Graph.renameSvgPageIds (cyclomatic 23) REDACTED:2634— Graph.Graph.renameSvgPageIds has cyclomatic complexity 23 (threshold 15). Of this number, 16 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.mayIntersect (cyclomatic 23) REDACTED:12011— Graph.Graph.mayIntersect 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.getCellDescription (cyclomatic 23) REDACTED:22857— Graph.Graph.getCellDescription 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
InlineToolbar.InlineToolbar.showLineEndMenu (cyclomatic 23) src/main/webapp/js/grapheditor/InlineToolbar.js:3195— InlineToolbar.InlineToolbar.showLineEndMenu has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 3306, 3221, 3386, …). 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.
Sidebar.Sidebar.createItem (cyclomatic 23) src/main/webapp/js/grapheditor/Sidebar.js:5244— Sidebar.Sidebar.createItem has cyclomatic complexity 23 (threshold 15). Of this number, 21 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Sidebar.Sidebar.addFoldingHandler (cyclomatic 23) src/main/webapp/js/grapheditor/Sidebar.js:7723— Sidebar.Sidebar.addFoldingHandler has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 5 of the 23 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 7735, 7830, 7775). 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.
libavoid-routing.AvoidRouting.jettyStub (cyclomatic 23) src/main/webapp/js/libavoid-js/libavoid-routing.js:178— libavoid-routing.AvoidRouting.jettyStub 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.
mxEdgeHandler.mxEdgeHandler.getHandleForEvent (cyclomatic 23) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:847— mxEdgeHandler.mxEdgeHandler.getHandleForEvent has cyclomatic complexity 23 (threshold 15). Of this number, 18 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxEdgeSegmentHandler.mxEdgeSegmentHandler.updatePreviewState (cyclomatic 23) src/main/webapp/mxgraph/src/handler/mxEdgeSegmentHandler.js:118— mxEdgeSegmentHandler.mxEdgeSegmentHandler.updatePreviewState 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.
mxGraphHandler.mxGraphHandler.mouseUp (cyclomatic 23) src/main/webapp/mxgraph/src/handler/mxGraphHandler.js:1880— mxGraphHandler.mxGraphHandler.mouseUp 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.
mxCellEditor.mxCellEditor.installListeners (cyclomatic 23) src/main/webapp/mxgraph/src/view/mxCellEditor.js:352— mxCellEditor.mxCellEditor.installListeners has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 1 of the 23 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 396, 431, 463, …). 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.
mxGraphView.mxGraphView.getChangedGraphBounds (cyclomatic 23) src/main/webapp/mxgraph/src/view/mxGraphView.js:2055— mxGraphView.mxGraphView.getChangedGraphBounds has cyclomatic complexity 23 (threshold 15). Of this number, 20 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
trees.Draw.loadPlugin() (cyclomatic 23) src/main/webapp/plugins/trees/trees.js:14— trees.Draw.loadPlugin() 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. This shape REPEATS in the file: 2 other methods here (trees.Draw.loadPlugin()::addSibling, trees.Draw.loadPlugin()::selectCell) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
sortCells (cyclomatic 23) src/main/webapp/mxgraph/src/util/mxUtils.js:4324— sortCells has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 8 of the 23 points are its own statements and the rest belongs to 4 function items inside it that branch (getNode, getIndex, a function literal at line 4455, …). 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.
isTextShapeInvalid (cyclomatic 23) src/main/webapp/mxgraph/src/view/mxCellRenderer.js:1242— isTextShapeInvalid has cyclomatic complexity 23 (threshold 15). Of this number, 17 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
P2PCollab::joinFile::messageListener (cyclomatic 23) src/main/webapp/js/diagramly/P2PCollab.js:1277— P2PCollab::joinFile::messageListener has cyclomatic complexity 23 (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.
Dialogs.AnimationDialog (cyclomatic 22) src/main/webapp/js/diagramly/Dialogs.js:14088— Dialogs.AnimationDialog 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. This shape REPEATS in the file: 5 other methods here (Dialogs.AnimationDialog::loadFromContext, Dialogs.AnimationDialog::formatSelectorText, Dialogs.AnimationDialog::renderStepField, …) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 6 times rather than 6 independent problems. Splitting this body alone leaves the other 5 exactly as they are. Where these are variations on one operation, the change that clears all 6 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DrawioFile.DrawioFile.handleFileError (cyclomatic 22) REDACTED:3680— DrawioFile.DrawioFile.handleFileError has cyclomatic complexity 22 (threshold 15). Of this number, 15 points are the body's own statements and 7 belong to 2 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.
DrawioFileSync.DrawioFileSync.cleanup (cyclomatic 22) src/main/webapp/js/diagramly/DrawioFileSync.js:1573— DrawioFileSync.DrawioFileSync.cleanup 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.
DrawioFileSync.DrawioFileSync.sanitizePageTerminals (cyclomatic 22) src/main/webapp/js/diagramly/DrawioFileSync.js:2831— DrawioFileSync.DrawioFileSync.sanitizePageTerminals has cyclomatic complexity 22 (threshold 15). Of this number, 19 points are the body's own statements and 3 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.
Editor.RoughCanvas.getStyle (cyclomatic 22) src/main/webapp/js/diagramly/Editor.js:2215— Editor.RoughCanvas.getStyle has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Editor.ChangePageSetup.execute (cyclomatic 22) src/main/webapp/js/diagramly/Editor.js:15322— Editor.ChangePageSetup.execute 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.
EditorUi.EditorUi.getFileData (cyclomatic 22) src/main/webapp/js/diagramly/EditorUi.js:3673— EditorUi.EditorUi.getFileData has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.mergeMermaidStyleDelta (cyclomatic 22) src/main/webapp/js/diagramly/EditorUi.js:15151— EditorUi.EditorUi.mergeMermaidStyleDelta has cyclomatic complexity 22 (threshold 15). Of this number, 16 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.updateDefaultStyles (cyclomatic 22) src/main/webapp/js/diagramly/EditorUi.js:27719— EditorUi.EditorUi.updateDefaultStyles 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.readGraphModelFromHtmlClipboardData (cyclomatic 22) src/main/webapp/js/diagramly/EditorUi.js:29589— EditorUi.EditorUi.readGraphModelFromHtmlClipboardData has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to one function literal inside it that branches (line 29591). 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: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
HomeDialog.HomeDialog.render (cyclomatic 22) src/main/webapp/js/diagramly/HomeDialog.js:500— HomeDialog.HomeDialog.render has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
LayoutPicker.EditorUi.getSuggestedLayout (cyclomatic 22) src/main/webapp/js/diagramly/LayoutPicker.js:524— LayoutPicker.EditorUi.getSuggestedLayout 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.
OneDriveClient.OneDriveClient.authenticateStep2 (cyclomatic 22) src/main/webapp/js/diagramly/OneDriveClient.js:339— OneDriveClient.OneDriveClient.authenticateStep2 has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 2 of the 22 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 356, 426, 399, …). 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.
OneDriveFile.OneDriveFile.saveFile (cyclomatic 22) src/main/webapp/js/diagramly/OneDriveFile.js:609— OneDriveFile.OneDriveFile.saveFile has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 6 of the 22 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 622, 659, 638, …). 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.
Pages.Graph.createViewState (cyclomatic 22) src/main/webapp/js/diagramly/Pages.js:1601— Pages.Graph.createViewState has cyclomatic complexity 22 (threshold 15). Of this number, 13 points are the body's own statements and 9 belong to 3 function literals 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.
AnimatedExport.AnimatedGifExport.findAnimatedPaths (cyclomatic 22) src/main/webapp/js/diagramly/gif/AnimatedExport.js:254— AnimatedExport.AnimatedGifExport.findAnimatedPaths 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.
AnimationExport.AnimationExport.createSegment (cyclomatic 22) src/main/webapp/js/diagramly/gif/AnimationExport.js:1189— AnimationExport.AnimationExport.createSegment has cyclomatic complexity 22 (threshold 15). Of this number, 15 points are the body's own statements and 7 belong to 2 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.
mxGraphMlCodec.mxGraphMlCodec.importEdge (cyclomatic 22) REDACTED:2050— mxGraphMlCodec.mxGraphMlCodec.importEdge 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.
mxGraphMlCodec.mxGraphMlCodec.addEdgeStyle (cyclomatic 22) REDACTED:2310— mxGraphMlCodec.mxGraphMlCodec.addEdgeStyle has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 7 function items inside it that branch (dashStyleFn, desktopLineStyleFn, endArrowFill, …). 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.
TidyStyle.Tidy.styleTheme (cyclomatic 22) src/main/webapp/js/diagramly/tidy/TidyStyle.js:1599— TidyStyle.Tidy.styleTheme 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.
TidyStyle.Tidy.prepareStyle (cyclomatic 22) src/main/webapp/js/diagramly/tidy/TidyStyle.js:2013— TidyStyle.Tidy.prepareStyle has cyclomatic complexity 22 (threshold 15). Of this number, 13 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.getPaletteStyle (cyclomatic 22) REDACTED:3356— EditorUi.EditorUi.getPaletteStyle has cyclomatic complexity 22 (threshold 15). Of this number, 16 points are the body's own statements and 6 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.selectCellInDirection (cyclomatic 22) REDACTED:4648— EditorUi.EditorUi.selectCellInDirection has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 7 of the 22 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 4685, bounds, depth). 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.
Format.BaseFormatPanel.createStepper (cyclomatic 22) src/main/webapp/js/grapheditor/Format.js:1160— Format.BaseFormatPanel.createStepper has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 3 of the 22 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 1237, changeValue, a function literal at line 1262, …). 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.
Format.ArrangePanel.addGroupPadding (cyclomatic 22) src/main/webapp/js/grapheditor/Format.js:3969— Format.ArrangePanel.addGroupPadding has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 7 of the 22 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 4020, a function literal at line 3997, isUniform). 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.
Graph.Graph.isStyleAllowed::isTokenAllowed (cyclomatic 22) REDACTED:4954— Graph.Graph.isStyleAllowed::isTokenAllowed 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.initTransparentBoundsStyleSync (cyclomatic 22) REDACTED:9075— Graph.Graph.initTransparentBoundsStyleSync has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to one function literal inside it that branches (line 9077). 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: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.getSequenceMessageRow (cyclomatic 22) REDACTED:10742— Graph.Graph.getSequenceMessageRow has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 5 of the 22 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 10758, 10753). 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: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.elkConfigToOptions (cyclomatic 22) REDACTED:14874— Graph.Graph.elkConfigToOptions has cyclomatic complexity 22 (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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.paintTableCellLines (cyclomatic 22) REDACTED:25343— Graph.Graph.paintTableCellLines has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.mxCellRenderer.getPaintedLabelBox (cyclomatic 22) REDACTED:28522— Graph.mxCellRenderer.getPaintedLabelBox has cyclomatic complexity 22 (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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.mxEdgeStyle.SideToSide (cyclomatic 22) REDACTED:32686— Graph.mxEdgeStyle.SideToSide 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Omnibox.Omnibox.getResults (cyclomatic 22) src/main/webapp/js/grapheditor/Omnibox.js:2316— Omnibox.Omnibox.getResults has cyclomatic complexity 22 (threshold 15). Of this number, 19 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Shapes.mxShapeBasicRect2.moveNWInner (cyclomatic 22) src/main/webapp/js/grapheditor/Shapes.js:7401— Shapes.mxShapeBasicRect2.moveNWInner has cyclomatic complexity 22 (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. This shape REPEATS in the file: one other method here (Shapes.mxShapeBasicRect2.lineNWInner) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.lineNWInner (cyclomatic 22) src/main/webapp/js/grapheditor/Shapes.js:7431— Shapes.mxShapeBasicRect2.lineNWInner has cyclomatic complexity 22 (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. This shape REPEATS in the file: one other method here (Shapes.mxShapeBasicRect2.moveNWInner) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxGraphHandler.mxGraphHandler.moveCells (cyclomatic 22) src/main/webapp/mxgraph/src/handler/mxGraphHandler.js:2010— mxGraphHandler.mxGraphHandler.moveCells 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.
mxSwimlane.mxSwimlane.paintSwimlane (cyclomatic 22) src/main/webapp/mxgraph/src/shape/mxSwimlane.js:432— mxSwimlane.mxSwimlane.paintSwimlane 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. This shape REPEATS in the file: one other method here (mxSwimlane.mxSwimlane.paintRoundedSwimlane) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxSwimlane.mxSwimlane.paintRoundedSwimlane (cyclomatic 22) src/main/webapp/mxgraph/src/shape/mxSwimlane.js:564— mxSwimlane.mxSwimlane.paintRoundedSwimlane 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. This shape REPEATS in the file: one other method here (mxSwimlane.mxSwimlane.paintSwimlane) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxSvgCanvas2D.mxSvgCanvas2D.wrapSvgBlockElements (cyclomatic 22) REDACTED:3215— mxSvgCanvas2D.mxSvgCanvas2D.wrapSvgBlockElements 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.
mxGraph.mxGraph.getEdges (cyclomatic 22) src/main/webapp/mxgraph/src/view/mxGraph.js:12915— mxGraph.mxGraph.getEdges 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.
mxPrintPreview.mxPrintPreview.addGraphFragment (cyclomatic 22) src/main/webapp/mxgraph/src/view/mxPrintPreview.js:963— mxPrintPreview.mxPrintPreview.addGraphFragment has cyclomatic complexity 22 (threshold 15). Of this number, 16 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
getPrettyXml (cyclomatic 22) src/main/webapp/mxgraph/src/util/mxUtils.js:1282— getPrettyXml 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.
SideToSide (cyclomatic 22) src/main/webapp/mxgraph/src/view/mxEdgeStyle.js:405— SideToSide 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.
mxPanningManager::panTo (cyclomatic 22) src/main/webapp/mxgraph/src/util/mxPanningManager.js:100— mxPanningManager::panTo has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
mxReader.DrawioViewer.init (cyclomatic 21) src/main/webapp/connect/common/js/mxReader.js:181— mxReader.DrawioViewer.init has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 7 of the 21 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 254, 363, 234, …). 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.
App.App.loadTemplate (cyclomatic 21) src/main/webapp/js/diagramly/App.js:6513— App.App.loadTemplate has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 7 of the 21 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 6529, 6558). 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.
App.App.fetchAndShowNotification (cyclomatic 21) src/main/webapp/js/diagramly/App.js:8126— App.App.fetchAndShowNotification has cyclomatic complexity 21 (threshold 15). Of this number, 11 points are the body's own statements and 10 belong to 3 function literals inside it that branch. 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.
ConfigEditor.DrawioConfigEditor.install.importConfig (cyclomatic 21) src/main/webapp/js/diagramly/ConfigEditor.js:1178— ConfigEditor.DrawioConfigEditor.install.importConfig has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 1187). 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.
Dialogs.PolygonDialog (cyclomatic 21) src/main/webapp/js/diagramly/Dialogs.js:25702— Dialogs.PolygonDialog 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. This shape REPEATS in the file: one other method here (Dialogs.PolygonDialog::renderPolygon) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DrawioFileSync.DrawioFileSync.getPendingPageUpdates (cyclomatic 21) src/main/webapp/js/diagramly/DrawioFileSync.js:2162— DrawioFileSync.DrawioFileSync.getPendingPageUpdates has cyclomatic complexity 21 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
EditorUi.EditorUi.getHtml (cyclomatic 21) src/main/webapp/js/diagramly/EditorUi.js:3750— EditorUi.EditorUi.getHtml has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.loadDescriptor (cyclomatic 21) src/main/webapp/js/diagramly/EditorUi.js:4774— EditorUi.EditorUi.loadDescriptor 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 4778, 4847, 4827, …). 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: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.showSearchWindow (cyclomatic 21) src/main/webapp/js/diagramly/EditorUi.js:6093— EditorUi.EditorUi.showSearchWindow 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.isSelfContainedSvg (cyclomatic 21) src/main/webapp/js/diagramly/EditorUi.js:20669— EditorUi.EditorUi.isSelfContainedSvg has cyclomatic complexity 21 (threshold 15). Of this number, 16 points are the body's own statements and 5 belong to 2 function items inside it that branch. 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.mxChildChange.execute::collect (cyclomatic 21) src/main/webapp/js/diagramly/EditorUi.js:22347— EditorUi.mxChildChange.execute::collect 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. This shape REPEATS in the file: one other method here (EditorUi.mxChildChange.execute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.placeRestoredEdgeLabels (cyclomatic 21) src/main/webapp/js/diagramly/EditorUi.js:28993— EditorUi.EditorUi.placeRestoredEdgeLabels 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.installKeyboardShortcut (cyclomatic 21) src/main/webapp/js/diagramly/EditorUi.js:32289— EditorUi.EditorUi.installKeyboardShortcut has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
LayoutPicker.EditorUi.showLayoutPicker (cyclomatic 21) src/main/webapp/js/diagramly/LayoutPicker.js:3370— LayoutPicker.EditorUi.showLayoutPicker has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 3542, a function literal at line 3437, a function literal at line 3429, …). 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.
SpringMove.SpringMove.render (cyclomatic 21) src/main/webapp/js/diagramly/SpringMove.js:1216— SpringMove.SpringMove.render has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
TrelloClient.TrelloClient.getFile (cyclomatic 21) REDACTED:112— TrelloClient.TrelloClient.getFile has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 128, 158, 211, …). 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.
AnimatedExport.AnimatedGifExport.renderFrames (cyclomatic 21) src/main/webapp/js/diagramly/gif/AnimatedExport.js:102— AnimatedExport.AnimatedGifExport.renderFrames has cyclomatic complexity 21 (threshold 15). Of this number, 11 points are the body's own statements and 10 belong to 3 function literals 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.
Tidy.Tidy.ops.attachTexts (cyclomatic 21) src/main/webapp/js/diagramly/tidy/Tidy.js:1631— Tidy.Tidy.ops.attachTexts has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Tidy.Tidy.applyChange (cyclomatic 21) src/main/webapp/js/diagramly/tidy/Tidy.js:3335— Tidy.Tidy.applyChange 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.
Editor.Editor.extractGraphModelFromPng (cyclomatic 21) src/main/webapp/js/grapheditor/Editor.js:925— Editor.Editor.extractGraphModelFromPng has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 8 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 936). 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.
EditorUi.EditorUi.isArrowKeyEvent (cyclomatic 21) REDACTED:4410— EditorUi.EditorUi.isArrowKeyEvent has cyclomatic complexity 21 (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.
Format.Format.immediateRefresh (cyclomatic 21) src/main/webapp/js/grapheditor/Format.js:306— Format.Format.immediateRefresh has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 8 of the 21 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 338, 336). 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.
Format.ArrangePanel.addEdgeWaypoints (cyclomatic 21) src/main/webapp/js/grapheditor/Format.js:4592— Format.ArrangePanel.addEdgeWaypoints has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 7 of the 21 points are its own statements and the rest belongs to 4 function items inside it that branch (addUpdate::update, a function literal at line 4712, a function literal at line 4632, …). 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.
Format.TextFormatPanel.getMatchConnectorChanges (cyclomatic 21) src/main/webapp/js/grapheditor/Format.js:4944— Format.TextFormatPanel.getMatchConnectorChanges has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Graph.Graph.isDataSourceColumn (cyclomatic 21) REDACTED:18789— Graph.Graph.isDataSourceColumn has cyclomatic complexity 21 (threshold 15). Of this number, 18 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.foldCells (cyclomatic 21) REDACTED:19851— Graph.Graph.foldCells 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.unbundleCells (cyclomatic 21) REDACTED:20986— Graph.Graph.unbundleCells has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 belong to 2 function items inside it that branch. 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.getTransparentChildBounds (cyclomatic 21) REDACTED:21400— Graph.Graph.getTransparentChildBounds has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Shapes.TableShape.addCollapsedRegionPath (cyclomatic 21) src/main/webapp/js/grapheditor/Shapes.js:447— Shapes.TableShape.addCollapsedRegionPath has cyclomatic complexity 21 (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.
Shapes.TaperedArrowShape.paintTaperedLine (cyclomatic 21) src/main/webapp/js/grapheditor/Shapes.js:7717— Shapes.TaperedArrowShape.paintTaperedLine has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Toolbar.Toolbar.createTextToolbar (cyclomatic 21) src/main/webapp/js/grapheditor/Toolbar.js:165— Toolbar.Toolbar.createTextToolbar has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 11 function literals inside it that branch (lines 325, 286, 339, …). 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.
open.main (cyclomatic 21) src/main/webapp/js/open.js:44— open.main has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 4 of the 21 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 54, 166, 152, …). 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.
mxConnectionHandler.mxConnectionHandler.mouseUp (cyclomatic 21) src/main/webapp/mxgraph/src/handler/mxConnectionHandler.js:1738— mxConnectionHandler.mxConnectionHandler.mouseUp 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.
mxGraphHandler.mxGraphHandler.mouseDown (cyclomatic 21) src/main/webapp/mxgraph/src/handler/mxGraphHandler.js:594— mxGraphHandler.mxGraphHandler.mouseDown 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.
mxText.mxText.updateValue (cyclomatic 21) src/main/webapp/mxgraph/src/shape/mxText.js:1033— mxText.mxText.updateValue 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.
mxPopupMenu.mxPopupMenu.documentKeyDown (cyclomatic 21) src/main/webapp/mxgraph/src/util/mxPopupMenu.js:960— mxPopupMenu.mxPopupMenu.documentKeyDown has cyclomatic complexity 21 (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.
mxCellEditor.mxCellEditor.startEditing (cyclomatic 21) src/main/webapp/mxgraph/src/view/mxCellEditor.js:840— mxCellEditor.mxCellEditor.startEditing has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 10 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 889). 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.
mxCellRenderer.mxCellRenderer.insertStateAfter (cyclomatic 21) src/main/webapp/mxgraph/src/view/mxCellRenderer.js:1666— mxCellRenderer.mxCellRenderer.insertStateAfter 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. This is NOT this file's highest cyclomatic complexity: mxCellRenderer.mxCellRenderer.isTextShapeInvalid (cyclomatic 23) 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.
mxGraph.mxGraph.intersectsEdgeShape (cyclomatic 21) src/main/webapp/mxgraph/src/view/mxGraph.js:12661— mxGraph.mxGraph.intersectsEdgeShape has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxGraphView.mxGraphView.validateCells (cyclomatic 21) src/main/webapp/mxgraph/src/view/mxGraphView.js:1174— mxGraphView.mxGraphView.validateCells has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
createRoughCanvas (cyclomatic 21) src/main/webapp/js/diagramly/Editor.js:2031— createRoughCanvas has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 4 function items inside it that branch (draw, fillSketch, _drawToContext, …). 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.
flexArrow (cyclomatic 21) src/main/webapp/js/grapheditor/Shapes.js:10134— flexArrow 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 8 function literals inside it that branch (lines 10180, 10251, 10149, …). 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.
repairXml (cyclomatic 21) src/main/webapp/mxgraph/src/util/mxUtils.js:1016— repairXml has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 1027). 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.
setStyle (cyclomatic 21) src/main/webapp/mxgraph/src/util/mxUtils.js:4867— setStyle 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.
install.importConfig (cyclomatic 21) src/main/webapp/js/diagramly/ConfigEditor.js:1178— install.importConfig has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1187, 1210, 1222). 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.
Loop (cyclomatic 21) src/main/webapp/mxgraph/src/view/mxEdgeStyle.js:235— Loop 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.
(anonymous) (cyclomatic 21) REDACTED:376— (anonymous) 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.
App.App.pingVersion (cyclomatic 20) src/main/webapp/js/diagramly/App.js:733— App.App.pingVersion 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.
Dialogs.AnimationDialog.getFastForwardSteps (cyclomatic 20) src/main/webapp/js/diagramly/Dialogs.js:17831— Dialogs.AnimationDialog.getFastForwardSteps has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Dialogs.LibraryDialog (cyclomatic 20) src/main/webapp/js/diagramly/Dialogs.js:19852— Dialogs.LibraryDialog 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. This shape REPEATS in the file: one other method here (Dialogs.LibraryDialog::addButton) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.PolygonTool.init (cyclomatic 20) src/main/webapp/js/diagramly/Dialogs.js:27280— Dialogs.PolygonTool.init has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 27290, 27379, 27318, …). 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.
Dialogs.PolygonTool.keyChanged (cyclomatic 20) src/main/webapp/js/diagramly/Dialogs.js:27563— Dialogs.PolygonTool.keyChanged 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.
DiffSync.EditorUi.getJsonForCell (cyclomatic 20) src/main/webapp/js/diagramly/DiffSync.js:2451— DiffSync.EditorUi.getJsonForCell has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DiffSync.EditorUi.diffOwnCellProperties (cyclomatic 20) src/main/webapp/js/diagramly/DiffSync.js:2675— DiffSync.EditorUi.diffOwnCellProperties 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.
DiffSync.EditorUi.isJsonEqual (cyclomatic 20) src/main/webapp/js/diagramly/DiffSync.js:3211— DiffSync.EditorUi.isJsonEqual 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.
DrawioFile.DrawioFile.absorbUnconfirmedRepairs (cyclomatic 20) REDACTED:1274— DrawioFile.DrawioFile.absorbUnconfirmedRepairs has cyclomatic complexity 20 (threshold 15). Of this number, 16 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DrawioFileSync.DrawioFileSync.markLocalChanges (cyclomatic 20) src/main/webapp/js/diagramly/DrawioFileSync.js:2403— DrawioFileSync.DrawioFileSync.markLocalChanges has cyclomatic complexity 20 (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.
DriveClient.DriveClient.getFile (cyclomatic 20) src/main/webapp/js/diagramly/DriveClient.js:1820— DriveClient.DriveClient.getFile has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 1868, checkAnswer). 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.
Editor.Editor.loadUrl (cyclomatic 20) src/main/webapp/js/diagramly/Editor.js:6925— Editor.Editor.loadUrl has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 6936, 6980, 6974). 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: Editor.Editor.createRoughCanvas (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
Editor.Graph.addFont (cyclomatic 20) src/main/webapp/js/diagramly/Editor.js:10723— Editor.Graph.addFont 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. This is NOT this file's highest cyclomatic complexity: Editor.Editor.createRoughCanvas (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
Editor.Graph.getCustomLinkTitle (cyclomatic 20) src/main/webapp/js/diagramly/Editor.js:12039— Editor.Graph.getCustomLinkTitle 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. This is NOT this file's highest cyclomatic complexity: Editor.Editor.createRoughCanvas (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
Editor.Graph.getCellsForTags (cyclomatic 20) src/main/webapp/js/diagramly/Editor.js:14032— Editor.Graph.getCellsForTags 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. This is NOT this file's highest cyclomatic complexity: Editor.Editor.createRoughCanvas (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
EditorUi.EditorUi.startUiLog (cyclomatic 20) src/main/webapp/js/diagramly/EditorUi.js:833— EditorUi.EditorUi.startUiLog has cyclomatic complexity 20 (threshold 15). Of this number, 11 points are the body's own statements and 9 belong to 3 function literals inside it that branch. 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.createExportPresetsRow (cyclomatic 20) src/main/webapp/js/diagramly/EditorUi.js:11632— EditorUi.EditorUi.createExportPresetsRow 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 items inside it that branch (a function literal at line 11697, a function literal at line 11647, a function literal at line 11707, …). 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.createEmbedImage (cyclomatic 20) src/main/webapp/js/diagramly/EditorUi.js:13000— EditorUi.EditorUi.createEmbedImage has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to 3 function items inside it that branch (doUpdate, a function literal at line 13077, a function literal at line 13043). 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.installStatusMinimizer (cyclomatic 20) src/main/webapp/js/diagramly/EditorUi.js:25348— EditorUi.EditorUi.installStatusMinimizer has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 25369, 25353, 25361). 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: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.installImagePasteHandler (cyclomatic 20) src/main/webapp/js/diagramly/EditorUi.js:29414— EditorUi.EditorUi.installImagePasteHandler 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 29418, 29463, 29454, …). 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: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.createLayoutAddSelect (cyclomatic 20) src/main/webapp/js/diagramly/EditorUi.js:34428— EditorUi.EditorUi.createLayoutAddSelect has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 34496). 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: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.parseBoxNames (cyclomatic 20) src/main/webapp/js/diagramly/EditorUi.js:36119— EditorUi.EditorUi.parseBoxNames has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.parseCsvList (cyclomatic 20) src/main/webapp/js/diagramly/EditorUi.js:39512— EditorUi.EditorUi.parseCsvList has cyclomatic complexity 20 (threshold 15). Of this number, 16 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.showRemotelyStoredLibrary (cyclomatic 20) src/main/webapp/js/diagramly/EditorUi.js:42367— EditorUi.EditorUi.showRemotelyStoredLibrary has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 42467, 42406, 42444, …). 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: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
ForceExplorer.ForceExplorer.collideLabels (cyclomatic 20) src/main/webapp/js/diagramly/ForceExplorer.js:3023— ForceExplorer.ForceExplorer.collideLabels has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
HomeDialog.HomeDialog.load (cyclomatic 20) src/main/webapp/js/diagramly/HomeDialog.js:298— HomeDialog.HomeDialog.load has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 339, 355). 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.
LayoutPicker.LayoutPanel.updatePreviewStyles (cyclomatic 20) src/main/webapp/js/diagramly/LayoutPicker.js:2920— LayoutPicker.LayoutPanel.updatePreviewStyles has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to one function item inside it that branches. 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.
LayoutPicker.EditorUi.doShowLayoutSettings (cyclomatic 20) src/main/webapp/js/diagramly/LayoutPicker.js:3601— LayoutPicker.EditorUi.doShowLayoutSettings 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. This shape REPEATS in the file: one other method here (LayoutPicker.EditorUi.doShowLayoutSettings::renderOptions) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
LibavoidRouting.LibavoidRouting.addResizePreviewRoutes (cyclomatic 20) src/main/webapp/js/diagramly/LibavoidRouting.js:4191— LibavoidRouting.LibavoidRouting.addResizePreviewRoutes 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.
Pages.Graph.setViewState (cyclomatic 20) src/main/webapp/js/diagramly/Pages.js:1805— Pages.Graph.setViewState 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.
Pages.EditorUi.moveDraggedTabsOutsideGroups (cyclomatic 20) src/main/webapp/js/diagramly/Pages.js:3775— Pages.EditorUi.moveDraggedTabsOutsideGroups has cyclomatic complexity 20 (threshold 15). Of this number, 16 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SpringMove.SpringMove.init (cyclomatic 20) src/main/webapp/js/diagramly/SpringMove.js:119— SpringMove.SpringMove.init 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.
Tidy.Tidy.isContainment (cyclomatic 20) src/main/webapp/js/diagramly/tidy/Tidy.js:971— Tidy.Tidy.isContainment has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TidyFeatures.TidyFeatures.rank (cyclomatic 20) src/main/webapp/js/diagramly/tidy/TidyFeatures.js:476— TidyFeatures.TidyFeatures.rank has cyclomatic complexity 20 (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.
TidyWindow.TidyWindow.previewStyles (cyclomatic 20) src/main/webapp/js/diagramly/tidy/TidyWindow.js:1206— TidyWindow.TidyWindow.previewStyles 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.
Editor.Dialog (cyclomatic 20) src/main/webapp/js/grapheditor/Editor.js:2220— Editor.Dialog has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
EditorUi.EditorUi.init (cyclomatic 20) REDACTED:1396— EditorUi.EditorUi.init has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1412, 1462, 1442). 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.
Graph.Graph.createShapeInsideMarkup (cyclomatic 20) REDACTED:7364— Graph.Graph.createShapeInsideMarkup has cyclomatic complexity 20 (threshold 15). Of this number, 11 points are the body's own statements and 9 belong to 2 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.measureShapeInsideFlow (cyclomatic 20) REDACTED:7559— Graph.Graph.measureShapeInsideFlow 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.refreshBrowserTranslateMirror (cyclomatic 20) REDACTED:9513— Graph.Graph.refreshBrowserTranslateMirror 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.matchStyleRule (cyclomatic 20) REDACTED:18223— Graph.Graph.matchStyleRule has cyclomatic complexity 20 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.BalloonTreeLayout.getTrees (cyclomatic 20) REDACTED:27480— Graph.BalloonTreeLayout.getTrees has cyclomatic complexity 20 (threshold 15). Of this number, 15 points are the body's own statements and 5 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
InlineToolbar.InlineToolbar.updateButtons (cyclomatic 20) src/main/webapp/js/grapheditor/InlineToolbar.js:706— InlineToolbar.InlineToolbar.updateButtons has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
InlineToolbar.InlineToolbar.showConnStyleMenu (cyclomatic 20) src/main/webapp/js/grapheditor/InlineToolbar.js:3608— InlineToolbar.InlineToolbar.showConnStyleMenu has cyclomatic complexity 20 (threshold 15). Of this number, 15 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
InlineToolbar.InlineToolbar.getTableRange (cyclomatic 20) src/main/webapp/js/grapheditor/InlineToolbar.js:3979— InlineToolbar.InlineToolbar.getTableRange has cyclomatic complexity 20 (threshold 15). Of this number, 18 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Sidebar.Sidebar.matchTermEntries (cyclomatic 20) src/main/webapp/js/grapheditor/Sidebar.js:2440— Sidebar.Sidebar.matchTermEntries 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.
mxVertexHandler.mxVertexHandler.getHandleForEvent (cyclomatic 20) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:541— mxVertexHandler.mxVertexHandler.getHandleForEvent has cyclomatic complexity 20 (threshold 15). Of this number, 14 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxText.mxText.redrawText (cyclomatic 20) src/main/webapp/mxgraph/src/shape/mxText.js:370— mxText.mxText.redrawText 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.
mxSvgCanvas2D.mxSvgCanvas2D.createAlternateContent (cyclomatic 20) REDACTED:602— mxSvgCanvas2D.mxSvgCanvas2D.createAlternateContent 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.
mxGraph.mxGraph.scrollPointToVisible (cyclomatic 20) src/main/webapp/mxgraph/src/view/mxGraph.js:2859— mxGraph.mxGraph.scrollPointToVisible 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.
mxGraph.mxGraph.disconnectGraph (cyclomatic 20) src/main/webapp/mxgraph/src/view/mxGraph.js:7671— mxGraph.mxGraph.disconnectGraph 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.
mxGraph.mxGraph.findTreeRoots (cyclomatic 20) src/main/webapp/mxgraph/src/view/mxGraph.js:13259— mxGraph.mxGraph.findTreeRoots 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.
AbsAuth.contactOAuthServer (cyclomatic 20) src/main/server/java/com/mxgraph/online/AbsAuth.java:493— AbsAuth.contactOAuthServer 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.
App.App.showSplash (cyclomatic 19) src/main/webapp/js/diagramly/App.js:5530— App.App.showSplash has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to 2 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.
ConfigEditor.DrawioConfigEditor.install.populateFields (cyclomatic 19) src/main/webapp/js/diagramly/ConfigEditor.js:1232— ConfigEditor.DrawioConfigEditor.install.populateFields has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to 3 function literals 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.
DrawioFileSync.DrawioFileSync.updateRealtime (cyclomatic 19) src/main/webapp/js/diagramly/DrawioFileSync.js:448— DrawioFileSync.DrawioFileSync.updateRealtime 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.
DrawioFileSync.DrawioFileSync.updateStatus (cyclomatic 19) src/main/webapp/js/diagramly/DrawioFileSync.js:599— DrawioFileSync.DrawioFileSync.updateStatus has cyclomatic complexity 19 (threshold 15). Of this number, 11 points are the body's own statements and 8 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.
DrawioFileSync.DrawioFileSync.handleLegacyMessage (cyclomatic 19) src/main/webapp/js/diagramly/DrawioFileSync.js:3995— DrawioFileSync.DrawioFileSync.handleLegacyMessage has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 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.
Editor.RoughCanvas.limitFill (cyclomatic 19) src/main/webapp/js/diagramly/Editor.js:2355— Editor.RoughCanvas.limitFill 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. This is NOT this file's highest cyclomatic complexity: Editor.Editor.createRoughCanvas (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
Editor.Editor.parseAnimationScript (cyclomatic 19) src/main/webapp/js/diagramly/Editor.js:15440— Editor.Editor.parseAnimationScript has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Editor.Editor.createRoughCanvas (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
EditorUi.EditorUi.anonymizeXml::anonymizeNode (cyclomatic 19) src/main/webapp/js/diagramly/EditorUi.js:3402— EditorUi.EditorUi.anonymizeXml::anonymizeNode has cyclomatic complexity 19 (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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.anonymizePatch (cyclomatic 19) src/main/webapp/js/diagramly/EditorUi.js:3451— EditorUi.EditorUi.anonymizePatch has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.showLanguageDialog (cyclomatic 19) src/main/webapp/js/diagramly/EditorUi.js:7352— EditorUi.EditorUi.showLanguageDialog has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 5 function items inside it that branch (updateLanguageStates, a function literal at line 7424, getSelectedLanguage, …). 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.showRemoteExportDialog (cyclomatic 19) src/main/webapp/js/diagramly/EditorUi.js:11396— EditorUi.EditorUi.showRemoteExportDialog has cyclomatic complexity 19 (threshold 15). Of this number, 11 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.updateMermaidAltText (cyclomatic 19) src/main/webapp/js/diagramly/EditorUi.js:16665— EditorUi.EditorUi.updateMermaidAltText 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.encodeEmbedImage (cyclomatic 19) src/main/webapp/js/diagramly/EditorUi.js:19428— EditorUi.EditorUi.encodeEmbedImage has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 5 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 19467). 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: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
ForceExplorer.ForceExplorer.frame (cyclomatic 19) src/main/webapp/js/diagramly/ForceExplorer.js:3689— ForceExplorer.ForceExplorer.frame has cyclomatic complexity 19 (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.
FusionTheme.SimpleUi.loadScripts (cyclomatic 19) src/main/webapp/js/diagramly/FusionTheme.js:621— FusionTheme.SimpleUi.loadScripts has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Omnibox.Omnibox.getResults (cyclomatic 19) src/main/webapp/js/diagramly/Omnibox.js:124— Omnibox.Omnibox.getResults 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.
AnimatedExport.AnimatedGifExport.doExport (cyclomatic 19) src/main/webapp/js/diagramly/gif/AnimatedExport.js:30— AnimatedExport.AnimatedGifExport.doExport has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Mp4Encoder.Mp4Encoder.createMp4 (cyclomatic 19) src/main/webapp/js/diagramly/gif/Mp4Encoder.js:268— Mp4Encoder.Mp4Encoder.createMp4 has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Tidy.Tidy.getRoutableEdges (cyclomatic 19) src/main/webapp/js/diagramly/tidy/Tidy.js:2201— Tidy.Tidy.getRoutableEdges has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Tidy.Tidy.getEdgesThroughShapes (cyclomatic 19) src/main/webapp/js/diagramly/tidy/Tidy.js:2268— Tidy.Tidy.getEdgesThroughShapes has cyclomatic complexity 19 (threshold 15). Of this number, 13 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.removeUserDefinedDarkColors (cyclomatic 19) REDACTED:1947— EditorUi.EditorUi.removeUserDefinedDarkColors has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to 2 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.
EditorUi.EditorUi.installTypingShim (cyclomatic 19) REDACTED:4871— EditorUi.EditorUi.installTypingShim has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 5 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 4941, 4903, 5028). 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.
Graph.Graph.replaceFontElements (cyclomatic 19) REDACTED:6297— Graph.Graph.replaceFontElements 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.getScaledCellAt (cyclomatic 19) REDACTED:11859— Graph.Graph.getScaledCellAt 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.convertValueToString (cyclomatic 19) REDACTED:17848— Graph.Graph.convertValueToString 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.bundleEdges (cyclomatic 19) REDACTED:20853— Graph.Graph.bundleEdges 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.visitTableCells (cyclomatic 19) REDACTED:25204— Graph.Graph.visitTableCells 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Omnibox.Omnibox.render (cyclomatic 19) src/main/webapp/js/grapheditor/Omnibox.js:2465— Omnibox.Omnibox.render has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Shapes.mxSwimlane.paintVertexShape (cyclomatic 19) src/main/webapp/js/grapheditor/Shapes.js:1018— Shapes.mxSwimlane.paintVertexShape 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.
libavoid-routing.AvoidRouting.computeRoutes (cyclomatic 19) src/main/webapp/js/libavoid-js/libavoid-routing.js:1055— libavoid-routing.AvoidRouting.computeRoutes 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. This shape REPEATS in the file: one other method here (libavoid-routing.AvoidRouting.computeRoutes::solveWith) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxShape.mxShape.paint (cyclomatic 19) src/main/webapp/mxgraph/src/shape/mxShape.js:1094— mxShape.mxShape.paint has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
mxGraph.mxGraph.getDropTarget (cyclomatic 19) src/main/webapp/mxgraph/src/view/mxGraph.js:12003— mxGraph.mxGraph.getDropTarget has cyclomatic complexity 19 (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.
mxBasic.mxShapeBasicPolygon.getConstraints (cyclomatic 19) src/main/webapp/shapes/mxBasic.js:3379— mxBasic.mxShapeBasicPolygon.getConstraints has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to one function item inside it that branches. 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.
mxCisco19.mxShapeCisco19Rect.paintVertexShape (cyclomatic 19) src/main/webapp/shapes/mxCisco19.js:34— mxCisco19.mxShapeCisco19Rect.paintVertexShape has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Utils.isIPv6TransitionAddress (cyclomatic 19) REDACTED:792— Utils.isIPv6TransitionAddress has cyclomatic complexity 19 (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.
equalPoints (cyclomatic 19) src/main/webapp/mxgraph/src/util/mxUtils.js:2755— equalPoints has cyclomatic complexity 19 (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.
zapGremlins (cyclomatic 19) src/main/webapp/mxgraph/src/util/mxUtils.js:3840— zapGremlins 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.
install.populateFields (cyclomatic 19) src/main/webapp/js/diagramly/ConfigEditor.js:1232— install.populateFields has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to 4 function literals 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.
App.App.main::doMain (cyclomatic 18) src/main/webapp/js/diagramly/App.js:1643— App.App.main::doMain 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. This shape REPEATS in the file: one other method here (App.App.main) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
App.App.load (cyclomatic 18) src/main/webapp/js/diagramly/App.js:4079— App.App.load 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.
ConfigEditor.DrawioConfigEditor.install (cyclomatic 18) src/main/webapp/js/diagramly/ConfigEditor.js:48— ConfigEditor.DrawioConfigEditor.install has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to 2 function literals 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.
Dialogs.ChatWindow (cyclomatic 18) src/main/webapp/js/diagramly/Dialogs.js:11644— Dialogs.ChatWindow 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. This shape REPEATS in the file: 2 other methods here (Dialogs.ChatWindow::renderResponseData, Dialogs.ChatWindow::addExchange) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.CustomDialog (cyclomatic 18) src/main/webapp/js/diagramly/Dialogs.js:21195— Dialogs.CustomDialog has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to 3 function literals 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.
DiffSync.EditorUi.createParentLookup (cyclomatic 18) src/main/webapp/js/diagramly/DiffSync.js:1008— DiffSync.EditorUi.createParentLookup has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Editor.Editor.expandSvgPatterns::expandElement (cyclomatic 18) src/main/webapp/js/diagramly/Editor.js:4679— Editor.Editor.expandSvgPatterns::expandElement 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. This is NOT this file's highest cyclomatic complexity: Editor.Editor.createRoughCanvas (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
EditorUi.EditorUi.hashValue (cyclomatic 18) src/main/webapp/js/diagramly/EditorUi.js:5715— EditorUi.EditorUi.hashValue 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.exportImage (cyclomatic 18) src/main/webapp/js/diagramly/EditorUi.js:13836— EditorUi.EditorUi.exportImage has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 13889, 13851, 13904, …). 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: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.importVisio (cyclomatic 18) src/main/webapp/js/diagramly/EditorUi.js:14364— EditorUi.EditorUi.importVisio 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 5 function literals inside it that branch (lines 14393, 14381, 14434, …). 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: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.convertLucidChart (cyclomatic 18) src/main/webapp/js/diagramly/EditorUi.js:14683— EditorUi.EditorUi.convertLucidChart has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 14709, 14699, 14685, …). 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: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.destroyWindows (cyclomatic 18) src/main/webapp/js/diagramly/EditorUi.js:25545— EditorUi.EditorUi.destroyWindows 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
Extensions.addAllStyles (cyclomatic 18) REDACTED:4760— Extensions.addAllStyles 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. This is NOT this file's highest cyclomatic complexity: Extensions.addStyle (cyclomatic 26) 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.
Extensions.normalizeEdge (cyclomatic 18) REDACTED:6971— Extensions.normalizeEdge has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Extensions.addStyle (cyclomatic 26) 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.
ForceExplorer.ForceExplorer.getEndLabelPoint (cyclomatic 18) src/main/webapp/js/diagramly/ForceExplorer.js:2966— ForceExplorer.ForceExplorer.getEndLabelPoint 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.
GitLabClient.GitLabClient.executeRequest (cyclomatic 18) src/main/webapp/js/diagramly/GitLabClient.js:235— GitLabClient.GitLabClient.executeRequest has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 256, 317, 328). 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.
GraphViewer.GraphViewer.showLayers (cyclomatic 18) REDACTED:1761— GraphViewer.GraphViewer.showLayers 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.
LayoutPicker.LayoutPanel.syncPreview (cyclomatic 18) src/main/webapp/js/diagramly/LayoutPicker.js:3028— LayoutPicker.LayoutPanel.syncPreview has cyclomatic complexity 18 (threshold 15). Of this number, 10 points are the body's own statements and 8 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.
LayoutPicker.EditorUi.doShowLayoutSettings::renderOptions (cyclomatic 18) src/main/webapp/js/diagramly/LayoutPicker.js:3789— LayoutPicker.EditorUi.doShowLayoutSettings::renderOptions 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. This shape REPEATS in the file: one other method here (LayoutPicker.EditorUi.doShowLayoutSettings) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
LibavoidRouting.LibavoidRouting.computeRoutes (cyclomatic 18) src/main/webapp/js/diagramly/LibavoidRouting.js:4320— LibavoidRouting.LibavoidRouting.computeRoutes 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.
P2PCollab.P2PCollab (cyclomatic 18) src/main/webapp/js/diagramly/P2PCollab.js:11— P2PCollab.P2PCollab 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. This shape REPEATS in the file: 2 other methods here (P2PCollab.P2PCollab::sendMessage, P2PCollab.P2PCollab::processMsg) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
SpringMove.SpringMove.initStates (cyclomatic 18) src/main/webapp/js/diagramly/SpringMove.js:353— SpringMove.SpringMove.initStates 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.
StorageFile.StorageFile.saveFile (cyclomatic 18) src/main/webapp/js/diagramly/StorageFile.js:298— StorageFile.StorageFile.saveFile has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 344, 331, 314, …). 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.
ViewerModern.ViewerModern.getExportFormats (cyclomatic 18) src/main/webapp/js/diagramly/ViewerModern.js:1429— ViewerModern.ViewerModern.getExportFormats has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
emf-svg.parseEMF (cyclomatic 18) src/main/webapp/js/diagramly/emf/emf-svg.js:826— emf-svg.parseEMF 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.
GifEncoder.GifEncoder.createPalette (cyclomatic 18) src/main/webapp/js/diagramly/gif/GifEncoder.js:537— GifEncoder.GifEncoder.createPalette has cyclomatic complexity 18 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
mxGraphMlCodec.mxGraphMlCodec.dataElem2Obj (cyclomatic 18) REDACTED:423— mxGraphMlCodec.mxGraphMlCodec.dataElem2Obj 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.
Sidebar.Sidebar.searchEntries (cyclomatic 18) src/main/webapp/js/diagramly/sidebar/Sidebar.js:2436— Sidebar.Sidebar.searchEntries has cyclomatic complexity 18 (threshold 15). Of this number, 9 points are the body's own statements and 9 belong to 2 function literals 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.
Tidy.Tidy.ops.resetLabels (cyclomatic 18) src/main/webapp/js/diagramly/tidy/Tidy.js:1785— Tidy.Tidy.ops.resetLabels has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to one function item inside it that branches (reset). 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.
TidyStyle.Tidy.keepRoleColors (cyclomatic 18) src/main/webapp/js/diagramly/tidy/TidyStyle.js:1439— TidyStyle.Tidy.keepRoleColors 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.
TidyWindow.TidyWindow.preview (cyclomatic 18) src/main/webapp/js/diagramly/tidy/TidyWindow.js:1058— TidyWindow.TidyWindow.preview 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.
Editor.FilenameDialog.createFileTypes (cyclomatic 18) src/main/webapp/js/grapheditor/Editor.js:4647— Editor.FilenameDialog.createFileTypes has cyclomatic complexity 18 (threshold 15). Of this number, 9 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
EditorUi.EditorUi.getTabGroups (cyclomatic 18) REDACTED:3967— EditorUi.EditorUi.getTabGroups 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.
EditorUi.EditorUi.createStatusContainer (cyclomatic 18) REDACTED:9222— EditorUi.EditorUi.createStatusContainer 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 2 function literals inside it that branch (lines 9228, 9284). 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.
Format.BaseFormatPanel.createColorOption (cyclomatic 18) src/main/webapp/js/grapheditor/Format.js:1454— Format.BaseFormatPanel.createColorOption 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. This shape REPEATS in the file: one other method here (Format.BaseFormatPanel.createColorOption::apply) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Format.TextFormatPanel.createLabelBackgroundOption (cyclomatic 18) src/main/webapp/js/grapheditor/Format.js:4839— Format.TextFormatPanel.createLabelBackgroundOption has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Format.StyleFormatPanel.init (cyclomatic 18) src/main/webapp/js/grapheditor/Format.js:6919— Format.StyleFormatPanel.init 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.
Graph.Graph.canonicalizeSvgCssRules (cyclomatic 18) REDACTED:6141— Graph.Graph.canonicalizeSvgCssRules 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.getDataStyleValue (cyclomatic 18) REDACTED:18021— Graph.Graph.getDataStyleValue 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.getCellTypeName (cyclomatic 18) REDACTED:22755— Graph.Graph.getCellTypeName 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.LabelBoxIndex.isFree (cyclomatic 18) REDACTED:29706— Graph.LabelBoxIndex.isFree has cyclomatic complexity 18 (threshold 15). Of this number, 9 points are the body's own statements and 9 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Shapes.TableShape.paintStripes (cyclomatic 18) src/main/webapp/js/grapheditor/Shapes.js:320— Shapes.TableShape.paintStripes has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Shapes.mxShapeBasicRect2.moveNEInner (cyclomatic 18) src/main/webapp/js/grapheditor/Shapes.js:7357— Shapes.mxShapeBasicRect2.moveNEInner has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (Shapes.mxShapeBasicRect2.lineNEInner) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.lineNEInner (cyclomatic 18) src/main/webapp/js/grapheditor/Shapes.js:7379— Shapes.mxShapeBasicRect2.lineNEInner has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (Shapes.mxShapeBasicRect2.moveNEInner) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Sidebar.Sidebar.rasterizeSvgDataUri (cyclomatic 18) src/main/webapp/js/grapheditor/Sidebar.js:5050— Sidebar.Sidebar.rasterizeSvgDataUri has cyclomatic complexity 18 (threshold 15). Of this number, 10 points are the body's own statements and 8 belong to 2 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.
libavoid-routing.AvoidRouting.filterEnclosing (cyclomatic 18) src/main/webapp/js/libavoid-js/libavoid-routing.js:278— libavoid-routing.AvoidRouting.filterEnclosing 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.
mxConnectionHandler.mxConnectionHandler.isOutlineConnectEvent (cyclomatic 18) src/main/webapp/mxgraph/src/handler/mxConnectionHandler.js:1040— mxConnectionHandler.mxConnectionHandler.isOutlineConnectEvent has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
mxEdgeHandler.mxEdgeHandler.mouseDown (cyclomatic 18) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:955— mxEdgeHandler.mxEdgeHandler.mouseDown 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. This is NOT this file's highest cyclomatic complexity: mxEdgeHandler.mxEdgeHandler.createMarker (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
mxEdgeHandler.mxEdgeHandler.getPreviewTerminalState (cyclomatic 18) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:1231— mxEdgeHandler.mxEdgeHandler.getPreviewTerminalState 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. This is NOT this file's highest cyclomatic complexity: mxEdgeHandler.mxEdgeHandler.createMarker (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
mxEdgeHandler.mxEdgeHandler.isOutlineConnectEvent (cyclomatic 18) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:1430— mxEdgeHandler.mxEdgeHandler.isOutlineConnectEvent has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: mxEdgeHandler.mxEdgeHandler.createMarker (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
mxTooltipHandler.mxTooltipHandler.reset (cyclomatic 18) src/main/webapp/mxgraph/src/handler/mxTooltipHandler.js:255— mxTooltipHandler.mxTooltipHandler.reset has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
mxVertexHandler.mxVertexHandler.reset (cyclomatic 18) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:1481— mxVertexHandler.mxVertexHandler.reset 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.
mxGraphModel.mxGraphModel.updateEdgeParent (cyclomatic 18) src/main/webapp/mxgraph/src/model/mxGraphModel.js:835— mxGraphModel.mxGraphModel.updateEdgeParent has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
mxShape.mxShape.addPoints (cyclomatic 18) src/main/webapp/mxgraph/src/shape/mxShape.js:1483— mxShape.mxShape.addPoints 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.
mxGraph.mxGraph.isPointNearPolyline (cyclomatic 18) src/main/webapp/mxgraph/src/view/mxGraph.js:12328— mxGraph.mxGraph.isPointNearPolyline 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.
mxGraphView.mxGraphView.invalidate (cyclomatic 18) src/main/webapp/mxgraph/src/view/mxGraphView.js:1032— mxGraphView.mxGraphView.invalidate 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.
props.Draw.loadPlugin() (cyclomatic 18) src/main/webapp/plugins/props.js:8— props.Draw.loadPlugin() has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to 2 function items inside it that branch (cellClicked, extractData). 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.
convertImages::(anonymous)::(anonymous)::processNext::onload (cyclomatic 18) src/main/webapp/js/diagramly/Editor.js:6709— convertImages::(anonymous)::(anonymous)::processNext::onload 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.
typeIntoShapePicker (cyclomatic 18) REDACTED:4784— typeIntoShapePicker has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
extractTextWithWhitespace::doExtract (cyclomatic 18) src/main/webapp/mxgraph/src/util/mxUtils.js:1405— extractTextWithWhitespace::doExtract 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.
getDirectedBounds (cyclomatic 18) src/main/webapp/mxgraph/src/util/mxUtils.js:3320— getDirectedBounds has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
getScrollOrigin (cyclomatic 18) src/main/webapp/mxgraph/src/util/mxUtils.js:3731— getScrollOrigin 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.
showFillMenu::update (cyclomatic 18) src/main/webapp/js/grapheditor/InlineToolbar.js:2829— showFillMenu::update has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
createMarker::getCell (cyclomatic 18) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:571— createMarker::getCell has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
dompurify-smoke.load (cyclomatic 17) etc/dependencies/dompurify-smoke.js:26— dompurify-smoke.load has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 52, 39). 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.
Dialogs.StyleRulesDialog.toObject (cyclomatic 17) src/main/webapp/js/diagramly/Dialogs.js:22516— Dialogs.StyleRulesDialog.toObject 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.
Dialogs.PolygonTool.updatePreview (cyclomatic 17) src/main/webapp/js/diagramly/Dialogs.js:28116— Dialogs.PolygonTool.updatePreview 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.
DrawioFile.DrawioFile.fileSaved (cyclomatic 17) REDACTED:4122— DrawioFile.DrawioFile.fileSaved 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.
DrawioFileSync.DrawioFileSync.isAdditiveOnly (cyclomatic 17) src/main/webapp/js/diagramly/DrawioFileSync.js:1766— DrawioFileSync.DrawioFileSync.isAdditiveOnly 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.
Editor.mxShape.paint (cyclomatic 17) src/main/webapp/js/diagramly/Editor.js:2781— Editor.mxShape.paint has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Editor.Editor.createRoughCanvas (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
Editor.Editor.convertImageToDataUri (cyclomatic 17) src/main/webapp/js/diagramly/Editor.js:6202— Editor.Editor.convertImageToDataUri has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 6229, 6266, 6293, …). 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: Editor.Editor.createRoughCanvas (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
Editor.Editor.convertLegacyAnimationStep (cyclomatic 17) src/main/webapp/js/diagramly/Editor.js:15573— Editor.Editor.convertLegacyAnimationStep 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. This is NOT this file's highest cyclomatic complexity: Editor.Editor.createRoughCanvas (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
EditorUi.EditorUi.isDiagramDataEmpty (cyclomatic 17) src/main/webapp/js/diagramly/EditorUi.js:1183— EditorUi.EditorUi.isDiagramDataEmpty has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.fileStats (cyclomatic 17) src/main/webapp/js/diagramly/EditorUi.js:4083— EditorUi.EditorUi.fileStats 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.showHtmlDialog (cyclomatic 17) src/main/webapp/js/diagramly/EditorUi.js:10835— EditorUi.EditorUi.showHtmlDialog has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 11031, 10970, 11005, …). 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: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.sanitizeExportPreset (cyclomatic 17) src/main/webapp/js/diagramly/EditorUi.js:11512— EditorUi.EditorUi.sanitizeExportPreset has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.getEmbeddedPng (cyclomatic 17) src/main/webapp/js/diagramly/EditorUi.js:13478— EditorUi.EditorUi.getEmbeddedPng has cyclomatic complexity 17 (threshold 15). Of this number, 10 points are the body's own statements and 7 belong to 3 function literals 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.applyMermaidElkPostPass (cyclomatic 17) src/main/webapp/js/diagramly/EditorUi.js:15754— EditorUi.EditorUi.applyMermaidElkPostPass has cyclomatic complexity 17 (threshold 15). Of this number, 11 points are the body's own statements and 6 belong to 2 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.drainRepairParents (cyclomatic 17) src/main/webapp/js/diagramly/EditorUi.js:22528— EditorUi.drainRepairParents 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.createShapesWindow (cyclomatic 17) src/main/webapp/js/diagramly/EditorUi.js:27018— EditorUi.EditorUi.createShapesWindow 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.generateDataSourceCells (cyclomatic 17) src/main/webapp/js/diagramly/EditorUi.js:38437— EditorUi.EditorUi.generateDataSourceCells has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.updateCommentOverlays (cyclomatic 17) src/main/webapp/js/diagramly/EditorUi.js:43735— EditorUi.EditorUi.updateCommentOverlays has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to 2 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
ElkLayout.ElkLayoutBindings.run (cyclomatic 17) src/main/webapp/js/diagramly/ElkLayout.js:54— ElkLayout.ElkLayoutBindings.run has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ForceExplorer.ForceExplorer.updateAnimations (cyclomatic 17) src/main/webapp/js/diagramly/ForceExplorer.js:4018— ForceExplorer.ForceExplorer.updateAnimations 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.
ForceExplorer.ForceExplorer.renderTransform (cyclomatic 17) src/main/webapp/js/diagramly/ForceExplorer.js:4146— ForceExplorer.ForceExplorer.renderTransform has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ForceExplorer.ForceExplorer.flattenPath (cyclomatic 17) src/main/webapp/js/diagramly/ForceExplorer.js:4500— ForceExplorer.ForceExplorer.flattenPath 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.
GraphViewer.GraphViewer.blockedAncestorFrames (cyclomatic 17) REDACTED:3607— GraphViewer.GraphViewer.blockedAncestorFrames has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
LayoutPicker.EditorUi.getLayoutFormConfig (cyclomatic 17) src/main/webapp/js/diagramly/LayoutPicker.js:292— LayoutPicker.EditorUi.getLayoutFormConfig 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.
LibavoidRouting.LibavoidRouting.createLayout (cyclomatic 17) src/main/webapp/js/diagramly/LibavoidRouting.js:220— LibavoidRouting.LibavoidRouting.createLayout has cyclomatic complexity 17 (threshold 15). 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 items inside it that branch (runRouting, a function literal at line 322, runRouting::collect, …). 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.
Pages.EditorUi.initPages (cyclomatic 17) src/main/webapp/js/diagramly/Pages.js:1397— Pages.EditorUi.initPages has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1433, 1421, 1480). 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.
mxGraphMlCodec.mxGraphMlCodec.handleTemplates (cyclomatic 17) REDACTED:1169— mxGraphMlCodec.mxGraphMlCodec.handleTemplates 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.
Sidebar.Sidebar.getMatchingLibraryChips (cyclomatic 17) src/main/webapp/js/diagramly/sidebar/Sidebar.js:2021— Sidebar.Sidebar.getMatchingLibraryChips has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Editor.installMxWindowEdgeResizeHandles (cyclomatic 17) src/main/webapp/js/grapheditor/Editor.js:2600— Editor.installMxWindowEdgeResizeHandles has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 3 function items inside it that branch (addHandle::move, addHandle::down, addHandle::up). 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.
Editor.PageSetupDialog (cyclomatic 17) src/main/webapp/js/grapheditor/Editor.js:3471— Editor.PageSetupDialog 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. This shape REPEATS in the file: one other method here (Editor.PageSetupDialog::applyFn) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Editor.mxGraphHandler.isPropagateSelectionCell (cyclomatic 17) src/main/webapp/js/grapheditor/Editor.js:5333— Editor.mxGraphHandler.isPropagateSelectionCell has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
EditorUi.EditorUi.updateSelectionStateForTableCells (cyclomatic 17) REDACTED:1788— EditorUi.EditorUi.updateSelectionStateForTableCells 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.typeIntoShapePicker (cyclomatic 18) 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.
EditorUi.EditorUi.getPaletteCellsForShapePicker (cyclomatic 17) REDACTED:3149— EditorUi.EditorUi.getPaletteCellsForShapePicker has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.typeIntoShapePicker (cyclomatic 18) 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.
EditorUi.EditorUi.showTypingShim (cyclomatic 17) REDACTED:5083— EditorUi.EditorUi.showTypingShim 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.typeIntoShapePicker (cyclomatic 18) 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.
Format.BaseFormatPanel.createRelativeOption (cyclomatic 17) src/main/webapp/js/grapheditor/Format.js:2121— Format.BaseFormatPanel.createRelativeOption has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 2133, 2193, 2203). 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.
Format.StyleFormatPanel.addSvgVars (cyclomatic 17) src/main/webapp/js/grapheditor/Format.js:7182— Format.StyleFormatPanel.addSvgVars has cyclomatic complexity 17 (threshold 15). Of this number, 9 points are the body's own statements and 8 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Graph.mxImageShape.getImageDataUri (cyclomatic 17) REDACTED:253— Graph.mxImageShape.getImageDataUri 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.removePasteFormatting (cyclomatic 17) REDACTED:4363— Graph.Graph.removePasteFormatting 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.elkOptionsToConfig (cyclomatic 17) REDACTED:15152— Graph.Graph.elkOptionsToConfig 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.getDataSources (cyclomatic 17) REDACTED:18907— Graph.Graph.getDataSources has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.mxGraphView.updateMultipleTerminalPoint (cyclomatic 17) REDACTED:30962— Graph.mxGraphView.updateMultipleTerminalPoint 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.mxStencilRegistry.getStencil (cyclomatic 17) REDACTED:34135— Graph.mxStencilRegistry.getStencil 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
InlineToolbar.InlineToolbar.coversEdge (cyclomatic 17) src/main/webapp/js/grapheditor/InlineToolbar.js:1345— InlineToolbar.InlineToolbar.coversEdge has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: InlineToolbar.InlineToolbar.showFillMenu::update (cyclomatic 18) 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.
InlineToolbar.InlineToolbar.showMarkerSubPanel (cyclomatic 17) src/main/webapp/js/grapheditor/InlineToolbar.js:3432— InlineToolbar.InlineToolbar.showMarkerSubPanel has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 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. This is NOT this file's highest cyclomatic complexity: InlineToolbar.InlineToolbar.showFillMenu::update (cyclomatic 18) 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.
Menus.Menus.pickColor (cyclomatic 17) src/main/webapp/js/grapheditor/Menus.js:1408— Menus.Menus.pickColor 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 5 function literals inside it that branch (lines 1410, 1431, 1454, …). 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.
Omnibox.Omnibox.addActionEntries (cyclomatic 17) src/main/webapp/js/grapheditor/Omnibox.js:1214— Omnibox.Omnibox.addActionEntries 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.
Omnibox.Omnibox.createItem (cyclomatic 17) src/main/webapp/js/grapheditor/Omnibox.js:2574— Omnibox.Omnibox.createItem 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.
Shapes.mxShapeBasicRect2.paintNW (cyclomatic 17) src/main/webapp/js/grapheditor/Shapes.js:6901— Shapes.mxShapeBasicRect2.paintNW has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 3 other methods here (Shapes.mxShapeBasicRect2.paintNE, Shapes.mxShapeBasicRect2.paintSE, Shapes.mxShapeBasicRect2.paintSW) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.paintNE (cyclomatic 17) src/main/webapp/js/grapheditor/Shapes.js:6938— Shapes.mxShapeBasicRect2.paintNE has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 3 other methods here (Shapes.mxShapeBasicRect2.paintNW, Shapes.mxShapeBasicRect2.paintSE, Shapes.mxShapeBasicRect2.paintSW) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.paintSE (cyclomatic 17) src/main/webapp/js/grapheditor/Shapes.js:6987— Shapes.mxShapeBasicRect2.paintSE has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 3 other methods here (Shapes.mxShapeBasicRect2.paintNW, Shapes.mxShapeBasicRect2.paintNE, Shapes.mxShapeBasicRect2.paintSW) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.paintSW (cyclomatic 17) src/main/webapp/js/grapheditor/Shapes.js:7024— Shapes.mxShapeBasicRect2.paintSW has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 3 other methods here (Shapes.mxShapeBasicRect2.paintNW, Shapes.mxShapeBasicRect2.paintNE, Shapes.mxShapeBasicRect2.paintSE) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.paintTopInner (cyclomatic 17) src/main/webapp/js/grapheditor/Shapes.js:7070— Shapes.mxShapeBasicRect2.paintTopInner has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 2 other methods here (Shapes.mxShapeBasicRect2.paintRightInner, Shapes.mxShapeBasicRect2.paintLeftInner) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.paintRightInner (cyclomatic 17) src/main/webapp/js/grapheditor/Shapes.js:7124— Shapes.mxShapeBasicRect2.paintRightInner has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 2 other methods here (Shapes.mxShapeBasicRect2.paintTopInner, Shapes.mxShapeBasicRect2.paintLeftInner) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.paintLeftInner (cyclomatic 17) src/main/webapp/js/grapheditor/Shapes.js:7157— Shapes.mxShapeBasicRect2.paintLeftInner has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 2 other methods here (Shapes.mxShapeBasicRect2.paintTopInner, Shapes.mxShapeBasicRect2.paintRightInner) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.paintBottomInner (cyclomatic 17) src/main/webapp/js/grapheditor/Shapes.js:7211— Shapes.mxShapeBasicRect2.paintBottomInner has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Shapes.mxShapeBasicRect2.paintSWInner (cyclomatic 17) src/main/webapp/js/grapheditor/Shapes.js:7240— Shapes.mxShapeBasicRect2.paintSWInner has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Shapes.mxShapeBasicRect2.moveSWInner (cyclomatic 17) src/main/webapp/js/grapheditor/Shapes.js:7269— Shapes.mxShapeBasicRect2.moveSWInner has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 3 other methods here (Shapes.mxShapeBasicRect2.lineSWInner, Shapes.mxShapeBasicRect2.moveSEInner, Shapes.mxShapeBasicRect2.lineSEInner) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.lineSWInner (cyclomatic 17) src/main/webapp/js/grapheditor/Shapes.js:7291— Shapes.mxShapeBasicRect2.lineSWInner has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 3 other methods here (Shapes.mxShapeBasicRect2.moveSWInner, Shapes.mxShapeBasicRect2.moveSEInner, Shapes.mxShapeBasicRect2.lineSEInner) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.moveSEInner (cyclomatic 17) src/main/webapp/js/grapheditor/Shapes.js:7313— Shapes.mxShapeBasicRect2.moveSEInner has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 3 other methods here (Shapes.mxShapeBasicRect2.moveSWInner, Shapes.mxShapeBasicRect2.lineSWInner, Shapes.mxShapeBasicRect2.lineSEInner) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.lineSEInner (cyclomatic 17) src/main/webapp/js/grapheditor/Shapes.js:7335— Shapes.mxShapeBasicRect2.lineSEInner has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 3 other methods here (Shapes.mxShapeBasicRect2.moveSWInner, Shapes.mxShapeBasicRect2.lineSWInner, Shapes.mxShapeBasicRect2.moveSEInner) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.TaperedArrowShape.getWidthHandleFrame (cyclomatic 17) src/main/webapp/js/grapheditor/Shapes.js:7666— Shapes.TaperedArrowShape.getWidthHandleFrame 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.
Shapes.TaperedArrowShape.createMarker (cyclomatic 17) src/main/webapp/js/grapheditor/Shapes.js:7849— Shapes.TaperedArrowShape.createMarker 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.
Shapes.MermaidSankeyLinkShape.paintEdgeShape (cyclomatic 17) src/main/webapp/js/grapheditor/Shapes.js:9678— Shapes.MermaidSankeyLinkShape.paintEdgeShape 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.
Sidebar.Sidebar.matchPartialEntries (cyclomatic 17) src/main/webapp/js/grapheditor/Sidebar.js:2380— Sidebar.Sidebar.matchPartialEntries 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.
mxEdgeHandler.mxEdgeHandler.getPointForEvent (cyclomatic 17) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:1141— mxEdgeHandler.mxEdgeHandler.getPointForEvent 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. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: mxEdgeHandler.mxEdgeHandler.createMarker (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
mxSelectionCellsHandler.mxSelectionCellsHandler.refresh (cyclomatic 17) src/main/webapp/mxgraph/src/handler/mxSelectionCellsHandler.js:170— mxSelectionCellsHandler.mxSelectionCellsHandler.refresh 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.
mxVertexHandler.mxVertexHandler.createSizers (cyclomatic 17) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:2303— mxVertexHandler.mxVertexHandler.createSizers has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
mxText.mxText.redrawHtmlShapeWithCss3 (cyclomatic 17) src/main/webapp/mxgraph/src/shape/mxText.js:888— mxText.mxText.redrawHtmlShapeWithCss3 has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 901). 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.
mxGraph.mxGraph.updateGroupBounds (cyclomatic 17) src/main/webapp/mxgraph/src/view/mxGraph.js:4453— mxGraph.mxGraph.updateGroupBounds 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.
mxGraph.mxGraph.getPreferredSizeForCell (cyclomatic 17) src/main/webapp/mxgraph/src/view/mxGraph.js:6047— mxGraph.mxGraph.getPreferredSizeForCell 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.
mxGraph.mxGraph.getCellContainmentArea (cyclomatic 17) src/main/webapp/mxgraph/src/view/mxGraph.js:6904— mxGraph.mxGraph.getCellContainmentArea 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.
mxGraph.mxGraph.setConnectionConstraint (cyclomatic 17) src/main/webapp/mxgraph/src/view/mxGraph.js:7375— mxGraph.mxGraph.setConnectionConstraint 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.
mxGraph.mxGraph.panGraph (cyclomatic 17) src/main/webapp/mxgraph/src/view/mxGraph.js:8453— mxGraph.mxGraph.panGraph 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.
mxGraph.mxGraph.validateGraph (cyclomatic 17) src/main/webapp/mxgraph/src/view/mxGraph.js:9397— mxGraph.mxGraph.validateGraph 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.
mxGraph.mxGraph.getCellAt (cyclomatic 17) src/main/webapp/mxgraph/src/view/mxGraph.js:12204— mxGraph.mxGraph.getCellAt 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.
mxGraph.mxGraph.getOpposites (cyclomatic 17) src/main/webapp/mxgraph/src/view/mxGraph.js:12994— mxGraph.mxGraph.getOpposites 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.
mxGraph.mxGraph.selectCell (cyclomatic 17) src/main/webapp/mxgraph/src/view/mxGraph.js:13636— mxGraph.mxGraph.selectCell 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.
mxGraphView.mxGraphView.getPreviousNode (cyclomatic 17) src/main/webapp/mxgraph/src/view/mxGraphView.js:1702— mxGraphView.mxGraphView.getPreviousNode 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.
mxGraphView.mxGraphView.getPerimeterPoint (cyclomatic 17) src/main/webapp/mxgraph/src/view/mxGraphView.js:3559— mxGraphView.mxGraphView.getPerimeterPoint 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.
mxMultiplicity.mxMultiplicity.check (cyclomatic 17) src/main/webapp/mxgraph/src/view/mxMultiplicity.js:163— mxMultiplicity.mxMultiplicity.check has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
RevisionDialog::(anonymous)::updateGraph (cyclomatic 17) src/main/webapp/js/diagramly/Dialogs.js:9071— RevisionDialog::(anonymous)::updateGraph 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.
paintForeground (cyclomatic 17) src/main/webapp/js/grapheditor/Shapes.js:3339— paintForeground 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.
init (cyclomatic 17) src/main/webapp/js/diagramly/ForceExplorer.js:173— init has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 6 function items inside it that branch (getPoint, replacePlaceholders, applyDataStyles, …). 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.
keepLockedGeometries::(anonymous)::setGeometry (cyclomatic 17) src/main/webapp/js/diagramly/LayoutPicker.js:854— keepLockedGeometries::(anonymous)::setGeometry has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
render::redraw (cyclomatic 17) src/main/webapp/js/export.js:456— render::redraw 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.
mxText (cyclomatic 17) src/main/webapp/mxgraph/src/shape/mxText.js:59— mxText 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.
dompurify-smoke.unsafe (cyclomatic 16) etc/dependencies/dompurify-smoke.js:153— dompurify-smoke.unsafe has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 167, 161). 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.
mxReader.DrawioViewer.resetGraphView (cyclomatic 16) src/main/webapp/connect/common/js/mxReader.js:386— mxReader.DrawioViewer.resetGraphView has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
App.App.open (cyclomatic 16) src/main/webapp/js/diagramly/App.js:3990— App.App.open has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
App.App.checkDrafts (cyclomatic 16) src/main/webapp/js/diagramly/App.js:5264— App.App.checkDrafts has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 5276, 5310, 5291, …). 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.
Dialogs.CustomActionDialog.liftLegacyLayers (cyclomatic 16) src/main/webapp/js/diagramly/Dialogs.js:8198— Dialogs.CustomActionDialog.liftLegacyLayers 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.
Dialogs.StyleRulesDialog.parseRules (cyclomatic 16) src/main/webapp/js/diagramly/Dialogs.js:22434— Dialogs.StyleRulesDialog.parseRules has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DriveClient.DriveClient.showPermissions (cyclomatic 16) src/main/webapp/js/diagramly/DriveClient.js:3183— DriveClient.DriveClient.showPermissions has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 3224, 3202, 3187). 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.
DriveFile.DriveFile.getComments (cyclomatic 16) src/main/webapp/js/diagramly/DriveFile.js:938— DriveFile.DriveFile.getComments has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 3 function items inside it that branch (driveCommentToDrawio, a function literal at line 977, a function literal at line 969). 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.
Editor.Editor.loadCompatibleCss (cyclomatic 16) src/main/webapp/js/diagramly/Editor.js:1864— Editor.Editor.loadCompatibleCss has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Editor.Editor.createRoughCanvas (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
Editor.Editor.convertLegacyAnimation (cyclomatic 16) src/main/webapp/js/diagramly/Editor.js:15653— Editor.Editor.convertLegacyAnimation has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 3 function items inside it that branch (merge, paramsMatch, flush). 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. This is NOT this file's highest cyclomatic complexity: Editor.Editor.createRoughCanvas (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
Editor.Editor.toggleFlowAnimation (cyclomatic 16) src/main/webapp/js/diagramly/Editor.js:16200— Editor.Editor.toggleFlowAnimation has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Editor.Editor.createRoughCanvas (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
EditorUi.EditorUi.showEmbedImageDialog (cyclomatic 16) src/main/webapp/js/diagramly/EditorUi.js:12836— EditorUi.EditorUi.showEmbedImageDialog has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 12920, 12961). 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: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.extractMermaidDeclaration (cyclomatic 16) src/main/webapp/js/diagramly/EditorUi.js:15588— EditorUi.EditorUi.extractMermaidDeclaration 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.getEmbedSvgSize (cyclomatic 16) src/main/webapp/js/diagramly/EditorUi.js:20530— EditorUi.EditorUi.getEmbedSvgSize has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.sanitizeRealtimeTerminals (cyclomatic 16) src/main/webapp/js/diagramly/EditorUi.js:20930— EditorUi.EditorUi.sanitizeRealtimeTerminals has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.parseViewBox (cyclomatic 16) src/main/webapp/js/diagramly/EditorUi.js:31409— EditorUi.EditorUi.parseViewBox 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. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
EditorUi.EditorUi.gotoCommentAnchor (cyclomatic 16) src/main/webapp/js/diagramly/EditorUi.js:43557— EditorUi.EditorUi.gotoCommentAnchor has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.createSpinner (cyclomatic 30) 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.
Extensions.updateEndpoint (cyclomatic 16) REDACTED:6476— Extensions.updateEndpoint has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Extensions.addStyle (cyclomatic 26) 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.
Extensions.importLucidPage::addLine (cyclomatic 16) REDACTED:6805— Extensions.importLucidPage::addLine has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This shape REPEATS in the file: one other method here (Extensions.importLucidPage) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: Extensions.addStyle (cyclomatic 26) 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.
ForceExplorer.ForceExplorer.focusInDirection (cyclomatic 16) src/main/webapp/js/diagramly/ForceExplorer.js:1350— ForceExplorer.ForceExplorer.focusInDirection has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: ForceExplorer.ForceExplorer.init (cyclomatic 17) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
ForceExplorer.ForceExplorer.getLabelSizes (cyclomatic 16) src/main/webapp/js/diagramly/ForceExplorer.js:2784— ForceExplorer.ForceExplorer.getLabelSizes has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 2 function items inside it that branch (add, getMarkerSize). 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. This is NOT this file's highest cyclomatic complexity: ForceExplorer.ForceExplorer.init (cyclomatic 17) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
GitHubFile.GitHubFile.saveFile (cyclomatic 16) src/main/webapp/js/diagramly/GitHubFile.js:233— GitHubFile.GitHubFile.saveFile has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 244, 270, 260, …). 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.
GraphViewer.GraphViewer.getModelNodeBounds::getOrigin (cyclomatic 16) REDACTED:3483— GraphViewer.GraphViewer.getModelNodeBounds::getOrigin has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (GraphViewer.GraphViewer.getModelNodeBounds) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
LayoutPicker.EditorUi.getLayoutScope (cyclomatic 16) src/main/webapp/js/diagramly/LayoutPicker.js:437— LayoutPicker.EditorUi.getLayoutScope 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.
OneDriveClient.OneDriveClient.executeWriteRequest (cyclomatic 16) src/main/webapp/js/diagramly/OneDriveClient.js:1200— OneDriveClient.OneDriveClient.executeWriteRequest has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1244, 1206, 1228, …). 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.
Tidy.Tidy.collect (cyclomatic 16) src/main/webapp/js/diagramly/tidy/Tidy.js:238— Tidy.Tidy.collect has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (Tidy.Tidy.collect::visit) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Tidy.Tidy.runLayout (cyclomatic 16) src/main/webapp/js/diagramly/tidy/Tidy.js:2404— Tidy.Tidy.runLayout has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TidyWindow.TidyWindow.prefetch (cyclomatic 16) src/main/webapp/js/diagramly/tidy/TidyWindow.js:173— TidyWindow.TidyWindow.prefetch has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
TidyWindow.TidyWindow.saveBase (cyclomatic 16) src/main/webapp/js/diagramly/tidy/TidyWindow.js:929— TidyWindow.TidyWindow.saveBase 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.
Editor.PrintDialog.create (cyclomatic 16) src/main/webapp/js/grapheditor/Editor.js:3049— Editor.PrintDialog.create has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 2 function items inside it that branch (preview, a function literal at line 3123). 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.
EditorUi.EditorUi.pickColor (cyclomatic 16) REDACTED:10120— EditorUi.EditorUi.pickColor has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: EditorUi.EditorUi.typeIntoShapePicker (cyclomatic 18) 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.
Graph.Graph.addLightDarkColors (cyclomatic 16) REDACTED:2936— Graph.Graph.addLightDarkColors has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.createCssRuleMatcher (cyclomatic 16) REDACTED:6040— Graph.Graph.createCssRuleMatcher has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.openLink (cyclomatic 16) REDACTED:12522— Graph.Graph.openLink has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.isSameLayoutRoute (cyclomatic 16) REDACTED:14690— Graph.Graph.isSameLayoutRoute has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to one function item inside it that branches (simplify). 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.applyStyleRules (cyclomatic 16) REDACTED:18654— Graph.Graph.applyStyleRules has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.updateInheritedLabelValues (cyclomatic 16) REDACTED:19094— Graph.Graph.updateInheritedLabelValues has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.fitGroupToChildren (cyclomatic 16) REDACTED:21354— Graph.Graph.fitGroupToChildren 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. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.normalizeModel::growContainers (cyclomatic 16) REDACTED:21752— Graph.Graph.normalizeModel::growContainers has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.getZoomSteps (cyclomatic 16) REDACTED:22149— Graph.Graph.getZoomSteps has cyclomatic complexity 16 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.addFlowAnimationToNode (cyclomatic 16) REDACTED:23581— Graph.Graph.addFlowAnimationToNode has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.Graph.getContinuousPathData (cyclomatic 16) REDACTED:23905— Graph.Graph.getContinuousPathData has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.HoverIcons.getState (cyclomatic 16) REDACTED:24849— Graph.HoverIcons.getState has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.mxCellRenderer.resolveColor (cyclomatic 16) REDACTED:28198— Graph.mxCellRenderer.resolveColor has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.getPlainTextGroup (cyclomatic 16) REDACTED:30129— Graph.getPlainTextGroup has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.getLabelBoxSize (cyclomatic 16) REDACTED:30198— Graph.getLabelBoxSize has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
Graph.mxGraphView.setTieClones (cyclomatic 16) REDACTED:33267— Graph.mxGraphView.setTieClones has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Graph.Graph.init (cyclomatic 24) 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.
InlineToolbar.InlineToolbar.addHandleBounds (cyclomatic 16) src/main/webapp/js/grapheditor/InlineToolbar.js:978— InlineToolbar.InlineToolbar.addHandleBounds has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: InlineToolbar.InlineToolbar.showFillMenu::update (cyclomatic 18) 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.
InlineToolbar.InlineToolbar.getCellBounds (cyclomatic 16) src/main/webapp/js/grapheditor/InlineToolbar.js:1081— InlineToolbar.InlineToolbar.getCellBounds 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. This is NOT this file's highest cyclomatic complexity: InlineToolbar.InlineToolbar.showFillMenu::update (cyclomatic 18) 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.
InlineToolbar.InlineToolbar.showLineStyleMenu (cyclomatic 16) src/main/webapp/js/grapheditor/InlineToolbar.js:2559— InlineToolbar.InlineToolbar.showLineStyleMenu has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to 2 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. This is NOT this file's highest cyclomatic complexity: InlineToolbar.InlineToolbar.showFillMenu::update (cyclomatic 18) 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.
Omnibox.Omnibox.getFormatControls (cyclomatic 16) src/main/webapp/js/grapheditor/Omnibox.js:1463— Omnibox.Omnibox.getFormatControls 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.
Omnibox.Omnibox.revealFormatControl (cyclomatic 16) src/main/webapp/js/grapheditor/Omnibox.js:1689— Omnibox.Omnibox.revealFormatControl has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 1693). 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.
Omnibox.Omnibox.getFields (cyclomatic 16) src/main/webapp/js/grapheditor/Omnibox.js:1954— Omnibox.Omnibox.getFields has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 2 function items inside it that branch (add, a function literal at line 1997). 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.
Shapes.TableShape.paintVertexShape (cyclomatic 16) src/main/webapp/js/grapheditor/Shapes.js:207— Shapes.TableShape.paintVertexShape 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.
Shapes.ZigzagShape.paintVertexShape (cyclomatic 16) src/main/webapp/js/grapheditor/Shapes.js:8157— Shapes.ZigzagShape.paintVertexShape 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.
Sidebar.Sidebar.getShapeMatches (cyclomatic 16) src/main/webapp/js/grapheditor/Sidebar.js:1314— Sidebar.Sidebar.getShapeMatches 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.
libavoid-routing.AvoidRouting.shapeFrame (cyclomatic 16) src/main/webapp/js/libavoid-js/libavoid-routing.js:356— libavoid-routing.AvoidRouting.shapeFrame 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.
libavoid-routing.AvoidRouting.toWorldFrame (cyclomatic 16) src/main/webapp/js/libavoid-js/libavoid-routing.js:498— libavoid-routing.AvoidRouting.toWorldFrame has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxEdgeHandler.mxEdgeHandler.start (cyclomatic 16) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:1008— mxEdgeHandler.mxEdgeHandler.start has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: mxEdgeHandler.mxEdgeHandler.createMarker (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
mxEdgeHandler.mxEdgeHandler.refresh (cyclomatic 16) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:2981— mxEdgeHandler.mxEdgeHandler.refresh has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: mxEdgeHandler.mxEdgeHandler.createMarker (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
mxSvgCanvas2D.mxSvgCanvas2D.updateFill (cyclomatic 16) REDACTED:1309— mxSvgCanvas2D.mxSvgCanvas2D.updateFill 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.
mxCellRenderer.mxCellRenderer.rotateLabelBounds (cyclomatic 16) src/main/webapp/mxgraph/src/view/mxCellRenderer.js:1462— mxCellRenderer.mxCellRenderer.rotateLabelBounds 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. This is NOT this file's highest cyclomatic complexity: mxCellRenderer.mxCellRenderer.isTextShapeInvalid (cyclomatic 23) 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.
mxGraph.mxGraph.updateSelection (cyclomatic 16) src/main/webapp/mxgraph/src/view/mxGraph.js:1990— mxGraph.mxGraph.updateSelection has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 3 function items inside it that branch (getResult, a function literal at line 2040, isContained). 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.
mxGraph.mxGraph.updatePageBreaks (cyclomatic 16) src/main/webapp/mxgraph/src/view/mxGraph.js:3305— mxGraph.mxGraph.updatePageBreaks has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mxGraph.mxGraph.getOutlineConstraint (cyclomatic 16) src/main/webapp/mxgraph/src/view/mxGraph.js:7216— mxGraph.mxGraph.getOutlineConstraint 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.
mxGraph.mxGraph.scrollRectToVisible (cyclomatic 16) src/main/webapp/mxgraph/src/view/mxGraph.js:8911— mxGraph.mxGraph.scrollRectToVisible 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.
mxGraphView.mxGraphView.validateInvalidCell (cyclomatic 16) src/main/webapp/mxgraph/src/view/mxGraphView.js:1589— mxGraphView.mxGraphView.validateInvalidCell has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
mxGraphView.mxGraphView.updateEdgeState (cyclomatic 16) src/main/webapp/mxgraph/src/view/mxGraphView.js:2767— mxGraphView.mxGraphView.updateEdgeState 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.
mxGraphView.mxGraphView.getPoint (cyclomatic 16) src/main/webapp/mxgraph/src/view/mxGraphView.js:4093— mxGraphView.mxGraphView.getPoint 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.
trello.Draw.loadPlugin() (cyclomatic 16) REDACTED:8— trello.Draw.loadPlugin() has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 4 function items inside it that branch (main, main::doCreateFile, a function literal at line 17, …). 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.
mxCiscoSafe.mxShapeCiscoSafeCompositeIcon.paintVertexShape (cyclomatic 16) src/main/webapp/shapes/mxCiscoSafe.js:39— mxCiscoSafe.mxShapeCiscoSafeCompositeIcon.paintVertexShape 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.
getPreferredSizeForCell (cyclomatic 16) src/main/webapp/js/diagramly/Editor.js:5743— getPreferredSizeForCell has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
EditorUi::setDefaultStyle (cyclomatic 16) REDACTED:97— EditorUi::setDefaultStyle 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.
EllipsePerimeter (cyclomatic 16) src/main/webapp/mxgraph/src/view/mxPerimeter.js:161— EllipsePerimeter 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.
Deprecated: crypto-js etc/dependencies/package.json:16— crypto-js 4.2.0, declared in etc/dependencies/package.json, is marked deprecated by its publisher: "Active development of CryptoJS has been discontinued. This library is no longer maintained.". Replace it with the package or version that message names, or record why this one must stay.
Menus.Menus.init (cognitive 1480) src/main/webapp/js/diagramly/Menus.js:313— Menus.Menus.init has cognitive complexity 1480 (threshold 15). Drivers by points: if/else 527 (935 pts), boolean chains 328, ternaries 61 (133 pts), loops 22 (44 pts), error handling 13 (40 pts) (nesting depth added 529). Of this number, 108 points are the body's own statements and 1372 belong to 244 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addCompositeShape (cognitive 1227) REDACTED:7711— addCompositeShape has cognitive complexity 1227 (threshold 15). Drivers by points: if/else 329 (742 pts), ternaries 67 (213 pts), loops 65 (152 pts), boolean chains 56, match/switch 21 (50 pts), error handling 7 (14 pts) (nesting depth added 682). Of this number, 1222 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
EditorUi.EditorUi.installMessageHandler (cognitive 759) src/main/webapp/js/diagramly/EditorUi.js:32341— EditorUi.EditorUi.installMessageHandler has cognitive complexity 759 (threshold 15). Drivers by points: if/else 174 (486 pts), ternaries 35 (144 pts), boolean chains 84, loops 4 (24 pts), error handling 9 (21 pts) (nesting depth added 453). Most of this is not in the body itself: 6 of the 759 points are its own statements and the rest belongs to 36 function literals inside it that branch (lines 32406, 33033, 32890, …). 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.
EditorUi.EditorUi.doImportCsv (cognitive 700) src/main/webapp/js/diagramly/EditorUi.js:39560— EditorUi.EditorUi.doImportCsv has cognitive complexity 700 (threshold 15). Drivers by points: if/else 189 (555 pts), ternaries 64 (264 pts), loops 46 (142 pts), boolean chains 134, error handling 2 (5 pts) (nesting depth added 665). 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. This shape REPEATS in the file: 2 other methods here (EditorUi.EditorUi.doImportCsv::updateListItems, EditorUi.EditorUi.doImportCsv::moveToInsertPoint) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
init (cognitive 583) src/main/webapp/js/grapheditor/Actions.js:17— init has cognitive complexity 583 (threshold 15). Drivers by points: if/else 189 (348 pts), boolean chains 103, ternaries 39 (73 pts), loops 21 (51 pts), error handling 7 (8 pts) (nesting depth added 224). Most of this is not in the body itself: 2 of the 583 points are its own statements and the rest belongs to 201 function items inside it that branch (a function literal at line 2131, a function literal at line 951, a function literal at line 2360, …). 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.
addFont (cognitive 570) src/main/webapp/js/grapheditor/Format.js:5025— addFont has cognitive complexity 570 (threshold 15). Drivers by points: if/else 152 (346 pts), ternaries 44 (93 pts), boolean chains 79, loops 16 (40 pts), error handling 6 (12 pts) (nesting depth added 273). Of this number, 79 points are the body's own statements and 491 belong to 87 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
EditorUi.EditorUi.initCanvas (cognitive 433) REDACTED:5648— EditorUi.EditorUi.initCanvas has cognitive complexity 433 (threshold 15). Drivers by points: if/else 96 (237 pts), boolean chains 93, ternaries 26 (91 pts), loops 2 (7 pts), error handling 1 (5 pts) (nesting depth added 215). Of this number, 138 points are the body's own statements and 295 belong to 46 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
configure (cognitive 415) src/main/webapp/js/diagramly/Editor.js:3441— configure has cognitive complexity 415 (threshold 15). Drivers by points: if/else 192 (384 pts), boolean chains 19, loops 3 (10 pts), ternaries 1 (2 pts) (nesting depth added 200). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
executeCustomActions (cognitive 402) src/main/webapp/js/diagramly/Editor.js:12980— executeCustomActions has cognitive complexity 402 (threshold 15). Drivers by points: if/else 77 (277 pts), ternaries 15 (76 pts), loops 6 (25 pts), boolean chains 22, error handling 1 (2 pts) (nesting depth added 281). Most of this is not in the body itself: 6 of the 402 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 13055, needsView, a function literal at line 13042, …). 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.
init (cognitive 353) REDACTED:163— init has cognitive complexity 353 (threshold 15). Drivers by points: if/else 63 (207 pts), ternaries 35 (79 pts), boolean chains 49, error handling 3 (12 pts), loops 1 (6 pts) (nesting depth added 202). Of this number, 44 points are the body's own statements and 309 belong to 20 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
addSearchPalette (cognitive 308) src/main/webapp/js/grapheditor/Sidebar.js:2838— addSearchPalette has cognitive complexity 308 (threshold 15). Drivers by points: if/else 85 (198 pts), boolean chains 50, ternaries 8 (26 pts), loops 10 (24 pts), error handling 2 (10 pts) (nesting depth added 153). Most of this is not in the body itself: 2 of the 308 points are its own statements and the rest belongs to 44 function items inside it that branch (a function literal at line 3594, a function literal at line 3052, a function literal at line 2958, …). 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.
EditorUi.EditorUi.init (cognitive 301) src/main/webapp/js/diagramly/EditorUi.js:22767— EditorUi.EditorUi.init has cognitive complexity 301 (threshold 15). Drivers by points: if/else 84 (179 pts), boolean chains 104, ternaries 6 (9 pts), loops 3 (7 pts), error handling 1 (2 pts) (nesting depth added 103). Of this number, 148 points are the body's own statements and 153 belong to 49 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
saveFile (cognitive 301) src/main/webapp/js/diagramly/DriveClient.js:2183— saveFile has cognitive complexity 301 (threshold 15). Drivers by points: if/else 52 (136 pts), ternaries 20 (86 pts), error handling 19 (55 pts), boolean chains 24 (nesting depth added 186). Of this number, 22 points are the body's own statements and 279 belong to 19 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
start (cognitive 267) src/main/webapp/js/diagramly/App.js:4281— start has cognitive complexity 267 (threshold 15). Drivers by points: if/else 63 (160 pts), boolean chains 50, ternaries 8 (33 pts), error handling 8 (24 pts) (nesting depth added 138). Of this number, 93 points are the body's own statements and 174 belong to 20 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
loadFile (cognitive 265) src/main/webapp/js/diagramly/App.js:7011— loadFile has cognitive complexity 265 (threshold 15). Drivers by points: if/else 68 (180 pts), ternaries 9 (35 pts), boolean chains 30, error handling 5 (20 pts) (nesting depth added 153). Most of this is not in the body itself: 9 of the 265 points are its own statements and the rest belongs to 29 function items inside it that branch (a function literal at line 7020, a function literal at line 7272, a function literal at line 7384, …). 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.
EditorUi.EditorUi.libraryLoaded (cognitive 228) src/main/webapp/js/diagramly/EditorUi.js:6149— EditorUi.EditorUi.libraryLoaded has cognitive complexity 228 (threshold 15). Drivers by points: if/else 62 (158 pts), boolean chains 29, ternaries 5 (16 pts), error handling 2 (14 pts), loops 3 (11 pts) (nesting depth added 127). Of this number, 33 points are the body's own statements and 195 belong to 17 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
updateCell (cognitive 226) REDACTED:5951— updateCell has cognitive complexity 226 (threshold 15). Drivers by points: if/else 40 (145 pts), ternaries 9 (41 pts), boolean chains 23, loops 3 (17 pts) (nesting depth added 151). Of this number, 196 points are the body's own statements and 30 belong to 2 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
EditorUi.EditorUi.updateDiagram (cognitive 218) src/main/webapp/js/diagramly/EditorUi.js:4913— EditorUi.EditorUi.updateDiagram has cognitive complexity 218 (threshold 15). Drivers by points: if/else 32 (141 pts), loops 4 (25 pts), error handling 4 (24 pts), ternaries 3 (19 pts), boolean chains 9 (nesting depth added 166). Of this number, 217 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
Shapes.mxShapeBasicRect2.strictDrawShape (cognitive 211) src/main/webapp/js/grapheditor/Shapes.js:6106— Shapes.mxShapeBasicRect2.strictDrawShape has cognitive complexity 211 (threshold 15). Drivers by points: if/else 81 (143 pts), boolean chains 45, ternaries 23 (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.
(anonymous) (cognitive 208) src/main/webapp/plugins/random.js:8— (anonymous) has cognitive complexity 208 (threshold 15). Drivers by points: if/else 39 (98 pts), ternaries 17 (53 pts), loops 13 (48 pts), boolean chains 9 (nesting depth added 130). Most of this is not in the body itself: 1 of the 208 points is its own statement and the rest belongs to 13 function items inside it that branch (a function literal at line 205, a function literal at line 435, a function literal at line 102, …). 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.
drawNode (cognitive 202) src/main/webapp/mxgraph/src/shape/mxStencil.js:650— drawNode has cognitive complexity 202 (threshold 15). Drivers by points: if/else 61 (135 pts), ternaries 6 (35 pts), loops 4 (17 pts), boolean chains 15 (nesting depth added 116). 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.
catchup (cognitive 201) src/main/webapp/js/diagramly/DrawioFileSync.js:3614— catchup has cognitive complexity 201 (threshold 15). Drivers by points: if/else 33 (144 pts), error handling 2 (17 pts), boolean chains 15, ternaries 2 (15 pts), loops 1 (10 pts) (nesting depth added 148). Of this number, 26 points are the body's own statements and 175 belong to 3 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.
executeBatch (cognitive 201) src/main/webapp/js/diagramly/gif/AnimationExport.js:714— executeBatch has cognitive complexity 201 (threshold 15). Drivers by points: if/else 49 (123 pts), ternaries 13 (46 pts), loops 6 (18 pts), boolean chains 14 (nesting depth added 119). 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.
getHexagonPerimeterPoint (cognitive 187) src/main/webapp/mxgraph/src/view/mxPerimeter.js:487— getHexagonPerimeterPoint has cognitive complexity 187 (threshold 15). Drivers by points: if/else 88 (157 pts), boolean chains 29, ternaries 1 (nesting depth added 69). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addLabels (cognitive 184) REDACTED:2486— addLabels has cognitive complexity 184 (threshold 15). Drivers by points: if/else 35 (95 pts), ternaries 6 (37 pts), match/switch 6 (24 pts), boolean chains 14, loops 3 (10 pts), error handling 1 (4 pts) (nesting depth added 119). Of this number, 170 points are the body's own statements and 14 belong to 4 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Dialogs.RevisionDialog (cognitive 182) src/main/webapp/js/diagramly/Dialogs.js:8653— Dialogs.RevisionDialog has cognitive complexity 182 (threshold 15). Drivers by points: if/else 49 (143 pts), loops 4 (16 pts), boolean chains 15, error handling 2 (7 pts), ternaries 1 (nesting depth added 111). Of this number, 25 points are the body's own statements and 157 belong to 21 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Embed.initGraph (cognitive 179) REDACTED:154— Embed.initGraph has cognitive complexity 179 (threshold 15). Drivers by points: if/else 57 (131 pts), boolean chains 30, ternaries 4 (10 pts), error handling 2 (4 pts), loops 2 (4 pts) (nesting depth added 84). Of this number, 89 points are the body's own statements and 90 belong to 11 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity· main (cognitive 179) · ×1
main (cognitive 179) src/main/webapp/js/diagramly/App.js:1006— main has cognitive complexity 179 (threshold 15). Drivers by points: if/else 97 (209 pts), boolean chains 65, error handling 15 (41 pts), ternaries 11 (26 pts), loops 4 (15 pts) (nesting depth added 164). 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.
loadLibraries (cognitive 179) src/main/webapp/js/diagramly/App.js:7633— loadLibraries has cognitive complexity 179 (threshold 15). Drivers by points: if/else 33 (114 pts), error handling 6 (38 pts), boolean chains 13, loops 2 (7 pts), ternaries 2 (7 pts) (nesting depth added 123). Most of this is not in the body itself: 12 of the 179 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 7701, 7658, 7737, …). 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.
cloneCells (cognitive 176) src/main/webapp/mxgraph/src/view/mxGraph.js:4596— cloneCells has cognitive complexity 176 (threshold 15). Drivers by points: if/else 20 (132 pts), loops 5 (35 pts), boolean chains 8, ternaries 1 (nesting depth added 142). 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.
patchPages (cognitive 175) src/main/webapp/js/diagramly/DiffSync.js:454— patchPages has cognitive complexity 175 (threshold 15). Drivers by points: if/else 47 (123 pts), loops 12 (20 pts), ternaries 6 (18 pts), boolean chains 13, error handling 1 (nesting depth added 96). Of this number, 80 points are the body's own statements and 95 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
createMenubarForTheme (cognitive 174) src/main/webapp/js/diagramly/SimpleClassic.js:580— createMenubarForTheme has cognitive complexity 174 (threshold 15). Drivers by points: if/else 40 (119 pts), ternaries 9 (47 pts), boolean chains 8 (nesting depth added 117). Of this number, 80 points are the body's own statements and 94 belong to 4 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ParseDialog::parse (cognitive 171) src/main/webapp/js/diagramly/Dialogs.js:1520— ParseDialog::parse has cognitive complexity 171 (threshold 15). Drivers by points: if/else 40 (106 pts), ternaries 8 (33 pts), loops 7 (20 pts), boolean chains 12 (nesting depth added 104). 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.
patch (cognitive 171) REDACTED:1374— patch has cognitive complexity 171 (threshold 15). Drivers by points: if/else 35 (101 pts), loops 7 (33 pts), ternaries 6 (19 pts), boolean chains 18 (nesting depth added 105). Of this number, 154 points are the body's own statements and 17 belong to 2 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
getBoundingBoxFromGeometry (cognitive 169) src/main/webapp/mxgraph/src/view/mxGraph.js:8095— getBoundingBoxFromGeometry has cognitive complexity 169 (threshold 15). Drivers by points: if/else 28 (149 pts), loops 2 (9 pts), boolean chains 6, ternaries 3 (5 pts) (nesting depth added 130). Of this number, 155 points are the body's own statements and 14 belong to one function item inside it that branches. 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.
LayersWindow (cognitive 166) REDACTED:5350— LayersWindow has cognitive complexity 166 (threshold 15). Drivers by points: if/else 63 (103 pts), ternaries 17 (29 pts), boolean chains 22, loops 8 (12 pts) (nesting depth added 56). Most of this is not in the body itself: 3 of the 166 points are its own statements and the rest belongs to 51 function items inside it that branch (refresh::addLayer, a function literal at line 5619, renameLayer::stopEditing, …). 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.
SegmentConnector (cognitive 164) src/main/webapp/mxgraph/src/view/mxEdgeStyle.js:600— SegmentConnector has cognitive complexity 164 (threshold 15). Drivers by points: if/else 39 (83 pts), boolean chains 56, loops 6 (13 pts), ternaries 3 (12 pts) (nesting depth added 60). Of this number, 162 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
showGitLabDialog (cognitive 162) src/main/webapp/js/diagramly/GitLabClient.js:808— showGitLabDialog has cognitive complexity 162 (threshold 15). Drivers by points: if/else 54 (93 pts), ternaries 11 (41 pts), loops 6 (16 pts), boolean chains 12 (nesting depth added 79). Most of this is not in the body itself: 5 of the 162 points are its own statements and the rest belongs to 49 function items inside it that branch (a function literal at line 1309, a function literal at line 987, a function literal at line 1133, …). 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.
export.render (cognitive 161) src/main/webapp/js/export.js:234— export.render has cognitive complexity 161 (threshold 15). Drivers by points: if/else 170 (312 pts), boolean chains 124, loops 19 (55 pts), ternaries 21 (52 pts), error handling 18 (37 pts) (nesting depth added 228). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (export.render::collectAnnotRects) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
random.Draw.loadPlugin() (cognitive 160) src/main/webapp/plugins/random.js:8— random.Draw.loadPlugin() has cognitive complexity 160 (threshold 15). Drivers by points: if/else 39 (98 pts), loops 13 (48 pts), boolean chains 9, ternaries 3 (5 pts) (nesting depth added 96). Most of this is not in the body itself: 1 of the 160 points is its own statement and the rest belongs to 8 function literals inside it that branch (lines 205, 435, 102, …). 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.
addToolbar (cognitive 160) REDACTED:1843— addToolbar has cognitive complexity 160 (threshold 15). Drivers by points: if/else 52 (106 pts), ternaries 10 (30 pts), boolean chains 17, error handling 1 (4 pts), loops 2 (3 pts) (nesting depth added 78). Of this number, 58 points are the body's own statements and 102 belong to 37 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
mouseMove (cognitive 157) src/main/webapp/mxgraph/src/handler/mxConnectionHandler.js:1248— mouseMove has cognitive complexity 157 (threshold 15). Drivers by points: if/else 41 (119 pts), boolean chains 30, ternaries 1 (5 pts), loops 1 (3 pts) (nesting depth added 84). 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.
createTagsDialog (cognitive 154) src/main/webapp/js/diagramly/Editor.js:11069— createTagsDialog has cognitive complexity 154 (threshold 15). Drivers by points: if/else 32 (94 pts), ternaries 9 (37 pts), loops 5 (16 pts), boolean chains 7 (nesting depth added 101). Most of this is not in the body itself: 4 of the 154 points are its own statements and the rest belongs to 16 function items inside it that branch (a function literal at line 11144, a function literal at line 11199, a function literal at line 11418, …). 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.
updateLivePreview (cognitive 154) src/main/webapp/mxgraph/src/handler/mxGraphHandler.js:1490— updateLivePreview has cognitive complexity 154 (threshold 15). Drivers by points: if/else 28 (110 pts), ternaries 4 (28 pts), loops 2 (9 pts), boolean chains 7 (nesting depth added 113). Of this number, 88 points are the body's own statements and 66 belong to one function literal inside it that branches. 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.
createPickerMenuForTheme (cognitive 153) src/main/webapp/js/diagramly/SimpleClassic.js:271— createPickerMenuForTheme has cognitive complexity 153 (threshold 15). Drivers by points: if/else 30 (104 pts), ternaries 8 (35 pts), boolean chains 14 (nesting depth added 101). Of this number, 25 points are the body's own statements and 128 belong to 6 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Graph.Graph.replacePlaceholders (cognitive 152) REDACTED:16602— Graph.Graph.replacePlaceholders has cognitive complexity 152 (threshold 15). Drivers by points: if/else 27 (123 pts), boolean chains 15, loops 2 (8 pts), ternaries 1 (6 pts) (nesting depth added 107). Of this number, 148 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cellsRemoved (cognitive 152) src/main/webapp/mxgraph/src/view/mxGraph.js:5177— cellsRemoved has cognitive complexity 152 (threshold 15). Drivers by points: if/else 20 (81 pts), ternaries 4 (37 pts), loops 8 (28 pts), boolean chains 6 (nesting depth added 114). Of this number, 32 points are the body's own statements and 120 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
OrthConnector (cognitive 152) src/main/webapp/mxgraph/src/view/mxEdgeStyle.js:1141— OrthConnector has cognitive complexity 152 (threshold 15). Drivers by points: if/else 57 (98 pts), ternaries 20 (28 pts), boolean chains 18, loops 7, match/switch 1 (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addGraphStyles (cognitive 150) src/main/webapp/js/grapheditor/Format.js:9130— addGraphStyles has cognitive complexity 150 (threshold 15). Drivers by points: if/else 39 (67 pts), ternaries 21 (43 pts), boolean chains 29, loops 7 (11 pts) (nesting depth added 54). Most of this is not in the body itself: 10 of the 150 points are its own statements and the rest belongs to 26 function items inside it that branch (a function literal at line 9249, a function literal at line 9147, a function literal at line 9216, …). 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.
DataSourceDialog (cognitive 143) src/main/webapp/js/diagramly/Dialogs.js:23065— DataSourceDialog has cognitive complexity 143 (threshold 15). Drivers by points: if/else 37 (46 pts), ternaries 27 (39 pts), boolean chains 30, loops 17 (25 pts), error handling 2 (3 pts) (nesting depth added 30). Most of this is not in the body itself: 15 of the 143 points are its own statements and the rest belongs to 32 function items inside it that branch (a function literal at line 23675, a function literal at line 23588, a function literal at line 23729, …). 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.
EditDataDialog (cognitive 140) REDACTED:3880— EditDataDialog has cognitive complexity 140 (threshold 15). Drivers by points: if/else 49 (87 pts), loops 10 (20 pts), boolean chains 17, ternaries 6 (12 pts), error handling 3 (4 pts) (nesting depth added 55). Of this number, 62 points are the body's own statements and 78 belong to 17 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
init (cognitive 138) src/main/webapp/js/diagramly/App.js:2032— init has cognitive complexity 138 (threshold 15). Drivers by points: if/else 45 (82 pts), boolean chains 35, error handling 6 (12 pts), ternaries 4 (9 pts) (nesting depth added 48). Of this number, 89 points are the body's own statements and 49 belong to 16 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.
execute (cognitive 138) src/main/webapp/mxgraph/src/layout/mxStackLayout.js:370— execute has cognitive complexity 138 (threshold 15). Drivers by points: if/else 33 (87 pts), ternaries 7 (35 pts), boolean chains 14, loops 1 (2 pts) (nesting depth added 83). 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.
toggleUserPanel (cognitive 137) src/main/webapp/js/diagramly/App.js:9379— toggleUserPanel has cognitive complexity 137 (threshold 15). Drivers by points: if/else 45 (105 pts), ternaries 5 (19 pts), boolean chains 9, loops 1 (4 pts) (nesting depth added 77). Of this number, 44 points are the body's own statements and 93 belong to 29 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
EditorUi.EditorUi.addFileDropHandler (cognitive 136) src/main/webapp/js/diagramly/EditorUi.js:30495— EditorUi.EditorUi.addFileDropHandler has cognitive complexity 136 (threshold 15). Drivers by points: if/else 27 (111 pts), ternaries 2 (15 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 98). Most of this is not in the body itself: 3 of the 136 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 30531, 30517, 30622, …). 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.
Graph.Graph.pasteCellStyles (cognitive 136) REDACTED:11443— Graph.Graph.pasteCellStyles has cognitive complexity 136 (threshold 15). Drivers by points: if/else 24 (94 pts), loops 5 (21 pts), boolean chains 15, ternaries 2 (6 pts) (nesting depth added 90). 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.
EmbedServlet2.createEmbedJavaScript (cognitive 135) src/main/server/java/com/mxgraph/online/EmbedServlet2.java:273— EmbedServlet2.createEmbedJavaScript has cognitive complexity 135 (threshold 15). Drivers by points: if/else 21 (104 pts), error handling 2 (16 pts), loops 3 (10 pts), boolean chains 4, ternaries 1 (nesting depth added 104). 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.
createShapePicker (cognitive 132) REDACTED:2675— createShapePicker has cognitive complexity 132 (threshold 15). Drivers by points: if/else 30 (83 pts), ternaries 11 (36 pts), boolean chains 9, loops 2 (4 pts) (nesting depth added 80). Of this number, 21 points are the body's own statements and 111 belong to 5 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Editor.Graph.createTagsDialog.refreshTags (cognitive 131) src/main/webapp/js/diagramly/Editor.js:11124— Editor.Graph.createTagsDialog.refreshTags has cognitive complexity 131 (threshold 15). Drivers by points: if/else 23 (79 pts), ternaries 7 (32 pts), loops 3 (13 pts), boolean chains 7 (nesting depth added 91). Most of this is not in the body itself: 7 of the 131 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 11144, 11199, 11297, …). 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.
createDropHandler (cognitive 131) src/main/webapp/js/grapheditor/Sidebar.js:5466— createDropHandler has cognitive complexity 131 (threshold 15). Drivers by points: if/else 20 (72 pts), ternaries 8 (26 pts), boolean chains 18, loops 3 (11 pts), error handling 1 (4 pts) (nesting depth added 81). Most of this is not in the body itself: 1 of the 131 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 5471, 5643). 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.
mxSvgCanvas2D.mxSvgCanvas2D.wrapSvgTextElement (cognitive 129) REDACTED:2589— mxSvgCanvas2D.mxSvgCanvas2D.wrapSvgTextElement has cognitive complexity 129 (threshold 15). Drivers by points: if/else 59 (152 pts), loops 20 (45 pts), boolean chains 18, ternaries 2 (7 pts) (nesting depth added 123). 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. This shape REPEATS in the file: one other method here (mxSvgCanvas2D.mxSvgCanvas2D.wrapSvgTextElement::collectLeaves) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
init (cognitive 128) src/main/webapp/js/diagramly/ElectronApp.js:451— init has cognitive complexity 128 (threshold 15). Drivers by points: if/else 31 (85 pts), ternaries 5 (20 pts), boolean chains 13, error handling 3 (7 pts), loops 2 (3 pts) (nesting depth added 74). None of this is in the body itself: all 128 points belong to 34 function items inside it that branch (a function literal at line 544, a function literal at line 522, a function literal at line 458, …). 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.
MoreShapesDialog (cognitive 127) src/main/webapp/js/diagramly/Dialogs.js:18275— MoreShapesDialog has cognitive complexity 127 (threshold 15). Drivers by points: if/else 29 (74 pts), loops 12 (28 pts), ternaries 6 (13 pts), boolean chains 12 (nesting depth added 68). Of this number, 51 points are the body's own statements and 76 belong to 18 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addGeometry (cognitive 127) src/main/webapp/js/grapheditor/Format.js:3383— addGeometry has cognitive complexity 127 (threshold 15). Drivers by points: if/else 48 (88 pts), boolean chains 27, ternaries 8 (10 pts), loops 1 (2 pts) (nesting depth added 43). Of this number, 43 points are the body's own statements and 84 belong to 19 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TextOutlineWindow (cognitive 127) REDACTED:4781— TextOutlineWindow has cognitive complexity 127 (threshold 15). Drivers by points: if/else 56 (78 pts), ternaries 13 (25 pts), boolean chains 13, loops 7 (11 pts) (nesting depth added 38). None of this is in the body itself: all 127 points belong to 24 function items inside it that branch (a function literal at line 5192, a function literal at line 5111, getRow, …). 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.
extract (cognitive 126) src/main/webapp/js/diagramly/tidy/TidyFeatures.js:133— extract has cognitive complexity 126 (threshold 15). Drivers by points: if/else 30 (60 pts), loops 19 (25 pts), boolean chains 21, ternaries 18 (20 pts) (nesting depth added 38). Of this number, 116 points are the body's own statements and 10 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.applyEdgesText (cognitive 125) src/main/webapp/js/diagramly/EditorUi.js:36312— EditorUi.EditorUi.applyEdgesText has cognitive complexity 125 (threshold 15). Drivers by points: if/else 29 (71 pts), loops 22 (25 pts), boolean chains 24, ternaries 5 (nesting depth added 45). Of this number, 116 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConnectionPointsDialog (cognitive 124) src/main/webapp/js/diagramly/Dialogs.js:24961— ConnectionPointsDialog has cognitive complexity 124 (threshold 15). Drivers by points: if/else 34 (44 pts), boolean chains 34, ternaries 20 (32 pts), loops 12 (14 pts) (nesting depth added 24). None of this is in the body itself: all 124 points belong to 29 function items inside it that branch (a function literal at line 25240, init, init::applyPointProp, …). 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.
handleCompoundShape (cognitive 124) REDACTED:1267— handleCompoundShape has cognitive complexity 124 (threshold 15). Drivers by points: if/else 28 (75 pts), loops 6 (20 pts), match/switch 4 (12 pts), boolean chains 11, error handling 1 (3 pts), ternaries 1 (3 pts) (nesting depth added 73). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.pasteCells (cognitive 122) src/main/webapp/js/diagramly/EditorUi.js:28720— EditorUi.EditorUi.pasteCells has cognitive complexity 122 (threshold 15). Drivers by points: if/else 27 (69 pts), error handling 6 (21 pts), boolean chains 18, ternaries 3 (10 pts), loops 1 (4 pts) (nesting depth added 67). Of this number, 107 points are the body's own statements and 15 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
dropAndConnect (cognitive 122) src/main/webapp/js/grapheditor/Sidebar.js:5793— dropAndConnect has cognitive complexity 122 (threshold 15). Drivers by points: if/else 26 (66 pts), ternaries 10 (28 pts), boolean chains 22, loops 1 (4 pts), error handling 1 (2 pts) (nesting depth added 62). Of this number, 121 points are the body's own statements and 1 belongs to 4 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
stripPendingInserts (cognitive 122) src/main/webapp/js/diagramly/DrawioFileSync.js:1983— stripPendingInserts has cognitive complexity 122 (threshold 15). Drivers by points: if/else 16 (55 pts), loops 12 (54 pts), boolean chains 7, ternaries 1 (6 pts) (nesting depth added 86). 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.
mxElectrical.mxShapeElectricalDualInLineIC.paintVertexShape (cognitive 121) src/main/webapp/shapes/mxElectrical.js:770— mxElectrical.mxShapeElectricalDualInLineIC.paintVertexShape has cognitive complexity 121 (threshold 15). Drivers by points: if/else 46 (100 pts), loops 4 (12 pts), boolean chains 8, match/switch 1 (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.
mxKubernetes.mxShapeKubernetesIcon2.paintVertexShape (cognitive 119) src/main/webapp/shapes/mxKubernetes.js:196— mxKubernetes.mxShapeKubernetesIcon2.paintVertexShape has cognitive complexity 119 (threshold 15). Drivers by points: if/else 80 (119 pts) (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Utils.checkStreamContent (cognitive 119) REDACTED:444— Utils.checkStreamContent has cognitive complexity 119 (threshold 15). Drivers by points: if/else 35 (77 pts), boolean chains 42 (nesting depth added 42). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.handleError (cognitive 118) src/main/webapp/js/diagramly/EditorUi.js:7701— EditorUi.EditorUi.handleError has cognitive complexity 118 (threshold 15). Drivers by points: if/else 28 (73 pts), boolean chains 23, ternaries 6 (15 pts), loops 1 (5 pts), error handling 1 (2 pts) (nesting depth added 59). Of this number, 93 points are the body's own statements and 25 belong to 6 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Editor.Editor.convertImages (cognitive 117) src/main/webapp/js/diagramly/Editor.js:6329— Editor.Editor.convertImages has cognitive complexity 117 (threshold 15). Drivers by points: if/else 36 (80 pts), boolean chains 19, loops 10 (11 pts), error handling 3 (5 pts), ternaries 2 (nesting depth added 47). Most of this is not in the body itself: 2 of the 117 points are its own statements and the rest belongs to 17 function items inside it that branch (a function literal at line 6527, a function literal at line 6362, a function literal at line 6676, …). 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.
EditorUi.EditorUi.print (cognitive 117) src/main/webapp/js/diagramly/EditorUi.js:29906— EditorUi.EditorUi.print has cognitive complexity 117 (threshold 15). Drivers by points: if/else 43 (81 pts), boolean chains 18, ternaries 6 (10 pts), loops 3 (8 pts) (nesting depth added 47). Of this number, 63 points are the body's own statements and 54 belong to 6 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.
Graph.Graph.connectVertex (cognitive 117) REDACTED:17522— Graph.Graph.connectVertex has cognitive complexity 117 (threshold 15). Drivers by points: if/else 42 (75 pts), boolean chains 30, ternaries 6 (9 pts), loops 2 (3 pts) (nesting depth added 37). Of this number, 61 points are the body's own statements and 56 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.mxChildChange.execute (cognitive 116) src/main/webapp/js/diagramly/EditorUi.js:22110— EditorUi.mxChildChange.execute has cognitive complexity 116 (threshold 15). Drivers by points: if/else 31 (83 pts), ternaries 13 (52 pts), boolean chains 26, loops 5 (17 pts) (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. This shape REPEATS in the file: one other method here (EditorUi.mxChildChange.execute::collect) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Graph.mxGraphView.updateLineJumps (cognitive 114) REDACTED:31567— Graph.mxGraphView.updateLineJumps has cognitive complexity 114 (threshold 15). Drivers by points: if/else 15 (53 pts), loops 7 (30 pts), boolean chains 21, ternaries 3 (10 pts) (nesting depth added 68). Of this number, 110 points are the body's own statements and 4 belong to one function item inside it that branches. 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.
handleWriteRevoked (cognitive 113) REDACTED:2338— handleWriteRevoked has cognitive complexity 113 (threshold 15). Drivers by points: if/else 19 (62 pts), loops 8 (36 pts), boolean chains 6, ternaries 2 (6 pts), error handling 2 (3 pts) (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.
mouseMove (cognitive 112) src/main/webapp/mxgraph/src/handler/mxGraphHandler.js:1237— mouseMove has cognitive complexity 112 (threshold 15). Drivers by points: if/else 29 (68 pts), boolean chains 34, ternaries 3 (10 pts) (nesting depth added 46). 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.
Graph.Graph.setTextColor (cognitive 111) REDACTED:3297— Graph.Graph.setTextColor has cognitive complexity 111 (threshold 15). Drivers by points: if/else 22 (52 pts), boolean chains 21, loops 12 (21 pts), ternaries 7 (15 pts), error handling 1 (2 pts) (nesting depth added 48). Of this number, 104 points are the body's own statements and 7 belong to 3 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
plainText (cognitive 111) REDACTED:3758— plainText has cognitive complexity 111 (threshold 15). Drivers by points: if/else 34 (61 pts), ternaries 12 (29 pts), boolean chains 16, loops 2 (5 pts) (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.
getXmlFile (cognitive 111) src/main/webapp/js/diagramly/DriveClient.js:1964— getXmlFile has cognitive complexity 111 (threshold 15). Drivers by points: if/else 31 (66 pts), boolean chains 16, ternaries 4 (16 pts), error handling 4 (13 pts) (nesting depth added 56). Most of this is not in the body itself: 8 of the 111 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 1986, a function literal at line 2112, a function literal at line 2070, …). 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.
showGitHubDialog (cognitive 111) src/main/webapp/js/diagramly/GitHubClient.js:896— showGitHubDialog has cognitive complexity 111 (threshold 15). Drivers by points: if/else 42 (64 pts), ternaries 10 (30 pts), boolean chains 9, loops 4 (8 pts) (nesting depth added 46). Most of this is not in the body itself: 2 of the 111 points are its own statements and the rest belongs to 38 function items inside it that branch (a function literal at line 1241, a function literal at line 1137, a function literal at line 1094, …). 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.
EditorUi.EditorUi.applyTableText (cognitive 108) src/main/webapp/js/diagramly/EditorUi.js:37416— EditorUi.EditorUi.applyTableText has cognitive complexity 108 (threshold 15). Drivers by points: if/else 21 (39 pts), ternaries 17 (39 pts), loops 14 (20 pts), boolean chains 10 (nesting depth added 46). Of this number, 106 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
updateTabContainer (cognitive 108) src/main/webapp/js/diagramly/Pages.js:3176— updateTabContainer has cognitive complexity 108 (threshold 15). Drivers by points: if/else 26 (71 pts), ternaries 7 (21 pts), boolean chains 11, loops 2 (5 pts) (nesting depth added 62). Of this number, 95 points are the body's own statements and 13 belong to 5 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
convertHtmlInlineToSvg (cognitive 107) src/main/webapp/mxgraph/src/util/mxUtils.js:6552— convertHtmlInlineToSvg has cognitive complexity 107 (threshold 15). Drivers by points: if/else 27 (80 pts), ternaries 4 (13 pts), boolean chains 12, loops 1 (2 pts) (nesting depth added 63). Of this number, 104 points are the body's own statements and 3 belong to one function item inside it that branches. 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.
EditorUi.EditorUi.fileLoaded (cognitive 106) src/main/webapp/js/diagramly/EditorUi.js:5256— EditorUi.EditorUi.fileLoaded has cognitive complexity 106 (threshold 15). Drivers by points: if/else 36 (71 pts), error handling 7 (21 pts), boolean chains 11, ternaries 1 (3 pts) (nesting depth added 51). Of this number, 72 points are the body's own statements and 34 belong to 4 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.
fireMouseEvent (cognitive 105) src/main/webapp/mxgraph/src/view/mxGraph.js:14371— fireMouseEvent has cognitive complexity 105 (threshold 15). Drivers by points: if/else 32 (68 pts), boolean chains 33, loops 1 (4 pts) (nesting depth added 39). Of this number, 102 points are the body's own statements and 3 belong to one function item inside it that branches. 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.
Sidebar.Sidebar.createDragSource (cognitive 103) src/main/webapp/js/grapheditor/Sidebar.js:6440— Sidebar.Sidebar.createDragSource has cognitive complexity 103 (threshold 15). Drivers by points: boolean chains 68, if/else 16 (20 pts), ternaries 6 (13 pts), loops 2 (nesting depth added 11). Of this number, 74 points are the body's own statements and 29 belong to 10 function items inside it that branch. 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.
constrainChild (cognitive 103) src/main/webapp/mxgraph/src/view/mxGraph.js:6979— constrainChild has cognitive complexity 103 (threshold 15). Drivers by points: if/else 23 (94 pts), loops 1 (5 pts), boolean chains 3, ternaries 1 (nesting depth added 75). 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.
patchPage (cognitive 102) src/main/webapp/js/diagramly/DiffSync.js:1111— patchPage has cognitive complexity 102 (threshold 15). Drivers by points: if/else 25 (53 pts), boolean chains 20, loops 8 (16 pts), ternaries 7 (13 pts) (nesting depth added 42). Of this number, 76 points are the body's own statements and 26 belong to 3 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
(anonymous) (cognitive 100) REDACTED:6410— (anonymous) has cognitive complexity 100 (threshold 15). Drivers by points: if/else 21 (36 pts), ternaries 13 (29 pts), boolean chains 23, loops 7 (8 pts), error handling 2 (4 pts) (nesting depth added 34). None of this is in the body itself: all 100 points belong to 37 function items inside it that branch (getIntAttr, toSmallCaps, getStyleString, …). 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.
updateButtonContainer (cognitive 100) src/main/webapp/js/diagramly/App.js:7908— updateButtonContainer has cognitive complexity 100 (threshold 15). Drivers by points: if/else 23 (69 pts), boolean chains 19, ternaries 3 (12 pts) (nesting depth added 55). Of this number, 99 points are the body's own statements and 1 belongs to 4 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
addSizeHandler (cognitive 100) REDACTED:1317— addSizeHandler has cognitive complexity 100 (threshold 15). Drivers by points: if/else 35 (56 pts), boolean chains 30, ternaries 7 (14 pts) (nesting depth added 28). Of this number, 23 points are the body's own statements and 77 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.createSvgImageSymbol (cognitive 99) REDACTED:6381— Graph.Graph.createSvgImageSymbol has cognitive complexity 99 (threshold 15). Drivers by points: if/else 12 (53 pts), loops 4 (27 pts), ternaries 2 (13 pts), boolean chains 4, error handling 1 (2 pts) (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.
addMenuHandler (cognitive 98) REDACTED:11542— addMenuHandler has cognitive complexity 98 (threshold 15). Drivers by points: if/else 27 (70 pts), boolean chains 26, ternaries 1 (2 pts) (nesting depth added 44). Most of this is not in the body itself: 10 of the 98 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 11702, 11550, 11632, …). 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.
diffPages (cognitive 98) src/main/webapp/js/diagramly/DiffSync.js:1944— diffPages has cognitive complexity 98 (threshold 15). Drivers by points: if/else 16 (49 pts), ternaries 8 (36 pts), boolean chains 7, loops 3 (6 pts) (nesting depth added 64). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
getFile (cognitive 98) src/main/webapp/js/diagramly/OneDriveClient.js:690— getFile has cognitive complexity 98 (threshold 15). Drivers by points: if/else 25 (61 pts), ternaries 5 (16 pts), boolean chains 13, error handling 2 (8 pts) (nesting depth added 53). Most of this is not in the body itself: 1 of the 98 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 719, 694, 837, …). 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.
move (cognitive 97) src/main/webapp/mxgraph/src/util/mxGuide.js:204— move has cognitive complexity 97 (threshold 15). Drivers by points: if/else 29 (70 pts), boolean chains 18, ternaries 3 (6 pts), loops 1 (3 pts) (nesting depth added 46). Of this number, 63 points are the body's own statements and 34 belong to 4 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
focusTabStopInDirection (cognitive 96) REDACTED:4456— focusTabStopInDirection has cognitive complexity 96 (threshold 15). Drivers by points: if/else 13 (40 pts), ternaries 10 (33 pts), boolean chains 13, error handling 1 (5 pts), loops 2 (5 pts) (nesting depth added 57). Of this number, 81 points are the body's own statements and 15 belong to one function literal inside it that branches. 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.
tick (cognitive 96) src/main/webapp/js/diagramly/SpringMove.js:1039— tick has cognitive complexity 96 (threshold 15). Drivers by points: ternaries 12 (52 pts), if/else 9 (26 pts), boolean chains 11, loops 5 (7 pts) (nesting depth added 59). 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.
SaveDialog::addStorageEntry (cognitive 93) src/main/webapp/js/diagramly/Dialogs.js:4595— SaveDialog::addStorageEntry has cognitive complexity 93 (threshold 15). Drivers by points: if/else 17 (59 pts), ternaries 5 (18 pts), boolean chains 16 (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.
createTooltip (cognitive 93) src/main/webapp/js/grapheditor/Sidebar.js:564— createTooltip has cognitive complexity 93 (threshold 15). Drivers by points: if/else 30 (45 pts), ternaries 14 (30 pts), boolean chains 18 (nesting depth added 31). Of this number, 49 points are the body's own statements and 44 belong to 14 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addCustomEntries (cognitive 93) src/main/webapp/js/diagramly/sidebar/Sidebar.js:1680— addCustomEntries has cognitive complexity 93 (threshold 15). Drivers by points: if/else 16 (56 pts), error handling 2 (13 pts), loops 3 (9 pts), boolean chains 8, ternaries 1 (7 pts) (nesting depth added 63). Most of this is not in the body itself: 14 of the 93 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 1696, 1714, 1761, …). 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.
styleChanged (cognitive 93) src/main/webapp/shapes/mxAtlassian2.js:611— styleChanged has cognitive complexity 93 (threshold 15). Drivers by points: ternaries 15 (51 pts), if/else 15 (33 pts), boolean chains 9 (nesting depth added 54). 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.
Extensions.createOrgChart (cognitive 92) REDACTED:14078— Extensions.createOrgChart has cognitive complexity 92 (threshold 15). Drivers by points: if/else 20 (41 pts), loops 13 (28 pts), boolean chains 13, match/switch 1 (4 pts), ternaries 2 (4 pts), error handling 2 (nesting depth added 41). Of this number, 73 points are the body's own statements and 19 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity· text (cognitive 92) · ×1
text (cognitive 92) REDACTED:3327— text has cognitive complexity 92 (threshold 15). Drivers by points: if/else 17 (57 pts), loops 2 (14 pts), boolean chains 12, ternaries 2 (9 pts) (nesting depth added 59). 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.
measure (cognitive 92) src/main/webapp/js/diagramly/tidy/Tidy.js:1023— measure has cognitive complexity 92 (threshold 15). Drivers by points: if/else 21 (48 pts), loops 16 (23 pts), boolean chains 21 (nesting depth added 34). Of this number, 78 points are the body's own statements and 14 belong to 4 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.
EditorUi.EditorUi.applyOutline (cognitive 91) src/main/webapp/js/diagramly/EditorUi.js:35311— EditorUi.EditorUi.applyOutline has cognitive complexity 91 (threshold 15). Drivers by points: if/else 20 (40 pts), loops 15 (24 pts), boolean chains 14, ternaries 5 (13 pts) (nesting depth added 37). Of this number, 77 points are the body's own statements and 14 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
executeRequest (cognitive 91) src/main/webapp/js/diagramly/DriveClient.js:356— executeRequest has cognitive complexity 91 (threshold 15). Drivers by points: if/else 31 (49 pts), boolean chains 23, ternaries 5 (12 pts), error handling 4 (5 pts), loops 1 (2 pts) (nesting depth added 27). Most of this is not in the body itself: 11 of the 91 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 450, 382, 429, …). 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.
EditorUi.EditorUi.getEmbedCellChange (cognitive 90) src/main/webapp/js/diagramly/EditorUi.js:20282— EditorUi.EditorUi.getEmbedCellChange has cognitive complexity 90 (threshold 15). Drivers by points: if/else 22 (61 pts), boolean chains 14, ternaries 4 (10 pts), loops 3 (5 pts) (nesting depth added 47). 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.
FilePropertiesDialog (cognitive 90) src/main/webapp/js/diagramly/Dialogs.js:24473— FilePropertiesDialog has cognitive complexity 90 (threshold 15). Drivers by points: if/else 33 (55 pts), ternaries 9 (18 pts), boolean chains 16, error handling 1 (nesting depth added 31). Of this number, 45 points are the body's own statements and 45 belong to 24 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity· main (cognitive 90) · ×1
main (cognitive 90) src/main/webapp/js/open.js:44— main has cognitive complexity 90 (threshold 15). Drivers by points: if/else 14 (58 pts), ternaries 5 (25 pts), loops 1 (4 pts), boolean chains 3 (nesting depth added 67). Most of this is not in the body itself: 4 of the 90 points are its own statements and the rest belongs to 14 function literals inside it that branch (lines 54, 166, 152, …). 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.
saveFile (cognitive 89) src/main/webapp/js/diagramly/App.js:6303— saveFile has cognitive complexity 89 (threshold 15). Drivers by points: if/else 24 (59 pts), boolean chains 15, error handling 2 (9 pts), ternaries 2 (6 pts) (nesting depth added 46). Of this number, 17 points are the body's own statements and 72 belong to 13 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
updateBullets (cognitive 89) src/main/webapp/js/diagramly/ForceExplorer.js:4632— updateBullets has cognitive complexity 89 (threshold 15). Drivers by points: ternaries 10 (41 pts), if/else 9 (32 pts), boolean chains 10, loops 2 (6 pts) (nesting depth added 58). 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.
EditorUi.EditorUi.applyExternalImages (cognitive 88) src/main/webapp/js/diagramly/EditorUi.js:19959— EditorUi.EditorUi.applyExternalImages has cognitive complexity 88 (threshold 15). Drivers by points: if/else 25 (63 pts), loops 10 (16 pts), boolean chains 8, ternaries 1 (nesting depth added 44). Of this number, 87 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
EmbedDialog (cognitive 88) src/main/webapp/js/diagramly/Dialogs.js:645— EmbedDialog has cognitive complexity 88 (threshold 15). Drivers by points: if/else 25 (40 pts), ternaries 10 (23 pts), boolean chains 14, error handling 3 (11 pts) (nesting depth added 36). Of this number, 26 points are the body's own statements and 62 belong to 8 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addTabDragListeners (cognitive 88) src/main/webapp/js/diagramly/Pages.js:3484— addTabDragListeners has cognitive complexity 88 (threshold 15). Drivers by points: if/else 20 (40 pts), boolean chains 21, loops 6 (18 pts), ternaries 3 (9 pts) (nesting depth added 38). None of this is in the body itself: all 88 points belong to 7 function items inside it that branch (a function literal at line 3648, a function literal at line 3575, a function literal at line 3489, …). 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.
mouseUp (cognitive 88) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:2023— mouseUp has cognitive complexity 88 (threshold 15). Drivers by points: if/else 24 (64 pts), boolean chains 19, ternaries 1 (5 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.
DrawioFile.DrawioFile.mergeFile (cognitive 87) REDACTED:644— DrawioFile.DrawioFile.mergeFile has cognitive complexity 87 (threshold 15). Drivers by points: if/else 17 (46 pts), ternaries 6 (23 pts), error handling 4 (10 pts), boolean chains 8 (nesting depth added 52). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cellSizeUpdated (cognitive 87) src/main/webapp/mxgraph/src/view/mxGraph.js:5878— cellSizeUpdated has cognitive complexity 87 (threshold 15). Drivers by points: if/else 21 (81 pts), boolean chains 3, ternaries 1 (3 pts) (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.
importLucidPage (cognitive 86) REDACTED:6641— importLucidPage has cognitive complexity 86 (threshold 15). Drivers by points: if/else 34 (69 pts), loops 10 (20 pts), boolean chains 13, ternaries 4, error handling 2 (3 pts) (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
findCommonProperties (cognitive 86) REDACTED:1614— findCommonProperties has cognitive complexity 86 (threshold 15). Drivers by points: if/else 15 (46 pts), loops 5 (19 pts), ternaries 2 (12 pts), boolean chains 7, error handling 1 (2 pts) (nesting depth added 56). Of this number, 33 points are the body's own statements and 53 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
connect (cognitive 86) src/main/webapp/mxgraph/src/handler/mxConnectionHandler.js:1918— connect has cognitive complexity 86 (threshold 15). Drivers by points: if/else 19 (50 pts), boolean chains 15, ternaries 3 (11 pts), loops 2 (8 pts), error handling 1 (2 pts) (nesting depth added 46). 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.
D2 · Cognitive Complexity· union (cognitive 86) · ×1
union (cognitive 86) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:1692— union has cognitive complexity 86 (threshold 15). Drivers by points: if/else 27 (59 pts), ternaries 6 (19 pts), boolean chains 8 (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.
EditorUi.mxTerminalChange.execute (cognitive 85) src/main/webapp/js/diagramly/EditorUi.js:21407— EditorUi.mxTerminalChange.execute has cognitive complexity 85 (threshold 15). Drivers by points: if/else 20 (45 pts), ternaries 6 (28 pts), boolean chains 12 (nesting depth added 47). 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.
convertTxt2Html (cognitive 85) REDACTED:3986— convertTxt2Html has cognitive complexity 85 (threshold 15). Drivers by points: if/else 62 (107 pts), boolean chains 35, loops 16 (34 pts), ternaries 7 (14 pts), match/switch 1 (3 pts), error handling 1 (2 pts) (nesting depth added 73). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity· fit (cognitive 85) · ×1
fit (cognitive 85) src/main/webapp/mxgraph/src/view/mxGraph.js:3039— fit has cognitive complexity 85 (threshold 15). Drivers by points: if/else 15 (45 pts), ternaries 12 (35 pts), boolean chains 5 (nesting depth added 53). 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.
convertFile (cognitive 85) src/main/webapp/js/diagramly/App.js:8893— convertFile has cognitive complexity 85 (threshold 15). Drivers by points: if/else 31 (64 pts), boolean chains 9, ternaries 1 (7 pts), loops 1 (3 pts), error handling 1 (2 pts) (nesting depth added 42). Of this number, 20 points are the body's own statements and 65 belong to 9 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
fileSaved (cognitive 85) src/main/webapp/js/diagramly/DrawioFileSync.js:4262— fileSaved has cognitive complexity 85 (threshold 15). Drivers by points: ternaries 11 (41 pts), if/else 14 (34 pts), boolean chains 10 (nesting depth added 50). Of this number, 63 points are the body's own statements and 22 belong to 3 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.
showLightbox (cognitive 84) REDACTED:2610— showLightbox has cognitive complexity 84 (threshold 15). Drivers by points: if/else 19 (52 pts), ternaries 6 (19 pts), boolean chains 13 (nesting depth added 46). Of this number, 78 points are the body's own statements and 6 belong to one function literal inside it that branches. 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.
addInsertTableCellItem (cognitive 84) src/main/webapp/js/grapheditor/Menus.js:589— addInsertTableCellItem has cognitive complexity 84 (threshold 15). Drivers by points: if/else 24 (46 pts), error handling 6 (19 pts), ternaries 5 (10 pts), boolean chains 9 (nesting depth added 40). Of this number, 23 points are the body's own statements and 61 belong to 7 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.
initMath (cognitive 83) src/main/webapp/js/diagramly/Editor.js:5317— initMath has cognitive complexity 83 (threshold 15). Drivers by points: if/else 21 (50 pts), loops 5 (14 pts), boolean chains 13, ternaries 2 (4 pts), error handling 1 (2 pts) (nesting depth added 41). Most of this is not in the body itself: 5 of the 83 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 5527, loadMath, onMathJaxDone, …). 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.
installInputHandler (cognitive 83) src/main/webapp/js/grapheditor/Format.js:683— installInputHandler has cognitive complexity 83 (threshold 15). Drivers by points: if/else 20 (52 pts), ternaries 8 (13 pts), loops 3 (11 pts), boolean chains 7 (nesting depth added 45). Most of this is not in the body itself: 6 of the 83 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 698, 802, 847, …). 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.
solveMovePreview (cognitive 83) src/main/webapp/js/diagramly/LibavoidRouting.js:3638— solveMovePreview has cognitive complexity 83 (threshold 15). Drivers by points: if/else 13 (31 pts), ternaries 14 (31 pts), loops 8 (11 pts), boolean chains 10 (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.
mouseMove (cognitive 83) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:1865— mouseMove has cognitive complexity 83 (threshold 15). Drivers by points: if/else 23 (52 pts), boolean chains 18, ternaries 4 (13 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.
Graph.Graph.clipSvgDataUri (cognitive 82) REDACTED:5184— Graph.Graph.clipSvgDataUri has cognitive complexity 82 (threshold 15). Drivers by points: if/else 15 (52 pts), error handling 3 (12 pts), loops 2 (10 pts), boolean chains 8 (nesting depth added 54). 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.
initGraph (cognitive 81) src/main/webapp/js/embed.dev.js:154— initGraph has cognitive complexity 81 (threshold 15). Drivers by points: if/else 77 (215 pts), boolean chains 31, ternaries 6 (19 pts), error handling 3 (7 pts), loops 2 (4 pts) (nesting depth added 157). 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.
EditorUi.EditorUi.insertTextAt (cognitive 80) src/main/webapp/js/diagramly/EditorUi.js:16965— EditorUi.EditorUi.insertTextAt has cognitive complexity 80 (threshold 15). Drivers by points: if/else 22 (64 pts), boolean chains 8, error handling 2 (8 pts) (nesting depth added 48). Of this number, 72 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
authorizeStep2 (cognitive 80) src/main/webapp/js/diagramly/DriveClient.js:1010— authorizeStep2 has cognitive complexity 80 (threshold 15). Drivers by points: if/else 27 (64 pts), error handling 3 (8 pts), boolean chains 5, ternaries 1 (3 pts) (nesting depth added 44). Of this number, 32 points are the body's own statements and 48 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
getPreviewPoints (cognitive 80) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:1311— getPreviewPoints has cognitive complexity 80 (threshold 15). Drivers by points: if/else 17 (64 pts), boolean chains 10, loops 1 (4 pts), ternaries 2 (nesting depth added 50). Of this number, 74 points are the body's own statements and 6 belong to one function item inside it that branches. 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.
EditorUi.EditorUi.installNativeClipboardHandler (cognitive 79) src/main/webapp/js/diagramly/EditorUi.js:24873— EditorUi.EditorUi.installNativeClipboardHandler has cognitive complexity 79 (threshold 15). Drivers by points: if/else 21 (41 pts), boolean chains 22, error handling 5 (10 pts), ternaries 1 (6 pts) (nesting depth added 30). Most of this is not in the body itself: 1 of the 79 points is its own statement and the rest belongs to 13 function literals inside it that branch (lines 24957, 25127, 25164, …). 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.
searchEntries (cognitive 79) src/main/webapp/js/grapheditor/Sidebar.js:2582— searchEntries has cognitive complexity 79 (threshold 15). Drivers by points: if/else 14 (38 pts), loops 10 (27 pts), boolean chains 14 (nesting depth added 41). Of this number, 77 points are the body's own statements and 2 belong to 2 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.
patchCellRecursive (cognitive 79) src/main/webapp/js/diagramly/DiffSync.js:1527— patchCellRecursive has cognitive complexity 79 (threshold 15). Drivers by points: if/else 18 (46 pts), loops 6 (14 pts), boolean chains 13, ternaries 3 (6 pts) (nesting depth added 39). Of this number, 39 points are the body's own statements and 40 belong to 2 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
addItem (cognitive 79) src/main/webapp/mxgraph/src/util/mxPopupMenu.js:217— addItem has cognitive complexity 79 (threshold 15). Drivers by points: if/else 27 (56 pts), boolean chains 13, error handling 1 (4 pts), ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 35). Of this number, 23 points are the body's own statements and 56 belong to 7 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.
createFooterMenuForTheme (cognitive 79) src/main/webapp/js/diagramly/SimpleClassic.js:106— createFooterMenuForTheme has cognitive complexity 79 (threshold 15). Drivers by points: ternaries 12 (51 pts), if/else 10 (24 pts), boolean chains 4 (nesting depth added 53). Of this number, 21 points are the body's own statements and 58 belong to 7 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
runWithDialog (cognitive 78) src/main/webapp/js/diagramly/ElkLayout.js:291— runWithDialog has cognitive complexity 78 (threshold 15). Drivers by points: if/else 41 (68 pts), boolean chains 24, ternaries 11 (17 pts), loops 8 (13 pts), error handling 1 (4 pts) (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.parseStyleRule (cognitive 77) REDACTED:18071— Graph.Graph.parseStyleRule has cognitive complexity 77 (threshold 15). Drivers by points: if/else 10 (35 pts), ternaries 7 (23 pts), boolean chains 10, loops 2 (9 pts) (nesting depth added 48). Of this number, 72 points are the body's own statements and 5 belong to one function item inside it that branches. 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.
ProxyServlet.doGet (cognitive 77) REDACTED:68— ProxyServlet.doGet has cognitive complexity 77 (threshold 15). Drivers by points: ternaries 11 (33 pts), if/else 13 (27 pts), error handling 4 (8 pts), boolean chains 6, loops 1 (3 pts) (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.
ImageDialog (cognitive 77) src/main/webapp/js/diagramly/Dialogs.js:5614— ImageDialog has cognitive complexity 77 (threshold 15). Drivers by points: if/else 33 (51 pts), ternaries 7 (14 pts), boolean chains 7, loops 2 (5 pts) (nesting depth added 28). Most of this is not in the body itself: 9 of the 77 points are its own statements and the rest belongs to 33 function items inside it that branch (insertImage, apply, filePicked, …). 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.
getColorSchemeStyles (cognitive 77) src/main/webapp/js/diagramly/Editor.js:10410— getColorSchemeStyles has cognitive complexity 77 (threshold 15). Drivers by points: if/else 20 (53 pts), boolean chains 18, ternaries 2 (4 pts), loops 2 (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.
addStroke (cognitive 77) src/main/webapp/js/grapheditor/Format.js:7782— addStroke has cognitive complexity 77 (threshold 15). Drivers by points: if/else 33 (40 pts), ternaries 14 (21 pts), boolean chains 12, loops 3 (4 pts) (nesting depth added 15). Most of this is not in the body itself: 9 of the 77 points are its own statements and the rest belongs to 26 function items inside it that branch (a function literal at line 8257, a function literal at line 7857, a function literal at line 8055, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cognitive 77) src/main/webapp/js/diagramly/App.js:458— (anonymous) has cognitive complexity 77 (threshold 15). Drivers by points: if/else 19 (60 pts), boolean chains 17 (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.
merge (cognitive 77) src/main/webapp/js/diagramly/DrawioFileSync.js:3246— merge has cognitive complexity 77 (threshold 15). Drivers by points: if/else 16 (41 pts), ternaries 7 (20 pts), boolean chains 10, error handling 2 (3 pts), loops 1 (3 pts) (nesting depth added 41). Of this number, 71 points are the body's own statements and 6 belong to 2 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.
EditorUi.EditorUi.replaceAlternateContent (cognitive 76) src/main/webapp/js/diagramly/EditorUi.js:9921— EditorUi.EditorUi.replaceAlternateContent has cognitive complexity 76 (threshold 15). Drivers by points: if/else 25 (55 pts), boolean chains 16, error handling 1 (3 pts), loops 2 (nesting depth added 32). Most of this is not in the body itself: 3 of the 76 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 9979, replaceElt, a function literal at line 10097, …). 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.
create (cognitive 76) src/main/webapp/js/diagramly/Editor.js:14624— create has cognitive complexity 76 (threshold 15). Drivers by points: if/else 35 (42 pts), boolean chains 14, ternaries 14, error handling 2 (3 pts), loops 1 (3 pts) (nesting depth added 10). Of this number, 59 points are the body's own statements and 17 belong to 15 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.
Dialogs.LibraryDialog::addButton (cognitive 75) src/main/webapp/js/diagramly/Dialogs.js:20059— Dialogs.LibraryDialog::addButton has cognitive complexity 75 (threshold 15). Drivers by points: if/else 23 (56 pts), loops 2 (7 pts), boolean chains 5, ternaries 1 (4 pts), error handling 2 (3 pts) (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. This shape REPEATS in the file: one other method here (Dialogs.LibraryDialog) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Graph.TableLayout.execute (cognitive 75) REDACTED:27179— Graph.TableLayout.execute has cognitive complexity 75 (threshold 15). Drivers by points: if/else 15 (43 pts), ternaries 4 (14 pts), loops 4 (11 pts), boolean chains 7 (nesting depth added 45). Of this number, 53 points are the body's own statements and 22 belong to one function literal inside it that branches. 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.
tick (cognitive 75) src/main/webapp/js/diagramly/ForceExplorer.js:3833— tick has cognitive complexity 75 (threshold 15). Drivers by points: if/else 14 (42 pts), ternaries 3 (20 pts), boolean chains 7, loops 4 (6 pts) (nesting depth added 47). 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.
authenticateStep2 (cognitive 75) src/main/webapp/js/diagramly/OneDriveClient.js:339— authenticateStep2 has cognitive complexity 75 (threshold 15). Drivers by points: if/else 20 (54 pts), error handling 2 (9 pts), ternaries 3 (9 pts), boolean chains 3 (nesting depth added 47). Most of this is not in the body itself: 2 of the 75 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 426, 356, 343, …). 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.
EditorUi.EditorUi.initializeEmbedMode (cognitive 74) src/main/webapp/js/diagramly/EditorUi.js:31217— EditorUi.EditorUi.initializeEmbedMode has cognitive complexity 74 (threshold 15). Drivers by points: if/else 14 (45 pts), loops 3 (15 pts), boolean chains 6, error handling 1 (4 pts), ternaries 1 (4 pts) (nesting depth added 49). Most of this is not in the body itself: 5 of the 74 points are its own statements and the rest belongs to one function literal inside it that branches (line 31228). 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.
Graph.Graph.removeTieReferences (cognitive 74) REDACTED:21131— Graph.Graph.removeTieReferences has cognitive complexity 74 (threshold 15). Drivers by points: if/else 12 (40 pts), loops 7 (18 pts), ternaries 4 (11 pts), boolean chains 5 (nesting depth added 46). 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.
Graph.mxConnector.paintCutCurve (cognitive 74) REDACTED:32018— Graph.mxConnector.paintCutCurve has cognitive complexity 74 (threshold 15). Drivers by points: if/else 23 (41 pts), boolean chains 14, loops 9 (10 pts), ternaries 4 (9 pts) (nesting depth added 24). Of this number, 39 points are the body's own statements and 35 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addInsertTableItem (cognitive 74) src/main/webapp/js/grapheditor/Menus.js:805— addInsertTableItem has cognitive complexity 74 (threshold 15). Drivers by points: if/else 15 (21 pts), loops 12 (20 pts), ternaries 13 (18 pts), boolean chains 15 (nesting depth added 19). Most of this is not in the body itself: 7 of the 74 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 1076, a function literal at line 831, selectSize, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cognitive 74) src/main/webapp/plugins/nextcloud.js:8— (anonymous) has cognitive complexity 74 (threshold 15). Drivers by points: if/else 30 (44 pts), boolean chains 12, error handling 6 (9 pts), ternaries 6 (8 pts), loops 1 (nesting depth added 19). None of this is in the body itself: all 74 points belong to 48 function items inside it that branch (saveFile, a function literal at line 13, a function literal at line 200, …). 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.
EditorUi.EditorUi.importXml (cognitive 73) src/main/webapp/js/diagramly/EditorUi.js:13999— EditorUi.EditorUi.importXml has cognitive complexity 73 (threshold 15). Drivers by points: if/else 16 (52 pts), loops 2 (8 pts), boolean chains 7, ternaries 2 (5 pts), error handling 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.
EditorUi.EditorUi.replaceLockedGroupChildren (cognitive 73) src/main/webapp/js/diagramly/EditorUi.js:14827— EditorUi.EditorUi.replaceLockedGroupChildren has cognitive complexity 73 (threshold 15). Drivers by points: if/else 17 (44 pts), loops 9 (15 pts), boolean chains 8, ternaries 6 (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.
EditorUi.EditorUi.encodeEmbedPng (cognitive 73) src/main/webapp/js/diagramly/EditorUi.js:19703— EditorUi.EditorUi.encodeEmbedPng has cognitive complexity 73 (threshold 15). Drivers by points: loops 12 (25 pts), if/else 12 (24 pts), ternaries 7 (22 pts), boolean chains 2 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.repairHasParentCycle (cognitive 73) src/main/webapp/js/diagramly/EditorUi.js:21720— EditorUi.repairHasParentCycle has cognitive complexity 73 (threshold 15). Drivers by points: if/else 34 (72 pts), ternaries 13 (30 pts), boolean chains 29, loops 9 (16 pts) (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. This shape REPEATS in the file: one other method here (EditorUi.repairHasParentCycle::capturePage) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.ColorDialog (cognitive 73) REDACTED:348— Dialogs.ColorDialog has cognitive complexity 73 (threshold 15). Drivers by points: if/else 137 (255 pts), boolean chains 58, ternaries 8 (10 pts), loops 2 (3 pts) (nesting depth added 121). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (Dialogs.ColorDialog::setDefaultSelected, Dialogs.ColorDialog::inputChanged, Dialogs.ColorDialog::addCurrentToRecent) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Graph.Graph.addFlowRingsToNode (cognitive 73) REDACTED:23688— Graph.Graph.addFlowRingsToNode has cognitive complexity 73 (threshold 15). Drivers by points: if/else 16 (45 pts), loops 5 (13 pts), boolean chains 11, ternaries 3 (4 pts) (nesting depth added 38). Of this number, 71 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
mxElectrical.mxShapeElectricalQFPIC.paintVertexShape (cognitive 73) src/main/webapp/shapes/mxElectrical.js:1168— mxElectrical.mxShapeElectricalQFPIC.paintVertexShape has cognitive complexity 73 (threshold 15). Drivers by points: if/else 19 (35 pts), match/switch 9 (26 pts), loops 4 (8 pts), boolean chains 4 (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.
NewDialog (cognitive 73) src/main/webapp/js/diagramly/Dialogs.js:2386— NewDialog has cognitive complexity 73 (threshold 15). Drivers by points: if/else 186 (373 pts), ternaries 42 (74 pts), boolean chains 70, loops 18 (56 pts), error handling 1 (3 pts) (nesting depth added 259). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CreateDialog (cognitive 73) src/main/webapp/js/diagramly/Dialogs.js:5029— CreateDialog has cognitive complexity 73 (threshold 15). Drivers by points: if/else 51 (76 pts), boolean chains 24, ternaries 12 (18 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addStyles (cognitive 73) src/main/webapp/js/diagramly/Editor.js:10137— addStyles has cognitive complexity 73 (threshold 15). Drivers by points: if/else 21 (41 pts), ternaries 9 (20 pts), loops 3 (7 pts), boolean chains 5 (nesting depth added 35). Of this number, 18 points are the body's own statements and 55 belong to 9 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.
onKeyDown (cognitive 73) REDACTED:3556— onKeyDown has cognitive complexity 73 (threshold 15). Drivers by points: if/else 18 (40 pts), ternaries 4 (20 pts), boolean chains 9, error handling 1 (4 pts) (nesting depth added 41). Of this number, 47 points are the body's own statements and 26 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
patchRealtime (cognitive 73) src/main/webapp/js/diagramly/DrawioFileSync.js:2240— patchRealtime has cognitive complexity 73 (threshold 15). Drivers by points: if/else 8 (30 pts), ternaries 7 (28 pts), loops 2 (9 pts), boolean chains 6 (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.
(anonymous) (cognitive 73) src/main/webapp/plugins/replay.js:10— (anonymous) has cognitive complexity 73 (threshold 15). Drivers by points: if/else 22 (50 pts), error handling 3 (10 pts), loops 3 (9 pts), ternaries 2 (3 pts), boolean chains 1 (nesting depth added 42). Most of this is not in the body itself: 5 of the 73 points are its own statements and the rest belongs to 18 function items inside it that branch (a function literal at line 191, processDelta, a function literal at line 146, …). 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.
Editor.Editor.extractGraphModelFromPdf (cognitive 72) src/main/webapp/js/diagramly/Editor.js:3120— Editor.Editor.extractGraphModelFromPdf has cognitive complexity 72 (threshold 15). Drivers by points: if/else 19 (47 pts), loops 4 (9 pts), boolean chains 8, error handling 2 (7 pts), ternaries 1 (nesting depth added 38). Of this number, 65 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.showExportDialog (cognitive 72) src/main/webapp/js/diagramly/EditorUi.js:11787— EditorUi.EditorUi.showExportDialog has cognitive complexity 72 (threshold 15). Drivers by points: if/else 95 (159 pts), boolean chains 53, ternaries 10 (13 pts), loops 4 (8 pts) (nesting depth added 71). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (EditorUi.EditorUi.showExportDialog::getPresetValues, EditorUi.EditorUi.showExportDialog::setPresetValues) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxGraphMlCodec.mxGraphMlCodec.importNode (cognitive 72) REDACTED:739— mxGraphMlCodec.mxGraphMlCodec.importNode has cognitive complexity 72 (threshold 15). Drivers by points: if/else 19 (56 pts), loops 5 (14 pts), boolean chains 2 (nesting depth added 46). 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.
getCellOptions (cognitive 72) src/main/webapp/js/grapheditor/InlineToolbar.js:4345— getCellOptions has cognitive complexity 72 (threshold 15). Drivers by points: if/else 19 (31 pts), ternaries 9 (29 pts), boolean chains 7, error handling 1 (3 pts), loops 1 (2 pts) (nesting depth added 35). Of this number, 69 points are the body's own statements and 3 belong to 5 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
redrawHandles (cognitive 72) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:1947— redrawHandles has cognitive complexity 72 (threshold 15). Drivers by points: if/else 18 (32 pts), boolean chains 18, ternaries 5 (16 pts), loops 3 (6 pts) (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.
resize (cognitive 72) src/main/webapp/mxgraph/src/view/mxCellEditor.js:540— resize has cognitive complexity 72 (threshold 15). Drivers by points: if/else 18 (44 pts), boolean chains 14, ternaries 7 (14 pts) (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
GraphViewer.GraphViewer.getModelNodeBounds (cognitive 71) REDACTED:3430— GraphViewer.GraphViewer.getModelNodeBounds has cognitive complexity 71 (threshold 15). Drivers by points: if/else 15 (45 pts), loops 8 (20 pts), boolean chains 17, ternaries 4 (7 pts) (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.
replay.Draw.loadPlugin() (cognitive 71) src/main/webapp/plugins/replay.js:10— replay.Draw.loadPlugin() has cognitive complexity 71 (threshold 15). Drivers by points: if/else 22 (50 pts), error handling 3 (10 pts), loops 3 (9 pts), boolean chains 1, ternaries 1 (nesting depth added 41). Most of this is not in the body itself: 5 of the 71 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 191, processDelta, decodeChanges, …). 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.
updateLanguages (cognitive 71) src/main/webapp/js/diagramly/LightboxModern.js:2240— updateLanguages has cognitive complexity 71 (threshold 15). Drivers by points: if/else 11 (36 pts), ternaries 4 (15 pts), boolean chains 11, loops 4 (9 pts) (nesting depth added 41). Of this number, 69 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
Dialogs.MarkupDialog (cognitive 70) REDACTED:2571— Dialogs.MarkupDialog has cognitive complexity 70 (threshold 15). Drivers by points: if/else 37 (43 pts), boolean chains 10, ternaries 5 (7 pts), loops 3 (6 pts), error handling 2 (4 pts) (nesting depth added 13). Most of this is not in the body itself: 5 of the 70 points are its own statements and the rest belongs to 20 function items inside it that branch (applyFormat, a function literal at line 2774, a function literal at line 2896, …). 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.
Graph.mxGraphView.updateTieLayout (cognitive 70) REDACTED:33655— Graph.mxGraphView.updateTieLayout has cognitive complexity 70 (threshold 15). Drivers by points: ternaries 19 (51 pts), if/else 5 (9 pts), boolean chains 7, loops 3 (nesting depth added 36). Of this number, 60 points are the body's own statements and 10 belong to one function literal inside it that branches. 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.
cellsAdded (cognitive 69) src/main/webapp/mxgraph/src/view/mxGraph.js:4951— cellsAdded has cognitive complexity 69 (threshold 15). Drivers by points: if/else 13 (48 pts), boolean chains 10, ternaries 3 (9 pts), loops 1 (2 pts) (nesting depth added 42). Of this number, 65 points are the body's own statements and 4 belong to one function item inside it that branches. 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.
updateSelectionStateForCell (cognitive 68) REDACTED:2047— updateSelectionStateForCell has cognitive complexity 68 (threshold 15). Drivers by points: if/else 17 (36 pts), boolean chains 24, ternaries 2 (8 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.
keyDown (cognitive 68) src/main/webapp/mxgraph/src/util/mxPopupMenu.js:1052— keyDown has cognitive complexity 68 (threshold 15). Drivers by points: if/else 16 (29 pts), ternaries 5 (19 pts), boolean chains 17, loops 1 (3 pts) (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
EditorUi.EditorUi.exportSvg (cognitive 67) src/main/webapp/js/diagramly/EditorUi.js:9661— EditorUi.EditorUi.exportSvg has cognitive complexity 67 (threshold 15). Drivers by points: if/else 22 (43 pts), ternaries 6 (13 pts), boolean chains 9, error handling 1 (2 pts) (nesting depth added 29). Most of this is not in the body itself: 14 of the 67 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 9729, 9819, 9867, …). 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.
Format.BaseFormatPanel.installInputHandler.update (cognitive 67) src/main/webapp/js/grapheditor/Format.js:698— Format.BaseFormatPanel.installInputHandler.update has cognitive complexity 67 (threshold 15). Drivers by points: if/else 18 (49 pts), loops 3 (11 pts), boolean chains 6, ternaries 1 (nesting depth added 39). Of this number, 63 points are the body's own statements and 4 belong to one function literal inside it that branches. 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.
Graph.mxStencilRegistry.getStencil (cognitive 67) REDACTED:34135— Graph.mxStencilRegistry.getStencil has cognitive complexity 67 (threshold 15). Drivers by points: if/else 12 (52 pts), error handling 1 (8 pts), loops 1 (5 pts), boolean chains 2 (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.
limitFill (cognitive 67) src/main/webapp/js/diagramly/Editor.js:2355— limitFill has cognitive complexity 67 (threshold 15). Drivers by points: ternaries 8 (40 pts), if/else 9 (26 pts), boolean chains 1 (nesting depth added 49). 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.
getEdgeShapeOutline (cognitive 67) src/main/webapp/mxgraph/src/view/mxGraph.js:12416— getEdgeShapeOutline has cognitive complexity 67 (threshold 15). Drivers by points: if/else 18 (30 pts), loops 9 (14 pts), ternaries 4 (13 pts), boolean chains 9, error handling 1 (nesting depth added 26). Of this number, 54 points are the body's own statements and 13 belong to 9 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
createRouteEdges (cognitive 67) src/main/webapp/js/diagramly/LibavoidRouting.js:1990— createRouteEdges has cognitive complexity 67 (threshold 15). Drivers by points: ternaries 15 (42 pts), if/else 6 (14 pts), boolean chains 9, loops 2 (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.
collect::visit (cognitive 67) src/main/webapp/js/diagramly/tidy/Tidy.js:327— collect::visit has cognitive complexity 67 (threshold 15). Drivers by points: if/else 19 (56 pts), boolean chains 10, 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.
libavoid-routing.AvoidRouting.withOutsideLabels (cognitive 66) src/main/webapp/js/libavoid-js/libavoid-routing.js:602— libavoid-routing.AvoidRouting.withOutsideLabels has cognitive complexity 66 (threshold 15). Drivers by points: ternaries 8 (26 pts), if/else 17 (23 pts), boolean chains 11, loops 5 (6 pts) (nesting depth added 25). Of this number, 46 points are the body's own statements and 20 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
create.cellListField (cognitive 66) src/main/webapp/js/diagramly/Dialogs.js:7103— create.cellListField has cognitive complexity 66 (threshold 15). Drivers by points: if/else 20 (31 pts), boolean chains 17, ternaries 6 (12 pts), loops 3 (6 pts) (nesting depth added 20). Most of this is not in the body itself: 8 of the 66 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 7223, updateChip, missingIds, …). 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.
FreehandWindow (cognitive 66) src/main/webapp/js/diagramly/Dialogs.js:11181— FreehandWindow has cognitive complexity 66 (threshold 15). Drivers by points: if/else 23 (32 pts), ternaries 19 (27 pts), boolean chains 7 (nesting depth added 17). Most of this is not in the body itself: 10 of the 66 points are its own statements and the rest belongs to 21 function items inside it that branch (updateMode, updateName, startDrawing, …). 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.
exportToCanvas (cognitive 66) src/main/webapp/js/diagramly/Editor.js:8005— exportToCanvas has cognitive complexity 66 (threshold 15). Drivers by points: if/else 28 (39 pts), ternaries 8 (10 pts), error handling 7 (9 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 18). Most of this is not in the body itself: 13 of the 66 points are its own statements and the rest belongs to 12 function items inside it that branch (a function literal at line 8060, (anonymous)::(anonymous)::onload, a function literal at line 8237, …). 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.
start (cognitive 66) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:647— start has cognitive complexity 66 (threshold 15). Drivers by points: if/else 16 (43 pts), boolean chains 12, ternaries 2 (7 pts), loops 1 (4 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.
EditorUi.EditorUi.anonymizePatch (cognitive 65) src/main/webapp/js/diagramly/EditorUi.js:3451— EditorUi.EditorUi.anonymizePatch has cognitive complexity 65 (threshold 15). Drivers by points: if/else 14 (53 pts), loops 3 (9 pts), error handling 1 (3 pts) (nesting depth added 47). Of this number, 27 points are the body's own statements and 38 belong to one function literal inside it that branches. 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.
EditorUi.EditorUi.setFileData (cognitive 65) src/main/webapp/js/diagramly/EditorUi.js:3932— EditorUi.EditorUi.setFileData has cognitive complexity 65 (threshold 15). Drivers by points: if/else 13 (36 pts), loops 3 (10 pts), boolean chains 9, ternaries 3 (7 pts), error handling 1 (3 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.
EditorUi.EditorUi.showConfigurationEditorDialog (cognitive 65) src/main/webapp/js/diagramly/EditorUi.js:6918— EditorUi.EditorUi.showConfigurationEditorDialog has cognitive complexity 65 (threshold 15). Drivers by points: if/else 31 (39 pts), boolean chains 11, error handling 5 (6 pts), ternaries 4 (5 pts), loops 2 (4 pts) (nesting depth added 12). Of this number, 23 points are the body's own statements and 42 belong to 10 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.
Extensions.convertText (cognitive 65) REDACTED:4549— Extensions.convertText has cognitive complexity 65 (threshold 15). Drivers by points: if/else 20 (41 pts), boolean chains 11, ternaries 4 (7 pts), error handling 1 (3 pts), loops 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.
paintForeground (cognitive 65) src/main/webapp/js/grapheditor/Shapes.js:8621— paintForeground has cognitive complexity 65 (threshold 15). Drivers by points: if/else 25 (44 pts), ternaries 5 (14 pts), boolean chains 7 (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.
createPopover (cognitive 65) src/main/webapp/js/grapheditor/InlineToolbar.js:1517— createPopover has cognitive complexity 65 (threshold 15). Drivers by points: boolean chains 21, ternaries 10 (21 pts), if/else 17 (20 pts), loops 2 (3 pts) (nesting depth added 15). Most of this is not in the body itself: 3 of the 65 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 1602, a function literal at line 1821, a function literal at line 1585, …). 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.
recordMenus (cognitive 65) src/main/webapp/js/grapheditor/Omnibox.js:1026— recordMenus has cognitive complexity 65 (threshold 15). Drivers by points: if/else 11 (26 pts), ternaries 6 (19 pts), boolean chains 10, loops 3 (7 pts), error handling 1 (3 pts) (nesting depth added 34). Of this number, 55 points are the body's own statements and 10 belong to 5 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
EditorUi.EditorUi.importFiles (cognitive 64) src/main/webapp/js/diagramly/EditorUi.js:17625— EditorUi.EditorUi.importFiles has cognitive complexity 64 (threshold 15). Drivers by points: if/else 16 (33 pts), boolean chains 21, loops 4 (10 pts) (nesting depth added 23). Most of this is not in the body itself: 14 of the 64 points are its own statements and the rest belongs to 9 function literals inside it that branch (lines 17765, 17715, 17662, …). 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.
mxGraph.mxGraph.disconnectGraph (cognitive 64) src/main/webapp/mxgraph/src/view/mxGraph.js:7671— mxGraph.mxGraph.disconnectGraph has cognitive complexity 64 (threshold 15). Drivers by points: if/else 8 (39 pts), loops 4 (18 pts), boolean chains 7 (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.
addTable (cognitive 64) src/main/webapp/js/grapheditor/Format.js:2460— addTable has cognitive complexity 64 (threshold 15). Drivers by points: if/else 28 (41 pts), error handling 6 (12 pts), boolean chains 7, ternaries 2 (4 pts) (nesting depth added 21). Of this number, 34 points are the body's own statements and 30 belong to 6 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.
applySharedState (cognitive 64) src/main/webapp/js/diagramly/ForceExplorer.js:1700— applySharedState has cognitive complexity 64 (threshold 15). Drivers by points: if/else 9 (20 pts), ternaries 6 (18 pts), boolean chains 16, loops 4 (10 pts) (nesting depth added 29). Of this number, 60 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.createContainerChildLayout (cognitive 63) src/main/webapp/js/diagramly/EditorUi.js:31886— EditorUi.EditorUi.createContainerChildLayout has cognitive complexity 63 (threshold 15). Drivers by points: if/else 15 (53 pts), loops 2 (6 pts), boolean chains 4 (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.
mxFreehand.mxFreehand (cognitive 63) src/main/webapp/js/diagramly/mxFreehand.js:5— mxFreehand.mxFreehand has cognitive complexity 63 (threshold 15). Drivers by points: if/else 19 (26 pts), boolean chains 20, loops 5 (12 pts), ternaries 3 (5 pts) (nesting depth added 16). Most of this is not in the body itself: 10 of the 63 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 396, updateSvgPath, a function literal at line 158, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
(anonymous) (cognitive 63) REDACTED:3794— (anonymous) has cognitive complexity 63 (threshold 15). Drivers by points: if/else 24 (37 pts), boolean chains 17, loops 4 (5 pts), match/switch 1 (2 pts), error handling 1, ternaries 1 (nesting depth added 15). None of this is in the body itself: all 63 points belong to 26 function items inside it that branch (mxVsdxGeometry, processGeoElem, getIndex, …). 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.
Graph.HoverIcons.repaint (cognitive 62) REDACTED:24638— Graph.HoverIcons.repaint has cognitive complexity 62 (threshold 15). Drivers by points: if/else 22 (54 pts), boolean chains 8 (nesting depth added 32). Of this number, 38 points are the body's own statements and 24 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
EditorUi (cognitive 62) REDACTED:7— EditorUi has cognitive complexity 62 (threshold 15). Drivers by points: if/else 102 (259 pts), boolean chains 76, loops 7 (21 pts), error handling 6 (16 pts), ternaries 3 (6 pts) (nesting depth added 184). 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.
installShapePicker (cognitive 62) REDACTED:2165— installShapePicker has cognitive complexity 62 (threshold 15). Drivers by points: if/else 20 (34 pts), boolean chains 18, loops 2 (6 pts), ternaries 2 (4 pts) (nesting depth added 20). Most of this is not in the body itself: 1 of the 62 points is its own statement and the rest belongs to 29 function items inside it that branch (dblClick, a function literal at line 2427, a function literal at line 2349, …). 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.
getAlternateTextLines (cognitive 62) REDACTED:489— getAlternateTextLines has cognitive complexity 62 (threshold 15). Drivers by points: loops 6 (22 pts), if/else 9 (19 pts), boolean chains 12, ternaries 3 (9 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
diffCell (cognitive 62) src/main/webapp/js/diagramly/DiffSync.js:2563— diffCell has cognitive complexity 62 (threshold 15). Drivers by points: ternaries 13 (27 pts), if/else 18 (24 pts), boolean chains 11 (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.
addPopupMenuCellItems (cognitive 62) src/main/webapp/js/grapheditor/Menus.js:1781— addPopupMenuCellItems has cognitive complexity 62 (threshold 15). Drivers by points: if/else 12 (38 pts), boolean chains 18, ternaries 1 (6 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.
Editor.Editor.repairTruncatedXml (cognitive 61) src/main/webapp/js/grapheditor/Editor.js:779— Editor.Editor.repairTruncatedXml has cognitive complexity 61 (threshold 15). Drivers by points: if/else 19 (47 pts), loops 4 (10 pts), boolean chains 4 (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.
extractGraphModel (cognitive 61) src/main/webapp/js/diagramly/Editor.js:2926— extractGraphModel has cognitive complexity 61 (threshold 15). Drivers by points: if/else 20 (44 pts), boolean chains 11, loops 1 (3 pts), ternaries 1 (3 pts) (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.
alignCells (cognitive 61) src/main/webapp/mxgraph/src/view/mxGraph.js:3741— alignCells has cognitive complexity 61 (threshold 15). Drivers by points: if/else 24 (50 pts), loops 2 (6 pts), boolean chains 5 (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.
SequenceMessage (cognitive 61) src/main/webapp/js/grapheditor/Shapes.js:4257— SequenceMessage has cognitive complexity 61 (threshold 15). Drivers by points: ternaries 11 (22 pts), boolean chains 18, if/else 11 (18 pts), loops 1 (3 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.
D2 · Cognitive Complexity· plan (cognitive 61) · ×1
plan (cognitive 61) src/main/webapp/js/diagramly/tidy/Tidy.js:1412— plan has cognitive complexity 61 (threshold 15). Drivers by points: boolean chains 29, if/else 11 (20 pts), ternaries 4 (8 pts), loops 2 (3 pts), match/switch 1 (nesting depth added 14). 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.
TrianglePerimeter (cognitive 61) src/main/webapp/mxgraph/src/view/mxPerimeter.js:313— TrianglePerimeter has cognitive complexity 61 (threshold 15). Drivers by points: if/else 21 (30 pts), ternaries 7 (19 pts), boolean chains 12 (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.
findAnimatedPaths (cognitive 60) src/main/webapp/js/diagramly/gif/AnimatedExport.js:254— findAnimatedPaths has cognitive complexity 60 (threshold 15). Drivers by points: if/else 10 (32 pts), ternaries 5 (22 pts), boolean chains 5, loops 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.
Dialogs.SelectorChips.create.cellListField (cognitive 59) src/main/webapp/js/diagramly/Dialogs.js:7103— Dialogs.SelectorChips.create.cellListField has cognitive complexity 59 (threshold 15). Drivers by points: if/else 20 (31 pts), boolean chains 17, loops 3 (6 pts), ternaries 3 (5 pts) (nesting depth added 16). Most of this is not in the body itself: 8 of the 59 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 7223, updateChip, missingIds, …). 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.
EditorUi.EditorUi.generateOpenAiMermaidDiagram.fn (cognitive 59) src/main/webapp/js/diagramly/EditorUi.js:15377— EditorUi.EditorUi.generateOpenAiMermaidDiagram.fn has cognitive complexity 59 (threshold 15). Drivers by points: if/else 19 (40 pts), boolean chains 7, error handling 2 (6 pts), ternaries 2 (6 pts) (nesting depth added 29). Most of this is not in the body itself: 1 of the 59 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 15446, 15440, 15384, …). 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.
EditorUi.EditorUi.applyListText (cognitive 59) src/main/webapp/js/diagramly/EditorUi.js:36892— EditorUi.EditorUi.applyListText has cognitive complexity 59 (threshold 15). Drivers by points: if/else 14 (35 pts), loops 6 (10 pts), ternaries 6 (8 pts), boolean chains 6 (nesting depth added 27). Of this number, 55 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.getTransparentChildBounds (cognitive 59) REDACTED:21400— Graph.Graph.getTransparentChildBounds has cognitive complexity 59 (threshold 15). Drivers by points: if/else 16 (49 pts), loops 2 (5 pts), boolean chains 3, ternaries 2 (nesting depth added 36). Of this number, 58 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
createCss (cognitive 59) REDACTED:2351— createCss has cognitive complexity 59 (threshold 15). Drivers by points: if/else 26 (36 pts), ternaries 7 (12 pts), boolean chains 11 (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.
keepLockedGeometries (cognitive 59) src/main/webapp/js/diagramly/LayoutPicker.js:732— keepLockedGeometries has cognitive complexity 59 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 20, loops 5 (9 pts), ternaries 3 (5 pts) (nesting depth added 14). None of this is in the body itself: all 59 points belong to 8 function items inside it that branch (a function literal at line 734, (anonymous)::setGeometry, (anonymous)::check, …). 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.
removeOverlaps (cognitive 59) src/main/webapp/js/diagramly/tidy/Tidy.js:2004— removeOverlaps has cognitive complexity 59 (threshold 15). Drivers by points: if/else 14 (29 pts), ternaries 5 (12 pts), boolean chains 11, loops 6 (7 pts) (nesting depth added 23). Of this number, 45 points are the body's own statements and 14 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getResults (cognitive 59) src/main/webapp/js/grapheditor/Omnibox.js:2316— getResults has cognitive complexity 59 (threshold 15). Drivers by points: if/else 13 (29 pts), loops 6 (15 pts), ternaries 3 (13 pts), boolean chains 2 (nesting depth added 35). Of this number, 52 points are the body's own statements and 7 belong to one function literal inside it that branches. 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.
Editor.Editor.drawSvgWithHtmlInCanvas (cognitive 58) src/main/webapp/js/diagramly/Editor.js:7735— Editor.Editor.drawSvgWithHtmlInCanvas has cognitive complexity 58 (threshold 15). Drivers by points: if/else 21 (36 pts), loops 8 (11 pts), boolean chains 6, error handling 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 20). Of this number, 32 points are the body's own statements and 26 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.parseHtmlData (cognitive 58) src/main/webapp/js/diagramly/EditorUi.js:29788— EditorUi.EditorUi.parseHtmlData has cognitive complexity 58 (threshold 15). Drivers by points: if/else 14 (43 pts), error handling 1 (6 pts), boolean chains 3, loops 1 (3 pts), ternaries 1 (3 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.
mxGraphHandler.mxGraphHandler.getStateBounds (cognitive 58) src/main/webapp/mxgraph/src/handler/mxGraphHandler.js:839— mxGraphHandler.mxGraphHandler.getStateBounds has cognitive complexity 58 (threshold 15). Drivers by points: if/else 12 (48 pts), loops 2 (8 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.
getDropAndConnectGeometry (cognitive 58) src/main/webapp/js/grapheditor/Sidebar.js:6038— getDropAndConnectGeometry has cognitive complexity 58 (threshold 15). Drivers by points: if/else 23 (51 pts), boolean chains 7 (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.
setStyle (cognitive 58) src/main/webapp/mxgraph/src/util/mxUtils.js:4867— setStyle has cognitive complexity 58 (threshold 15). Drivers by points: if/else 13 (25 pts), ternaries 5 (23 pts), boolean chains 6, loops 1 (4 pts) (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
mxFreehand::stopDrawing (cognitive 58) src/main/webapp/js/diagramly/mxFreehand.js:236— mxFreehand::stopDrawing has cognitive complexity 58 (threshold 15). Drivers by points: if/else 12 (35 pts), loops 5 (13 pts), boolean chains 5, ternaries 1 (5 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.
Graph.Graph.sanitizeElkLayoutOptions (cognitive 57) REDACTED:14995— Graph.Graph.sanitizeElkLayoutOptions has cognitive complexity 57 (threshold 15). Drivers by points: if/else 13 (40 pts), boolean chains 8, loops 2 (5 pts), ternaries 1 (4 pts) (nesting depth added 33). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
mxBasic.mxShapeBasicPatternFillRect.paintVertexShape (cognitive 57) src/main/webapp/shapes/mxBasic.js:3642— mxBasic.mxShapeBasicPatternFillRect.paintVertexShape has cognitive complexity 57 (threshold 15). Drivers by points: if/else 24 (41 pts), boolean chains 8, loops 4 (8 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.
PluginsDialog (cognitive 57) src/main/webapp/js/diagramly/Dialogs.js:18811— PluginsDialog has cognitive complexity 57 (threshold 15). Drivers by points: if/else 24 (43 pts), loops 3 (7 pts), boolean chains 6, ternaries 1 (nesting depth added 23). Of this number, 16 points are the body's own statements and 41 belong to 15 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
init (cognitive 57) src/main/webapp/js/grapheditor/Format.js:2310— init has cognitive complexity 57 (threshold 15). Drivers by points: if/else 18 (43 pts), boolean chains 10, ternaries 1 (4 pts) (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.
sanitizePageTerminals (cognitive 57) src/main/webapp/js/diagramly/DrawioFileSync.js:2831— sanitizePageTerminals has cognitive complexity 57 (threshold 15). Drivers by points: if/else 11 (43 pts), boolean chains 7, loops 3 (7 pts) (nesting depth added 36). Of this number, 51 points are the body's own statements and 6 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.
mapObject (cognitive 57) REDACTED:545— mapObject has cognitive complexity 57 (threshold 15). Drivers by points: if/else 14 (32 pts), error handling 1 (6 pts), ternaries 1 (6 pts), loops 3 (5 pts), match/switch 1 (5 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.
DrawioFileSync.DrawioFileSync.handleMessageData (cognitive 56) src/main/webapp/js/diagramly/DrawioFileSync.js:985— DrawioFileSync.DrawioFileSync.handleMessageData has cognitive complexity 56 (threshold 15). Drivers by points: if/else 21 (43 pts), ternaries 2 (8 pts), boolean chains 5 (nesting depth added 28). 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.
EditorUi.EditorUi.getXmlFileData (cognitive 56) src/main/webapp/js/diagramly/EditorUi.js:3173— EditorUi.EditorUi.getXmlFileData has cognitive complexity 56 (threshold 15). Drivers by points: if/else 14 (38 pts), ternaries 2 (6 pts), boolean chains 5, error handling 1 (4 pts), loops 1 (3 pts) (nesting depth added 33). Of this number, 36 points are the body's own statements and 20 belong to one function item inside it that branches. 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.
EditorUi.EditorUi.openFileHandle (cognitive 56) src/main/webapp/js/diagramly/EditorUi.js:30752— EditorUi.EditorUi.openFileHandle has cognitive complexity 56 (threshold 15). Drivers by points: if/else 20 (37 pts), boolean chains 7, error handling 2 (6 pts), ternaries 2 (6 pts) (nesting depth added 25). Of this number, 39 points are the body's own statements and 17 belong to 2 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.
Graph.Graph.getLoopAroundPoints (cognitive 56) REDACTED:10898— Graph.Graph.getLoopAroundPoints has cognitive complexity 56 (threshold 15). Drivers by points: ternaries 11 (19 pts), boolean chains 16, if/else 12 (13 pts), loops 4 (8 pts) (nesting depth added 13). Of this number, 48 points are the body's own statements and 8 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.mxConnector.paintLine (cognitive 56) REDACTED:32335— Graph.mxConnector.paintLine has cognitive complexity 56 (threshold 15). Drivers by points: if/else 16 (41 pts), ternaries 2 (8 pts), boolean chains 5, loops 1 (2 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.
mxArrowConnector.mxArrowConnector.paintEdgeShape (cognitive 56) src/main/webapp/mxgraph/src/shape/mxArrowConnector.js:124— mxArrowConnector.mxArrowConnector.paintEdgeShape has cognitive complexity 56 (threshold 15). Drivers by points: if/else 27 (39 pts), boolean chains 9, ternaries 3 (6 pts), loops 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.
getFastForwardSteps (cognitive 56) src/main/webapp/js/diagramly/Dialogs.js:17831— getFastForwardSteps has cognitive complexity 56 (threshold 15). Drivers by points: if/else 8 (32 pts), loops 3 (9 pts), ternaries 2 (8 pts), boolean chains 7 (nesting depth added 36). Of this number, 55 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
click (cognitive 56) src/main/webapp/mxgraph/src/view/mxGraph.js:2644— click has cognitive complexity 56 (threshold 15). Drivers by points: if/else 12 (33 pts), loops 2 (9 pts), boolean chains 7, ternaries 1 (7 pts) (nesting depth added 34). Of this number, 53 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
addEditOps (cognitive 56) src/main/webapp/js/grapheditor/Format.js:7309— addEditOps has cognitive complexity 56 (threshold 15). Drivers by points: if/else 16 (45 pts), boolean chains 9, loops 1 (2 pts) (nesting depth added 30). Of this number, 33 points are the body's own statements and 23 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
updatePreviewState (cognitive 56) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:1465— updatePreviewState has cognitive complexity 56 (threshold 15). Drivers by points: ternaries 9 (23 pts), if/else 16 (22 pts), boolean chains 11 (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.
snapDistance (cognitive 56) src/main/webapp/mxgraph/src/util/mxGuide.js:573— snapDistance has cognitive complexity 56 (threshold 15). Drivers by points: if/else 15 (23 pts), ternaries 7 (15 pts), boolean chains 12, loops 3 (6 pts) (nesting depth added 19). Of this number, 54 points are the body's own statements and 2 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.replaceFileData (cognitive 55) src/main/webapp/js/diagramly/EditorUi.js:2875— EditorUi.EditorUi.replaceFileData has cognitive complexity 55 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 4 (13 pts), ternaries 5 (12 pts), boolean chains 3 (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.
EditorUi.EditorUi.getCommentAnchorCells (cognitive 55) src/main/webapp/js/diagramly/EditorUi.js:43475— EditorUi.EditorUi.getCommentAnchorCells has cognitive complexity 55 (threshold 15). Drivers by points: if/else 9 (33 pts), loops 3 (15 pts), error handling 1 (4 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 40). Of this number, 38 points are the body's own statements and 17 belong to one function item inside it that branches. 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.
LayoutPicker.LayoutPreviews.run (cognitive 55) src/main/webapp/js/diagramly/LayoutPicker.js:1558— LayoutPicker.LayoutPreviews.run has cognitive complexity 55 (threshold 15). Drivers by points: if/else 18 (35 pts), error handling 2 (7 pts), boolean chains 6, ternaries 3 (4 pts), loops 2 (3 pts) (nesting depth added 24). Most of this is not in the body itself: 11 of the 55 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 1581, next, a function literal at line 1681, …). 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.
createDragSource::dragOver (cognitive 55) src/main/webapp/js/grapheditor/Sidebar.js:6700— createDragSource::dragOver has cognitive complexity 55 (threshold 15). Drivers by points: if/else 16 (35 pts), boolean chains 14, ternaries 2 (6 pts) (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
getPendingPageUpdates (cognitive 55) src/main/webapp/js/diagramly/DrawioFileSync.js:2162— getPendingPageUpdates has cognitive complexity 55 (threshold 15). Drivers by points: if/else 7 (28 pts), loops 3 (12 pts), boolean chains 8, ternaries 2 (7 pts) (nesting depth added 35). 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.
saveViewState (cognitive 55) src/main/webapp/js/diagramly/Pages.js:1672— saveViewState has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 17 (27 pts), if/else 12 (17 pts), boolean chains 11 (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.
getLazySize (cognitive 55) REDACTED:3362— getLazySize has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 7 (22 pts), if/else 6 (16 pts), boolean chains 12, loops 1 (4 pts), error handling 1 (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.
updateBoundingBox (cognitive 55) src/main/webapp/mxgraph/src/shape/mxText.js:554— updateBoundingBox has cognitive complexity 55 (threshold 15). Drivers by points: if/else 19 (40 pts), boolean chains 8, error handling 1 (4 pts), ternaries 1 (3 pts) (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
saveFile (cognitive 55) src/main/webapp/js/diagramly/LocalFile.js:157— saveFile has cognitive complexity 55 (threshold 15). Drivers by points: if/else 19 (30 pts), ternaries 5 (17 pts), boolean chains 4, error handling 1 (4 pts) (nesting depth added 26). Most of this is not in the body itself: 6 of the 55 points are its own statements and the rest belongs to 19 function literals inside it that branch (lines 326, 172, 174, …). 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.
EditorUi.EditorUi.collectCellImages (cognitive 54) src/main/webapp/js/diagramly/EditorUi.js:18631— EditorUi.EditorUi.collectCellImages has cognitive complexity 54 (threshold 15). Drivers by points: if/else 15 (37 pts), boolean chains 12, loops 2 (4 pts), ternaries 1 (nesting depth added 24). Of this number, 53 points are the body's own statements and 1 belongs to one function literal inside it that branches. 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.
ElectronApp.LocalFile.saveFile (cognitive 54) src/main/webapp/js/diagramly/ElectronApp.js:2019— ElectronApp.LocalFile.saveFile has cognitive complexity 54 (threshold 15). Drivers by points: if/else 23 (44 pts), ternaries 2 (6 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 26). Of this number, 32 points are the body's own statements and 22 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.
mxGraph.mxGraph.panGraph (cognitive 54) src/main/webapp/mxgraph/src/view/mxGraph.js:8453— mxGraph.mxGraph.panGraph has cognitive complexity 54 (threshold 15). Drivers by points: if/else 14 (39 pts), loops 3 (12 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.
paintCollapsedOutline (cognitive 54) src/main/webapp/js/grapheditor/Shapes.js:754— paintCollapsedOutline has cognitive complexity 54 (threshold 15). Drivers by points: if/else 14 (27 pts), ternaries 5 (14 pts), loops 7 (9 pts), boolean chains 4 (nesting depth added 24). Of this number, 48 points are the body's own statements and 6 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
updateCurrentState (cognitive 54) src/main/webapp/mxgraph/src/handler/mxConnectionHandler.js:1076— updateCurrentState has cognitive complexity 54 (threshold 15). Drivers by points: if/else 19 (42 pts), boolean chains 11, ternaries 1 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
saveFile (cognitive 54) src/main/webapp/js/diagramly/OneDriveFile.js:609— saveFile has cognitive complexity 54 (threshold 15). Drivers by points: if/else 16 (36 pts), ternaries 3 (9 pts), error handling 2 (6 pts), boolean chains 3 (nesting depth added 30). Most of this is not in the body itself: 10 of the 54 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 622, 659, 638, …). 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.
DriveFile.DriveFile.saveFile (cognitive 53) src/main/webapp/js/diagramly/DriveFile.js:165— DriveFile.DriveFile.saveFile has cognitive complexity 53 (threshold 15). Drivers by points: if/else 22 (42 pts), error handling 5 (11 pts) (nesting depth added 26). Most of this is not in the body itself: 11 of the 53 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 195, 263, 184, …). 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.
Extensions.getFontStyleString (cognitive 53) REDACTED:5060— Extensions.getFontStyleString has cognitive complexity 53 (threshold 15). Drivers by points: if/else 12 (37 pts), loops 3 (9 pts), boolean chains 7 (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.
Graph.Graph.renameSvgPageIds (cognitive 53) REDACTED:2634— Graph.Graph.renameSvgPageIds has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 7 (25 pts), if/else 6 (17 pts), loops 4 (7 pts), boolean chains 4 (nesting depth added 32). Of this number, 43 points are the body's own statements and 10 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addProperties (cognitive 53) src/main/webapp/js/diagramly/Editor.js:9265— addProperties has cognitive complexity 53 (threshold 15). Drivers by points: if/else 72 (125 pts), ternaries 26 (59 pts), loops 15 (32 pts), boolean chains 31, error handling 2 (5 pts) (nesting depth added 106). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
matchPartialEntries (cognitive 53) src/main/webapp/js/grapheditor/Sidebar.js:2380— matchPartialEntries has cognitive complexity 53 (threshold 15). Drivers by points: if/else 6 (23 pts), loops 3 (13 pts), ternaries 2 (12 pts), boolean chains 5 (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.
executeCreateObject (cognitive 53) src/main/webapp/js/diagramly/App.js:4794— executeCreateObject has cognitive complexity 53 (threshold 15). Drivers by points: if/else 25 (31 pts), ternaries 5 (13 pts), boolean chains 6, error handling 2 (3 pts) (nesting depth added 15). Of this number, 20 points are the body's own statements and 33 belong to 13 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.
fileCreated (cognitive 53) src/main/webapp/js/diagramly/App.js:6832— fileCreated has cognitive complexity 53 (threshold 15). Drivers by points: if/else 21 (37 pts), boolean chains 11, loops 1 (3 pts), ternaries 1 (2 pts) (nesting depth added 19). Of this number, 21 points are the body's own statements and 32 belong to 8 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.
readGraphState (cognitive 53) src/main/webapp/js/grapheditor/Editor.js:1779— readGraphState has cognitive complexity 53 (threshold 15). Drivers by points: if/else 20 (25 pts), boolean chains 22, ternaries 5 (6 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
update (cognitive 53) src/main/webapp/js/diagramly/ForceExplorer.js:2457— update has cognitive complexity 53 (threshold 15). Drivers by points: if/else 12 (25 pts), ternaries 4 (15 pts), boolean chains 8, loops 5 (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.
pickDiagrams (cognitive 53) src/main/webapp/js/diagramly/DriveClient.js:1650— pickDiagrams has cognitive complexity 53 (threshold 15). Drivers by points: if/else 16 (38 pts), loops 2 (6 pts), ternaries 2 (4 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 29). Most of this is not in the body itself: 4 of the 53 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 1663, a function literal at line 1752, (anonymous)::exit). 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.
mxGraphMlCodec.mxGraphMlCodec.handleTemplates (cognitive 52) REDACTED:1169— mxGraphMlCodec.mxGraphMlCodec.handleTemplates has cognitive complexity 52 (threshold 15). Drivers by points: if/else 6 (25 pts), ternaries 2 (12 pts), loops 5 (11 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 37). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Graph.Graph.canonicalizeSvgCssRules (cognitive 52) REDACTED:6141— Graph.Graph.canonicalizeSvgCssRules has cognitive complexity 52 (threshold 15). Drivers by points: if/else 7 (29 pts), loops 3 (16 pts), boolean chains 5, error handling 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.
Graph.mxText.paint (cognitive 52) REDACTED:8131— Graph.mxText.paint has cognitive complexity 52 (threshold 15). Drivers by points: if/else 14 (32 pts), ternaries 5 (14 pts), boolean chains 6 (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.
mxPidMisc.mxShapePidColumn.foreground (cognitive 52) src/main/webapp/shapes/pid2/mxPidMisc.js:187— mxPidMisc.mxShapePidColumn.foreground has cognitive complexity 52 (threshold 15). Drivers by points: if/else 18 (30 pts), loops 7 (15 pts), boolean chains 7 (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.
getCellsForTags (cognitive 52) src/main/webapp/js/diagramly/Editor.js:14032— getCellsForTags has cognitive complexity 52 (threshold 15). Drivers by points: if/else 7 (27 pts), loops 3 (10 pts), ternaries 2 (8 pts), boolean chains 7 (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.
updateTextNodes (cognitive 52) REDACTED:2204— updateTextNodes has cognitive complexity 52 (threshold 15). Drivers by points: ternaries 25 (35 pts), if/else 12 (13 pts), boolean chains 4 (nesting depth added 11). Of this number, 31 points are the body's own statements and 21 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
App.App.pickLibrary (cognitive 51) src/main/webapp/js/diagramly/App.js:5996— App.App.pickLibrary has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 8 (25 pts), if/else 9 (18 pts), loops 1 (4 pts), boolean chains 2, error handling 2 (nesting depth added 29). Of this number, 27 points are the body's own statements and 24 belong to 5 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DrawioFileSync.DrawioFileSync.receiveRemoteChanges (cognitive 51) src/main/webapp/js/diagramly/DrawioFileSync.js:1404— DrawioFileSync.DrawioFileSync.receiveRemoteChanges has cognitive complexity 51 (threshold 15). Drivers by points: if/else 10 (25 pts), ternaries 3 (15 pts), loops 1 (5 pts), error handling 1 (4 pts), boolean chains 2 (nesting depth added 34). Most of this is not in the body itself: 5 of the 51 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1420, 1466, 1438). 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.
EditorUi.EditorUi.showBanner (cognitive 51) src/main/webapp/js/diagramly/EditorUi.js:8042— EditorUi.EditorUi.showBanner has cognitive complexity 51 (threshold 15). Drivers by points: if/else 17 (38 pts), boolean chains 8, ternaries 2 (5 pts) (nesting depth added 24). Of this number, 29 points are the body's own statements and 22 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Graph.Graph.createLayouts (cognitive 51) REDACTED:14364— Graph.Graph.createLayouts has cognitive complexity 51 (threshold 15). Drivers by points: if/else 12 (29 pts), boolean chains 10, loops 3 (9 pts), ternaries 1 (3 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.
mxBpmnShape2.mxBpmnShape.redrawPath (cognitive 51) src/main/webapp/shapes/bpmn/mxBpmnShape2.js:135— mxBpmnShape2.mxBpmnShape.redrawPath has cognitive complexity 51 (threshold 15). Drivers by points: if/else 29 (49 pts), boolean chains 2 (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.
StorageDialog (cognitive 51) src/main/webapp/js/diagramly/Dialogs.js:6— StorageDialog has cognitive complexity 51 (threshold 15). Drivers by points: if/else 26 (34 pts), boolean chains 11, ternaries 3 (4 pts), loops 1 (2 pts) (nesting depth added 10). Most of this is not in the body itself: 6 of the 51 points are its own statements and the rest belongs to 13 function items inside it that branch (addLogo, addButtons, addLogo::initButton::clientFn, …). 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.
addFill (cognitive 51) src/main/webapp/js/grapheditor/Format.js:7450— addFill has cognitive complexity 51 (threshold 15). Drivers by points: if/else 13 (20 pts), ternaries 9 (18 pts), boolean chains 7, loops 5 (6 pts) (nesting depth added 17). Most of this is not in the body itself: 9 of the 51 points are its own statements and the rest belongs to 12 function items inside it that branch (a function literal at line 7572, a function literal at line 7670, a function literal at line 7477, …). 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.
getPrettyXml (cognitive 51) src/main/webapp/mxgraph/src/util/mxUtils.js:1282— getPrettyXml has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (32 pts), loops 3 (12 pts), ternaries 3 (6 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.
sortCells (cognitive 51) src/main/webapp/mxgraph/src/util/mxUtils.js:4324— sortCells has cognitive complexity 51 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 7 (19 pts), ternaries 6 (11 pts), boolean chains 1 (nesting depth added 28). Of this number, 17 points are the body's own statements and 34 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
predictBounds (cognitive 51) src/main/webapp/js/diagramly/ForceExplorer.js:2092— predictBounds has cognitive complexity 51 (threshold 15). Drivers by points: ternaries 7 (21 pts), if/else 6 (12 pts), boolean chains 11, loops 6 (7 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.
getSuggestedLayout (cognitive 51) src/main/webapp/js/diagramly/LayoutPicker.js:524— getSuggestedLayout has cognitive complexity 51 (threshold 15). Drivers by points: if/else 9 (26 pts), loops 6 (16 pts), boolean chains 5, ternaries 1 (4 pts) (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.
Dialogs.StyleRulesDialog.parseRules (cognitive 50) src/main/webapp/js/diagramly/Dialogs.js:22434— Dialogs.StyleRulesDialog.parseRules has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 4 (19 pts), if/else 6 (16 pts), loops 3 (12 pts), boolean chains 2, error handling 1 (nesting depth added 34). Of this number, 36 points are the body's own statements and 14 belong to one function item inside it that branches. 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.
EditorUi.EditorUi.createFileData (cognitive 50) src/main/webapp/js/diagramly/EditorUi.js:3015— EditorUi.EditorUi.createFileData has cognitive complexity 50 (threshold 15). Drivers by points: if/else 20 (36 pts), boolean chains 9, ternaries 2 (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.
EditorUi.EditorUi.fileStats (cognitive 50) src/main/webapp/js/diagramly/EditorUi.js:4083— EditorUi.EditorUi.fileStats has cognitive complexity 50 (threshold 15). Drivers by points: if/else 10 (34 pts), loops 4 (13 pts), boolean chains 2, error handling 1 (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.
getCellsForShapePicker (cognitive 50) REDACTED:2975— getCellsForShapePicker has cognitive complexity 50 (threshold 15). Drivers by points: if/else 14 (32 pts), boolean chains 7, loops 2 (5 pts), ternaries 4, error handling 1 (2 pts) (nesting depth added 22). Of this number, 31 points are the body's own statements and 19 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pickFile (cognitive 50) src/main/webapp/js/diagramly/App.js:5834— pickFile has cognitive complexity 50 (threshold 15). Drivers by points: if/else 17 (36 pts), boolean chains 9, ternaries 2 (4 pts), error handling 1 (nesting depth added 21). Of this number, 20 points are the body's own statements and 30 belong to 9 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
EntityRelation (cognitive 50) src/main/webapp/mxgraph/src/view/mxEdgeStyle.js:98— EntityRelation has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 9 (23 pts), if/else 17 (22 pts), boolean chains 5 (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.
addMouseWheelListener (cognitive 50) src/main/webapp/mxgraph/src/util/mxEvent.js:390— addMouseWheelListener has cognitive complexity 50 (threshold 15). Drivers by points: if/else 12 (32 pts), boolean chains 7, ternaries 3 (7 pts), loops 1 (4 pts) (nesting depth added 27). Most of this is not in the body itself: 7 of the 50 points are its own statements and the rest belongs to 8 function items inside it that branch (a function literal at line 487, wheelHandler, a function literal at line 474, …). 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.
MiroImporter::parseStyles (cognitive 50) src/main/webapp/js/diagramly/miro/MiroImporter.js:218— MiroImporter::parseStyles has cognitive complexity 50 (threshold 15). Drivers by points: if/else 12 (30 pts), ternaries 5 (13 pts), boolean chains 3, match/switch 1 (2 pts), error handling 1, loops 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.
EditorUi.EditorUi.installSettings (cognitive 49) src/main/webapp/js/diagramly/EditorUi.js:28009— EditorUi.EditorUi.installSettings has cognitive complexity 49 (threshold 15). Drivers by points: if/else 15 (38 pts), boolean chains 8, error handling 1 (3 pts) (nesting depth added 25). Of this number, 38 points are the body's own statements and 11 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
EditorUi.EditorUi.refreshDataSources (cognitive 49) src/main/webapp/js/diagramly/EditorUi.js:39101— EditorUi.EditorUi.refreshDataSources has cognitive complexity 49 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 6 (9 pts), ternaries 3 (9 pts), boolean chains 6, error handling 2 (5 pts) (nesting depth added 21). Most of this is not in the body itself: 7 of the 49 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 39119, 39153, 39134, …). 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.
Graph.Graph.copyCellStyles (cognitive 49) REDACTED:11322— Graph.Graph.copyCellStyles has cognitive complexity 49 (threshold 15). Drivers by points: if/else 11 (30 pts), boolean chains 14, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
setGraphXml (cognitive 49) src/main/webapp/js/diagramly/Editor.js:5098— setGraphXml has cognitive complexity 49 (threshold 15). Drivers by points: if/else 12 (25 pts), ternaries 3 (9 pts), boolean chains 7, error handling 1 (4 pts), loops 1 (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.
getImageForMarker (cognitive 49) REDACTED:5257— getImageForMarker has cognitive complexity 49 (threshold 15). Drivers by points: if/else 29 (30 pts), ternaries 9 (18 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
App (cognitive 49) src/main/webapp/js/diagramly/App.js:10— App has cognitive complexity 49 (threshold 15). Drivers by points: if/else 17 (25 pts), error handling 4 (9 pts), boolean chains 8, ternaries 3 (5 pts), loops 1 (2 pts) (nesting depth added 16). Of this number, 24 points are the body's own statements and 25 belong to 6 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.
keepFixedRoleColors (cognitive 49) src/main/webapp/js/diagramly/tidy/TidyStyle.js:829— keepFixedRoleColors has cognitive complexity 49 (threshold 15). Drivers by points: if/else 9 (32 pts), boolean chains 11, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
insertStateAfter (cognitive 49) src/main/webapp/mxgraph/src/view/mxCellRenderer.js:1666— insertStateAfter has cognitive complexity 49 (threshold 15). Drivers by points: if/else 12 (32 pts), boolean chains 8, loops 2 (6 pts), ternaries 1 (3 pts) (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DrawioFileSync.DrawioFileSync.sendLocalChanges (cognitive 48) src/main/webapp/js/diagramly/DrawioFileSync.js:3042— DrawioFileSync.DrawioFileSync.sendLocalChanges has cognitive complexity 48 (threshold 15). Drivers by points: if/else 13 (29 pts), loops 3 (10 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (nesting depth added 25). 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.
EditorUi.EditorUi.applySharedViewMode (cognitive 48) src/main/webapp/js/diagramly/EditorUi.js:1901— EditorUi.EditorUi.applySharedViewMode has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 13, ternaries 4 (11 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.
EditorUi.EditorUi.downloadRequestBuilder (cognitive 48) src/main/webapp/js/diagramly/EditorUi.js:4425— EditorUi.EditorUi.downloadRequestBuilder has cognitive complexity 48 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 16, ternaries 10, loops 1 (3 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Dialogs.ExportDialog (cognitive 48) REDACTED:3340— Dialogs.ExportDialog has cognitive complexity 48 (threshold 15). Drivers by points: if/else 34 (37 pts), boolean chains 11 (nesting depth added 3). Most of this is not in the body itself: 5 of the 48 points are its own statements and the rest belongs to 8 function items inside it that branch (formatChanged, a function literal at line 3725, checkValues, …). 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.
Graph.Graph.foldCells (cognitive 48) REDACTED:19851— Graph.Graph.foldCells has cognitive complexity 48 (threshold 15). Drivers by points: if/else 12 (40 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Graph.Graph.getAutoLabelPlacement (cognitive 48) REDACTED:29813— Graph.Graph.getAutoLabelPlacement has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (30 pts), boolean chains 8, loops 3 (6 pts), ternaries 2 (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.
Graph.mxGraphView.getMultiplePerimeterPoint (cognitive 48) REDACTED:31020— Graph.mxGraphView.getMultiplePerimeterPoint has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (27 pts), boolean chains 9, loops 2 (8 pts), ternaries 2 (4 pts) (nesting depth added 25). Of this number, 44 points are the body's own statements and 4 belong to one function item inside it that branches. 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.
mxArchiMate3.mxArchiMate3Application.foreground (cognitive 48) src/main/webapp/shapes/mxArchiMate3.js:181— mxArchiMate3.mxArchiMate3Application.foreground has cognitive complexity 48 (threshold 15). Drivers by points: if/else 48. 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.
createLegend (cognitive 48) src/main/webapp/js/diagramly/Dialogs.js:22624— createLegend has cognitive complexity 48 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 5 (17 pts), ternaries 2 (10 pts), boolean chains 3 (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.
createColorOption::apply (cognitive 48) src/main/webapp/js/grapheditor/Format.js:1542— createColorOption::apply has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (28 pts), ternaries 5 (12 pts), boolean chains 8 (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.
connectionPreview (cognitive 48) src/main/webapp/js/diagramly/LibavoidRouting.js:3297— connectionPreview has cognitive complexity 48 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 16, ternaries 7 (11 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addTextBackground (cognitive 48) REDACTED:4163— addTextBackground has cognitive complexity 48 (threshold 15). Drivers by points: if/else 14 (26 pts), ternaries 7 (14 pts), boolean chains 8 (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.
createParentLookup (cognitive 48) src/main/webapp/js/diagramly/DiffSync.js:1008— createParentLookup has cognitive complexity 48 (threshold 15). Drivers by points: if/else 11 (36 pts), ternaries 2 (6 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 31). Of this number, 47 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
styleEdges (cognitive 48) src/main/webapp/js/diagramly/tidy/TidyStyle.js:1721— styleEdges has cognitive complexity 48 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 12, ternaries 5 (12 pts), loops 5 (8 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.
D2 · Cognitive Complexity· open (cognitive 48) · ×1
open (cognitive 48) src/main/webapp/mxgraph/src/view/mxPrintPreview.js:531— open has cognitive complexity 48 (threshold 15). Drivers by points: if/else 22 (33 pts), loops 4 (7 pts), boolean chains 4, ternaries 3, error handling 1 (nesting depth added 14). Of this number, 44 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LayoutPicker.EditorUi.keepLockedGeometries.<returned closure> (cognitive 47) src/main/webapp/js/diagramly/LayoutPicker.js:734— LayoutPicker.EditorUi.keepLockedGeometries.<returned closure> has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 18, loops 5 (9 pts), ternaries 1 (nesting depth added 10). Of this number, 29 points are the body's own statements and 18 belong to 7 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.isLiveLayoutLimited (cognitive 47) REDACTED:13892— Graph.Graph.isLiveLayoutLimited has cognitive complexity 47 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 4 (12 pts), ternaries 3 (10 pts), boolean chains 7 (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.
Graph.Graph.updateShapes (cognitive 47) REDACTED:17212— Graph.Graph.updateShapes has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (30 pts), boolean chains 8, loops 3 (8 pts), ternaries 1 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Graph.mxGraphView.updateCurveLineJumps (cognitive 47) REDACTED:31777— Graph.mxGraphView.updateCurveLineJumps has cognitive complexity 47 (threshold 15). Drivers by points: if/else 6 (22 pts), boolean chains 10, loops 5 (10 pts), ternaries 4 (5 pts) (nesting depth added 22). Of this number, 44 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxSvgCanvas2D.mxSvgCanvas2D.wrapSvgTextElement::collectLeaves (cognitive 47) REDACTED:2603— mxSvgCanvas2D.mxSvgCanvas2D.wrapSvgTextElement::collectLeaves has cognitive complexity 47 (threshold 15). Drivers by points: if/else 10 (37 pts), loops 3 (9 pts), boolean chains 1 (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. This shape REPEATS in the file: one other method here (mxSvgCanvas2D.mxSvgCanvas2D.wrapSvgTextElement) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
RevisionDialog::(anonymous)::updateGraph (cognitive 47) src/main/webapp/js/diagramly/Dialogs.js:9071— RevisionDialog::(anonymous)::updateGraph has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (35 pts), loops 2 (7 pts), boolean chains 3, ternaries 1 (2 pts) (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.
convertImages::(anonymous)::(anonymous)::processNext::onload (cognitive 47) src/main/webapp/js/diagramly/Editor.js:6709— convertImages::(anonymous)::(anonymous)::processNext::onload has cognitive complexity 47 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 6 (17 pts), boolean chains 2, 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.
execute (cognitive 47) src/main/webapp/js/diagramly/Editor.js:15322— execute has cognitive complexity 47 (threshold 15). Drivers by points: if/else 16 (39 pts), boolean chains 5, ternaries 1 (3 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.
moveCells (cognitive 47) src/main/webapp/mxgraph/src/view/mxGraph.js:6660— moveCells has cognitive complexity 47 (threshold 15). Drivers by points: if/else 9 (24 pts), boolean chains 10, loops 4 (10 pts), ternaries 3 (nesting depth added 21). Of this number, 42 points are the body's own statements and 5 belong to one function literal inside it that branches. 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.
getConnectionPoint (cognitive 47) src/main/webapp/mxgraph/src/view/mxGraph.js:7439— getConnectionPoint has cognitive complexity 47 (threshold 15). Drivers by points: if/else 18 (36 pts), boolean chains 10, ternaries 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
showTextMenu (cognitive 47) src/main/webapp/js/grapheditor/InlineToolbar.js:2863— showTextMenu has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 8 (16 pts), boolean chains 7, loops 4 (6 pts) (nesting depth added 16). Most of this is not in the body itself: 14 of the 47 points are its own statements and the rest belongs to 25 function items inside it that branch (a function literal at line 2930, getValue, a function literal at line 3087, …). 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.
showShapeMenu (cognitive 47) src/main/webapp/js/grapheditor/InlineToolbar.js:4733— showShapeMenu has cognitive complexity 47 (threshold 15). Drivers by points: if/else 16 (22 pts), ternaries 6 (10 pts), loops 6 (9 pts), boolean chains 6 (nesting depth added 13). Most of this is not in the body itself: 8 of the 47 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 4901, a function literal at line 4784, a function literal at line 4826, …). 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.
showLocalLightbox (cognitive 47) REDACTED:2733— showLocalLightbox has cognitive complexity 47 (threshold 15). Drivers by points: if/else 17 (20 pts), ternaries 9 (14 pts), boolean chains 10, error handling 2 (3 pts) (nesting depth added 9). Of this number, 32 points are the body's own statements and 15 belong to 21 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.
patchCell (cognitive 47) src/main/webapp/js/diagramly/DiffSync.js:1731— patchCell has cognitive complexity 47 (threshold 15). Drivers by points: if/else 16 (35 pts), boolean chains 10, loops 1 (2 pts) (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.
resizeVertex (cognitive 47) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:1029— resizeVertex has cognitive complexity 47 (threshold 15). Drivers by points: if/else 19 (40 pts), boolean chains 5, ternaries 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getFile (cognitive 47) REDACTED:112— getFile has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (34 pts), ternaries 3 (7 pts), boolean chains 6 (nesting depth added 23). Most of this is not in the body itself: 1 of the 47 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 158, 128, 211, …). 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.
update (cognitive 47) src/main/webapp/mxgraph/src/handler/mxConstraintHandler.js:256— update has cognitive complexity 47 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 15, ternaries 3 (10 pts), loops 1 (3 pts) (nesting depth added 20). Of this number, 41 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
EditorUi.EditorUi.showPublishLinkDialog (cognitive 46) src/main/webapp/js/diagramly/EditorUi.js:11056— EditorUi.EditorUi.showPublishLinkDialog has cognitive complexity 46 (threshold 15). Drivers by points: if/else 23 (28 pts), boolean chains 11, ternaries 5, loops 1 (2 pts) (nesting depth added 6). Of this number, 27 points are the body's own statements and 19 belong to 5 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.
Graph.Graph.getTooltipForCell (cognitive 46) REDACTED:22474— Graph.Graph.getTooltipForCell has cognitive complexity 46 (threshold 15). Drivers by points: if/else 13 (32 pts), boolean chains 8, loops 2 (6 pts) (nesting depth added 23). Of this number, 41 points are the body's own statements and 5 belong to one function literal inside it that branches. 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.
mxEdgeHandler.mxEdgeHandler.getHandleForEvent (cognitive 46) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:847— mxEdgeHandler.mxEdgeHandler.getHandleForEvent has cognitive complexity 46 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 3 (9 pts), boolean chains 7, ternaries 2 (4 pts) (nesting depth added 24). Of this number, 38 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxSwimlane.mxSwimlane.paintSwimlane (cognitive 46) src/main/webapp/mxgraph/src/shape/mxSwimlane.js:432— mxSwimlane.mxSwimlane.paintSwimlane has cognitive complexity 46 (threshold 15). Drivers by points: if/else 22 (44 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. This shape REPEATS in the file: one other method here (mxSwimlane.mxSwimlane.paintRoundedSwimlane) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxSwimlane.mxSwimlane.paintRoundedSwimlane (cognitive 46) src/main/webapp/mxgraph/src/shape/mxSwimlane.js:564— mxSwimlane.mxSwimlane.paintRoundedSwimlane has cognitive complexity 46 (threshold 15). Drivers by points: if/else 22 (44 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. This shape REPEATS in the file: one other method here (mxSwimlane.mxSwimlane.paintSwimlane) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxGraphView.mxGraphView.getPerimeterPoint (cognitive 46) src/main/webapp/mxgraph/src/view/mxGraphView.js:3559— mxGraphView.mxGraphView.getPerimeterPoint has cognitive complexity 46 (threshold 15). Drivers by points: if/else 11 (41 pts), boolean chains 5 (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.
addEffects (cognitive 46) src/main/webapp/js/grapheditor/Format.js:8612— addEffects has cognitive complexity 46 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 10, ternaries 6 (10 pts), loops 2 (4 pts) (nesting depth added 14). None of this is in the body itself: all 46 points belong to 6 function items inside it that branch (a function literal at line 8650, a function literal at line 8684, a function literal at line 8640, …). 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.
executeRequest (cognitive 46) src/main/webapp/js/diagramly/GitHubClient.js:313— executeRequest has cognitive complexity 46 (threshold 15). Drivers by points: if/else 19 (29 pts), ternaries 2 (8 pts), boolean chains 6, error handling 1 (3 pts) (nesting depth added 18). Most of this is not in the body itself: 2 of the 46 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 327, 433, 422, …). 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.
Dialogs.EditGeometryDialog::applyFn (cognitive 45) src/main/webapp/js/diagramly/Dialogs.js:19752— Dialogs.EditGeometryDialog::applyFn has cognitive complexity 45 (threshold 15). Drivers by points: if/else 12 (44 pts), loops 1 (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.
EditorUi.EditorUi.saveRequest (cognitive 45) src/main/webapp/js/diagramly/EditorUi.js:9327— EditorUi.EditorUi.saveRequest has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (24 pts), error handling 2 (11 pts), boolean chains 6, ternaries 2 (4 pts) (nesting depth added 24). Most of this is not in the body itself: 2 of the 45 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 9331, 9368, 9346). 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.
EditorUi.EditorUi.importFile (cognitive 45) src/main/webapp/js/diagramly/EditorUi.js:17474— EditorUi.EditorUi.importFile has cognitive complexity 45 (threshold 15). Drivers by points: if/else 19 (31 pts), boolean chains 8, ternaries 2 (6 pts) (nesting depth added 16). Of this number, 35 points are the body's own statements and 10 belong to 2 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.
EditorUi.EditorUi.pasteXml (cognitive 45) src/main/webapp/js/diagramly/EditorUi.js:28576— EditorUi.EditorUi.pasteXml has cognitive complexity 45 (threshold 15). Drivers by points: if/else 18 (34 pts), boolean chains 5, loops 1 (3 pts), ternaries 2 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.insertCellEditorDrop (cognitive 45) src/main/webapp/js/diagramly/EditorUi.js:29230— EditorUi.EditorUi.insertCellEditorDrop has cognitive complexity 45 (threshold 15). Drivers by points: if/else 20 (26 pts), boolean chains 10, loops 2 (4 pts), ternaries 4, error handling 1 (nesting depth added 8). Of this number, 29 points are the body's own statements and 16 belong to 5 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.
LayoutPicker.EditorUi.applyLayoutList (cognitive 45) src/main/webapp/js/diagramly/LayoutPicker.js:941— LayoutPicker.EditorUi.applyLayoutList has cognitive complexity 45 (threshold 15). Drivers by points: if/else 20 (34 pts), boolean chains 4, loops 2 (4 pts), ternaries 2 (3 pts) (nesting depth added 17). Of this number, 25 points are the body's own statements and 20 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Format.TextFormatPanel.getMatchConnectorChanges (cognitive 45) src/main/webapp/js/grapheditor/Format.js:4944— Format.TextFormatPanel.getMatchConnectorChanges has cognitive complexity 45 (threshold 15). Drivers by points: if/else 6 (22 pts), loops 5 (13 pts), boolean chains 7, ternaries 2 (3 pts) (nesting depth added 25). Of this number, 43 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
liftLegacyLayers (cognitive 45) src/main/webapp/js/diagramly/Dialogs.js:8198— liftLegacyLayers has cognitive complexity 45 (threshold 15). Drivers by points: if/else 7 (25 pts), ternaries 2 (9 pts), loops 3 (7 pts), boolean chains 4 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FilenameDialog (cognitive 45) src/main/webapp/js/grapheditor/Editor.js:4410— FilenameDialog has cognitive complexity 45 (threshold 15). Drivers by points: if/else 21 (33 pts), boolean chains 10, ternaries 2 (nesting depth added 12). Most of this is not in the body itself: 15 of the 45 points are its own statements and the rest belongs to 7 function items inside it that branch (init, a function literal at line 4453, a function literal at line 4526, …). 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.
validateBackgroundStyles (cognitive 45) src/main/webapp/js/grapheditor/Editor.js:4874— validateBackgroundStyles has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 11 (19 pts), if/else 14 (18 pts), boolean chains 8 (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.
markLocalChanges (cognitive 45) src/main/webapp/js/diagramly/DrawioFileSync.js:2403— markLocalChanges has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (28 pts), loops 2 (8 pts), boolean chains 7, error handling 1 (2 pts) (nesting depth added 24). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
invalidate (cognitive 45) src/main/webapp/mxgraph/src/view/mxGraphView.js:1032— invalidate has cognitive complexity 45 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 4 (14 pts), ternaries 5 (10 pts), boolean chains 2 (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.
image (cognitive 45) REDACTED:1743— image has cognitive complexity 45 (threshold 15). Drivers by points: if/else 20 (30 pts), ternaries 5 (8 pts), boolean chains 7 (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.
readGraphFile (cognitive 45) src/main/webapp/js/diagramly/ElectronApp.js:1389— readGraphFile has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 9, ternaries 5 (8 pts), error handling 1 (3 pts) (nesting depth added 13). Most of this is not in the body itself: 6 of the 45 points are its own statements and the rest belongs to 17 function literals inside it that branch (lines 1437, 1444, 1408, …). 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.
keyDown (cognitive 45) src/main/webapp/js/grapheditor/Omnibox.js:740— keyDown has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (20 pts), ternaries 7 (17 pts), boolean chains 8 (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.
pickColor (cognitive 45) src/main/webapp/js/grapheditor/Menus.js:1408— pickColor has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 6 (22 pts), if/else 8 (19 pts), boolean chains 4 (nesting depth added 27). None of this is in the body itself: all 45 points belong to 5 function items inside it that branch (a function literal at line 1410, a function literal at line 1454, (anonymous)::getColorFn, …). 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.
EditorUi.EditorUi.convertLucidChart (cognitive 44) src/main/webapp/js/diagramly/EditorUi.js:14683— EditorUi.EditorUi.convertLucidChart has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (31 pts), error handling 2 (6 pts), loops 1 (5 pts), boolean chains 2 (nesting depth added 24). None of this is in the body itself: all 44 points belong to 4 function literals inside it that branch (lines 14709, 14699, 14685, …). 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.
mxJsCanvas.mxJsCanvas.text (cognitive 44) src/main/webapp/js/diagramly/util/mxJsCanvas.js:638— mxJsCanvas.mxJsCanvas.text has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (27 pts), loops 3 (7 pts), match/switch 3 (6 pts), boolean chains 4 (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.
EditorUi.EditorUi.getTabGroups (cognitive 44) REDACTED:3967— EditorUi.EditorUi.getTabGroups has cognitive complexity 44 (threshold 15). Drivers by points: if/else 7 (22 pts), loops 5 (13 pts), ternaries 2 (7 pts), boolean chains 2 (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.
mxGraph.mxGraph.setConnectionConstraint (cognitive 44) src/main/webapp/mxgraph/src/view/mxGraph.js:7375— mxGraph.mxGraph.setConnectionConstraint has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 11 (35 pts), if/else 5 (8 pts), boolean chains 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.
mxGraph.mxGraph.scrollRectToVisible (cognitive 44) src/main/webapp/mxgraph/src/view/mxGraph.js:8911— mxGraph.mxGraph.scrollRectToVisible has cognitive complexity 44 (threshold 15). Drivers by points: if/else 16 (42 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.
getPreferredSizeForCell (cognitive 44) src/main/webapp/mxgraph/src/view/mxGraph.js:6047— getPreferredSizeForCell has cognitive complexity 44 (threshold 15). Drivers by points: if/else 13 (40 pts), boolean chains 3, ternaries 1 (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
getCells (cognitive 44) src/main/webapp/mxgraph/src/view/mxGraph.js:13126— getCells has cognitive complexity 44 (threshold 15). Drivers by points: if/else 8 (27 pts), boolean chains 13, loops 1 (3 pts), ternaries 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.
updateHeader (cognitive 44) src/main/webapp/js/diagramly/App.js:9088— updateHeader has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (25 pts), ternaries 5 (14 pts), boolean chains 5 (nesting depth added 22). Most of this is not in the body itself: 14 of the 44 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 9107, 9140, 9175, …). 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.
addUnsavedStatus (cognitive 44) REDACTED:3256— addUnsavedStatus has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (26 pts), boolean chains 12, ternaries 2 (6 pts) (nesting depth added 21). Of this number, 24 points are the body's own statements and 20 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Graph.Graph.prefixSvgIds (cognitive 43) REDACTED:5474— Graph.Graph.prefixSvgIds has cognitive complexity 43 (threshold 15). Drivers by points: if/else 44 (80 pts), loops 14 (25 pts), boolean chains 18, ternaries 5 (6 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. This shape REPEATS in the file: one other method here (Graph.Graph.prefixSvgIds::prefixRule) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Graph.Graph.computeShapeInsideSpacer::run (cognitive 43) REDACTED:7726— Graph.Graph.computeShapeInsideSpacer::run has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (29 pts), boolean chains 6, loops 3 (6 pts), ternaries 1 (2 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. This shape REPEATS in the file: one other method here (Graph.Graph.computeShapeInsideSpacer) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
AbsAuth.doGetAbst (cognitive 43) src/main/server/java/com/mxgraph/online/AbsAuth.java:259— AbsAuth.doGetAbst has cognitive complexity 43 (threshold 15). Drivers by points: if/else 21 (31 pts), boolean chains 7, error handling 2, 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.
replaceLightDarkFunctions (cognitive 43) src/main/webapp/js/diagramly/Editor.js:1742— replaceLightDarkFunctions has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 10, loops 3 (6 pts), ternaries 1 (2 pts) (nesting depth added 15). Of this number, 30 points are the body's own statements and 13 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addFont (cognitive 43) src/main/webapp/js/diagramly/Editor.js:10723— addFont has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (34 pts), ternaries 2 (6 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.
addResizePreviewRoutes (cognitive 43) src/main/webapp/js/diagramly/LibavoidRouting.js:4191— addResizePreviewRoutes has cognitive complexity 43 (threshold 15). Drivers by points: loops 6 (14 pts), if/else 5 (13 pts), ternaries 5 (13 pts), boolean chains 3 (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.
redrawHandles (cognitive 43) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:2654— redrawHandles has cognitive complexity 43 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 12, ternaries 4 (11 pts), loops 2 (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.
shapePin (cognitive 43) src/main/webapp/js/libavoid-js/libavoid-routing.js:430— shapePin has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 15 (25 pts), if/else 4 (9 pts), boolean chains 8, 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.
updateValue (cognitive 43) src/main/webapp/mxgraph/src/shape/mxText.js:1033— updateValue has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (28 pts), ternaries 4 (9 pts), boolean chains 6 (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.
(anonymous) (cognitive 43) REDACTED:376— (anonymous) has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (33 pts), boolean chains 5, error handling 1 (3 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.
saveFile (cognitive 43) src/main/webapp/js/diagramly/StorageFile.js:298— saveFile has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (29 pts), ternaries 3 (9 pts), boolean chains 5 (nesting depth added 22). Most of this is not in the body itself: 10 of the 43 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 344, 331, 335, …). 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.
EditorUi.EditorUi.downloadFile (cognitive 42) src/main/webapp/js/diagramly/EditorUi.js:4244— EditorUi.EditorUi.downloadFile has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (30 pts), boolean chains 8, error handling 2 (4 pts) (nesting depth added 15). Of this number, 30 points are the body's own statements and 12 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.
EditorUi.EditorUi.addChromelessToolbarItems (cognitive 42) src/main/webapp/js/diagramly/EditorUi.js:8992— EditorUi.EditorUi.addChromelessToolbarItems has cognitive complexity 42 (threshold 15). Drivers by points: if/else 20 (34 pts), boolean chains 4, error handling 2 (4 pts) (nesting depth added 16). Most of this is not in the body itself: 10 of the 42 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 9035, 9123, 9138, …). 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.
EditorUi.EditorUi.resetScrollbars (cognitive 42) REDACTED:8448— EditorUi.EditorUi.resetScrollbars has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (34 pts), ternaries 2 (6 pts), boolean chains 2 (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.
Graph.Graph.isLabelBoxFree (cognitive 42) REDACTED:29346— Graph.Graph.isLabelBoxFree has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 18, loops 1 (2 pts), ternaries 1 (nesting depth added 6). Most of this is not in the body itself: 3 of the 42 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 29414, hitsOutline, a function literal at line 29387, …). 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.
Graph.mxGraphView.updateFixedPointSpacing (cognitive 42) REDACTED:32573— Graph.mxGraphView.updateFixedPointSpacing has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 10 (19 pts), if/else 7 (12 pts), boolean chains 9, loops 1 (2 pts) (nesting depth added 15). Of this number, 30 points are the body's own statements and 12 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InlineToolbar.InlineToolbar.showTableMenu (cognitive 42) src/main/webapp/js/grapheditor/InlineToolbar.js:4103— InlineToolbar.InlineToolbar.showTableMenu has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (22 pts), ternaries 5 (8 pts), boolean chains 6, loops 3 (6 pts) (nesting depth added 14). Of this number, 20 points are the body's own statements and 22 belong to 7 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.
Shapes.mxSwimlane.paintVertexShape (cognitive 42) src/main/webapp/js/grapheditor/Shapes.js:1018— Shapes.mxSwimlane.paintVertexShape has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 4 (20 pts), if/else 8 (14 pts), boolean chains 8 (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.
mxGraph.mxGraph.isPointNearPolyline (cognitive 42) src/main/webapp/mxgraph/src/view/mxGraph.js:12328— mxGraph.mxGraph.isPointNearPolyline has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 4 (19 pts), if/else 6 (17 pts), boolean chains 4, loops 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.
cellsOrdered (cognitive 42) src/main/webapp/mxgraph/src/view/mxGraph.js:4043— cellsOrdered has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 6 (25 pts), if/else 5 (13 pts), boolean chains 2, loops 1 (2 pts) (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.
getThumbnail (cognitive 42) src/main/webapp/js/diagramly/App.js:3638— getThumbnail has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 10, error handling 3 (5 pts), ternaries 1 (nesting depth added 11). Of this number, 25 points are the body's own statements and 17 belong to 8 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
previewEndpointDrag (cognitive 42) src/main/webapp/js/diagramly/LibavoidRouting.js:2970— previewEndpointDrag has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 12, ternaries 8 (12 pts), loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
resolveColor (cognitive 42) src/main/webapp/mxgraph/src/view/mxCellRenderer.js:479— resolveColor has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (22 pts), ternaries 5 (14 pts), boolean chains 6 (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.
DrawioFile.DrawioFile.updateFile (cognitive 41) REDACTED:571— DrawioFile.DrawioFile.updateFile has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (34 pts), boolean chains 4, error handling 1 (3 pts) (nesting depth added 23). Most of this is not in the body itself: 13 of the 41 points are its own statements and the rest belongs to one function literal inside it that branches (line 588). 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.
ViewerModern.GraphViewer.getDiagramLanguages (cognitive 41) src/main/webapp/js/diagramly/ViewerModern.js:416— ViewerModern.GraphViewer.getDiagramLanguages has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 3 (7 pts), boolean chains 5, ternaries 2 (3 pts) (nesting depth added 21). Of this number, 38 points are the body's own statements and 3 belong to one function literal inside it that branches. 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.
Sidebar.Sidebar.isEntryVisible (cognitive 41) src/main/webapp/js/diagramly/sidebar/Sidebar.js:316— Sidebar.Sidebar.isEntryVisible has cognitive complexity 41 (threshold 15). Drivers by points: if/else 8 (27 pts), loops 2 (7 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
export.render::collectAnnotRects (cognitive 41) src/main/webapp/js/export.js:505— export.render::collectAnnotRects has cognitive complexity 41 (threshold 15). Drivers by points: if/else 5 (22 pts), loops 3 (14 pts), boolean chains 5 (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. This shape REPEATS in the file: one other method here (export.render) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Graph.HoverIcons.update (cognitive 41) REDACTED:24907— Graph.HoverIcons.update has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (29 pts), boolean chains 12 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
findTreeRoots (cognitive 41) src/main/webapp/mxgraph/src/view/mxGraph.js:13259— findTreeRoots has cognitive complexity 41 (threshold 15). Drivers by points: if/else 7 (20 pts), ternaries 4 (10 pts), loops 2 (6 pts), boolean chains 5 (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.
hideDialog (cognitive 41) REDACTED:9873— hideDialog has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (27 pts), boolean chains 10, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 17). Of this number, 22 points are the body's own statements and 19 belong to one function literal inside it that branches. 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.
createFile (cognitive 41) src/main/webapp/js/diagramly/App.js:6718— createFile has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 13, ternaries 3 (4 pts), error handling 1 (2 pts) (nesting depth added 9). Of this number, 33 points are the body's own statements and 8 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.
createKeyboardGrid (cognitive 41) src/main/webapp/js/grapheditor/Editor.js:1260— createKeyboardGrid has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 6 (18 pts), if/else 9 (15 pts), boolean chains 8 (nesting depth added 18). Most of this is not in the body itself: 1 of the 41 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 1340, 1329). 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.
updateFixedPointSpacing (cognitive 41) src/main/webapp/mxgraph/src/view/mxGraphView.js:3353— updateFixedPointSpacing has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 10 (19 pts), boolean chains 10, if/else 5 (10 pts), loops 1 (2 pts) (nesting depth added 15). Of this number, 29 points are the body's own statements and 12 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
installListeners (cognitive 41) src/main/webapp/mxgraph/src/view/mxGraphView.js:4691— installListeners has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 16 (nesting depth added 12). Most of this is not in the body itself: 6 of the 41 points are its own statements and the rest belongs to 15 function items inside it that branch (a function literal at line 4796, a function literal at line 4824, a function literal at line 4812, …). 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.
addNode (cognitive 41) REDACTED:1172— addNode has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 15 (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.
loadScripts (cognitive 41) src/main/webapp/js/diagramly/FusionTheme.js:621— loadScripts has cognitive complexity 41 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (11 pts), ternaries 2 (6 pts), boolean chains 3, error handling 1 (3 pts) (nesting depth added 23). Of this number, 25 points are the body's own statements and 16 belong to 4 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
showTrelloDialog (cognitive 41) REDACTED:448— showTrelloDialog has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (25 pts), ternaries 7 (9 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 12). Most of this is not in the body itself: 1 of the 41 points is its own statement and the rest belongs to 21 function items inside it that branch (a function literal at line 616, a function literal at line 475, a function literal at line 524, …). 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.
App.App.loadPlugins (cognitive 40) src/main/webapp/js/diagramly/App.js:1924— App.App.loadPlugins has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (35 pts), error handling 1 (3 pts), boolean chains 1, 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.
EditorUi.EditorUi.setOutlineOrder (cognitive 40) src/main/webapp/js/diagramly/EditorUi.js:35653— EditorUi.EditorUi.setOutlineOrder has cognitive complexity 40 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 8 (12 pts), boolean chains 9, ternaries 3 (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.
GraphViewer.GraphViewer.showLayers (cognitive 40) REDACTED:1761— GraphViewer.GraphViewer.showLayers has cognitive complexity 40 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 4 (14 pts), boolean chains 5, ternaries 2 (3 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.
Trees.EditorUi.addTrees (cognitive 40) src/main/webapp/js/diagramly/Trees.js:221— Trees.EditorUi.addTrees has cognitive complexity 40 (threshold 15). Drivers by points: if/else 103 (224 pts), boolean chains 113, ternaries 12 (40 pts), loops 18 (38 pts), error handling 1 (2 pts) (nesting depth added 170). 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. This shape REPEATS in the file: 3 other methods here (Trees.EditorUi.addTrees::collectTreeRemoval, Trees.EditorUi.addTrees::hasConnectedSurvivor, Trees.EditorUi.addTrees::getTreeDirection) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Sidebar.Sidebar.showEntries (cognitive 40) src/main/webapp/js/diagramly/sidebar/Sidebar.js:372— Sidebar.Sidebar.showEntries has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 5 (12 pts), boolean chains 10 (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.
TidyStyle.Tidy.styleTheme (cognitive 40) src/main/webapp/js/diagramly/tidy/TidyStyle.js:1599— TidyStyle.Tidy.styleTheme has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 5 (9 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.updateInheritedLabelValues (cognitive 40) REDACTED:19094— Graph.Graph.updateInheritedLabelValues has cognitive complexity 40 (threshold 15). Drivers by points: ternaries 5 (19 pts), loops 3 (10 pts), if/else 3 (8 pts), boolean chains 3 (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.
Sidebar.Sidebar.matchTermEntries (cognitive 40) src/main/webapp/js/grapheditor/Sidebar.js:2440— Sidebar.Sidebar.matchTermEntries has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (28 pts), loops 3 (9 pts), boolean chains 3 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
getClassicStyleEntries (cognitive 40) src/main/webapp/js/diagramly/Editor.js:120— getClassicStyleEntries has cognitive complexity 40 (threshold 15). Drivers by points: if/else 6 (18 pts), boolean chains 11, loops 4 (7 pts), ternaries 2 (4 pts) (nesting depth added 17). Of this number, 26 points are the body's own statements and 14 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
absoluteCssFonts (cognitive 40) src/main/webapp/js/diagramly/Editor.js:7030— absoluteCssFonts has cognitive complexity 40 (threshold 15). Drivers by points: if/else 8 (20 pts), ternaries 4 (16 pts), loops 1 (3 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.
flexArrow (cognitive 40) src/main/webapp/js/grapheditor/Shapes.js:10134— flexArrow has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (36 pts), boolean chains 4 (nesting depth added 20). Most of this is not in the body itself: 2 of the 40 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 10180, 10251, 10149, …). 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.
removeUserDefinedDarkColors (cognitive 40) REDACTED:1947— removeUserDefinedDarkColors has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (25 pts), error handling 1 (5 pts), loops 2 (5 pts), boolean chains 4, ternaries 1 (nesting depth added 23). Of this number, 33 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
load (cognitive 40) src/main/webapp/js/diagramly/App.js:4079— load has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (26 pts), error handling 3 (6 pts), boolean chains 5, ternaries 1 (3 pts) (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
saveLibrary (cognitive 40) src/main/webapp/js/diagramly/App.js:6150— saveLibrary has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 13, ternaries 4, error handling 1 (nesting depth added 6). Most of this is not in the body itself: 12 of the 40 points are its own statements and the rest belongs to 11 function literals inside it that branch (lines 6179, 6159, 6247, …). 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.
createAlternateContent (cognitive 40) REDACTED:602— createAlternateContent has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (23 pts), ternaries 6 (12 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
handleFileError (cognitive 40) REDACTED:3680— handleFileError has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (25 pts), ternaries 2 (8 pts), boolean chains 7 (nesting depth added 18). Of this number, 23 points are the body's own statements and 17 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
init (cognitive 40) src/main/webapp/js/grapheditor/Menus.js:50— init has cognitive complexity 40 (threshold 15). Drivers by points: if/else 18 (26 pts), loops 6 (9 pts), boolean chains 3, ternaries 2 (nesting depth added 11). None of this is in the body itself: all 40 points belong to 52 function items inside it that branch (a function literal at line 227, a function literal at line 59, a function literal at line 240, …). 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.
styleMindmap (cognitive 40) src/main/webapp/js/diagramly/tidy/TidyStyle.js:1145— styleMindmap has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 6 (9 pts), boolean chains 6, ternaries 1 (nesting depth added 17). Of this number, 36 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getRoutePoints (cognitive 40) src/main/webapp/js/orgchart/mxOrgChartLayout.js:149— getRoutePoints has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 16, if/else 6 (12 pts), loops 7 (9 pts), ternaries 1 (3 pts) (nesting depth added 10). Of this number, 35 points are the body's own statements and 5 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
initStates (cognitive 40) src/main/webapp/js/diagramly/SpringMove.js:353— initStates has cognitive complexity 40 (threshold 15). Drivers by points: if/else 7 (23 pts), loops 6 (13 pts), boolean chains 4 (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.
addGraphFragment (cognitive 40) src/main/webapp/mxgraph/src/view/mxPrintPreview.js:963— addGraphFragment has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (35 pts), ternaries 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 20). Of this number, 27 points are the body's own statements and 13 belong to 3 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Dialogs.LinkDialog (cognitive 39) src/main/webapp/js/diagramly/Dialogs.js:6051— Dialogs.LinkDialog has cognitive complexity 39 (threshold 15). Drivers by points: if/else 34 (52 pts), ternaries 9 (23 pts), boolean chains 20, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Dialogs.LinkDialog::updateActionSummary) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
LibavoidRouting.LibavoidRouting.livePreviewMove (cognitive 39) src/main/webapp/js/diagramly/LibavoidRouting.js:3842— LibavoidRouting.LibavoidRouting.livePreviewMove has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 6 (8 pts), boolean chains 5, ternaries 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Editor.mxGraph.updatePageBreaks (cognitive 39) src/main/webapp/js/grapheditor/Editor.js:5108— Editor.mxGraph.updatePageBreaks has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (17 pts), ternaries 6 (11 pts), boolean chains 7, loops 2 (4 pts) (nesting depth added 15). Most of this is not in the body itself: 12 of the 39 points are its own statements and the rest belongs to one function literal inside it that branches (line 5169). 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.
mxVertexHandler.mxVertexHandler.mouseMove (cognitive 39) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:870— mxVertexHandler.mxVertexHandler.mouseMove has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (36 pts), boolean chains 3 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
mxAtlassian.mxAtlassianJiraIssue.paintForeground (cognitive 39) src/main/webapp/shapes/mxAtlassian.js:73— mxAtlassian.mxAtlassianJiraIssue.paintForeground has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18 (36 pts), match/switch 3 (nesting depth added 18). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
SplashDialog (cognitive 39) src/main/webapp/js/diagramly/Dialogs.js:347— SplashDialog has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 10, loops 1 (4 pts), ternaries 1 (nesting depth added 12). Of this number, 35 points are the body's own statements and 4 belong to 15 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SaveDialog (cognitive 39) src/main/webapp/js/diagramly/Dialogs.js:4424— SaveDialog has cognitive complexity 39 (threshold 15). Drivers by points: if/else 64 (120 pts), boolean chains 57, ternaries 10 (27 pts), loops 1 (2 pts) (nesting depth added 74). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addGroupPadding (cognitive 39) src/main/webapp/js/grapheditor/Format.js:3969— addGroupPadding has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 4 (7 pts), boolean chains 6, ternaries 2 (6 pts) (nesting depth added 17). Most of this is not in the body itself: 11 of the 39 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 4020, a function literal at line 3997, isUniform, …). 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.
addFoldingHandler (cognitive 39) src/main/webapp/js/grapheditor/Sidebar.js:7723— addFoldingHandler has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 2 (10 pts), ternaries 3 (7 pts), boolean chains 5 (nesting depth added 18). Most of this is not in the body itself: 4 of the 39 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 7735, 7830, 7775). 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.
pingVersion (cognitive 39) src/main/webapp/js/diagramly/App.js:733— pingVersion has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 8 (21 pts), error handling 3 (8 pts), if/else 3 (6 pts), boolean chains 4 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
showNotification (cognitive 39) src/main/webapp/js/diagramly/App.js:8210— showNotification has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (25 pts), ternaries 5 (7 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 14). Of this number, 16 points are the body's own statements and 23 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ColorPicker (cognitive 39) REDACTED:29— ColorPicker has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 10 (12 pts), boolean chains 11, loops 2 (3 pts), match/switch 1 (nesting depth added 4). Most of this is not in the body itself: 1 of the 39 points is its own statement and the rest belongs to 10 function items inside it that branch (fromHSV, a function literal at line 149, fromString, …). 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.
getResizePreviewCache (cognitive 39) src/main/webapp/js/diagramly/LibavoidRouting.js:4090— getResizePreviewCache has cognitive complexity 39 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 6 (19 pts), boolean chains 1 (nesting depth added 26). Of this number, 37 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
collideLabels (cognitive 39) src/main/webapp/js/diagramly/ForceExplorer.js:3023— collideLabels has cognitive complexity 39 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 4 (6 pts), ternaries 2 (6 pts), boolean chains 5 (nesting depth added 20). Of this number, 35 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
updateCellState (cognitive 39) src/main/webapp/mxgraph/src/view/mxGraphView.js:2636— updateCellState has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (33 pts), ternaries 1 (4 pts), boolean chains 2 (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.
getStructure (cognitive 39) src/main/webapp/js/diagramly/tidy/Tidy.js:498— getStructure has cognitive complexity 39 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 14, loops 8 (nesting depth added 9). Of this number, 36 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App.App.exportFile (cognitive 38) src/main/webapp/js/diagramly/App.js:8664— App.App.exportFile has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (23 pts), ternaries 3 (9 pts), boolean chains 6 (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.
EditorUi.mxChildChange.execute::collect (cognitive 38) src/main/webapp/js/diagramly/EditorUi.js:22347— EditorUi.mxChildChange.execute::collect has cognitive complexity 38 (threshold 15). Drivers by points: if/else 4 (13 pts), ternaries 4 (13 pts), boolean chains 6, loops 4 (6 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. This shape REPEATS in the file: one other method here (EditorUi.mxChildChange.execute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Extensions.createGroup (cognitive 38) REDACTED:6507— Extensions.createGroup has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 5 (12 pts), loops 4 (7 pts), boolean chains 4, error handling 1 (nesting depth added 13). Of this number, 22 points are the body's own statements and 16 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
emf-svg.emitTextOut (cognitive 38) src/main/webapp/js/diagramly/emf/emf-svg.js:2877— emf-svg.emitTextOut has cognitive complexity 38 (threshold 15). Drivers by points: if/else 21 (33 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxGraphMlCodec.mxGraphMlCodec.dataElem2Obj (cognitive 38) REDACTED:423— mxGraphMlCodec.mxGraphMlCodec.dataElem2Obj has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (28 pts), loops 2 (5 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Graph.Graph.optimizeNode (cognitive 38) REDACTED:4580— Graph.Graph.optimizeNode has cognitive complexity 38 (threshold 15). Drivers by points: loops 8 (18 pts), if/else 8 (14 pts), boolean chains 6 (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.
Graph.Graph.isStyleAllowed::isTokenAllowed (cognitive 38) REDACTED:4954— Graph.Graph.isStyleAllowed::isTokenAllowed has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 6, ternaries 2 (6 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.
Graph.Graph.initTransparentBoundsStyleSync (cognitive 38) REDACTED:9075— Graph.Graph.initTransparentBoundsStyleSync has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 3 (9 pts), boolean chains 7 (nesting depth added 18). None of this is in the body itself: all 38 points belong to one function literal inside it that branches (line 9077). 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.
Graph.Graph.writeContainerLayoutGeometries (cognitive 38) REDACTED:14733— Graph.Graph.writeContainerLayoutGeometries has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 9, loops 4 (7 pts), ternaries 1 (nesting depth added 14). Of this number, 37 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
scrollPointToVisible (cognitive 38) src/main/webapp/mxgraph/src/view/mxGraph.js:2859— scrollPointToVisible has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (30 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
createMarker (cognitive 38) src/main/webapp/js/grapheditor/Shapes.js:7849— createMarker has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 10 (28 pts), if/else 4 (7 pts), boolean chains 3 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
sanityCheck (cognitive 38) src/main/webapp/js/diagramly/App.js:2519— sanityCheck has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 12 (25 pts), if/else 4 (8 pts), boolean chains 5 (nesting depth added 17). Of this number, 35 points are the body's own statements and 3 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.
pickFolder (cognitive 38) src/main/webapp/js/diagramly/App.js:8574— pickFolder has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 11, ternaries 5 (11 pts) (nesting depth added 11). Most of this is not in the body itself: 15 of the 38 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 8584, 8605, 8619, …). 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.
wrapSvgBlockElements (cognitive 38) REDACTED:3215— wrapSvgBlockElements has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (24 pts), boolean chains 9, loops 3 (5 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.
isJsonEqual (cognitive 38) src/main/webapp/js/diagramly/DiffSync.js:3211— isJsonEqual has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (18 pts), ternaries 2 (8 pts), boolean chains 6, loops 3 (6 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.
parse (cognitive 38) src/main/webapp/js/diagramly/Settings.js:416— parse has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (33 pts), boolean chains 4, ternaries 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.
EditorUi.EditorUi.mergeMermaidStyleDelta (cognitive 37) src/main/webapp/js/diagramly/EditorUi.js:15151— EditorUi.EditorUi.mergeMermaidStyleDelta has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (28 pts), loops 5, boolean chains 2, ternaries 2 (nesting depth added 14). Of this number, 24 points are the body's own statements and 13 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GitHubFile.GitHubFile.saveFile (cognitive 37) src/main/webapp/js/diagramly/GitHubFile.js:233— GitHubFile.GitHubFile.saveFile has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (33 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 19). Most of this is not in the body itself: 9 of the 37 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 244, 270, 260, …). 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.
EditorUi.EditorUi.createKeyHandler (cognitive 37) REDACTED:10922— EditorUi.EditorUi.createKeyHandler has cognitive complexity 37 (threshold 15). Drivers by points: if/else 33 (104 pts), boolean chains 44, ternaries 3 (11 pts), loops 2 (5 pts) (nesting depth added 82). 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.
Graph.mxGraphView.updateAutoLabelPlacements (cognitive 37) REDACTED:30328— Graph.mxGraphView.updateAutoLabelPlacements has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (28 pts), boolean chains 4, loops 4, ternaries 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.
Sidebar.Sidebar.itemClicked (cognitive 37) src/main/webapp/js/grapheditor/Sidebar.js:7306— Sidebar.Sidebar.itemClicked has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 5 (12 pts), boolean chains 8, 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.
mxLeanMap.mxShapeLeanTimeline.paintVertexShape (cognitive 37) src/main/webapp/shapes/mxLeanMap.js:1999— mxLeanMap.mxShapeLeanTimeline.paintVertexShape has cognitive complexity 37 (threshold 15). Drivers by points: if/else 22, boolean chains 15. 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.
AbsAuth.contactOAuthServer (cognitive 37) src/main/server/java/com/mxgraph/online/AbsAuth.java:493— AbsAuth.contactOAuthServer has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (27 pts), error handling 2 (4 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
init (cognitive 37) src/main/webapp/js/diagramly/Dialogs.js:28223— init has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 8, loops 1, ternaries 1 (nesting depth added 11). Most of this is not in the body itself: 1 of the 37 points is its own statement and the rest belongs to 10 function items inside it that branch (a function literal at line 28270, a function literal at line 28228, a function literal at line 28341, …). 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.
createCellColorOption (cognitive 37) src/main/webapp/js/grapheditor/Format.js:1881— createCellColorOption has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 7 (10 pts), loops 4 (7 pts), boolean chains 6 (nesting depth added 12). Most of this is not in the body itself: 4 of the 37 points are its own statements and the rest belongs to 8 function items inside it that branch (getValue, getColor, a function literal at line 1961, …). 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.
Sidebar (cognitive 37) src/main/webapp/js/grapheditor/Sidebar.js:7— Sidebar has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 9 (11 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 11). Of this number, 18 points are the body's own statements and 19 belong to 7 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.
installAutoRouting::collectRestyled (cognitive 37) src/main/webapp/js/diagramly/LibavoidRouting.js:500— installAutoRouting::collectRestyled has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 12, loops 3 (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.
searchEntries (cognitive 37) src/main/webapp/js/diagramly/sidebar/Sidebar.js:2436— searchEntries has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 6, error handling 1 (3 pts) (nesting depth added 17). Most of this is not in the body itself: 7 of the 37 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 2466, 2459, 2507). 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.
redrawPreviewHandles (cognitive 37) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:1764— redrawPreviewHandles has cognitive complexity 37 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 10, ternaries 3 (6 pts), loops 2 (5 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getFormatControl (cognitive 37) src/main/webapp/js/grapheditor/Omnibox.js:1543— getFormatControl has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 12, ternaries 5 (7 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.
createMarker (cognitive 37) src/main/webapp/mxgraph/src/handler/mxConnectionHandler.js:548— createMarker has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 11, ternaries 1 (nesting depth added 11). None of this is in the body itself: all 37 points belong to 4 function literals inside it that branch (lines 555, 619, 633, …). 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.
createTextToolbar (cognitive 37) src/main/webapp/js/grapheditor/Toolbar.js:165— createTextToolbar has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 6 (13 pts), boolean chains 6, ternaries 2 (4 pts) (nesting depth added 13). None of this is in the body itself: all 37 points belong to 36 function literals inside it that branch (lines 286, 365, 428, …). 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.
EditorUi.EditorUi.sanitizeRealtimeTerminals (cognitive 36) src/main/webapp/js/diagramly/EditorUi.js:20930— EditorUi.EditorUi.sanitizeRealtimeTerminals has cognitive complexity 36 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 3 (9 pts), boolean chains 5 (nesting depth added 20). Of this number, 26 points are the body's own statements and 10 belong to one function item inside it that branches. 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.
Extensions.LucidImporter.importState (cognitive 36) REDACTED:7300— Extensions.LucidImporter.importState has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 4 (5 pts), boolean chains 4, ternaries 2 (nesting depth added 12). Of this number, 25 points are the body's own statements and 11 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ForceExplorer.ForceExplorer.renderTransform (cognitive 36) src/main/webapp/js/diagramly/ForceExplorer.js:4146— ForceExplorer.ForceExplorer.renderTransform has cognitive complexity 36 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 4 (9 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 20). Of this number, 35 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.destroy (cognitive 36) REDACTED:12049— EditorUi.EditorUi.destroy has cognitive complexity 36 (threshold 15). Drivers by points: if/else 23 (27 pts), loops 4 (7 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Graph.Graph.refreshBrowserTranslateMirror (cognitive 36) REDACTED:9513— Graph.Graph.refreshBrowserTranslateMirror has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 6 (11 pts), boolean chains 3, 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.
Graph.mxEdgeStyle.SideToSide (cognitive 36) REDACTED:32686— Graph.mxEdgeStyle.SideToSide has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 7, ternaries 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sidebar.Sidebar.getShapeMatches (cognitive 36) src/main/webapp/js/grapheditor/Sidebar.js:1314— Sidebar.Sidebar.getShapeMatches has cognitive complexity 36 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 2 (9 pts), ternaries 3 (6 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.
getStyle (cognitive 36) src/main/webapp/js/diagramly/Editor.js:2215— getStyle has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 8 (15 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 13). Of this number, 31 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
isEventIgnored (cognitive 36) src/main/webapp/mxgraph/src/view/mxGraph.js:14060— isEventIgnored has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 19, if/else 14 (17 pts) (nesting depth added 3). Of this number, 30 points are the body's own statements and 6 belong to 3 function literals inside it that branch. 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.
paintVertexShape (cognitive 36) src/main/webapp/js/grapheditor/Shapes.js:5787— paintVertexShape has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 11 (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.
createItem (cognitive 36) src/main/webapp/js/grapheditor/Sidebar.js:5244— createItem has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (23 pts), ternaries 4 (7 pts), boolean chains 6 (nesting depth added 13). Of this number, 29 points are the body's own statements and 7 belong to 4 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.
D2 · Cognitive Complexity· save (cognitive 36) · ×1
save (cognitive 36) src/main/webapp/js/diagramly/App.js:8401— save has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (24 pts), error handling 3 (7 pts), boolean chains 5 (nesting depth added 13). Most of this is not in the body itself: 6 of the 36 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 8421, a function literal at line 8429, a function literal at line 8407, …). 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.
getEndLabelPoint (cognitive 36) src/main/webapp/js/diagramly/ForceExplorer.js:2966— getEndLabelPoint has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 7 (20 pts), if/else 4 (10 pts), boolean chains 6 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
validateCellState (cognitive 36) src/main/webapp/mxgraph/src/view/mxGraphView.js:2389— validateCellState has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (29 pts), loops 1 (4 pts), boolean chains 2, ternaries 1 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
getLayoutFormValues (cognitive 36) src/main/webapp/js/diagramly/LayoutPicker.js:213— getLayoutFormValues has cognitive complexity 36 (threshold 15). Drivers by points: ternaries 8 (18 pts), if/else 9 (11 pts), boolean chains 6, 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.
tryCandidate (cognitive 36) src/main/webapp/js/diagramly/tidy/Tidy.js:2871— tryCandidate has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 10, ternaries 2 (4 pts), loops 1 (nesting depth added 9). Most of this is not in the body itself: 15 of the 36 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 2885, a function literal at line 2950, (anonymous)::isCellMovable). 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.
Loop (cognitive 36) src/main/webapp/mxgraph/src/view/mxEdgeStyle.js:235— Loop has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 5, loops 1 (3 pts), 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.
SideToSide (cognitive 36) src/main/webapp/mxgraph/src/view/mxEdgeStyle.js:405— SideToSide has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 7, ternaries 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dragOver (cognitive 36) src/main/webapp/mxgraph/src/util/mxDragSource.js:654— dragOver has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 9, ternaries 3 (8 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.
updatePreviewState (cognitive 36) src/main/webapp/mxgraph/src/handler/mxEdgeSegmentHandler.js:118— updatePreviewState has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (23 pts), boolean chains 11, loops 1 (2 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.
Dialogs.CustomActionDialog (cognitive 35) src/main/webapp/js/diagramly/Dialogs.js:8082— Dialogs.CustomActionDialog has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 8, loops 2 (8 pts), ternaries 4, error handling 1 (2 pts) (nesting depth added 12). Of this number, 32 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.isDiagramDataEmpty (cognitive 35) src/main/webapp/js/diagramly/EditorUi.js:1183— EditorUi.EditorUi.isDiagramDataEmpty has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (28 pts), boolean chains 4, loops 1 (2 pts), error handling 1 (nesting depth added 19). Of this number, 34 points are the body's own statements and 1 belongs to one function item inside it that branches. 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.
EditorUi.EditorUi.createHtml (cognitive 35) src/main/webapp/js/diagramly/EditorUi.js:10671— EditorUi.EditorUi.createHtml has cognitive complexity 35 (threshold 15). Drivers by points: if/else 19 (24 pts), ternaries 4 (7 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.createFormatWindow (cognitive 35) src/main/webapp/js/diagramly/EditorUi.js:26727— EditorUi.EditorUi.createFormatWindow has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 6 (15 pts), if/else 7 (12 pts), boolean chains 8 (nesting depth added 14). Of this number, 25 points are the body's own statements and 10 belong to 4 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
EditorUi.EditorUi.parseTableRows (cognitive 35) src/main/webapp/js/diagramly/EditorUi.js:37089— EditorUi.EditorUi.parseTableRows has cognitive complexity 35 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 5 (12 pts), boolean chains 11 (nesting depth added 13). Of this number, 34 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.applyDataStyles (cognitive 35) REDACTED:18471— Graph.Graph.applyDataStyles has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (21 pts), boolean chains 8, loops 1 (3 pts), ternaries 1 (3 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.
Graph.Graph.parseDataSource (cognitive 35) REDACTED:18831— Graph.Graph.parseDataSource has cognitive complexity 35 (threshold 15). Drivers by points: if/else 5 (14 pts), ternaries 4 (10 pts), boolean chains 8, loops 1 (3 pts) (nesting depth added 17). Of this number, 31 points are the body's own statements and 4 belong to one function item inside it that branches. 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.
Graph.Graph.getBoundsForGroup (cognitive 35) REDACTED:21561— Graph.Graph.getBoundsForGroup has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (32 pts), loops 1 (2 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.
Graph.LabelBoxIndex.add (cognitive 35) REDACTED:29570— Graph.LabelBoxIndex.add has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 10, loops 4 (8 pts) (nesting depth added 8). Of this number, 19 points are the body's own statements and 16 belong to 3 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.
mxGraph.mxGraph.processChange (cognitive 35) src/main/webapp/mxgraph/src/view/mxGraph.js:2071— mxGraph.mxGraph.processChange has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 9 (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.
mxBpmnShape2.mxShapeBpmn2Task2.paintVertexShape (cognitive 35) src/main/webapp/shapes/bpmn/mxBpmnShape2.js:1880— mxBpmnShape2.mxShapeBpmn2Task2.paintVertexShape has cognitive complexity 35 (threshold 15). Drivers by points: if/else 26 (34 pts), match/switch 1 (nesting depth added 8). 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.
BackgroundImageDialog (cognitive 35) src/main/webapp/js/diagramly/Dialogs.js:927— BackgroundImageDialog has cognitive complexity 35 (threshold 15). Drivers by points: if/else 40 (61 pts), boolean chains 20, ternaries 13 (16 pts), loops 3 (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.
convertImageToDataUri (cognitive 35) src/main/webapp/js/diagramly/Editor.js:6202— convertImageToDataUri has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (25 pts), error handling 2 (4 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 14). Most of this is not in the body itself: 9 of the 35 points are its own statements and the rest belongs to 6 function items inside it that branch (onload, a function literal at line 6229, onerror, …). 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.
addGeometryHandler::update (cognitive 35) src/main/webapp/js/grapheditor/Format.js:4131— addGeometryHandler::update has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (27 pts), loops 1 (3 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
nextDriveUse (cognitive 35) src/main/webapp/js/diagramly/App.js:3178— nextDriveUse has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 11, ternaries 5 (9 pts) (nesting depth added 8). Most of this is not in the body itself: 6 of the 35 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 3225, 3201, 3261, …). 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.
loadTemplate (cognitive 35) src/main/webapp/js/diagramly/App.js:6513— loadTemplate has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 6 (13 pts), boolean chains 5, error handling 1 (nesting depth added 12). Most of this is not in the body itself: 7 of the 35 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 6529, 6558, 6551, …). 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.
getMaxInlineFontSize (cognitive 35) src/main/webapp/mxgraph/src/util/mxUtils.js:6089— getMaxInlineFontSize has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (32 pts), boolean chains 2, loops 1 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
snapPoints (cognitive 35) src/main/webapp/js/diagramly/LibavoidRouting.js:1650— snapPoints has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 18, if/else 8 (11 pts), ternaries 5, loops 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
cleanup (cognitive 35) src/main/webapp/js/diagramly/DrawioFileSync.js:1573— cleanup has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 7, ternaries 1 (3 pts), error handling 1 (nesting depth added 14). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
addSearchIndex (cognitive 35) src/main/webapp/js/diagramly/sidebar/Sidebar.js:1411— addSearchIndex has cognitive complexity 35 (threshold 15). Drivers by points: if/else 6 (26 pts), ternaries 1 (7 pts), loops 1 (2 pts) (nesting depth added 27). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
getFillPattern (cognitive 35) REDACTED:901— getFillPattern has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 10 (13 pts), if/else 7 (11 pts), boolean chains 5, loops 1 (3 pts), match/switch 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
setViewState (cognitive 35) src/main/webapp/js/diagramly/Pages.js:1805— setViewState has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 7, ternaries 3 (6 pts), loops 2 (5 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runWithDialog::collect (cognitive 35) src/main/webapp/js/diagramly/ElkLayout.js:640— runWithDialog::collect has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 6, loops 3 (4 pts), ternaries 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Editor.Editor.embedCssFonts (cognitive 34) src/main/webapp/js/diagramly/Editor.js:7108— Editor.Editor.embedCssFonts has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (20 pts), loops 3 (8 pts), boolean chains 6 (nesting depth added 12). Most of this is not in the body itself: 8 of the 34 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 7153, 7119, 7193). 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.
EditorUi.EditorUi.showSearchWindow (cognitive 34) src/main/webapp/js/diagramly/EditorUi.js:6093— EditorUi.EditorUi.showSearchWindow has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 9 (23 pts), boolean chains 6, if/else 4 (5 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.
EditorUi.EditorUi.encodeEmbedImage (cognitive 34) src/main/webapp/js/diagramly/EditorUi.js:19428— EditorUi.EditorUi.encodeEmbedImage has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 3 (4 pts), boolean chains 3, ternaries 2 (nesting depth added 15). Most of this is not in the body itself: 4 of the 34 points are its own statements and the rest belongs to one function literal inside it that branches (line 19467). 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.
EditorUi.EditorUi.installResizeHandler (cognitive 34) src/main/webapp/js/diagramly/EditorUi.js:26160— EditorUi.EditorUi.installResizeHandler has cognitive complexity 34 (threshold 15). Drivers by points: if/else 21 (23 pts), boolean chains 7, ternaries 2 (4 pts) (nesting depth added 4). Most of this is not in the body itself: 6 of the 34 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 26280, 26345, 26242, …). 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.
EditorUi.EditorUi.updateActionStates (cognitive 34) src/main/webapp/js/diagramly/EditorUi.js:41885— EditorUi.EditorUi.updateActionStates has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 29, if/else 3 (4 pts), loops 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Tidy.Tidy.getOrderKept (cognitive 34) src/main/webapp/js/diagramly/tidy/Tidy.js:1349— Tidy.Tidy.getOrderKept has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 5 (17 pts), if/else 3 (11 pts), boolean chains 3, loops 2 (3 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.
Dialogs.EditDiagramDialog (cognitive 34) REDACTED:3062— Dialogs.EditDiagramDialog has cognitive complexity 34 (threshold 15). Drivers by points: if/else 21 (27 pts), error handling 2 (4 pts), boolean chains 3 (nesting depth added 8). Most of this is not in the body itself: 11 of the 34 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 3217, handleDrop, a function literal at line 3267, …). 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.
Editor.FilenameDialog.createFileTypes (cognitive 34) src/main/webapp/js/grapheditor/Editor.js:4647— Editor.FilenameDialog.createFileTypes has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (22 pts), ternaries 2 (5 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 14). Of this number, 21 points are the body's own statements and 13 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.applyStyleRules (cognitive 34) REDACTED:18654— Graph.Graph.applyStyleRules has cognitive complexity 34 (threshold 15). Drivers by points: if/else 6 (21 pts), loops 3 (7 pts), boolean chains 4, ternaries 1 (2 pts) (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.
Graph.mxEdgeStyle.TopToBottom (cognitive 34) REDACTED:32776— Graph.mxEdgeStyle.TopToBottom has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 8, ternaries 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InlineToolbar.InlineToolbar.getTableRange (cognitive 34) src/main/webapp/js/grapheditor/InlineToolbar.js:3979— InlineToolbar.InlineToolbar.getTableRange has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 5 (13 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 15). Of this number, 31 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Omnibox.Omnibox.getFields (cognitive 34) src/main/webapp/js/grapheditor/Omnibox.js:1954— Omnibox.Omnibox.getFields has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 4 (10 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 19). Most of this is not in the body itself: 13 of the 34 points are its own statements and the rest belongs to 2 function items inside it that branch (add, a function literal at line 1997). 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.
mxSvgCanvas2D.mxSvgCanvas2D.measureTextBackgrounds (cognitive 34) REDACTED:4399— mxSvgCanvas2D.mxSvgCanvas2D.measureTextBackgrounds has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 4 (15 pts), if/else 5 (12 pts), loops 3 (6 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.
FontDialog (cognitive 34) src/main/webapp/js/diagramly/Dialogs.js:23963— FontDialog has cognitive complexity 34 (threshold 15). Drivers by points: if/else 24 (25 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 2). Of this number, 18 points are the body's own statements and 16 belong to 6 function items inside it that branch. 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.
getEdgeValidationError (cognitive 34) src/main/webapp/mxgraph/src/view/mxGraph.js:9286— getEdgeValidationError has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 10, loops 1 (3 pts), ternaries 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
paintForeground (cognitive 34) src/main/webapp/js/grapheditor/Shapes.js:3339— paintForeground has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 5, loops 2 (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.
getClosestKeys (cognitive 34) src/main/webapp/js/grapheditor/Sidebar.js:1426— getClosestKeys has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 7 (12 pts), boolean chains 7, ternaries 2 (nesting depth added 11). Of this number, 32 points are the body's own statements and 2 belong to 2 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.
getPortConstraints (cognitive 34) src/main/webapp/mxgraph/src/util/mxUtils.js:3142— getPortConstraints has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (21 pts), match/switch 4 (12 pts), ternaries 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
updateStatus (cognitive 34) src/main/webapp/js/diagramly/DrawioFileSync.js:599— updateStatus has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 5 (15 pts), if/else 6 (11 pts), boolean chains 8 (nesting depth added 15). Most of this is not in the body itself: 12 of the 34 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 615, 655). 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.
getPreviousNode (cognitive 34) src/main/webapp/mxgraph/src/view/mxGraphView.js:1702— getPreviousNode has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 3 (7 pts), boolean chains 5, ternaries 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
moveDraggedTabsOutsideGroups (cognitive 34) src/main/webapp/js/diagramly/Pages.js:3775— moveDraggedTabsOutsideGroups has cognitive complexity 34 (threshold 15). Drivers by points: if/else 5 (12 pts), ternaries 3 (8 pts), boolean chains 7, loops 3 (7 pts) (nesting depth added 16). Of this number, 26 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
attachTexts (cognitive 34) src/main/webapp/js/diagramly/tidy/Tidy.js:1631— attachTexts has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 8, loops 4 (7 pts) (nesting depth added 14). Of this number, 27 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
updateParentHighlight (cognitive 34) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:2206— updateParentHighlight has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 14, ternaries 1 (4 pts) (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.
TopToBottom (cognitive 34) src/main/webapp/mxgraph/src/view/mxEdgeStyle.js:497— TopToBottom has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 8, ternaries 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
saveBase (cognitive 34) src/main/webapp/js/diagramly/tidy/TidyWindow.js:929— saveBase has cognitive complexity 34 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (10 pts), ternaries 3 (9 pts), boolean chains 5 (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.
startEditing (cognitive 34) src/main/webapp/mxgraph/src/view/mxCellEditor.js:840— startEditing has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 8 (nesting depth added 12). Most of this is not in the body itself: 14 of the 34 points are its own statements and the rest belongs to one function literal inside it that branches (line 889). 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.
Editor.Editor.keepFocusInList (cognitive 33) src/main/webapp/js/grapheditor/Editor.js:1152— Editor.Editor.keepFocusInList has cognitive complexity 33 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 2 (7 pts), ternaries 1 (6 pts), boolean chains 5 (nesting depth added 20). Most of this is not in the body itself: 1 of the 33 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 1173, 1162). 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.
Editor.Editor.getGraphXml (cognitive 33) src/main/webapp/js/grapheditor/Editor.js:1977— Editor.Editor.getGraphXml has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 12 (17 pts), if/else 10 (13 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.getPaletteCellsForShapePicker (cognitive 33) REDACTED:3149— EditorUi.EditorUi.getPaletteCellsForShapePicker has cognitive complexity 33 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 3 (9 pts), boolean chains 6, ternaries 2 (nesting depth added 17). Of this number, 23 points are the body's own statements and 10 belong to one function literal inside it that branches. 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.
EditorUi.EditorUi.updateActionStates (cognitive 33) REDACTED:8945— EditorUi.EditorUi.updateActionStates has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 26, loops 5, if/else 1 (2 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Format.Format.immediateRefresh (cognitive 33) src/main/webapp/js/grapheditor/Format.js:306— Format.Format.immediateRefresh has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 4, ternaries 2 (3 pts) (nesting depth added 10). Most of this is not in the body itself: 11 of the 33 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 338, 336). 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.
Graph.Graph.updateFollowingEdges (cognitive 33) REDACTED:13636— Graph.Graph.updateFollowingEdges has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 6, loops 4, ternaries 2 (nesting depth added 11). Of this number, 24 points are the body's own statements and 9 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.
Graph.Graph.getFirstLine::visit (cognitive 33) REDACTED:22600— Graph.Graph.getFirstLine::visit has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 15, if/else 5 (11 pts), loops 2 (4 pts), ternaries 1 (3 pts) (nesting depth added 10). 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.
Graph.Graph.getCellDescription (cognitive 33) REDACTED:22857— Graph.Graph.getCellDescription has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 4 (8 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.
Graph.mxGraphView.snapToAnchorPoint (cognitive 33) REDACTED:32509— Graph.mxGraphView.snapToAnchorPoint has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (24 pts), ternaries 1 (4 pts), loops 1 (3 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.
mxEdgeHandler.mxEdgeHandler.createBends (cognitive 33) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:654— mxEdgeHandler.mxEdgeHandler.createBends has cognitive complexity 33 (threshold 15). Drivers by points: if/else 6 (23 pts), ternaries 1 (6 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 23). Most of this is not in the body itself: 12 of the 33 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 671, 674). 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.
mxBpmnShape2.mxShapeBpmnEvent.strictDrawShape (cognitive 33) src/main/webapp/shapes/bpmn/mxBpmnShape2.js:903— mxBpmnShape2.mxShapeBpmnEvent.strictDrawShape has cognitive complexity 33 (threshold 15). Drivers by points: if/else 23 (31 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.
mxBpmnShape2.mxShapeBpmn2Task.paintVertexShape (cognitive 33) src/main/webapp/shapes/bpmn/mxBpmnShape2.js:1578— mxBpmnShape2.mxShapeBpmn2Task.paintVertexShape has cognitive complexity 33 (threshold 15). Drivers by points: if/else 24 (32 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
updateSelectionStateForTableCells (cognitive 33) REDACTED:1788— updateSelectionStateForTableCells has cognitive complexity 33 (threshold 15). Drivers by points: if/else 6 (15 pts), ternaries 2 (8 pts), boolean chains 7, loops 1 (3 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.
getPageIdForChange (cognitive 33) src/main/webapp/js/diagramly/DrawioFileSync.js:2555— getPageIdForChange has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 9, loops 2 (5 pts), ternaries 2 (4 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.
createPolygonHandles (cognitive 33) src/main/webapp/shapes/mxBasic.js:3435— createPolygonHandles has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 8, loops 3, error handling 1, ternaries 1 (nesting depth added 12). Most of this is not in the body itself: 10 of the 33 points are its own statements and the rest belongs to 9 function items inside it that branch ((anonymous)::execute, (anonymous)::redraw, a function literal at line 3535, …). 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.
getLayoutFormConfig (cognitive 33) src/main/webapp/js/diagramly/LayoutPicker.js:292— getLayoutFormConfig has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (23 pts), ternaries 1 (4 pts), boolean chains 3, loops 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.
mxODPicker (cognitive 33) src/main/webapp/js/onedrive/mxODPicker.js:11— mxODPicker has cognitive complexity 33 (threshold 15). Drivers by points: if/else 77 (107 pts), ternaries 47 (73 pts), boolean chains 41, error handling 4 (7 pts), loops 5 (7 pts), match/switch 2 (3 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.
add (cognitive 33) src/main/webapp/mxgraph/src/util/mxResources.js:205— add has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (23 pts), error handling 2 (8 pts), ternaries 2 (nesting depth added 18). Of this number, 18 points are the body's own statements and 15 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
refresh (cognitive 33) src/main/webapp/mxgraph/src/handler/mxSelectionCellsHandler.js:170— refresh has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 4, boolean chains 2 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
getCellStyle (cognitive 33) src/main/webapp/mxgraph/src/view/mxStylesheet.js:217— getCellStyle has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 2 (7 pts), ternaries 2 (5 pts), boolean chains 3 (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.
Dialogs.ParseDialog (cognitive 32) src/main/webapp/js/diagramly/Dialogs.js:1514— Dialogs.ParseDialog has cognitive complexity 32 (threshold 15). Drivers by points: if/else 71 (142 pts), boolean chains 33, ternaries 9 (33 pts), loops 8 (22 pts), error handling 1 (nesting depth added 109). 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.
Dialogs.PolygonDialog::renderPolygon (cognitive 32) src/main/webapp/js/diagramly/Dialogs.js:26244— Dialogs.PolygonDialog::renderPolygon has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 4 (8 pts), loops 7, boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiffSync.EditorUi.diffSavedPages (cognitive 32) src/main/webapp/js/diagramly/DiffSync.js:2100— DiffSync.EditorUi.diffSavedPages has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (19 pts), ternaries 2 (6 pts), loops 2 (4 pts), boolean chains 3 (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.
EditorUi.EditorUi.installImagePasteHandler (cognitive 32) src/main/webapp/js/diagramly/EditorUi.js:29414— EditorUi.EditorUi.installImagePasteHandler has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 3 (5 pts), boolean chains 3, error handling 1, ternaries 1 (nesting depth added 12). None of this is in the body itself: all 32 points belong to 5 function literals inside it that branch (lines 29418, 29454, 29463, …). 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.
EditorUi.EditorUi.readGraphModelFromHtmlClipboardData (cognitive 32) src/main/webapp/js/diagramly/EditorUi.js:29589— EditorUi.EditorUi.readGraphModelFromHtmlClipboardData has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (18 pts), error handling 4 (7 pts), boolean chains 4, ternaries 2 (3 pts) (nesting depth added 14). None of this is in the body itself: all 32 points belong to one function literal inside it that branches (line 29591). 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.
EditorUi.EditorUi.showRemotelyStoredLibrary (cognitive 32) src/main/webapp/js/diagramly/EditorUi.js:42367— EditorUi.EditorUi.showRemotelyStoredLibrary has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 4 (5 pts), error handling 2 (3 pts), boolean chains 2, ternaries 1 (nesting depth added 11). Most of this is not in the body itself: 6 of the 32 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 42406, 42467, 42430, …). 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.
SpringMove.SpringMove.init (cognitive 32) src/main/webapp/js/diagramly/SpringMove.js:119— SpringMove.SpringMove.init has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 5 (7 pts), boolean chains 4, 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.
EditorUi.EditorUi.selectCellInDirection (cognitive 32) REDACTED:4648— EditorUi.EditorUi.selectCellInDirection has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 7 (15 pts), if/else 5 (11 pts), boolean chains 5, loops 1 (nesting depth added 14). Most of this is not in the body itself: 13 of the 32 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 4685, bounds, depth). 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.
Format.ArrangePanel.addGeometryHandler.update (cognitive 32) src/main/webapp/js/grapheditor/Format.js:4131— Format.ArrangePanel.addGeometryHandler.update has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (27 pts), loops 1 (3 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.
Graph.mxImageShape.getImageDataUri (cognitive 32) REDACTED:253— Graph.mxImageShape.getImageDataUri has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (27 pts), boolean chains 5 (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.
Graph.Graph.replaceFontElements (cognitive 32) REDACTED:6297— Graph.Graph.replaceFontElements has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 4 (6 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxGraphView.mxGraphView.getPoint (cognitive 32) src/main/webapp/mxgraph/src/view/mxGraphView.js:4093— mxGraphView.mxGraphView.getPoint has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (17 pts), ternaries 4 (10 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ExportProxyServlet.doRequest (cognitive 32) REDACTED:49— ExportProxyServlet.doRequest has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (19 pts), loops 4 (7 pts), boolean chains 3, error handling 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addMathTextLayer (cognitive 32) src/main/webapp/js/diagramly/Editor.js:5631— addMathTextLayer has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 8 (14 pts), boolean chains 10, if/else 4 (6 pts), loops 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.
addClickHandler (cognitive 32) src/main/webapp/js/grapheditor/Sidebar.js:7406— addClickHandler has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 11, error handling 1 (nesting depth added 7). None of this is in the body itself: all 32 points belong to 5 function items inside it that branch (a function literal at line 7416, mouseUp, mouseMove, …). 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.
getPosition (cognitive 32) src/main/webapp/js/grapheditor/InlineToolbar.js:1238— getPosition has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 10, ternaries 7 (10 pts), if/else 6 (9 pts), loops 3 (nesting depth added 6). Of this number, 17 points are the body's own statements and 15 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
installFlaggedCells (cognitive 32) src/main/webapp/js/diagramly/LibavoidRouting.js:978— installFlaggedCells has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 11, loops 2 (3 pts) (nesting depth added 9). 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 items inside it that branch (a function literal at line 1018, update). 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.
updateDiagramData (cognitive 32) src/main/webapp/js/diagramly/Pages.js:2076— updateDiagramData has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 8, loops 3 (6 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.
checksumError (cognitive 32) REDACTED:890— checksumError has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 11, boolean chains 3, error handling 3, loops 1 (2 pts) (nesting depth added 5). Most of this is not in the body itself: 13 of the 32 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 938, 1004). 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.
patchFileNode (cognitive 32) src/main/webapp/js/diagramly/DiffSync.js:243— patchFileNode has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (6 pts), ternaries 1 (6 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.
diffOwnCellProperties (cognitive 32) src/main/webapp/js/diagramly/DiffSync.js:2675— diffOwnCellProperties has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 3 (9 pts), boolean chains 7, loops 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
createControls (cognitive 32) src/main/webapp/js/diagramly/ViewerModern.js:1143— createControls has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 9, error handling 1 (3 pts), loops 1 (nesting depth added 8). Of this number, 26 points are the body's own statements and 6 belong to 13 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
redrawShape (cognitive 32) src/main/webapp/mxgraph/src/view/mxCellRenderer.js:1788— redrawShape has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 12 (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.
start (cognitive 32) src/main/webapp/mxgraph/src/handler/mxGraphHandler.js:1010— start has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 18, if/else 3 (7 pts), loops 2 (5 pts), ternaries 1 (2 pts) (nesting depth added 8). Of this number, 24 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
createThumbnail (cognitive 32) src/main/webapp/js/diagramly/tidy/TidyWindow.js:1518— createThumbnail has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12, boolean chains 9, ternaries 6 (9 pts), loops 1 (2 pts) (nesting depth added 4). Of this number, 22 points are the body's own statements and 10 belong to 6 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Editor.Editor.addHtmlInCanvasFonts (cognitive 31) src/main/webapp/js/diagramly/Editor.js:7640— Editor.Editor.addHtmlInCanvasFonts has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 3 (8 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 20). Of this number, 28 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Editor.Editor.parseAnimationScript (cognitive 31) src/main/webapp/js/diagramly/Editor.js:15440— Editor.Editor.parseAnimationScript has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 4, loops 1, ternaries 1 (nesting depth added 13). Of this number, 28 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.hashValue (cognitive 31) src/main/webapp/js/diagramly/EditorUi.js:5715— EditorUi.EditorUi.hashValue has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 3 (8 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.
EditorUi.EditorUi.getEmbeddedSvg (cognitive 31) src/main/webapp/js/diagramly/EditorUi.js:13624— EditorUi.EditorUi.getEmbeddedSvg has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 5, error handling 1 (3 pts), ternaries 3 (nesting depth added 8). Of this number, 18 points are the body's own statements and 13 belong to 4 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.
EditorUi.EditorUi.importVisio (cognitive 31) src/main/webapp/js/diagramly/EditorUi.js:14364— EditorUi.EditorUi.importVisio has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (19 pts), error handling 3 (9 pts), boolean chains 3 (nesting depth added 12). None of this is in the body itself: all 31 points belong to 5 function literals inside it that branch (lines 14393, 14381, 14434, …). 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.
EditorUi.EditorUi.updateDefaultStyles (cognitive 31) src/main/webapp/js/diagramly/EditorUi.js:27719— EditorUi.EditorUi.updateDefaultStyles has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 10 (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.
EditorUi.EditorUi.parseDataSourceRows (cognitive 31) src/main/webapp/js/diagramly/EditorUi.js:38340— EditorUi.EditorUi.parseDataSourceRows has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 3 (8 pts), boolean chains 3 (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.
ElectronApp.App.main (cognitive 31) src/main/webapp/js/diagramly/ElectronApp.js:223— ElectronApp.App.main has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (21 pts), error handling 1 (4 pts), loops 2 (4 pts), boolean chains 1, ternaries 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.
GraphViewer.GraphViewer.loadLanguageResources (cognitive 31) REDACTED:3952— GraphViewer.GraphViewer.loadLanguageResources has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (16 pts), error handling 3 (10 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 17). Most of this is not in the body itself: 12 of the 31 points are its own statements and the rest belongs to 2 function items inside it that branch (done, a function literal at line 3986). 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.
EditorUi.EditorUi.getPaletteStyle (cognitive 31) REDACTED:3356— EditorUi.EditorUi.getPaletteStyle has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 9 (12 pts), boolean chains 4, ternaries 3 (nesting depth added 9). Of this number, 24 points are the body's own statements and 7 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.ctrlEnter (cognitive 31) REDACTED:9963— EditorUi.EditorUi.ctrlEnter has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (15 pts), ternaries 2 (8 pts), error handling 1 (3 pts), loops 1 (3 pts), boolean chains 2 (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.
Graph.Graph.getNestedCornerIconOffset (cognitive 31) REDACTED:20175— Graph.Graph.getNestedCornerIconOffset has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 4 (8 pts), boolean chains 3 (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.
Graph.Graph.addTextOutlineButton (cognitive 31) REDACTED:23234— Graph.Graph.addTextOutlineButton has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 6, loops 2, error handling 1, ternaries 1 (nesting depth added 5). Most of this is not in the body itself: 1 of the 31 points is its own statement and the rest belongs to 9 function items inside it that branch (escape, setVisible, keydown, …). 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.
Graph.Graph.addFlowAnimationToNode (cognitive 31) REDACTED:23581— Graph.Graph.addFlowAnimationToNode has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (7 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Omnibox.Omnibox.revealFormatControl (cognitive 31) src/main/webapp/js/grapheditor/Omnibox.js:1689— Omnibox.Omnibox.revealFormatControl has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 5, loops 1 (4 pts) (nesting depth added 15). Most of this is not in the body itself: 7 of the 31 points are its own statements and the rest belongs to one function literal inside it that branches (line 1693). 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.
Shapes.addCurvedPath (cognitive 31) src/main/webapp/js/grapheditor/Shapes.js:2058— Shapes.addCurvedPath has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 4 (8 pts), ternaries 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.
Shapes.MermaidBlockArrowShape.redrawPath (cognitive 31) src/main/webapp/js/grapheditor/Shapes.js:9486— Shapes.MermaidBlockArrowShape.redrawPath has cognitive complexity 31 (threshold 15). Drivers by points: if/else 19, boolean chains 11, loops 1. Of this number, 28 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
mxEdgeHandler.mxEdgeHandler.redraw (cognitive 31) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:2599— mxEdgeHandler.mxEdgeHandler.redraw has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (23 pts), loops 1 (5 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.
(anonymous) (cognitive 31) REDACTED:7268— (anonymous) has cognitive complexity 31 (threshold 15). Drivers by points: match/switch 5 (14 pts), if/else 7 (9 pts), loops 2 (6 pts), boolean chains 2 (nesting depth added 15). None of this is in the body itself: all 31 points belong to 11 function items inside it that branch (a function literal at line 7303, LineStyle, getLineColor, …). 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.
updatePreview (cognitive 31) src/main/webapp/js/diagramly/Dialogs.js:28116— updatePreview has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 6 (15 pts), if/else 8 (12 pts), boolean chains 2, 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.
getSvg (cognitive 31) src/main/webapp/js/diagramly/Editor.js:11732— getSvg has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 5 (9 pts), boolean chains 8, error handling 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.
getCustomLinkTitle (cognitive 31) src/main/webapp/js/diagramly/Editor.js:12039— getCustomLinkTitle has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 4 (13 pts), boolean chains 8, if/else 5 (8 pts), error handling 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.
D2 · Cognitive Complexity· play (cognitive 31) · ×1
play (cognitive 31) src/main/webapp/js/diagramly/Editor.js:15978— play has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 8, error handling 2 (4 pts), loops 1 (nesting depth added 3). Most of this is not in the body itself: 8 of the 31 points are its own statements and the rest belongs to 4 function items inside it that branch (runStep, a function literal at line 16111, iter, …). 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.
paintCollapsedTable (cognitive 31) src/main/webapp/js/grapheditor/Shapes.js:595— paintCollapsedTable has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 10, loops 7 (10 pts) (nesting depth added 5). Of this number, 29 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
createRelativeOption (cognitive 31) src/main/webapp/js/grapheditor/Format.js:2121— createRelativeOption has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 5 (12 pts), boolean chains 2 (nesting depth added 14). Most of this is not in the body itself: 3 of the 31 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 2133, a function literal at line 2193, a function literal at line 2203, …). 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.
setStyleFlag (cognitive 31) src/main/webapp/mxgraph/src/util/mxUtils.js:5001— setStyleFlag has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (21 pts), ternaries 2 (6 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
installPaletteDragReorder (cognitive 31) src/main/webapp/js/diagramly/sidebar/Sidebar.js:801— installPaletteDragReorder has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 6, ternaries 4 (5 pts), loops 1 (nesting depth added 6). Most of this is not in the body itself: 3 of the 31 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 824, 928, 812, …). 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.
update (cognitive 31) src/main/webapp/js/diagramly/LightboxModern.js:1993— update has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 17 (20 pts), if/else 8 (9 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
createExportPanel (cognitive 31) src/main/webapp/js/diagramly/LightboxModern.js:2914— createExportPanel has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 10 (13 pts), if/else 8 (9 pts), boolean chains 6, loops 3 (nesting depth added 4). Most of this is not in the body itself: 8 of the 31 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 2958, 3012, 2932, …). 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.
getFile (cognitive 31) src/main/webapp/js/diagramly/DriveClient.js:1820— getFile has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 6, ternaries 3, error handling 1 (2 pts) (nesting depth added 9). Most of this is not in the body itself: 8 of the 31 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 1868, checkAnswer, a function literal at line 1850). 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.
addPoints (cognitive 31) src/main/webapp/mxgraph/src/shape/mxShape.js:1483— addPoints has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 7, loops 2 (6 pts), ternaries 2 (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.
redrawText (cognitive 31) src/main/webapp/mxgraph/src/shape/mxText.js:370— redrawText has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 12 (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.
updateTextAreaStyle (cognitive 31) src/main/webapp/mxgraph/src/view/mxCellEditor.js:704— updateTextAreaStyle has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13, ternaries 7 (11 pts), boolean chains 7 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
moveCell (cognitive 31) src/main/webapp/mxgraph/src/layout/mxStackLayout.js:186— moveCell has cognitive complexity 31 (threshold 15). Drivers by points: if/else 5 (15 pts), ternaries 4 (12 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DrawioFile.DrawioFile.compressionChanged (cognitive 30) REDACTED:3872— DrawioFile.DrawioFile.compressionChanged has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (19 pts), ternaries 2 (5 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
EditorUi.EditorUi.importZipFile (cognitive 30) src/main/webapp/js/diagramly/EditorUi.js:17373— EditorUi.EditorUi.importZipFile has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 1 (nesting depth added 14). Most of this is not in the body itself: 3 of the 30 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 17383, 17394, 17377, …). 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.
EditorUi.EditorUi.removeSvgMetadata (cognitive 30) src/main/webapp/js/diagramly/EditorUi.js:20617— EditorUi.EditorUi.removeSvgMetadata has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (18 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.
Editor.mxGraphView.validateBackgroundPage (cognitive 30) src/main/webapp/js/grapheditor/Editor.js:4784— Editor.mxGraphView.validateBackgroundPage has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (22 pts), boolean chains 4, loops 1 (4 pts) (nesting depth added 17). Of this number, 18 points are the body's own statements and 12 belong to one function literal inside it that branches. 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.
Graph.Graph.removePasteFormatting (cognitive 30) REDACTED:4363— Graph.Graph.removePasteFormatting has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (20 pts), boolean chains 5, loops 2 (5 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.
Graph.Graph.convertValueToString (cognitive 30) REDACTED:17848— Graph.Graph.convertValueToString has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 8, loops 1 (3 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.
Graph.Graph.getBorderContainer (cognitive 30) REDACTED:20055— Graph.Graph.getBorderContainer has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (22 pts), boolean chains 5, loops 1 (3 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.
Graph.HoverIcons.getState (cognitive 30) REDACTED:24849— Graph.HoverIcons.getState has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (24 pts), boolean chains 6 (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.
Graph.BalloonTreeLayout.getTrees (cognitive 30) REDACTED:27480— Graph.BalloonTreeLayout.getTrees has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 7 (9 pts), boolean chains 4, ternaries 1 (nesting depth added 12). Of this number, 22 points are the body's own statements and 8 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InlineToolbar.InlineToolbar.showLineEndMenu (cognitive 30) src/main/webapp/js/grapheditor/InlineToolbar.js:3195— InlineToolbar.InlineToolbar.showLineEndMenu has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 2 (5 pts), boolean chains 4, ternaries 1 (nesting depth added 11). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 3306, 3386, 3221, …). 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.
mxEdgeHandler.mxEdgeHandler.getPointForEvent (cognitive 30) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:1141— mxEdgeHandler.mxEdgeHandler.getPointForEvent has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 14). Of this number, 20 points are the body's own statements and 10 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxGuide.mxGuide.moveDistance (cognitive 30) src/main/webapp/mxgraph/src/util/mxGuide.js:506— mxGuide.mxGuide.moveDistance has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 14, if/else 5 (8 pts), ternaries 5 (7 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
updateEndpoint (cognitive 30) REDACTED:6476— updateEndpoint has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 5 (15 pts), if/else 5 (12 pts), boolean chains 3 (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.
getCellContainmentArea (cognitive 30) src/main/webapp/mxgraph/src/view/mxGraph.js:6904— getCellContainmentArea has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (20 pts), boolean chains 10 (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.
traverse (cognitive 30) src/main/webapp/mxgraph/src/view/mxGraph.js:13354— traverse has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (16 pts), boolean chains 5, loops 1 (5 pts), ternaries 2 (4 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.
D2 · Cognitive Complexity· open (cognitive 30) · ×1
open (cognitive 30) src/main/webapp/js/diagramly/App.js:3990— open has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (20 pts), ternaries 2 (6 pts), boolean chains 3, error handling 1 (nesting depth added 15). Most of this is not in the body itself: 9 of the 30 points are its own statements and the rest belongs to one function literal inside it that branches (line 4017). 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.
checkDrafts (cognitive 30) src/main/webapp/js/diagramly/App.js:5264— checkDrafts has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 5 (10 pts), error handling 3 (7 pts), boolean chains 1 (nesting depth added 13). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 5276, 5310, 5291, …). 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.
getShapeSelection (cognitive 30) src/main/webapp/js/grapheditor/InlineToolbar.js:4619— getShapeSelection has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 11, if/else 5 (10 pts), loops 3 (7 pts), ternaries 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.
getVisibleCells (cognitive 30) src/main/webapp/js/diagramly/ForceExplorer.js:2388— getVisibleCells has cognitive complexity 30 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (7 pts), boolean chains 6, ternaries 1 (5 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.
updateTweens (cognitive 30) src/main/webapp/js/diagramly/ForceExplorer.js:3755— updateTweens has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 3 (11 pts), boolean chains 2, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
updateLabelBoundingBoxes (cognitive 30) src/main/webapp/mxgraph/src/view/mxGraphView.js:4886— updateLabelBoundingBoxes has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (18 pts), ternaries 2 (8 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 17). Of this number, 17 points are the body's own statements and 13 belong to one function literal inside it that branches. 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.
syncPreview (cognitive 30) src/main/webapp/js/diagramly/LayoutPicker.js:3028— syncPreview has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 4 (10 pts), boolean chains 4, loops 1 (nesting depth added 13). Of this number, 18 points are the body's own statements and 12 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
showPermissions (cognitive 30) src/main/webapp/js/diagramly/DriveClient.js:3183— showPermissions has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (7 pts), boolean chains 4, error handling 1 (2 pts), ternaries 1 (nesting depth added 15). Most of this is not in the body itself: 2 of the 30 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 3224, 3202, 3187, …). 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.
getLayoutVertices (cognitive 30) src/main/webapp/js/diagramly/tidy/Tidy.js:1558— getLayoutVertices has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 5 (8 pts), ternaries 1 (4 pts), boolean chains 3 (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.
executeRequest (cognitive 30) src/main/webapp/js/diagramly/GitLabClient.js:235— executeRequest has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 5, error handling 1 (3 pts), ternaries 1 (3 pts) (nesting depth added 9). Most of this is not in the body itself: 2 of the 30 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 256, a function literal at line 328, a function literal at line 317, …). 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.
compare (cognitive 30) src/main/webapp/mxgraph/src/model/mxCellPath.js:122— compare has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 5 (19 pts), if/else 5 (9 pts), boolean chains 1, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DrawioFile.DrawioFile.repairUnrenderableEdges (cognitive 29) REDACTED:1202— DrawioFile.DrawioFile.repairUnrenderableEdges has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (20 pts), loops 2 (5 pts), boolean chains 4 (nesting depth added 17). Most of this is not in the body itself: 5 of the 29 points are its own statements and the rest belongs to one function literal inside it that branches (line 1208). 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.
DrawioFile.DrawioFile.redirectToNewApp (cognitive 29) REDACTED:3496— DrawioFile.DrawioFile.redirectToNewApp has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (22 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 11). Most of this is not in the body itself: 10 of the 29 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 3515, 3530, 3513). 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.
Editor.Editor.loadCompatibleCss (cognitive 29) src/main/webapp/js/diagramly/Editor.js:1864— Editor.Editor.loadCompatibleCss has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 6, loops 1 (3 pts), error handling 1 (2 pts) (nesting depth added 13). Most of this is not in the body itself: 13 of the 29 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 1914, replaceLightDarkFunctions). 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.
EditorUi.EditorUi.loadDescriptor (cognitive 29) src/main/webapp/js/diagramly/EditorUi.js:4774— EditorUi.EditorUi.loadDescriptor has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 6, ternaries 4 (5 pts) (nesting depth added 7). Most of this is not in the body itself: 3 of the 29 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 4778, 4847, 4827, …). 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.
EditorUi.EditorUi.createExportPresetsRow (cognitive 29) src/main/webapp/js/diagramly/EditorUi.js:11632— EditorUi.EditorUi.createExportPresetsRow has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 3, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 11). None of this is in the body itself: all 29 points belong to 5 function items inside it that branch (a function literal at line 11697, a function literal at line 11707, a function literal at line 11647, …). 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.
EditorUi.EditorUi.openLocalFile (cognitive 29) src/main/webapp/js/diagramly/EditorUi.js:30960— EditorUi.EditorUi.openLocalFile has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 10, error handling 1 (2 pts) (nesting depth added 6). Of this number, 17 points are the body's own statements and 12 belong to 2 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.
ElectronApp.ExportDialog.exportFile (cognitive 29) src/main/webapp/js/diagramly/ElectronApp.js:2836— ElectronApp.ExportDialog.exportFile has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 3 (9 pts), boolean chains 5 (nesting depth added 13). Of this number, 19 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ForceExplorer.ForceExplorer.flattenPath (cognitive 29) src/main/webapp/js/diagramly/ForceExplorer.js:4500— ForceExplorer.ForceExplorer.flattenPath has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 6, ternaries 3 (5 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.
mxGraphMlCodec.mxGraphMlCodec.decode (cognitive 29) REDACTED:154— mxGraphMlCodec.mxGraphMlCodec.decode has cognitive complexity 29 (threshold 15). Drivers by points: loops 5 (12 pts), if/else 4 (11 pts), error handling 3 (5 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.
mxGraphMlCodec.mxGraphMlCodec.importEdge (cognitive 29) REDACTED:2050— mxGraphMlCodec.mxGraphMlCodec.importEdge has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 2 (7 pts), boolean chains 4, 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.
Format.DiagramStylePanel.getGlobalStyleButtons (cognitive 29) src/main/webapp/js/grapheditor/Format.js:8864— Format.DiagramStylePanel.getGlobalStyleButtons has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 5 (10 pts), loops 2 (3 pts) (nesting depth added 13). Most of this is not in the body itself: 11 of the 29 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 8926, a function literal at line 8881, isAllRounded). 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.
Graph.Graph.inlineSingleUseImages (cognitive 29) REDACTED:6231— Graph.Graph.inlineSingleUseImages has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (6 pts), boolean chains 4, ternaries 1 (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.
Graph.BalloonTreeLayout.measure (cognitive 29) REDACTED:27694— Graph.BalloonTreeLayout.measure has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 5 (13 pts), ternaries 1 (nesting depth added 16). Of this number, 27 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.mxGraphView.setTieClones (cognitive 29) REDACTED:33267— Graph.mxGraphView.setTieClones has cognitive complexity 29 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 5 (8 pts), ternaries 3 (8 pts), boolean chains 4 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InlineToolbar.InlineToolbar.repaint (cognitive 29) src/main/webapp/js/grapheditor/InlineToolbar.js:1180— InlineToolbar.InlineToolbar.repaint has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (16 pts), ternaries 3 (10 pts), boolean chains 3 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
InlineToolbar.InlineToolbar.createPopover.position (cognitive 29) src/main/webapp/js/grapheditor/InlineToolbar.js:1602— InlineToolbar.InlineToolbar.createPopover.position has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 9, loops 2 (3 pts), ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
InlineToolbar.InlineToolbar.showConnStyleMenu (cognitive 29) src/main/webapp/js/grapheditor/InlineToolbar.js:3608— InlineToolbar.InlineToolbar.showConnStyleMenu has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (22 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 9). Of this number, 20 points are the body's own statements and 9 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Shapes.TableShape.paintStripes (cognitive 29) src/main/webapp/js/grapheditor/Shapes.js:320— Shapes.TableShape.paintStripes has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 3 (11 pts), if/else 5 (8 pts), boolean chains 5, loops 3 (5 pts) (nesting depth added 13). Of this number, 27 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sidebar.Sidebar.getPickerShapes (cognitive 29) src/main/webapp/js/grapheditor/Sidebar.js:2016— Sidebar.Sidebar.getPickerShapes has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (9 pts), ternaries 3 (5 pts), boolean chains 2 (nesting depth added 14). Of this number, 27 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxEdgeSegmentHandler.mxEdgeSegmentHandler.redrawInnerBends (cognitive 29) src/main/webapp/mxgraph/src/handler/mxEdgeSegmentHandler.js:496— mxEdgeSegmentHandler.mxEdgeSegmentHandler.redrawInnerBends has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 1 (3 pts), boolean chains 2 (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.
mxVertexHandler.mxVertexHandler.mouseUp (cognitive 29) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:1305— mxVertexHandler.mxVertexHandler.mouseUp has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 5 (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.
mxGraphView.mxGraphView.getLabelPerimeterPoint (cognitive 29) src/main/webapp/mxgraph/src/view/mxGraphView.js:3735— mxGraphView.mxGraphView.getLabelPerimeterPoint has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 8, loops 1 (2 pts), ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
updateGroupBounds (cognitive 29) src/main/webapp/mxgraph/src/view/mxGraph.js:4453— updateGroupBounds has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (15 pts), ternaries 7 (11 pts), boolean chains 2, 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.
intersectsEdgeShape (cognitive 29) src/main/webapp/mxgraph/src/view/mxGraph.js:12661— intersectsEdgeShape has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 6, loops 4 (6 pts), ternaries 1 (4 pts) (nesting depth added 12). Of this number, 22 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addLineMarkerItems (cognitive 29) src/main/webapp/js/grapheditor/Format.js:102— addLineMarkerItems has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 6 (13 pts), if/else 5 (8 pts), boolean chains 5, loops 1 (3 pts) (nesting depth added 12). Of this number, 27 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addStencilPalette (cognitive 29) src/main/webapp/js/grapheditor/Sidebar.js:8031— addStencilPalette has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (6 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 14). Most of this is not in the body itself: 8 of the 29 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 8048, 8070, 8090). 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.
splitAtBr (cognitive 29) src/main/webapp/mxgraph/src/util/mxUtils.js:6806— splitAtBr has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (11 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.
TextareaDialog (cognitive 29) REDACTED:2404— TextareaDialog has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 6, ternaries 3, loops 1 (2 pts) (nesting depth added 5). Of this number, 20 points are the body's own statements and 9 belong to 6 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.
handleLegacyMessage (cognitive 29) src/main/webapp/js/diagramly/DrawioFileSync.js:3995— handleLegacyMessage has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 12, if/else 5 (11 pts), ternaries 2 (6 pts) (nesting depth added 10). Most of this is not in the body itself: 14 of the 29 points are its own statements and the rest belongs to one function literal inside it that branches (line 4008). 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.
installListeners (cognitive 29) src/main/webapp/js/diagramly/ForceExplorer.js:945— installListeners has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 12, if/else 11 (12 pts), ternaries 3 (5 pts) (nesting depth added 3). None of this is in the body itself: all 29 points belong to 13 function items inside it that branch (a function literal at line 1008, a function literal at line 974, a function literal at line 1059, …). 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.
validateCells (cognitive 29) src/main/webapp/mxgraph/src/view/mxGraphView.js:1174— validateCells has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 6 (7 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
createToggleGroup (cognitive 29) src/main/webapp/js/diagramly/LightboxModern.js:211— createToggleGroup has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 7, ternaries 2 (4 pts), loops 3 (nesting depth added 6). Most of this is not in the body itself: 2 of the 29 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 282, setIndex, choose, …). 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.
getPalettes (cognitive 29) src/main/webapp/js/diagramly/tidy/TidyStyle.js:259— getPalettes has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 9, loops 4 (5 pts), ternaries 2 (3 pts) (nesting depth added 7). Of this number, 23 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
render (cognitive 29) src/main/webapp/js/diagramly/SpringMove.js:1216— render has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 8, loops 5 (8 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
load (cognitive 29) src/main/webapp/js/diagramly/HomeDialog.js:298— load has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 8, ternaries 3 (5 pts) (nesting depth added 7). Most of this is not in the body itself: 12 of the 29 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 355, 339). 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.
Dialogs.SaveDialog::addStorageEntries (cognitive 28) src/main/webapp/js/diagramly/Dialogs.js:4792— Dialogs.SaveDialog::addStorageEntries has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 7, ternaries 2 (5 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Dialogs.DraftDialog (cognitive 28) src/main/webapp/js/diagramly/Dialogs.js:9516— Dialogs.DraftDialog has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 6, loops 2 (4 pts), ternaries 1 (nesting depth added 5). Of this number, 18 points are the body's own statements and 10 belong to 8 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
EditorUi.EditorUi.doSaveLocalFile (cognitive 28) src/main/webapp/js/diagramly/EditorUi.js:8751— EditorUi.EditorUi.doSaveLocalFile has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 7, error handling 1 (3 pts), ternaries 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.createEmbedSvg (cognitive 28) src/main/webapp/js/diagramly/EditorUi.js:13101— EditorUi.EditorUi.createEmbedSvg has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 5, 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.
EditorUi.EditorUi.exportImage (cognitive 28) src/main/webapp/js/diagramly/EditorUi.js:13836— EditorUi.EditorUi.exportImage has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (18 pts), error handling 2 (5 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 15). Most of this is not in the body itself: 6 of the 28 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 13889, 13904, 13927, …). 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.
Extensions.removeCellFromParent (cognitive 28) REDACTED:7083— Extensions.removeCellFromParent has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 2 (8 pts), boolean chains 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
TidyStyle.Tidy.restoreKeptRoleValues (cognitive 28) src/main/webapp/js/diagramly/tidy/TidyStyle.js:909— TidyStyle.Tidy.restoreKeptRoleValues has cognitive complexity 28 (threshold 15). Drivers by points: if/else 4 (12 pts), ternaries 2 (8 pts), boolean chains 4, loops 2 (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.
Editor.Editor.soundex (cognitive 28) src/main/webapp/js/grapheditor/Editor.js:1041— Editor.Editor.soundex has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 2 (5 pts), boolean chains 2 (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.
Graph.Graph.measureShapeInsideFlow (cognitive 28) REDACTED:7559— Graph.Graph.measureShapeInsideFlow has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (8 pts), ternaries 1 (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.
Graph.Graph.mayIntersect (cognitive 28) REDACTED:12011— Graph.Graph.mayIntersect has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 6, ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.runAsyncLayout (cognitive 28) REDACTED:14147— Graph.Graph.runAsyncLayout has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 8, error handling 2 (4 pts), ternaries 1 (nesting depth added 7). Most of this is not in the body itself: 8 of the 28 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 14225, next, finish). 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.
Graph.mxGraphView.updateChangedTies (cognitive 28) REDACTED:33948— Graph.mxGraphView.updateChangedTies has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (17 pts), loops 4 (7 pts), boolean chains 2, ternaries 1 (2 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.
Graph.mxStencilRegistry.parseStencilSet (cognitive 28) REDACTED:34319— Graph.mxStencilRegistry.parseStencilSet has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (24 pts), loops 2 (4 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.
Omnibox.Omnibox.render (cognitive 28) src/main/webapp/js/grapheditor/Omnibox.js:2465— Omnibox.Omnibox.render has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 4 (6 pts), boolean chains 5, 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.
mxGraph.mxGraph.resetEdges (cognitive 28) src/main/webapp/mxgraph/src/view/mxGraph.js:7137— mxGraph.mxGraph.resetEdges has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 2 (10 pts), if/else 3 (9 pts), loops 3 (8 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.
mxGraph.mxGraph.getOutlineConstraint (cognitive 28) src/main/webapp/mxgraph/src/view/mxGraph.js:7216— mxGraph.mxGraph.getOutlineConstraint has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 5, ternaries 2 (4 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.
props.Draw.loadPlugin()::cellClicked (cognitive 28) src/main/webapp/plugins/props.js:87— props.Draw.loadPlugin()::cellClicked has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 1 (3 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addSvgRule (cognitive 28) src/main/webapp/js/grapheditor/Format.js:7093— addSvgRule has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (15 pts), ternaries 2 (6 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 14). Most of this is not in the body itself: 1 of the 28 points is its own statement and the rest belongs to 5 function items inside it that branch (a function literal at line 7101, a function literal at line 7131, a function literal at line 7128, …). 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.
extractGraphModelFromPng (cognitive 28) src/main/webapp/js/grapheditor/Editor.js:925— extractGraphModelFromPng has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 8, error handling 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 8). Most of this is not in the body itself: 7 of the 28 points are its own statements and the rest belongs to one function literal inside it that branches (line 936). 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.
getOptions (cognitive 28) src/main/webapp/js/grapheditor/InlineToolbar.js:5015— getOptions has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 14, if/else 6 (11 pts), ternaries 2, loops 1 (nesting depth added 5). 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.
absorbUnconfirmedRepairs (cognitive 28) REDACTED:1274— absorbUnconfirmedRepairs has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 4 (7 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 9). Of this number, 18 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
paintForeground (cognitive 28) src/main/webapp/shapes/mxSysML.js:20— paintForeground has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getPreviewTerminalState (cognitive 28) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:1231— getPreviewTerminalState has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 4 (7 pts), boolean chains 6 (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.
reset (cognitive 28) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:1481— reset has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 5, 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.
prepareStyle (cognitive 28) src/main/webapp/js/diagramly/tidy/TidyStyle.js:2013— prepareStyle has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 4 (7 pts), ternaries 6, boolean chains 5 (nesting depth added 7). Of this number, 18 points are the body's own statements and 10 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mouseDown (cognitive 28) src/main/webapp/mxgraph/src/handler/mxGraphHandler.js:594— mouseDown has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 11 (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.
installListeners (cognitive 28) src/main/webapp/mxgraph/src/view/mxCellEditor.js:352— installListeners has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 10 (nesting depth added 5). None of this is in the body itself: all 28 points belong to 8 function literals inside it that branch (lines 396, 431, 463, …). 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.
render (cognitive 28) src/main/webapp/js/diagramly/HomeDialog.js:500— render has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 6, loops 3 (4 pts), ternaries 3 (4 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
createPalette (cognitive 28) src/main/webapp/js/diagramly/gif/GifEncoder.js:537— createPalette has cognitive complexity 28 (threshold 15). Drivers by points: loops 9 (17 pts), if/else 4 (7 pts), boolean chains 2, ternaries 2 (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
mxPanningManager::panTo (cognitive 28) src/main/webapp/mxgraph/src/util/mxPanningManager.js:100— mxPanningManager::panTo has cognitive complexity 28 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 5, ternaries 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Dialogs.SelectorChips.create.openTagPicker (cognitive 27) src/main/webapp/js/diagramly/Dialogs.js:7535— Dialogs.SelectorChips.create.openTagPicker has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 4 (6 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 10). Of this number, 14 points are the body's own statements and 13 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.
DiffSync.EditorUi.disconnectTerminal (cognitive 27) src/main/webapp/js/diagramly/DiffSync.js:349— DiffSync.EditorUi.disconnectTerminal has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 5, error handling 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.
Editor.Editor.AnimationPlayer.collectReferencedCells (cognitive 27) src/main/webapp/js/diagramly/Editor.js:15866— Editor.Editor.AnimationPlayer.collectReferencedCells has cognitive complexity 27 (threshold 15). Drivers by points: if/else 4 (15 pts), loops 3 (7 pts), boolean chains 5 (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.
EditorUi.EditorUi.loadGliffy (cognitive 27) src/main/webapp/js/diagramly/EditorUi.js:16304— EditorUi.EditorUi.loadGliffy has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 4, error handling 1 (4 pts), loops 1 (3 pts) (nesting depth added 14). Most of this is not in the body itself: 9 of the 27 points are its own statements and the rest belongs to one function literal inside it that branches (line 16326). 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.
EditorUi.EditorUi.windowResized (cognitive 27) src/main/webapp/js/diagramly/EditorUi.js:24673— EditorUi.EditorUi.windowResized has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 7 (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.
EditorUi.EditorUi.pasteFromClipboard (cognitive 27) src/main/webapp/js/diagramly/EditorUi.js:29072— EditorUi.EditorUi.pasteFromClipboard has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 2 (9 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 14). Most of this is not in the body itself: 9 of the 27 points are its own statements and the rest belongs to one function literal inside it that branches (line 29088). 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.
EditorUi.EditorUi.updateCommentOverlays (cognitive 27) src/main/webapp/js/diagramly/EditorUi.js:43735— EditorUi.EditorUi.updateCommentOverlays has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 4 (10 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 14). Of this number, 19 points are the body's own statements and 8 belong to 2 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.
LayoutPicker.EditorUi.showLayoutPicker (cognitive 27) src/main/webapp/js/diagramly/LayoutPicker.js:3370— LayoutPicker.EditorUi.showLayoutPicker has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 5, loops 4 (5 pts), ternaries 2 (nesting depth added 7). Most of this is not in the body itself: 11 of the 27 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 3542, a function literal at line 3429, a function literal at line 3437, …). 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.
Graph.Graph.computeShapeInsideSpacer (cognitive 27) REDACTED:7669— Graph.Graph.computeShapeInsideSpacer has cognitive complexity 27 (threshold 15). Drivers by points: if/else 29 (72 pts), boolean chains 28, loops 7 (19 pts), ternaries 5 (12 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. This shape REPEATS in the file: one other method here (Graph.Graph.computeShapeInsideSpacer::run) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Graph.Graph.updateInheritedLabelValuesOfEdges (cognitive 27) REDACTED:19150— Graph.Graph.updateInheritedLabelValuesOfEdges has cognitive complexity 27 (threshold 15). Drivers by points: if/else 3 (12 pts), loops 3 (9 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.moveTextBox (cognitive 27) REDACTED:30261— Graph.moveTextBox has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 5 (15 pts), if/else 5 (8 pts), boolean chains 4 (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.
mxEdgeSegmentHandler.mxEdgeSegmentHandler.getPreviewPoints (cognitive 27) src/main/webapp/mxgraph/src/handler/mxEdgeSegmentHandler.js:48— mxEdgeSegmentHandler.mxEdgeSegmentHandler.getPreviewPoints has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (21 pts), boolean chains 4, 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.
mxVertexHandler.mxVertexHandler.rotateCell (cognitive 27) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:1433— mxVertexHandler.mxVertexHandler.rotateCell has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (17 pts), boolean chains 5, loops 1 (5 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.
mxGraph.mxGraph.snapDelta (cognitive 27) src/main/webapp/mxgraph/src/view/mxGraph.js:8368— mxGraph.mxGraph.snapDelta has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (26 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.
update.Draw.loadPlugin()::createDemoResponse (cognitive 27) src/main/webapp/plugins/update.js:196— update.Draw.loadPlugin()::createDemoResponse has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (24 pts), boolean chains 2, loops 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.
create.openTagPicker (cognitive 27) src/main/webapp/js/diagramly/Dialogs.js:7535— create.openTagPicker has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 4 (6 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 10). Of this number, 14 points are the body's own statements and 13 belong to 9 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getOpposites (cognitive 27) src/main/webapp/mxgraph/src/view/mxGraph.js:12994— getOpposites has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (13 pts), ternaries 4 (8 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
init (cognitive 27) REDACTED:1396— init has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 7, error handling 1 (2 pts) (nesting depth added 10). Most of this is not in the body itself: 8 of the 27 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 1412, a function literal at line 1462, a function literal at line 1442, …). 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.
createZoomInput (cognitive 27) REDACTED:11869— createZoomInput has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 7, ternaries 1 (nesting depth added 4). Most of this is not in the body itself: 2 of the 27 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 11962, 11892, 11912, …). 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.
createStepper (cognitive 27) src/main/webapp/js/grapheditor/Format.js:1160— createStepper has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 7 (10 pts), error handling 1 (3 pts), boolean chains 2 (nesting depth added 8). Most of this is not in the body itself: 3 of the 27 points are its own statements and the rest belongs to 9 function items inside it that branch (changeValue, a function literal at line 1237, a function literal at line 1262, …). 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.
rasterizeSvgDataUri (cognitive 27) src/main/webapp/js/grapheditor/Sidebar.js:5050— rasterizeSvgDataUri has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 6, ternaries 2 (4 pts), error handling 2 (3 pts) (nesting depth added 10). Most of this is not in the body itself: 6 of the 27 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 5085, finish, a function literal at line 5082, …). 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.
parseCssSpacing (cognitive 27) src/main/webapp/mxgraph/src/util/mxUtils.js:310— parseCssSpacing has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 4 (13 pts), if/else 4 (9 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ColorWindow (cognitive 27) REDACTED:1989— ColorWindow has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 15, if/else 7 (9 pts), ternaries 2 (3 pts) (nesting depth added 3). None of this is in the body itself: all 27 points belong to 12 function items inside it that branch (a function literal at line 2134, fitHeight, a function literal at line 2068, …). 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.
getLabelBox (cognitive 27) src/main/webapp/js/diagramly/LibavoidRouting.js:2671— getLabelBox has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 9 (10 pts), if/else 8 (9 pts), boolean chains 8 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
edgeRouteBounds (cognitive 27) src/main/webapp/js/diagramly/LibavoidRouting.js:2813— edgeRouteBounds has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 11, ternaries 8, if/else 4 (6 pts), loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
isAdditiveOnly (cognitive 27) src/main/webapp/js/diagramly/DrawioFileSync.js:1766— isAdditiveOnly has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 11). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
updateAnimations (cognitive 27) src/main/webapp/js/diagramly/ForceExplorer.js:4018— updateAnimations has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 3 (7 pts), boolean chains 4, 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.
getMatchingLibraryChips (cognitive 27) src/main/webapp/js/diagramly/sidebar/Sidebar.js:2021— getMatchingLibraryChips has cognitive complexity 27 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 3 (9 pts), boolean chains 7 (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.
doShowLayoutSettings::renderOptions (cognitive 27) src/main/webapp/js/diagramly/LayoutPicker.js:3789— doShowLayoutSettings::renderOptions has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 5, loops 2 (5 pts), ternaries 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.
collect (cognitive 27) src/main/webapp/js/diagramly/tidy/Tidy.js:238— collect has cognitive complexity 27 (threshold 15). Drivers by points: if/else 29 (74 pts), boolean chains 27, loops 6 (10 pts) (nesting depth added 49). 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.
refresh (cognitive 27) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:2981— refresh has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 3, 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.
resetGraphView (cognitive 27) src/main/webapp/connect/common/js/mxReader.js:386— resetGraphView has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 5 (10 pts), boolean chains 5 (nesting depth added 9). Of this number, 14 points are the body's own statements and 13 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getResults (cognitive 27) src/main/webapp/js/diagramly/Omnibox.js:124— getResults has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 9, ternaries 3 (6 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
traverse (cognitive 27) src/main/webapp/mxgraph/src/layout/mxGraphLayout.js:159— traverse has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 1 (5 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Dialogs.AnimationDialog (cognitive 26) src/main/webapp/js/diagramly/Dialogs.js:14088— Dialogs.AnimationDialog has cognitive complexity 26 (threshold 15). Drivers by points: if/else 270 (385 pts), boolean chains 147, ternaries 37 (61 pts), loops 37 (52 pts), error handling 4 (6 pts) (nesting depth added 156). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (Dialogs.AnimationDialog::stepLabel, Dialogs.AnimationDialog::formatSelectorText) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.PolygonTool.keyChanged (cognitive 26) src/main/webapp/js/diagramly/Dialogs.js:27563— Dialogs.PolygonTool.keyChanged has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 9 (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.
DrawioFile.DrawioFile.save (cognitive 26) REDACTED:1873— DrawioFile.DrawioFile.save has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (22 pts), error handling 2 (3 pts), boolean chains 1 (nesting depth added 9). Of this number, 14 points are the body's own statements and 12 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.addLibraryEntries (cognitive 26) src/main/webapp/js/diagramly/EditorUi.js:6748— EditorUi.EditorUi.addLibraryEntries has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 4 (13 pts), if/else 4 (9 pts), error handling 1 (2 pts), boolean chains 1, 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.
EditorUi.EditorUi.showAnimatedGifExportDialog (cognitive 26) src/main/webapp/js/diagramly/EditorUi.js:8300— EditorUi.EditorUi.showAnimatedGifExportDialog has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 13, if/else 5 (6 pts), ternaries 6, loops 1 (nesting depth added 1). Of this number, 16 points are the body's own statements and 10 belong to 5 function items inside it that branch. 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.
EditorUi.EditorUi.editContainerLayout (cognitive 26) src/main/webapp/js/diagramly/EditorUi.js:37848— EditorUi.EditorUi.editContainerLayout has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 8, ternaries 4 (5 pts), loops 2 (3 pts) (nesting depth added 5). Of this number, 21 points are the body's own statements and 5 belong to 2 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.
EditorUi.EditorUi.handleRemoteInvoke (cognitive 26) src/main/webapp/js/diagramly/EditorUi.js:42615— EditorUi.EditorUi.handleRemoteInvoke has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 3, loops 1 (3 pts), error handling 1, ternaries 1 (nesting depth added 10). Of this number, 23 points are the body's own statements and 3 belong to 2 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.
LibavoidRouting.LibavoidRouting.computeRoutes (cognitive 26) src/main/webapp/js/diagramly/LibavoidRouting.js:4320— LibavoidRouting.LibavoidRouting.computeRoutes has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 4 (6 pts), boolean chains 5, ternaries 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.
TrelloFile.TrelloFile.saveFile (cognitive 26) src/main/webapp/js/diagramly/TrelloFile.js:99— TrelloFile.TrelloFile.saveFile has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (26 pts) (nesting depth added 14). Most of this is not in the body itself: 8 of the 26 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 114, 145, 131, …). 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.
Graph.Graph.elkOptionsToConfig (cognitive 26) REDACTED:15152— Graph.Graph.elkOptionsToConfig has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 4, 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.
Graph.Graph.getZoomSteps (cognitive 26) REDACTED:22149— Graph.Graph.getZoomSteps has cognitive complexity 26 (threshold 15). Drivers by points: loops 6 (16 pts), if/else 4 (6 pts), boolean chains 4 (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.
Graph.Graph.visitTableCells (cognitive 26) REDACTED:25204— Graph.Graph.visitTableCells has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (17 pts), boolean chains 6, loops 2 (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.
Graph.LabelBoxIndex.isFree (cognitive 26) REDACTED:29706— Graph.LabelBoxIndex.isFree has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 4 (7 pts), boolean chains 4 (nesting depth added 9). Most of this is not in the body itself: 10 of the 26 points are its own statements and the rest belongs to 2 function items inside it that branch (testAll, test). 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.
Graph.getLabelBoxSize (cognitive 26) REDACTED:30198— Graph.getLabelBoxSize has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 4 (13 pts), if/else 4 (8 pts), boolean chains 5 (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.
Graph.mxGraphView.updateIconOverlay (cognitive 26) REDACTED:30618— Graph.mxGraphView.updateIconOverlay has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 2 (4 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.
Shapes.mxShapeBasicRect2.paintFolds (cognitive 26) src/main/webapp/js/grapheditor/Shapes.js:7461— Shapes.mxShapeBasicRect2.paintFolds has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 17, if/else 5 (9 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.
mxSwimlane.mxSwimlane.paintTitleGlassEffect (cognitive 26) src/main/webapp/mxgraph/src/shape/mxSwimlane.js:322— mxSwimlane.mxSwimlane.paintTitleGlassEffect has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 11 (24 pts), if/else 2 (nesting depth added 13). Most of this is not in the body itself: 12 of the 26 points are its own statements and the rest belongs to 3 function items inside it that branch (mapX, mapY, a function literal at line 354). 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.
mxGraph.mxGraph.updatePageBreaks (cognitive 26) src/main/webapp/mxgraph/src/view/mxGraph.js:3305— mxGraph.mxGraph.updatePageBreaks has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 4 (7 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 10). Most of this is not in the body itself: 7 of the 26 points are its own statements and the rest belongs to one function literal inside it that branches (line 3341). 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.
mxSwimlaneManager.mxSwimlaneManager.cellsResized (cognitive 26) src/main/webapp/mxgraph/src/view/mxSwimlaneManager.js:332— mxSwimlaneManager.mxSwimlaneManager.cellsResized has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 2 (11 pts), if/else 3 (8 pts), loops 2 (7 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.
(anonymous) (cognitive 26) REDACTED:3387— (anonymous) has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2 (6 pts), ternaries 3 (4 pts) (nesting depth added 11). None of this is in the body itself: all 26 points belong to 10 function items inside it that branch (initialise, getColor, getFont, …). 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.
applyCustomResources (cognitive 26) src/main/webapp/js/diagramly/Editor.js:4500— applyCustomResources has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 4 (8 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ungroupCells (cognitive 26) src/main/webapp/mxgraph/src/view/mxGraph.js:4300— ungroupCells has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 2 (6 pts), boolean chains 4 (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.
updateAlternateBounds (cognitive 26) src/main/webapp/mxgraph/src/view/mxGraph.js:5731— updateAlternateBounds has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (20 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
paintVertexShape (cognitive 26) src/main/webapp/js/grapheditor/Shapes.js:8157— paintVertexShape has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 6 (14 pts), boolean chains 4, if/else 4, 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.
installResizeHandler (cognitive 26) REDACTED:8585— installResizeHandler has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 8, ternaries 2 (6 pts) (nesting depth added 8). Most of this is not in the body itself: 1 of the 26 points is its own statement and the rest belongs to 4 function items inside it that branch (setSize, setLocation, destroy, …). 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.
validateDependencies (cognitive 26) src/main/webapp/mxgraph/src/view/mxGraphView.js:2558— validateDependencies has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (19 pts), ternaries 1 (4 pts), boolean chains 2, loops 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.
rotate (cognitive 26) REDACTED:1621— rotate has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 5 (15 pts), if/else 5 (8 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addClickHandler (cognitive 26) REDACTED:2543— addClickHandler has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 12, if/else 7 (10 pts), error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 5). Most of this is not in the body itself: 1 of the 26 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 2547, 2589, 2575). 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.
diffCellRecursive (cognitive 26) src/main/webapp/js/diagramly/DiffSync.js:2211— diffCellRecursive has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 3 (7 pts), boolean chains 5, 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.
applyChange (cognitive 26) src/main/webapp/js/diagramly/tidy/Tidy.js:3335— applyChange has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (9 pts), ternaries 3 (7 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
setHandlesVisible (cognitive 26) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:2782— setHandlesVisible has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 3 (10 pts), loops 3 (6 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.
keepRoleColors (cognitive 26) src/main/webapp/js/diagramly/tidy/TidyStyle.js:1439— keepRoleColors has cognitive complexity 26 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 7, loops 3 (5 pts), 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.
moveCells (cognitive 26) src/main/webapp/mxgraph/src/handler/mxGraphHandler.js:2010— moveCells has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 10, loops 3 (5 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.
executeWriteRequest (cognitive 26) src/main/webapp/js/diagramly/OneDriveClient.js:1200— executeWriteRequest has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 5, error handling 3 (5 pts) (nesting depth added 8). Most of this is not in the body itself: 8 of the 26 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 1244, 1206, 1228, …). 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.
animateChanges::animate (cognitive 26) src/main/webapp/mxgraph/src/util/mxEffects.js:45— animateChanges::animate has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 7, 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.
EditorUi.EditorUi.saveLocalFile (cognitive 25) src/main/webapp/js/diagramly/EditorUi.js:8860— EditorUi.EditorUi.saveLocalFile has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 6, error handling 2 (3 pts), ternaries 1 (nesting depth added 5). Most of this is not in the body itself: 5 of the 25 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 8867, 8906). 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.
EditorUi.EditorUi.createEmbedImage (cognitive 25) src/main/webapp/js/diagramly/EditorUi.js:13000— EditorUi.EditorUi.createEmbedImage has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 3 (7 pts), boolean chains 2 (nesting depth added 9). Of this number, 15 points are the body's own statements and 10 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.drawEmbedImage (cognitive 25) src/main/webapp/js/diagramly/EditorUi.js:19626— EditorUi.EditorUi.drawEmbedImage has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 5, ternaries 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.createShapesWindow (cognitive 25) src/main/webapp/js/diagramly/EditorUi.js:27018— EditorUi.EditorUi.createShapesWindow has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 6 (14 pts), boolean chains 7, 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.
EditorUi.EditorUi.placeRestoredEdgeLabels (cognitive 25) src/main/webapp/js/diagramly/EditorUi.js:28993— EditorUi.EditorUi.placeRestoredEdgeLabels has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (6 pts), boolean chains 4, 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.
EditorUi.EditorUi.loadOrgChartScripts (cognitive 25) src/main/webapp/js/diagramly/EditorUi.js:38045— EditorUi.EditorUi.loadOrgChartScripts has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (20 pts), error handling 1 (3 pts), loops 1 (2 pts) (nesting depth added 11). Most of this is not in the body itself: 10 of the 25 points are its own statements and the rest belongs to one function item inside it that branches (done). 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.
EditorUi.EditorUi.loadDataSource (cognitive 25) src/main/webapp/js/diagramly/EditorUi.js:38908— EditorUi.EditorUi.loadDataSource has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 5 (12 pts), if/else 6 (8 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 10). Most of this is not in the body itself: 5 of the 25 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 38965, a function literal at line 38945, a function literal at line 38954, …). 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.
ForceExplorer.ForceExplorer.updateShownCells (cognitive 25) src/main/webapp/js/diagramly/ForceExplorer.js:3320— ForceExplorer.ForceExplorer.updateShownCells has cognitive complexity 25 (threshold 15). Drivers by points: loops 4 (13 pts), if/else 3 (10 pts), boolean chains 2 (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.
SpringMove.SpringMove.finish (cognitive 25) src/main/webapp/js/diagramly/SpringMove.js:1342— SpringMove.SpringMove.finish has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (8 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.
Editor.PageSetupDialog.addPageFormatPanel.listener (cognitive 25) src/main/webapp/js/grapheditor/Editor.js:4185— Editor.PageSetupDialog.addPageFormatPanel.listener has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 2, 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.
Graph.Graph.addAdaptiveColors (cognitive 25) REDACTED:2802— Graph.Graph.addAdaptiveColors has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (4 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.addLightDarkColors (cognitive 25) REDACTED:2936— Graph.Graph.addLightDarkColors has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 6, loops 2 (4 pts) (nesting depth added 9). Of this number, 17 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.prefixSvgIds::prefixRule (cognitive 25) REDACTED:5706— Graph.Graph.prefixSvgIds::prefixRule has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 2 (6 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. This shape REPEATS in the file: one other method here (Graph.Graph.prefixSvgIds) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Graph.Graph.getTieIndex (cognitive 25) REDACTED:20518— Graph.Graph.getTieIndex has cognitive complexity 25 (threshold 15). Drivers by points: loops 3 (11 pts), if/else 3 (8 pts), ternaries 1 (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.
Graph.Graph.getBoundingBoxFromGeometry (cognitive 25) REDACTED:21842— Graph.Graph.getBoundingBoxFromGeometry has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (19 pts), ternaries 1 (3 pts), loops 1 (2 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.
Graph.HoverIcons.init (cognitive 25) REDACTED:24196— Graph.HoverIcons.init has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 9 (nesting depth added 2). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 24311, 24268, 24290, …). 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.
Graph.Graph.paintTableCellLines (cognitive 25) REDACTED:25343— Graph.Graph.paintTableCellLines has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 8, ternaries 2 (4 pts) (nesting depth added 6). Of this number, 21 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.setTableColumnWidth (cognitive 25) REDACTED:26637— Graph.Graph.setTableColumnWidth has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (23 pts), boolean chains 1, 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.
Graph.mxShape.getFlowAnimationPath (cognitive 25) REDACTED:30760— Graph.mxShape.getFlowAnimationPath has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 4, loops 1 (2 pts), ternaries 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.
Utils.isIPv6TransitionAddress (cognitive 25) REDACTED:792— Utils.isIPv6TransitionAddress has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 11, if/else 5 (9 pts), loops 2 (5 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.
init (cognitive 25) src/main/webapp/js/diagramly/Dialogs.js:27280— init has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 5, loops 1, ternaries 1 (nesting depth added 5). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to 11 function items inside it that branch (a function literal at line 27290, a function literal at line 27379, dblClick, …). 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.
loadUrl (cognitive 25) src/main/webapp/js/diagramly/Editor.js:6925— loadUrl has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 2 (5 pts), boolean chains 4, error handling 1 (nesting depth added 8). Most of this is not in the body itself: 6 of the 25 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 6936, 6980, 6974, …). 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.
intersects (cognitive 25) src/main/webapp/mxgraph/src/view/mxGraph.js:12263— intersects has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (20 pts), ternaries 1 (3 pts), boolean chains 2 (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.
paintBackground (cognitive 25) src/main/webapp/js/grapheditor/Shapes.js:2705— paintBackground has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 7 (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.
getDoubleClickTerminalForEvent (cognitive 25) REDACTED:2484— getDoubleClickTerminalForEvent has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (12 pts), boolean chains 5, ternaries 1 (5 pts), loops 1 (3 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.
createStatusContainer (cognitive 25) REDACTED:9222— createStatusContainer has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 9). None of this is in the body itself: all 25 points belong to 2 function literals inside it that branch (lines 9228, 9284). 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.
descriptorChanged (cognitive 25) src/main/webapp/js/diagramly/App.js:8783— descriptorChanged has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 2 (5 pts), boolean chains 4 (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.
addPageFormatPanel.listener (cognitive 25) src/main/webapp/js/grapheditor/Editor.js:4185— addPageFormatPanel.listener has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 2, 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.
clone (cognitive 25) src/main/webapp/mxgraph/src/util/mxUtils.js:2709— clone has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 4, ternaries 2 (4 pts), loops 1 (3 pts) (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.
zapGremlins (cognitive 25) src/main/webapp/mxgraph/src/util/mxUtils.js:3840— zapGremlins has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 3 (9 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.
showLineStyleMenu (cognitive 25) src/main/webapp/js/grapheditor/InlineToolbar.js:2559— showLineStyleMenu has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 6 (14 pts), if/else 4 (6 pts), boolean chains 4, loops 1 (nesting depth added 10). Most of this is not in the body itself: 8 of the 25 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 2606, createDashPreview, a function literal at line 2624, …). 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.
getMovePreviewCache (cognitive 25) src/main/webapp/js/diagramly/LibavoidRouting.js:3533— getMovePreviewCache has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (8 pts), boolean chains 2 (nesting depth added 14). Of this number, 23 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
updateRealtime (cognitive 25) src/main/webapp/js/diagramly/DrawioFileSync.js:448— updateRealtime has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 9 (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.
cloneSourceCells (cognitive 25) src/main/webapp/js/diagramly/ForceExplorer.js:3252— cloneSourceCells has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 5 (9 pts), ternaries 2 (4 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
updatePoints (cognitive 25) src/main/webapp/mxgraph/src/view/mxGraphView.js:3041— updatePoints has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, loops 1 (3 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.
addFoldingHandler (cognitive 25) src/main/webapp/js/diagramly/sidebar/Sidebar.js:592— addFoldingHandler has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 2 (4 pts), ternaries 1 (nesting depth added 11). Most of this is not in the body itself: 2 of the 25 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 611, 660, 667, …). 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.
addTabListeners (cognitive 25) src/main/webapp/js/diagramly/Pages.js:4440— addTabListeners has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 11, ternaries 1 (2 pts) (nesting depth added 4). None of this is in the body itself: all 25 points belong to 6 function literals inside it that branch (lines 4537, 4514, 4490, …). 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.
fileSaved (cognitive 25) REDACTED:4122— fileSaved has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 3 (4 pts), ternaries 3 (4 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
doShowLayoutSettings (cognitive 25) src/main/webapp/js/diagramly/LayoutPicker.js:3601— doShowLayoutSettings has cognitive complexity 25 (threshold 15). Drivers by points: if/else 24 (38 pts), ternaries 13 (18 pts), boolean chains 17, loops 3 (6 pts), error handling 3 (4 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
initializeKeys (cognitive 25) REDACTED:278— initializeKeys has cognitive complexity 25 (threshold 15). Drivers by points: loops 6 (16 pts), if/else 3 (5 pts), match/switch 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
getEdgesThroughShapes (cognitive 25) src/main/webapp/js/diagramly/tidy/Tidy.js:2268— getEdgesThroughShapes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 9, loops 3 (4 pts) (nesting depth added 8). Of this number, 20 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runLayout (cognitive 25) src/main/webapp/js/diagramly/tidy/Tidy.js:2404— runLayout has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 9). Of this number, 18 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mouseDown (cognitive 25) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:955— mouseDown has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 7 (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.
addActionEntries (cognitive 25) src/main/webapp/js/grapheditor/Omnibox.js:1214— addActionEntries has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 3 (11 pts), boolean chains 8, if/else 2 (5 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
redrawLabel (cognitive 25) src/main/webapp/mxgraph/src/view/mxCellRenderer.js:1151— redrawLabel has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 13, if/else 7 (11 pts), ternaries 1 (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.
filterEnclosing (cognitive 25) src/main/webapp/js/libavoid-js/libavoid-routing.js:278— filterEnclosing has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 4 (6 pts), boolean chains 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getBoundingBox (cognitive 25) src/main/webapp/mxgraph/src/handler/mxGraphHandler.js:929— getBoundingBox has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (19 pts), boolean chains 4, 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.
updateSegment (cognitive 25) src/main/webapp/js/diagramly/gif/AnimationExport.js:1338— updateSegment has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 4, ternaries 1 (3 pts), 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.
previewStyles (cognitive 25) src/main/webapp/js/diagramly/tidy/TidyWindow.js:1206— previewStyles has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 8, ternaries 2 (4 pts), loops 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
decodeChild (cognitive 25) src/main/webapp/mxgraph/src/io/mxObjectCodec.js:1146— decodeChild has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 3 (10 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
loadCss (cognitive 25) src/main/webapp/js/diagramly/FusionTheme.js:451— loadCss has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 3 (8 pts), loops 1 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 11). Of this number, 17 points are the body's own statements and 8 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
setVertexLocation (cognitive 25) src/main/webapp/mxgraph/src/layout/mxGraphLayout.js:387— setVertexLocation has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (21 pts), boolean chains 4 (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.
Dialogs.LinkDialog::updateActionSummary (cognitive 24) src/main/webapp/js/diagramly/Dialogs.js:6281— Dialogs.LinkDialog::updateActionSummary has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 5 (13 pts), if/else 6 (7 pts), boolean chains 3, 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. This shape REPEATS in the file: one other method here (Dialogs.LinkDialog) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.ChatWindow::addExchange (cognitive 24) src/main/webapp/js/diagramly/Dialogs.js:13323— Dialogs.ChatWindow::addExchange has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 6, ternaries 3 (5 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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. This shape REPEATS in the file: one other method here (Dialogs.ChatWindow) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DrawioFile.DrawioFile.synchronizeFile (cognitive 24) REDACTED:490— DrawioFile.DrawioFile.synchronizeFile has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (24 pts) (nesting depth added 13). Most of this is not in the body itself: 7 of the 24 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 520, 551, 506, …). 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.
Editor.Editor.toggleFlowAnimation (cognitive 24) src/main/webapp/js/diagramly/Editor.js:16200— Editor.Editor.toggleFlowAnimation has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 6, 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.
EditorUi.EditorUi.installStatusMinimizer (cognitive 24) src/main/webapp/js/diagramly/EditorUi.js:25348— EditorUi.EditorUi.installStatusMinimizer has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 7, ternaries 2 (5 pts) (nesting depth added 7). None of this is in the body itself: all 24 points belong to 3 function literals inside it that branch (lines 25369, 25353, 25361). 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.
EditorUi.EditorUi.parseBoxNames (cognitive 24) src/main/webapp/js/diagramly/EditorUi.js:36119— EditorUi.EditorUi.parseBoxNames has cognitive complexity 24 (threshold 15). Drivers by points: loops 4 (9 pts), boolean chains 8, if/else 2 (5 pts), ternaries 1 (2 pts) (nesting depth added 9). Of this number, 23 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.getCsvStyle::isSourceValue (cognitive 24) src/main/webapp/js/diagramly/EditorUi.js:39327— EditorUi.EditorUi.getCsvStyle::isSourceValue has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (6 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (EditorUi.EditorUi.getCsvStyle) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
LibavoidRouting.LibavoidRouting.createLayout (cognitive 24) src/main/webapp/js/diagramly/LibavoidRouting.js:220— LibavoidRouting.LibavoidRouting.createLayout has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 5, loops 2 (4 pts), ternaries 1 (nesting depth added 6). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to 5 function items inside it that branch (runRouting, a function literal at line 322, runRouting::collect, …). 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.
Pages.Graph.createViewState (cognitive 24) src/main/webapp/js/diagramly/Pages.js:1601— Pages.Graph.createViewState has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 9 (11 pts), boolean chains 10, error handling 1 (2 pts), if/else 1 (nesting depth added 3). Of this number, 15 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
AnimationExport.AnimationExport.setFlowStartTimes (cognitive 24) src/main/webapp/js/diagramly/gif/AnimationExport.js:1428— AnimationExport.AnimationExport.setFlowStartTimes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 2 (6 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Tidy.Tidy.classify (cognitive 24) src/main/webapp/js/diagramly/tidy/Tidy.js:620— Tidy.Tidy.classify has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 7, loops 3 (4 pts), ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
EditorUi.EditorUi.showTypingShim (cognitive 24) REDACTED:5083— EditorUi.EditorUi.showTypingShim has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 5, error handling 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.
Graph.Graph.scopeStyleElements (cognitive 24) REDACTED:5915— Graph.Graph.scopeStyleElements has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 5 (8 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.
Graph.Graph.makeSequenceMessages (cognitive 24) REDACTED:10634— Graph.Graph.makeSequenceMessages has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (6 pts), boolean chains 2, 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.
mxVertexHandler.mxVertexHandler.getHandleForEvent (cognitive 24) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:541— mxVertexHandler.mxVertexHandler.getHandleForEvent has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, loops 2 (4 pts), ternaries 4 (nesting depth added 6). Of this number, 19 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxText.mxText.updateSize (cognitive 24) src/main/webapp/mxgraph/src/shape/mxText.js:1189— mxText.mxText.updateSize has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (21 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.
mxGraphView.mxGraphView.getRelativePoint (cognitive 24) src/main/webapp/mxgraph/src/view/mxGraphView.js:4217— mxGraphView.mxGraphView.getRelativePoint has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 1 (3 pts), ternaries 1 (3 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.
mxEmoji.mxShapeEmoji.getUnicodeText (cognitive 24) src/main/webapp/shapes/emoji/mxEmoji.js:1916— mxEmoji.mxShapeEmoji.getUnicodeText has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (19 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.
toObject (cognitive 24) src/main/webapp/js/diagramly/Dialogs.js:22516— toObject has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, loops 3 (5 pts), ternaries 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
normalizeEdge (cognitive 24) REDACTED:6971— normalizeEdge has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (9 pts), loops 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.
getDropTarget (cognitive 24) src/main/webapp/mxgraph/src/view/mxGraph.js:12003— getDropTarget has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 7, loops 4 (7 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
installLineMarkerMenu (cognitive 24) REDACTED:7826— installLineMarkerMenu has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, if/else 6 (12 pts) (nesting depth added 6). None of this is in the body itself: all 24 points belong to 2 function literals inside it that branch (lines 7834, 7876). 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.
fetchAndShowNotification (cognitive 24) src/main/webapp/js/diagramly/App.js:8126— fetchAndShowNotification has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (9 pts), error handling 2 (4 pts), loops 1, ternaries 1 (nesting depth added 5). Most of this is not in the body itself: 10 of the 24 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 8175, 8139, 8141, …). 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.
getSizeForString (cognitive 24) src/main/webapp/mxgraph/src/util/mxUtils.js:5135— getSizeForString has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13, ternaries 9 (10 pts), boolean chains 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.
addLinks (cognitive 24) src/main/webapp/js/diagramly/ForceExplorer.js:3401— addLinks has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 4 (10 pts), boolean chains 5, if/else 2 (5 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.
getChangedGraphBounds (cognitive 24) src/main/webapp/mxgraph/src/view/mxGraphView.js:2055— getChangedGraphBounds has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 11, if/else 5 (11 pts), loops 2 (nesting depth added 6). Of this number, 23 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
getLayoutScope (cognitive 24) src/main/webapp/js/diagramly/LayoutPicker.js:437— getLayoutScope has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (8 pts), boolean chains 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
showPreview (cognitive 24) src/main/webapp/js/diagramly/LayoutPicker.js:2854— showPreview has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 4 (7 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
updatePreviewStyles (cognitive 24) src/main/webapp/js/diagramly/LayoutPicker.js:2920— updatePreviewStyles has cognitive complexity 24 (threshold 15). Drivers by points: loops 3 (8 pts), boolean chains 7, if/else 3 (5 pts), ternaries 4 (nesting depth added 7). Of this number, 21 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getModelNodeBounds::getOrigin (cognitive 24) REDACTED:3483— getModelNodeBounds::getOrigin has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 3 (7 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
install.populateFields (cognitive 24) src/main/webapp/js/diagramly/ConfigEditor.js:1232— install.populateFields has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14, boolean chains 6, ternaries 2 (4 pts) (nesting depth added 2). Of this number, 14 points are the body's own statements and 10 belong to 4 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
createSegment (cognitive 24) src/main/webapp/js/diagramly/gif/AnimationExport.js:1189— createSegment has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6, ternaries 3, loops 2, error handling 1 (nesting depth added 4). Of this number, 16 points are the body's own statements and 8 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous) (cognitive 24) REDACTED:96— (anonymous) has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (18 pts), boolean chains 3, error handling 1 (3 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.
equals (cognitive 24) src/main/webapp/mxgraph/src/model/mxGeometry.js:407— equals has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 23, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
renderFrames (cognitive 24) src/main/webapp/js/diagramly/gif/AnimatedExport.js:102— renderFrames has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 3 (4 pts), error handling 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 6). Most of this is not in the body itself: 10 of the 24 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 149, (anonymous)::onload, (anonymous)::onerror). 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.
addItem (cognitive 24) src/main/webapp/mxgraph/src/util/mxToolbar.js:90— addItem has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (21 pts), ternaries 2, boolean chains 1 (nesting depth added 7). Most of this is not in the body itself: 10 of the 24 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 137, a function literal at line 123, (anonymous)::hideMenu). 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.
createMp4 (cognitive 24) src/main/webapp/js/diagramly/gif/Mp4Encoder.js:268— createMp4 has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 7, ternaries 4, boolean chains 2 (nesting depth added 5). Of this number, 19 points are the body's own statements and 5 belong to 8 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Dialogs.CropImageDialog::init (cognitive 23) src/main/webapp/js/diagramly/Dialogs.js:19176— Dialogs.CropImageDialog::init has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DrawioFileSync.DrawioFileSync.addUnconfirmedRemoves (cognitive 23) src/main/webapp/js/diagramly/DrawioFileSync.js:1829— DrawioFileSync.DrawioFileSync.addUnconfirmedRemoves has cognitive complexity 23 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 4 (8 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 11). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
DrawioFileSync.DrawioFileSync.fileChanged (cognitive 23) src/main/webapp/js/diagramly/DrawioFileSync.js:3486— DrawioFileSync.DrawioFileSync.fileChanged has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 2, ternaries 1 (nesting depth added 12). Most of this is not in the body itself: 1 of the 23 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 3488, 3508). 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.
EditorUi.EditorUi.exportVisio (cognitive 23) src/main/webapp/js/diagramly/EditorUi.js:14610— EditorUi.EditorUi.exportVisio has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (18 pts), error handling 1 (4 pts), boolean chains 1 (nesting depth added 12). Most of this is not in the body itself: 3 of the 23 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 14636, 14626, 14628). 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.
EditorUi.EditorUi.getOfflineLanguages (cognitive 23) src/main/webapp/js/diagramly/EditorUi.js:27154— EditorUi.EditorUi.getOfflineLanguages has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (7 pts), error handling 1, ternaries 1 (nesting depth added 13). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 27181, a function literal at line 27165, done). 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.
EditorUi.EditorUi.getCsvStyle (cognitive 23) src/main/webapp/js/diagramly/EditorUi.js:39307— EditorUi.EditorUi.getCsvStyle has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 pts), ternaries 6 (11 pts), boolean chains 10, loops 4 (7 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. This shape REPEATS in the file: one other method here (EditorUi.EditorUi.getCsvStyle::isSourceValue) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
EditorUi.EditorUi.getJsonForPage (cognitive 23) src/main/webapp/js/diagramly/EditorUi.js:42241— EditorUi.EditorUi.getJsonForPage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 5 (10 pts), boolean chains 1 (nesting depth added 10). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ElectronApp.App.saveFile (cognitive 23) src/main/webapp/js/diagramly/ElectronApp.js:2419— ElectronApp.App.saveFile has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 1 (nesting depth added 13). Most of this is not in the body itself: 5 of the 23 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 2427, 2454, 2440, …). 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.
Extensions.getAllTextM (cognitive 23) REDACTED:4685— Extensions.getAllTextM has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (23 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.
ForceExplorer.ForceExplorer.keyDown (cognitive 23) src/main/webapp/js/diagramly/ForceExplorer.js:1150— ForceExplorer.ForceExplorer.keyDown has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 10, ternaries 1 (2 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Minimal.EditorUi.initMinimalTheme (cognitive 23) src/main/webapp/js/diagramly/Minimal.js:18— Minimal.EditorUi.initMinimalTheme has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 21, ternaries 2 (6 pts), error handling 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. This shape REPEATS in the file: one other method here (Minimal.EditorUi.initMinimalTheme::toggleShapes) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Tidy.Tidy.ops.align (cognitive 23) src/main/webapp/js/diagramly/tidy/Tidy.js:1914— Tidy.Tidy.ops.align has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 4 (9 pts), boolean chains 1 (nesting depth added 14). Most of this is not in the body itself: 11 of the 23 points are its own statements and the rest belongs to one function item inside it that branches (flush). 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.
EditorUi.EditorUi.focusOpenedWindow (cognitive 23) REDACTED:3878— EditorUi.EditorUi.focusOpenedWindow has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (5 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.
Format.StyleFormatPanel.init (cognitive 23) src/main/webapp/js/grapheditor/Format.js:6919— Format.StyleFormatPanel.init has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.mxImageShape.getImageCssVars (cognitive 23) REDACTED:316— Graph.mxImageShape.getImageCssVars has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 2 (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.
Graph.Graph.getScaledCellAt (cognitive 23) REDACTED:11859— Graph.Graph.getScaledCellAt has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 7, 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.
Graph.Graph.unbundleCells (cognitive 23) REDACTED:20986— Graph.Graph.unbundleCells has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 6 (7 pts), boolean chains 5, ternaries 1 (nesting depth added 6). Of this number, 18 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.distributeColumns (cognitive 23) REDACTED:26903— Graph.Graph.distributeColumns has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 3 (4 pts), ternaries 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.mxCellRenderer.getLabelGap (cognitive 23) REDACTED:28436— Graph.mxCellRenderer.getLabelGap has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 3 (4 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.mxStencilRegistry.loadStencilSet (cognitive 23) REDACTED:34238— Graph.mxStencilRegistry.loadStencilSet has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 3, error handling 1 (3 pts) (nesting depth added 12). Of this number, 18 points are the body's own statements and 5 belong to one function literal inside it that branches. 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.
InlineToolbar.InlineToolbar.showMarkerSubPanel (cognitive 23) src/main/webapp/js/grapheditor/InlineToolbar.js:3432— InlineToolbar.InlineToolbar.showMarkerSubPanel has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 4, loops 2, ternaries 1 (nesting depth added 7). Of this number, 17 points are the body's own statements and 6 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.
libavoid-routing.AvoidRouting.toWorldFrame (cognitive 23) src/main/webapp/js/libavoid-js/libavoid-routing.js:498— libavoid-routing.AvoidRouting.toWorldFrame has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 3 (6 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 8). Of this number, 19 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxParallelEdgeLayout.mxParallelEdgeLayout.layout (cognitive 23) src/main/webapp/mxgraph/src/layout/mxParallelEdgeLayout.js:204— mxParallelEdgeLayout.mxParallelEdgeLayout.layout has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (9 pts), boolean chains 3 (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.
mxXmlCanvas2D.mxXmlCanvas2D.text (cognitive 23) src/main/webapp/mxgraph/src/util/mxXmlCanvas2D.js:1129— mxXmlCanvas2D.mxXmlCanvas2D.text has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), ternaries 2 (5 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.
mxArrows.mxShapeArrows2Arrow.getLabelBounds (cognitive 23) src/main/webapp/shapes/mxArrows.js:87— mxArrows.mxShapeArrows2Arrow.getLabelBounds has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (21 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.
mxCiscoSafe.mxShapeCiscoSafeCompositeIcon.paintVertexShape (cognitive 23) src/main/webapp/shapes/mxCiscoSafe.js:39— mxCiscoSafe.mxShapeCiscoSafeCompositeIcon.paintVertexShape has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (17 pts), ternaries 2 (5 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addAllStyles (cognitive 23) REDACTED:4760— addAllStyles has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 5, boolean chains 3, loops 1 (3 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
zoom (cognitive 23) src/main/webapp/mxgraph/src/view/mxGraph.js:8685— zoom has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 3, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getOutlinePerimeterPoint (cognitive 23) src/main/webapp/js/grapheditor/Shapes.js:4555— getOutlinePerimeterPoint has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 4 (10 pts), boolean chains 3 (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.
getWidthHandleFrame (cognitive 23) src/main/webapp/js/grapheditor/Shapes.js:7666— getWidthHandleFrame has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 6 (12 pts), boolean chains 5, if/else 4 (5 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
paintTaperedLine (cognitive 23) src/main/webapp/js/grapheditor/Shapes.js:7717— paintTaperedLine has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 7 (10 pts), loops 6, if/else 4 (5 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
isArrowKeyEvent (cognitive 23) REDACTED:4410— isArrowKeyEvent has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 12, if/else 4 (5 pts), error handling 1 (3 pts), ternaries 1 (3 pts) (nesting depth added 5). 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.
getCustomColors (cognitive 23) src/main/webapp/js/grapheditor/Format.js:7708— getCustomColors has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 3 (12 pts), if/else 3 (5 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
updateServiceWorker (cognitive 23) src/main/webapp/js/diagramly/App.js:614— updateServiceWorker has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (nesting depth added 8). Most of this is not in the body itself: 6 of the 23 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 644, a function literal at line 636, (anonymous)::(anonymous)::check, …). 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.
checkReleaseChannel (cognitive 23) src/main/webapp/js/diagramly/App.js:2796— checkReleaseChannel has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 7, ternaries 4 (5 pts), error handling 2 (nesting depth added 3). Most of this is not in the body itself: 9 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 2826). 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.
extractTextWithWhitespace::doExtract (cognitive 23) src/main/webapp/mxgraph/src/util/mxUtils.js:1405— extractTextWithWhitespace::doExtract has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 7, 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.
initPages (cognitive 23) src/main/webapp/js/diagramly/Pages.js:1397— initPages has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 8). Most of this is not in the body itself: 3 of the 23 points are its own statements and the rest belongs to 12 function items inside it that branch (a function literal at line 1433, sizeDidChange, a function literal at line 1421, …). 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.
getCrossReferenceSkip (cognitive 23) src/main/webapp/js/diagramly/DiffSync.js:2772— getCrossReferenceSkip has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 7, loops 2 (4 pts), ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
loadUrl (cognitive 23) src/main/webapp/js/diagramly/ElectronApp.js:3061— loadUrl has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 3 (9 pts), boolean chains 2, error handling 1 (nesting depth added 11). Most of this is not in the body itself: 9 of the 23 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 3078, 3090). 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.
start (cognitive 23) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:1008— start has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 6, loops 1 (3 pts), ternaries 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.
setFocus (cognitive 23) src/main/webapp/mxgraph/src/handler/mxConstraintHandler.js:397— setFocus has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 4 (7 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 10). Of this number, 20 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Dialogs.TagsWindow (cognitive 22) src/main/webapp/js/diagramly/Dialogs.js:13991— Dialogs.TagsWindow has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 12). Most of this is not in the body itself: 2 of the 22 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 14008, 14004). 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.
Dialogs.FilePropertiesDialog.createDataDialog (cognitive 22) src/main/webapp/js/diagramly/Dialogs.js:24879— Dialogs.FilePropertiesDialog.createDataDialog has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (5 pts), boolean chains 2, error handling 1 (nesting depth added 10). Most of this is not in the body itself: 4 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 24913). 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.
Editor.Graph.updateTransientTerminalEdges (cognitive 22) src/main/webapp/js/diagramly/Editor.js:12757— Editor.Graph.updateTransientTerminalEdges has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 10). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Editor.Graph.getCellsForAction (cognitive 22) src/main/webapp/js/diagramly/Editor.js:13775— Editor.Graph.getCellsForAction has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (7 pts), ternaries 2, boolean chains 1 (nesting depth added 9). Of this number, 19 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.createLink (cognitive 22) src/main/webapp/js/diagramly/EditorUi.js:10579— EditorUi.EditorUi.createLink has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, if/else 9 (10 pts), ternaries 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
EditorUi.EditorUi.splitCsvRecords (cognitive 22) src/main/webapp/js/diagramly/EditorUi.js:38187— EditorUi.EditorUi.splitCsvRecords has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.gotoCommentAnchor (cognitive 22) src/main/webapp/js/diagramly/EditorUi.js:43557— EditorUi.EditorUi.gotoCommentAnchor has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 8). Of this number, 20 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.showRevisionMergeDialog (cognitive 22) src/main/webapp/js/diagramly/EditorUi.js:43928— EditorUi.EditorUi.showRevisionMergeDialog has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 2 (3 pts), loops 1 (2 pts), boolean chains 1, ternaries 1 (nesting depth added 9). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 43973, 43935, 44000, …). 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.
ForceExplorer.ForceExplorer.getLabelSizes (cognitive 22) src/main/webapp/js/diagramly/ForceExplorer.js:2784— ForceExplorer.ForceExplorer.getLabelSizes has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, ternaries 3 (5 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 7 of the 22 points are its own statements and the rest belongs to 2 function items inside it that branch (add, getMarkerSize). 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.
ForceExplorer.ForceExplorer.removeNodes (cognitive 22) src/main/webapp/js/diagramly/ForceExplorer.js:3580— ForceExplorer.ForceExplorer.removeNodes has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 4, 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.
Omnibox.Omnibox.expandFormatControl (cognitive 22) src/main/webapp/js/diagramly/Omnibox.js:536— Omnibox.Omnibox.expandFormatControl has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (17 pts), boolean chains 3, loops 1 (2 pts) (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.
OneDriveClient.OneDriveClient.writeLargeFile (cognitive 22) src/main/webapp/js/diagramly/OneDriveClient.js:1081— OneDriveClient.OneDriveClient.writeLargeFile has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3, error handling 2 (3 pts) (nesting depth added 8). Most of this is not in the body itself: 3 of the 22 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1115, 1091, 1145). 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.
Editor.Dialog (cognitive 22) src/main/webapp/js/grapheditor/Editor.js:2220— Editor.Dialog has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 2, ternaries 1 (nesting depth added 4). Of this number, 19 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
EditorUi.EditorUi.getTabIndex (cognitive 22) REDACTED:4068— EditorUi.EditorUi.getTabIndex has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.createCssRuleMatcher (cognitive 22) REDACTED:6040— Graph.Graph.createCssRuleMatcher has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.createShapeInsideMarkup (cognitive 22) REDACTED:7364— Graph.Graph.createShapeInsideMarkup has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 7 (9 pts), if/else 5 (7 pts), boolean chains 3, loops 3 (nesting depth added 4). Most of this is not in the body itself: 9 of the 22 points are its own statements and the rest belongs to 2 function items inside it that branch (clipPolygon, createPolygon). 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.
Graph.Graph.getFollowingEdges (cognitive 22) REDACTED:13498— Graph.Graph.getFollowingEdges has cognitive complexity 22 (threshold 15). Drivers by points: loops 4 (9 pts), if/else 2 (8 pts), boolean chains 3, 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.
Shapes.HandJiggle.lineTo (cognitive 22) src/main/webapp/js/grapheditor/Shapes.js:2560— Shapes.HandJiggle.lineTo has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (13 pts), if/else 4 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 12). Most of this is not in the body itself: 9 of the 22 points are its own statements and the rest belongs to one function item inside it that branches (sign). 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.
Shapes.mxEdgeStyle.IsometricConnector (cognitive 22) src/main/webapp/js/grapheditor/Shapes.js:11036— Shapes.mxEdgeStyle.IsometricConnector has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 2, ternaries 1 (nesting depth added 8). Of this number, 13 points are the body's own statements and 9 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxGraphModel.mxGraphModel.cellAdded (cognitive 22) src/main/webapp/mxgraph/src/model/mxGraphModel.js:706— mxGraphModel.mxGraphModel.cellAdded 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, 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.
mxCellRenderer.mxCellRenderer.initControl (cognitive 22) src/main/webapp/mxgraph/src/view/mxCellRenderer.js:955— mxCellRenderer.mxCellRenderer.initControl has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 8). Of this number, 14 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxCellRenderer.mxCellRenderer.getControlBounds (cognitive 22) src/main/webapp/mxgraph/src/view/mxCellRenderer.js:1600— mxCellRenderer.mxCellRenderer.getControlBounds has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (20 pts), ternaries 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.
mxGraph.mxGraph.getTooltip (cognitive 22) src/main/webapp/mxgraph/src/view/mxGraph.js:9822— mxGraph.mxGraph.getTooltip has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 7 (nesting depth added 8). Of this number, 17 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxGraph.mxGraph.getCellsBeyond (cognitive 22) src/main/webapp/mxgraph/src/view/mxGraph.js:13207— mxGraph.mxGraph.getCellsBeyond has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 5, loops 1 (3 pts) (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
mxGraph.mxGraph.destroy (cognitive 22) src/main/webapp/mxgraph/src/view/mxGraph.js:14661— mxGraph.mxGraph.destroy has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (21 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.
trees.Draw.loadPlugin() (cognitive 22) src/main/webapp/plugins/trees/trees.js:14— trees.Draw.loadPlugin() has cognitive complexity 22 (threshold 15). Drivers by points: if/else 66 (144 pts), boolean chains 59, loops 6 (16 pts), ternaries 1 (2 pts) (nesting depth added 89). 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. This shape REPEATS in the file: 3 other methods here (trees.Draw.loadPlugin()::getTreeDirection, trees.Draw.loadPlugin()::addSibling, trees.Draw.loadPlugin()::selectCell) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
StyleRulesDialog::render (cognitive 22) src/main/webapp/js/diagramly/Dialogs.js:22012— StyleRulesDialog::render has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (8 pts), error handling 2 (6 pts), boolean chains 3, loops 3, ternaries 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
replacePlaceholders (cognitive 22) REDACTED:5848— replacePlaceholders has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 1 (4 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
contractParent (cognitive 22) src/main/webapp/mxgraph/src/view/mxGraph.js:6559— contractParent has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 5, loops 1 (3 pts) (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
getCellAt (cognitive 22) src/main/webapp/mxgraph/src/view/mxGraph.js:12204— getCellAt has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 6, loops 1 (2 pts), ternaries 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.
getEdges (cognitive 22) src/main/webapp/mxgraph/src/view/mxGraph.js:12915— getEdges has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 8, ternaries 6 (8 pts), if/else 2 (4 pts), loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
selectCell (cognitive 22) src/main/webapp/mxgraph/src/view/mxGraph.js:13636— selectCell has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5, ternaries 3 (5 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.
OutlinePerimeter (cognitive 22) src/main/webapp/js/grapheditor/Shapes.js:4830— OutlinePerimeter has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 5 (9 pts), boolean chains 3 (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.
pickColor (cognitive 22) REDACTED:10120— pickColor has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 4 (8 pts), boolean chains 6 (nesting depth added 7). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
extractGraphModelFromEvent (cognitive 22) REDACTED:10335— extractGraphModelFromEvent has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 2 (5 pts), boolean chains 3 (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.
addEdgeWaypoints (cognitive 22) src/main/webapp/js/grapheditor/Format.js:4592— addEdgeWaypoints has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 7, ternaries 2 (4 pts), loops 3 (nesting depth added 4). Most of this is not in the body itself: 5 of the 22 points are its own statements and the rest belongs to 11 function items inside it that branch (addUpdate::update, a function literal at line 4712, a function literal at line 4632, …). 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.
addSvgVars (cognitive 22) src/main/webapp/js/grapheditor/Format.js:7182— addSvgVars has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, ternaries 2 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 6). Of this number, 13 points are the body's own statements and 9 belong to 7 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rasterizeThumbImage (cognitive 22) src/main/webapp/js/grapheditor/Sidebar.js:4839— rasterizeThumbImage has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, ternaries 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.
showSplash (cognitive 22) src/main/webapp/js/diagramly/App.js:5530— showSplash has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 6, boolean chains 5 (nesting depth added 5). Of this number, 14 points are the body's own statements and 8 belong to 4 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.
installFocusTrap (cognitive 22) src/main/webapp/js/grapheditor/Editor.js:2715— installFocusTrap has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 9, ternaries 1 (3 pts) (nesting depth added 6). None of this is in the body itself: all 22 points belong to 6 function items inside it that branch (a function literal at line 2732, a function literal at line 2756, isSameTabStop, …). 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.
repairXml (cognitive 22) src/main/webapp/mxgraph/src/util/mxUtils.js:1016— repairXml has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 3 (9 pts), boolean chains 6, if/else 3 (6 pts), loops 1 (nesting depth added 9). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to one function literal inside it that branches (line 1027). 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.
transformShape (cognitive 22) src/main/webapp/js/diagramly/ForceExplorer.js:4284— transformShape has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
validateInvalidCells (cognitive 22) src/main/webapp/mxgraph/src/view/mxGraphView.js:1349— validateInvalidCells has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 5 (6 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getConstraints (cognitive 22) src/main/webapp/shapes/mxBasic.js:3379— getConstraints has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 3 (7 pts), boolean chains 6, if/else 2 (4 pts), loops 2 (4 pts), error handling 1 (nesting depth added 8). Of this number, 19 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
keyDown (cognitive 22) src/main/webapp/js/diagramly/LightboxModern.js:3648— keyDown has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 10 (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.
getJsonForCell (cognitive 22) src/main/webapp/js/diagramly/DiffSync.js:2451— getJsonForCell has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 4, 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, 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.
getResourceKeys (cognitive 22) src/main/webapp/js/grapheditor/Omnibox.js:1891— getResourceKeys has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 5, loops 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
updateEdgeParent (cognitive 22) src/main/webapp/mxgraph/src/model/mxGraphModel.js:835— updateEdgeParent has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, if/else 5 (9 pts), loops 2 (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.
createLabel (cognitive 22) src/main/webapp/mxgraph/src/view/mxCellRenderer.js:624— createLabel has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 8). Most of this is not in the body itself: 9 of the 22 points are its own statements and the rest belongs to 5 function items inside it that branch (getState, a function literal at line 666, a function literal at line 675, …). 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.
isTextShapeInvalid (cognitive 22) src/main/webapp/mxgraph/src/view/mxCellRenderer.js:1242— isTextShapeInvalid has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 18, if/else 2, ternaries 1 (2 pts) (nesting depth added 1). Of this number, 16 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
jettyStub (cognitive 22) src/main/webapp/js/libavoid-js/libavoid-routing.js:178— jettyStub has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 5 (6 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getFile (cognitive 22) src/main/webapp/js/diagramly/GitHubClient.js:496— getFile has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (2 pts) (nesting depth added 7). Of this number, 12 points are the body's own statements and 10 belong to 2 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.
mxPanningHandler (cognitive 22) src/main/webapp/mxgraph/src/handler/mxPanningHandler.js:34— mxPanningHandler has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 4 (nesting depth added 10). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 59, 42, 90). 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.
App.App.isModeEnabled (cognitive 21) src/main/webapp/js/diagramly/App.js:6619— App.App.isModeEnabled has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 14, if/else 7. 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.
Dialogs.FindWindow::testMeta (cognitive 21) src/main/webapp/js/diagramly/Dialogs.js:10001— Dialogs.FindWindow::testMeta has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.showHtmlDialog (cognitive 21) src/main/webapp/js/diagramly/EditorUi.js:10835— EditorUi.EditorUi.showHtmlDialog has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 4, ternaries 3 (nesting depth added 2). Most of this is not in the body itself: 5 of the 21 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 10970, 11031, 11005, …). 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.
EditorUi.EditorUi.showEmbedImageDialog (cognitive 21) src/main/webapp/js/diagramly/EditorUi.js:12836— EditorUi.EditorUi.showEmbedImageDialog has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 3, ternaries 3 (nesting depth added 4). Most of this is not in the body itself: 7 of the 21 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 12920, 12961). 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.
EditorUi.EditorUi.applyMermaidElkPostPass (cognitive 21) src/main/webapp/js/diagramly/EditorUi.js:15754— EditorUi.EditorUi.applyMermaidElkPostPass has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 5 (6 pts), error handling 3 (5 pts), boolean chains 3 (nesting depth added 5). Of this number, 12 points are the body's own statements and 9 belong to 2 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.
EditorUi.EditorUi.parseMermaidDiagram (cognitive 21) src/main/webapp/js/diagramly/EditorUi.js:15979— EditorUi.EditorUi.parseMermaidDiagram has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (14 pts), error handling 2 (4 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 6). Most of this is not in the body itself: 4 of the 21 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 15999, 15981). 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.
EditorUi.EditorUi.importLocalFile (cognitive 21) src/main/webapp/js/diagramly/EditorUi.js:17263— EditorUi.EditorUi.importLocalFile has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 8). Of this number, 14 points are the body's own statements and 7 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.
EditorUi.EditorUi.isSelfContainedSvg (cognitive 21) src/main/webapp/js/diagramly/EditorUi.js:20669— EditorUi.EditorUi.isSelfContainedSvg has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (8 pts), loops 3 (4 pts) (nesting depth added 5). Of this number, 15 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.getDataSourceConnectionCount (cognitive 21) src/main/webapp/js/diagramly/EditorUi.js:38542— EditorUi.EditorUi.getDataSourceConnectionCount has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (10 pts), boolean chains 5, if/else 1 (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.
EditorUi.EditorUi.openDatabase (cognitive 21) src/main/webapp/js/diagramly/EditorUi.js:42714— EditorUi.EditorUi.openDatabase has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 8, error handling 1 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ForceExplorer.ForceExplorer.focusInDirection (cognitive 21) src/main/webapp/js/diagramly/ForceExplorer.js:1350— ForceExplorer.ForceExplorer.focusInDirection has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 4 (6 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FusionTheme.EditorUi.installSimpleModern (cognitive 21) src/main/webapp/js/diagramly/FusionTheme.js:1009— FusionTheme.EditorUi.installSimpleModern has cognitive complexity 21 (threshold 15). Drivers by points: loops 6 (9 pts), if/else 3 (6 pts), boolean chains 4, 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.
Omnibox.Omnibox.addPageEntries (cognitive 21) src/main/webapp/js/diagramly/Omnibox.js:72— Omnibox.Omnibox.addPageEntries has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 2 (4 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 11). Most of this is not in the body itself: 4 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 82). 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.
AnimatedExport.AnimatedGifExport.doExport (cognitive 21) src/main/webapp/js/diagramly/gif/AnimatedExport.js:30— AnimatedExport.AnimatedGifExport.doExport has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (7 pts), ternaries 3 (4 pts), error handling 2 (nesting depth added 4). Of this number, 18 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxGraphMlCodec.mxGraphMlCodec.parseAttributes (cognitive 21) REDACTED:374— mxGraphMlCodec.mxGraphMlCodec.parseAttributes has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (19 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.
mxGraphMlCodec.mxGraphMlCodec.addEdgePath (cognitive 21) REDACTED:2156— mxGraphMlCodec.mxGraphMlCodec.addEdgePath has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 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.
TidyStyle.Tidy.getThemeColors (cognitive 21) src/main/webapp/js/diagramly/tidy/TidyStyle.js:448— TidyStyle.Tidy.getThemeColors has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (6 pts), boolean chains 3, ternaries 1 (nesting depth added 9). Of this number, 20 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.formatDate (cognitive 21) REDACTED:16127— Graph.Graph.formatDate has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 10, boolean chains 6, if/else 4, loops 1. Of this number, 18 points are the body's own statements and 3 belong to 2 function items inside it that branch. 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.
Graph.Graph.resolveInheritedLabelStyles (cognitive 21) REDACTED:19015— Graph.Graph.resolveInheritedLabelStyles has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (6 pts), ternaries 3 (6 pts), loops 2 (5 pts), boolean chains 4 (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.
Graph.Graph.normalizeModel (cognitive 21) REDACTED:21700— Graph.Graph.normalizeModel has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, loops 4 (nesting depth added 4). Most of this is not in the body itself: 5 of the 21 points are its own statements and the rest belongs to 2 function items inside it that branch (growContainers, collectEdges). 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.
Graph.getPlainTextGroup (cognitive 21) REDACTED:30129— Graph.getPlainTextGroup has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, loops 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Shapes.mxShapeBasicRect2.moveNWInner (cognitive 21) src/main/webapp/js/grapheditor/Shapes.js:7401— Shapes.mxShapeBasicRect2.moveNWInner has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 15, if/else 6. 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. This shape REPEATS in the file: one other method here (Shapes.mxShapeBasicRect2.lineNWInner) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.lineNWInner (cognitive 21) src/main/webapp/js/grapheditor/Shapes.js:7431— Shapes.mxShapeBasicRect2.lineNWInner has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 15, if/else 6. 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. This shape REPEATS in the file: one other method here (Shapes.mxShapeBasicRect2.moveNWInner) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
mxCellEditor.mxCellEditor.stopEditing (cognitive 21) src/main/webapp/mxgraph/src/view/mxCellEditor.js:1007— mxCellEditor.mxCellEditor.stopEditing has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, 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.
mxGraph.mxGraph.cellsFolded (cognitive 21) src/main/webapp/mxgraph/src/view/mxGraph.js:5641— mxGraph.mxGraph.cellsFolded has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (16 pts), boolean chains 3, 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.
mxBasic.mxShapeBasicPolygon.paintVertexShape (cognitive 21) src/main/webapp/shapes/mxBasic.js:3322— mxBasic.mxShapeBasicPolygon.paintVertexShape has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (6 pts), boolean chains 2, loops 1 (2 pts), error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
(anonymous) (cognitive 21) REDACTED:8305— (anonymous) has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 9, ternaries 1 (2 pts) (nesting depth added 3). None of this is in the body itself: all 21 points belong to 7 function items inside it that branch (handle, isReflexAngle, EllipticalArcTo, …). 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.
CustomDialog (cognitive 21) src/main/webapp/js/diagramly/Dialogs.js:21195— CustomDialog has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 3, loops 1 (2 pts), ternaries 1 (nesting depth added 4). Of this number, 12 points are the body's own statements and 9 belong to 4 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
expandSvgPatterns::expandElement (cognitive 21) src/main/webapp/js/diagramly/Editor.js:4679— expandSvgPatterns::expandElement has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 4 (7 pts), boolean chains 2, ternaries 2, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
writeGraphModelToPng (cognitive 21) src/main/webapp/js/diagramly/Editor.js:8355— writeGraphModelToPng has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 3 (6 pts), loops 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.
addSvgShadow (cognitive 21) src/main/webapp/js/diagramly/Editor.js:14367— addSvgShadow has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (15 pts), ternaries 3 (4 pts), boolean chains 2 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
getShapeBoundingBox (cognitive 21) src/main/webapp/js/grapheditor/Shapes.js:3036— getShapeBoundingBox has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 3 (10 pts), if/else 4 (9 pts), boolean chains 2 (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.
paintEdgeShape (cognitive 21) src/main/webapp/js/grapheditor/Shapes.js:9678— paintEdgeShape has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 6, if/else 4 (6 pts), ternaries 3 (6 pts), loops 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getResourceReverseMap (cognitive 21) src/main/webapp/js/grapheditor/Sidebar.js:2544— getResourceReverseMap has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (12 pts), boolean chains 6, 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.
isPropagateSelectionCell (cognitive 21) src/main/webapp/js/grapheditor/Editor.js:5333— isPropagateSelectionCell has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 12, if/else 4 (7 pts), ternaries 1 (2 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.
equalPoints (cognitive 21) src/main/webapp/mxgraph/src/util/mxUtils.js:2755— equalPoints has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 14, if/else 3 (5 pts), loops 1 (2 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
showLineEndMenu::(anonymous)::updatePreview (cognitive 21) src/main/webapp/js/grapheditor/InlineToolbar.js:3306— showLineEndMenu::(anonymous)::updatePreview has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (5 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.
animateFrame (cognitive 21) src/main/webapp/js/diagramly/ForceExplorer.js:398— animateFrame has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 2 (4 pts) (nesting depth added 8). Of this number, 17 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
validateInvalidCell (cognitive 21) src/main/webapp/mxgraph/src/view/mxGraphView.js:1589— validateInvalidCell has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 7, if/else 4 (6 pts), loops 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
enableLibraryEntry (cognitive 21) src/main/webapp/js/diagramly/sidebar/Sidebar.js:2099— enableLibraryEntry has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (6 pts), boolean chains 5, ternaries 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.
getFormatControls (cognitive 21) src/main/webapp/js/grapheditor/Omnibox.js:1463— getFormatControls has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 6, 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.
addGestureListeners (cognitive 21) src/main/webapp/mxgraph/src/util/mxEvent.js:156— addGestureListeners has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 3 (6 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.
removeGestureListeners (cognitive 21) src/main/webapp/mxgraph/src/util/mxEvent.js:211— removeGestureListeners has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 3 (6 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.
EllipsePerimeter (cognitive 21) src/main/webapp/mxgraph/src/view/mxPerimeter.js:161— EllipsePerimeter has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 6, 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.
paintVertexShape (cognitive 21) src/main/webapp/mxgraph/src/shape/mxSwimlane.js:241— paintVertexShape has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 1 (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.
encode (cognitive 21) src/main/webapp/mxgraph/src/io/mxCodec.js:447— encode has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (19 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.
rank (cognitive 21) src/main/webapp/js/diagramly/tidy/TidyFeatures.js:476— rank has cognitive complexity 21 (threshold 15). Drivers by points: loops 6 (7 pts), if/else 3 (5 pts), ternaries 2 (5 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parse (cognitive 21) src/main/webapp/mxgraph/src/util/mxResources.js:299— parse has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (19 pts), 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.
ConfigEditor.DrawioConfigEditor.install.populateFields (cognitive 20) src/main/webapp/js/diagramly/ConfigEditor.js:1232— ConfigEditor.DrawioConfigEditor.install.populateFields has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, boolean chains 6. Of this number, 12 points are the body's own statements and 8 belong to 3 function literals inside it that branch. 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.
DiffSync.EditorUi.getClaimantOrder::emitRun (cognitive 20) src/main/webapp/js/diagramly/DiffSync.js:887— DiffSync.EditorUi.getClaimantOrder::emitRun has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (7 pts), ternaries 1 (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.
DrawioFile.DrawioFile.autosave (cognitive 20) REDACTED:4236— DrawioFile.DrawioFile.autosave has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 1, error handling 1, ternaries 1 (nesting depth added 6). Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 4249, 4275, 4283). 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.
Editor.Graph.removeTagsForCells (cognitive 20) src/main/webapp/js/diagramly/Editor.js:14228— Editor.Graph.removeTagsForCells has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (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.
EditorUi.EditorUi.replaceSvgImage (cognitive 20) src/main/webapp/js/diagramly/EditorUi.js:991— EditorUi.EditorUi.replaceSvgImage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 2, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.getFileData (cognitive 20) src/main/webapp/js/diagramly/EditorUi.js:3673— EditorUi.EditorUi.getFileData has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 6, 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.
EditorUi.EditorUi.showLanguageDialog (cognitive 20) src/main/webapp/js/diagramly/EditorUi.js:7352— EditorUi.EditorUi.showLanguageDialog has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 7, loops 4 (nesting depth added 3). None of this is in the body itself: all 20 points belong to 5 function items inside it that branch (updateLanguageStates, a function literal at line 7424, getSelectedLanguage, …). 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.
EditorUi.EditorUi.sanitizeExportPreset (cognitive 20) src/main/webapp/js/diagramly/EditorUi.js:11512— EditorUi.EditorUi.sanitizeExportPreset has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 10). Of this number, 11 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.updatePageLink (cognitive 20) src/main/webapp/js/diagramly/EditorUi.js:14248— EditorUi.EditorUi.updatePageLink has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 1 (3 pts), error handling 1 (2 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.
EditorUi.EditorUi.loadPlantUml (cognitive 20) src/main/webapp/js/diagramly/EditorUi.js:16215— EditorUi.EditorUi.loadPlantUml has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 1 (3 pts), error handling 1 (nesting depth added 8). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 16252, call). 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.
EditorUi.EditorUi.embedExternalImages (cognitive 20) src/main/webapp/js/diagramly/EditorUi.js:18491— EditorUi.EditorUi.embedExternalImages has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 3 (5 pts), boolean chains 2, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 6). Of this number, 12 points are the body's own statements and 8 belong to 2 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.
EditorUi.drainRepairRestores (cognitive 20) src/main/webapp/js/diagramly/EditorUi.js:22613— EditorUi.drainRepairRestores has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 3 (6 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 11). Most of this is not in the body itself: 4 of the 20 points are its own statements and the rest belongs to one function item inside it that branches (visit). 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.
EditorUi.EditorUi.destroyWindows (cognitive 20) src/main/webapp/js/diagramly/EditorUi.js:25545— EditorUi.EditorUi.destroyWindows has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 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.
EditorUi.EditorUi.createLayoutAddSelect (cognitive 20) src/main/webapp/js/diagramly/EditorUi.js:34428— EditorUi.EditorUi.createLayoutAddSelect has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 4, error handling 1 (2 pts), loops 1 (nesting depth added 2). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 34496). 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.
EditorUi.EditorUi.getDataSourceRecords (cognitive 20) src/main/webapp/js/diagramly/EditorUi.js:38253— EditorUi.EditorUi.getDataSourceRecords has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 5, loops 3 (5 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.
Extensions.createEdge (cognitive 20) REDACTED:6288— Extensions.createEdge has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), ternaries 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.
LayoutPicker.LayoutPanel.isLayoutEdit (cognitive 20) src/main/webapp/js/diagramly/LayoutPicker.js:1947— LayoutPicker.LayoutPanel.isLayoutEdit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Pages.Graph.addExtFont (cognitive 20) src/main/webapp/js/diagramly/Pages.js:1943— Pages.Graph.addExtFont has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 1 (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.
emf-svg.parseEMF (cognitive 20) src/main/webapp/js/diagramly/emf/emf-svg.js:826— emf-svg.parseEMF has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 3, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TidyWindow.TidyWindow.repaintStyles (cognitive 20) src/main/webapp/js/diagramly/tidy/TidyWindow.js:1279— TidyWindow.TidyWindow.repaintStyles has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 5 (6 pts), boolean chains 2, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Editor.PageSetupDialog (cognitive 20) src/main/webapp/js/grapheditor/Editor.js:3471— Editor.PageSetupDialog has cognitive complexity 20 (threshold 15). Drivers by points: if/else 26 (37 pts), ternaries 9 (16 pts), boolean chains 13, loops 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Editor.PageSetupDialog::applyFn) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Graph.Graph.pasteTextStyles (cognitive 20) REDACTED:11664— Graph.Graph.pasteTextStyles has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.updateCellStyles (cognitive 20) REDACTED:11778— Graph.Graph.updateCellStyles has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.openLink (cognitive 20) REDACTED:12522— Graph.Graph.openLink has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, error handling 1 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Graph.Graph.removeInheritedLabelKeys (cognitive 20) REDACTED:19221— Graph.Graph.removeInheritedLabelKeys has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.getZoomStep (cognitive 20) REDACTED:22240— Graph.Graph.getZoomStep has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), boolean chains 2, ternaries 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.getTableLines (cognitive 20) REDACTED:25281— Graph.Graph.getTableLines has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 3 (nesting depth added 10). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 25288). 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.
Graph.LineJumpIndex.get (cognitive 20) REDACTED:31412— Graph.LineJumpIndex.get has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (7 pts), boolean chains 3, 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.
Graph.mxGraphView.invalidateChangedTies (cognitive 20) REDACTED:33884— Graph.mxGraphView.invalidateChangedTies has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (7 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.
Sidebar.Sidebar.addEntries (cognitive 20) src/main/webapp/js/grapheditor/Sidebar.js:1088— Sidebar.Sidebar.addEntries has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (5 pts), boolean chains 4, loops 1 (nesting depth added 8). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 1092, 1109, 1125). 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.
mxStackLayout.mxStackLayout.getLayoutCells (cognitive 20) src/main/webapp/mxgraph/src/layout/mxStackLayout.js:308— mxStackLayout.mxStackLayout.getLayoutCells has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 5 (16 pts), if/else 2 (3 pts), loops 1 (nesting depth added 12). Most of this is not in the body itself: 4 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 327). 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.
mxSvgCanvas2D.mxSvgCanvas2D.updateFill (cognitive 20) REDACTED:1309— mxSvgCanvas2D.mxSvgCanvas2D.updateFill has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
mxSvgCanvas2D.mxSvgCanvas2D.appendPolygonClip (cognitive 20) REDACTED:3551— mxSvgCanvas2D.mxSvgCanvas2D.appendPolygonClip has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 4, 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.
mxWindow.mxWindow.installMaximizeHandler (cognitive 20) src/main/webapp/mxgraph/src/util/mxWindow.js:802— mxWindow.mxWindow.installMaximizeHandler has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 4 (nesting depth added 9). None of this is in the body itself: all 20 points belong to one function literal inside it that branches (line 822). 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.
mxGraph.mxGraph.getSwimlaneAt (cognitive 20) src/main/webapp/mxgraph/src/view/mxGraph.js:12137— mxGraph.mxGraph.getSwimlaneAt has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 1 (2 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.
mxGraphView.mxGraphView.getLabelPerimeterSide (cognitive 20) src/main/webapp/mxgraph/src/view/mxGraphView.js:3642— mxGraphView.mxGraphView.getLabelPerimeterSide has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxCisco19.mxShapeCisco19Rect.paintVertexShape (cognitive 20) src/main/webapp/shapes/mxCisco19.js:34— mxCisco19.mxShapeCisco19Rect.paintVertexShape has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
mxBase64.decode (cognitive 20) src/main/server/java/com/mxgraph/online/mxBase64.java:348— mxBase64.decode has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
createGroup::updateMinMax (cognitive 20) REDACTED:6550— createGroup::updateMinMax has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 4 (13 pts), if/else 3 (4 pts), loops 1 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
normalizeGroup (cognitive 20) REDACTED:7048— normalizeGroup has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
createRoughCanvas (cognitive 20) src/main/webapp/js/diagramly/Editor.js:2031— createRoughCanvas has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 6, match/switch 2 (4 pts), loops 2, ternaries 1 (nesting depth added 4). None of this is in the body itself: all 20 points belong to 4 function items inside it that branch (draw, fillSketch, _drawToContext, …). 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.
addTagsForCells (cognitive 20) src/main/webapp/js/diagramly/Editor.js:14187— addTagsForCells has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 2 (5 pts), ternaries 1 (5 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
updateSelection (cognitive 20) src/main/webapp/mxgraph/src/view/mxGraph.js:1990— updateSelection has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (7 pts), boolean chains 5, ternaries 4 (5 pts), loops 3 (nesting depth added 5). Most of this is not in the body itself: 5 of the 20 points are its own statements and the rest belongs to 3 function items inside it that branch (getResult, a function literal at line 2040, isContained). 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.
cellsMoved (cognitive 20) src/main/webapp/mxgraph/src/view/mxGraph.js:6787— cellsMoved has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, loops 1 (2 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.
validateGraph (cognitive 20) src/main/webapp/mxgraph/src/view/mxGraph.js:9397— validateGraph has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6, ternaries 3, 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, 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.
addCollapsedRegionPath (cognitive 20) src/main/webapp/js/grapheditor/Shapes.js:447— addCollapsedRegionPath has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 8, ternaries 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.
createCustomHandles (cognitive 20) src/main/webapp/js/grapheditor/Shapes.js:10844— createCustomHandles has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getUsedShapeStyles (cognitive 20) REDACTED:3286— getUsedShapeStyles has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (13 pts), boolean chains 4, 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.
initClipboard (cognitive 20) REDACTED:5505— initClipboard has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 2 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). None of this is in the body itself: all 20 points belong to 5 function items inside it that branch (copy, cut, paste, …). 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.
addRecent (cognitive 20) src/main/webapp/js/diagramly/App.js:3485— addRecent has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (5 pts), loops 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.
updateButtons (cognitive 20) src/main/webapp/js/grapheditor/InlineToolbar.js:706— updateButtons has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 12, ternaries 2 (4 pts), if/else 1 (2 pts), loops 2 (nesting depth added 3). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
coversEdge (cognitive 20) src/main/webapp/js/grapheditor/InlineToolbar.js:1345— coversEdge has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (7 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.
setPageGroup (cognitive 20) src/main/webapp/js/diagramly/Pages.js:2977— setPageGroup has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, 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.
addTbl2Rows (cognitive 20) REDACTED:1783— addTbl2Rows has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 5 (13 pts), if/else 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addTbl2Cols (cognitive 20) REDACTED:1826— addTbl2Cols has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 5 (13 pts), if/else 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
loadArgs (cognitive 20) src/main/webapp/js/diagramly/ElectronApp.js:918— loadArgs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, ternaries 1 (3 pts) (nesting depth added 8). Most of this is not in the body itself: 5 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 937, 967). 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.
computeRoutes (cognitive 20) src/main/webapp/js/libavoid-js/libavoid-routing.js:1055— computeRoutes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 29 (46 pts), ternaries 14 (31 pts), boolean chains 27, loops 18 (25 pts), error handling 4 (6 pts) (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getCells (cognitive 20) src/main/webapp/mxgraph/src/handler/mxGraphHandler.js:731— getCells has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (7 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.
paint (cognitive 20) src/main/webapp/mxgraph/src/shape/mxShape.js:1094— paint has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 9, 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.
preview (cognitive 20) src/main/webapp/js/diagramly/tidy/TidyWindow.js:1058— preview has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 7, ternaries 2 (3 pts), loops 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getSpacing (cognitive 20) src/main/webapp/mxgraph/src/shape/mxText.js:1284— getSpacing has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 4 (8 pts), boolean chains 6, if/else 6 (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.
RhombusPerimeter (cognitive 20) src/main/webapp/mxgraph/src/view/mxPerimeter.js:232— RhombusPerimeter has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
send (cognitive 20) src/main/webapp/mxgraph/src/util/mxXmlRequest.js:319— send has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 5 (nesting depth added 8). Of this number, 13 points are the body's own statements and 7 belong to 2 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.
check (cognitive 20) src/main/webapp/mxgraph/src/view/mxMultiplicity.js:163— check has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 4 (8 pts), ternaries 1 (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.
redrawSpringHandle (cognitive 20) src/main/webapp/js/diagramly/SpringHandle.js:112— redrawSpringHandle has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 4 (7 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxTemporaryCellStates (cognitive 20) src/main/webapp/mxgraph/src/view/mxTemporaryCellStates.js:10— mxTemporaryCellStates has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 7). Of this number, 10 points are the body's own statements and 10 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App.App.openGenerateDialog (cognitive 19) src/main/webapp/js/diagramly/App.js:5070— App.App.openGenerateDialog has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 5 (6 pts), boolean chains 5 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App.App.filterDrafts (cognitive 19) src/main/webapp/js/diagramly/App.js:5199— App.App.filterDrafts has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 5, error handling 2 (3 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to one function literal inside it that branches (line 5210). 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.
ConfigEditor.DrawioConfigEditor.install.importConfig (cognitive 19) src/main/webapp/js/diagramly/ConfigEditor.js:1178— ConfigEditor.DrawioConfigEditor.install.importConfig has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6 (nesting depth added 4). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to one function literal inside it that branches (line 1187). 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.
Dialogs.LibraryDialog (cognitive 19) src/main/webapp/js/diagramly/Dialogs.js:19852— Dialogs.LibraryDialog has cognitive complexity 19 (threshold 15). Drivers by points: if/else 86 (172 pts), boolean chains 42, ternaries 9 (21 pts), loops 8 (15 pts), error handling 2 (3 pts) (nesting depth added 106). 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. This shape REPEATS in the file: one other method here (Dialogs.LibraryDialog::addButton) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.PolygonTool.mouseUp (cognitive 19) src/main/webapp/js/diagramly/Dialogs.js:27817— Dialogs.PolygonTool.mouseUp has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (3 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.
Editor.Editor.convertLegacyAnimationStep (cognitive 19) src/main/webapp/js/diagramly/Editor.js:15573— Editor.Editor.convertLegacyAnimationStep has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 2, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
EditorUi.EditorUi.updateMermaidAltText (cognitive 19) src/main/webapp/js/diagramly/EditorUi.js:16665— EditorUi.EditorUi.updateMermaidAltText has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (8 pts), boolean chains 6, if/else 4 (5 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.collectExternalImages (cognitive 19) src/main/webapp/js/diagramly/EditorUi.js:18587— EditorUi.EditorUi.collectExternalImages has cognitive complexity 19 (threshold 15). Drivers by points: loops 3 (8 pts), ternaries 2 (6 pts), error handling 1 (2 pts), if/else 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.
EditorUi.drainRepairParents (cognitive 19) src/main/webapp/js/diagramly/EditorUi.js:22528— EditorUi.drainRepairParents has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.restorePersistedEdgeStyle (cognitive 19) src/main/webapp/js/diagramly/EditorUi.js:27874— EditorUi.EditorUi.restorePersistedEdgeStyle has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, loops 1 (2 pts), ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.sendEmbeddedSvgExport (cognitive 19) src/main/webapp/js/diagramly/EditorUi.js:31516— EditorUi.EditorUi.sendEmbeddedSvgExport has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 2 (4 pts), boolean chains 2, error handling 1 (nesting depth added 6). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.getTableText (cognitive 19) src/main/webapp/js/diagramly/EditorUi.js:37335— EditorUi.EditorUi.getTableText has cognitive complexity 19 (threshold 15). Drivers by points: loops 5 (8 pts), if/else 3 (7 pts), ternaries 1 (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.
EditorUi.EditorUi.generateDataSourceCells (cognitive 19) src/main/webapp/js/diagramly/EditorUi.js:38437— EditorUi.EditorUi.generateDataSourceCells has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4, loops 1, ternaries 1 (nesting depth added 3). Of this number, 15 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
EditorUi.EditorUi.parseCsvList (cognitive 19) src/main/webapp/js/diagramly/EditorUi.js:39512— EditorUi.EditorUi.parseCsvList has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 2 (4 pts), ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 5). Of this number, 16 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Extensions.importLucidPage::addLine (cognitive 19) REDACTED:6805— Extensions.importLucidPage::addLine has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 6, if/else 5 (6 pts), loops 2 (5 pts), ternaries 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ForceExplorer.ForceExplorer.getLineGeometry (cognitive 19) src/main/webapp/js/diagramly/ForceExplorer.js:4570— ForceExplorer.ForceExplorer.getLineGeometry has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 3 (7 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TidyStyle.Tidy.getRole (cognitive 19) src/main/webapp/js/diagramly/tidy/TidyStyle.js:608— TidyStyle.Tidy.getRole has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 8 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Editor.PrintDialog.create (cognitive 19) src/main/webapp/js/grapheditor/Editor.js:3049— Editor.PrintDialog.create has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 3, ternaries 2 (3 pts) (nesting depth added 2). Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to 2 function items inside it that branch (preview, a function literal at line 3123). 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.
Graph.Graph.initLayoutManager (cognitive 19) REDACTED:12824— Graph.Graph.initLayoutManager has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 19. 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.
Graph.Graph.updateEdgeLabelShape (cognitive 19) REDACTED:17331— Graph.Graph.updateEdgeLabelShape has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, 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.
Graph.Graph.getDataSources (cognitive 19) REDACTED:18907— Graph.Graph.getDataSources has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 6, if/else 3 (5 pts), ternaries 3 (4 pts), error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.getTextOutline (cognitive 19) REDACTED:23064— Graph.Graph.getTextOutline has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (27 pts), loops 6 (8 pts), boolean chains 6, ternaries 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Graph.Graph.getTextOutline::collect) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Graph.Graph.getContinuousPathData (cognitive 19) REDACTED:23905— Graph.Graph.getContinuousPathData has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 8). Of this number, 18 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.mxImageExport.addLabelGaps (cognitive 19) REDACTED:29030— Graph.mxImageExport.addLabelGaps has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 3 (5 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 6). Of this number, 11 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InlineToolbar.InlineToolbar.getEdgeMidpoint (cognitive 19) src/main/webapp/js/grapheditor/InlineToolbar.js:760— InlineToolbar.InlineToolbar.getEdgeMidpoint has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, ternaries 1 (3 pts), loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxCircleLayout.mxCircleLayout.execute (cognitive 19) src/main/webapp/mxgraph/src/layout/mxCircleLayout.js:92— mxCircleLayout.mxCircleLayout.execute has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 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.
mxSvgCanvas2D.mxSvgCanvas2D.updateText (cognitive 19) REDACTED:2128— mxSvgCanvas2D.mxSvgCanvas2D.updateText has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 2 (8 pts), boolean chains 3 (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.
mxCellState.mxCellState.updateCachedBounds (cognitive 19) src/main/webapp/mxgraph/src/view/mxCellState.js:442— mxCellState.mxCellState.updateCachedBounds has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 3 (7 pts), if/else 5 (6 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LogServlet.doPost (cognitive 19) REDACTED:72— LogServlet.doPost has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (13 pts), if/else 3 (5 pts), error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CreateDialog::change (cognitive 19) src/main/webapp/js/diagramly/Dialogs.js:5362— CreateDialog::change has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 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.
getPageLinkWarning (cognitive 19) src/main/webapp/js/diagramly/Dialogs.js:17974— getPageLinkWarning has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, ternaries 2 (3 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PolygonDialog (cognitive 19) src/main/webapp/js/diagramly/Dialogs.js:25702— PolygonDialog has cognitive complexity 19 (threshold 15). Drivers by points: if/else 98 (158 pts), ternaries 26 (48 pts), boolean chains 42, loops 15 (21 pts), error handling 1 (2 pts) (nesting depth added 89). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getEdgeLabelStyle (cognitive 19) REDACTED:6416— getEdgeLabelStyle has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 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.
convertLegacyAnimation (cognitive 19) src/main/webapp/js/diagramly/Editor.js:15653— convertLegacyAnimation has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 5). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 3 function items inside it that branch (merge, flush, paramsMatch). 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.
translateCell (cognitive 19) src/main/webapp/mxgraph/src/view/mxGraph.js:6842— translateCell has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
editAsNew (cognitive 19) src/main/webapp/js/grapheditor/Editor.js:1678— editAsNew has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 4 (7 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 5). Of this number, 16 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getScrollOrigin (cognitive 19) src/main/webapp/mxgraph/src/util/mxUtils.js:3731— getScrollOrigin has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 7, ternaries 5 (6 pts), if/else 3 (5 pts), loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
color2hex (cognitive 19) src/main/webapp/mxgraph/src/util/mxUtils.js:4805— color2hex has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 1, error handling 1, ternaries 1 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
frame (cognitive 19) src/main/webapp/js/diagramly/ForceExplorer.js:3689— frame has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 9 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
getValidationVisibility (cognitive 19) src/main/webapp/mxgraph/src/view/mxGraphView.js:1468— getValidationVisibility has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, ternaries 2 (3 pts), loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
removeDuplicatePoints (cognitive 19) src/main/webapp/mxgraph/src/view/mxGraphView.js:3276— removeDuplicatePoints has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 7, if/else 3 (7 pts), loops 2 (5 pts) (nesting depth added 7). Of this number, 17 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getShadowPages (cognitive 19) REDACTED:344— getShadowPages has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 1 (4 pts), boolean chains 3, error handling 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.
install.importConfig (cognitive 19) src/main/webapp/js/diagramly/ConfigEditor.js:1178— install.importConfig has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6 (nesting depth added 4). 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 1187, 1210, 1222). 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.
diffAllCellProperties (cognitive 19) src/main/webapp/js/diagramly/DiffSync.js:2737— diffAllCellProperties has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 7, ternaries 2 (6 pts), if/else 2 (4 pts), loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
resetLabels (cognitive 19) src/main/webapp/js/diagramly/tidy/Tidy.js:1785— resetLabels has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 3 (6 pts), loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 5). Of this number, 10 points are the body's own statements and 9 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
saveLibrary (cognitive 19) src/main/webapp/js/diagramly/ElectronApp.js:2489— saveLibrary has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 3, boolean chains 2 (nesting depth added 5). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 2496, 2524, 2545, …). 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.
createItem (cognitive 19) src/main/webapp/js/grapheditor/Omnibox.js:2574— createItem has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 2 (4 pts), boolean chains 3 (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.
mxGraphHandler (cognitive 19) src/main/webapp/mxgraph/src/handler/mxGraphHandler.js:25— mxGraphHandler has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 7 (nesting depth added 4). None of this is in the body itself: all 19 points belong to 5 function literals inside it that branch (lines 60, 103, 31, …). 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.
launchPicker (cognitive 19) src/main/webapp/js/diagramly/OneDriveClient.js:1651— launchPicker has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (4 pts), boolean chains 3, error handling 1 (nesting depth added 7). Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1658, 1704, 1716). 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.
getRefIndex (cognitive 19) src/main/webapp/js/diagramly/GitLabClient.js:359— getRefIndex has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 2 (6 pts) (nesting depth added 9). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 370, 389, 399). 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.
getGroupOrder (cognitive 19) src/main/webapp/js/diagramly/Omnibox.js:174— getGroupOrder has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 6, loops 1 (2 pts), ternaries 1 (nesting depth added 7). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
reset (cognitive 19) src/main/webapp/mxgraph/src/handler/mxTooltipHandler.js:255— reset has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, if/else 3 (6 pts), ternaries 1 (2 pts) (nesting depth added 4). Of this number, 14 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
init (cognitive 19) src/main/webapp/mxgraph/src/util/mxLog.js:56— init has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, error handling 1 (2 pts) (nesting depth added 5). Of this number, 14 points are the body's own statements and 5 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getEdgeId (cognitive 19) src/main/webapp/mxgraph/src/layout/mxParallelEdgeLayout.js:157— getEdgeId has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 1 (4 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
drawImageResize.processDrawioFile (cognitive 18) etc/imageResize/drawImageResize.js:68— drawImageResize.processDrawioFile has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 5, error handling 3 (5 pts), loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App.App.main::configHandler (cognitive 18) src/main/webapp/js/diagramly/App.js:1732— App.App.main::configHandler has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 pts), error handling 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.
Dialogs.BackgroundImageDialog::urlChanged (cognitive 18) src/main/webapp/js/diagramly/Dialogs.js:998— Dialogs.BackgroundImageDialog::urlChanged has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 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.
DrawioClient.DrawioClient.createAuthCallback (cognitive 18) src/main/webapp/js/diagramly/DrawioClient.js:180— DrawioClient.DrawioClient.createAuthCallback has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), error handling 1 (4 pts), boolean chains 3 (nesting depth added 7). None of this is in the body itself: all 18 points belong to 2 function literals inside it that branch (lines 182, 196). 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.
DrawioFile.DrawioFile.handleFileSuccess (cognitive 18) REDACTED:3618— DrawioFile.DrawioFile.handleFileSuccess has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), 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.
DrawioFileSync.DrawioFileSync.restoresUnconfirmedRemoves (cognitive 18) src/main/webapp/js/diagramly/DrawioFileSync.js:1879— DrawioFileSync.DrawioFileSync.restoresUnconfirmedRemoves has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 6, if/else 3 (6 pts), loops 3 (4 pts), ternaries 1 (2 pts) (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.
DriveFile.DriveFile.getComments (cognitive 18) src/main/webapp/js/diagramly/DriveFile.js:938— DriveFile.DriveFile.getComments has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (6 pts), ternaries 4 (6 pts), boolean chains 4, loops 2 (nesting depth added 3). None of this is in the body itself: all 18 points belong to 3 function items inside it that branch (driveCommentToDrawio, a function literal at line 977, a function literal at line 969). 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.
Editor.Graph.updateCustomLinkAction (cognitive 18) src/main/webapp/js/diagramly/Editor.js:13737— Editor.Graph.updateCustomLinkAction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 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.
EditorUi.EditorUi.getSvgSubtree (cognitive 18) src/main/webapp/js/diagramly/EditorUi.js:1077— EditorUi.EditorUi.getSvgSubtree has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 4 (8 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.
EditorUi.EditorUi.repairFileData (cognitive 18) src/main/webapp/js/diagramly/EditorUi.js:2678— EditorUi.EditorUi.repairFileData has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (4 pts), boolean chains 2, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.refreshMermaidImage (cognitive 18) src/main/webapp/js/diagramly/EditorUi.js:16813— EditorUi.EditorUi.refreshMermaidImage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (6 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 6). Of this number, 15 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.repairHasParentCycle::capturePage (cognitive 18) src/main/webapp/js/diagramly/EditorUi.js:21834— EditorUi.repairHasParentCycle::capturePage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (7 pts), boolean chains 4, loops 2 (4 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. This shape REPEATS in the file: one other method here (EditorUi.repairHasParentCycle) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
EditorUi.EditorUi.addEmbedButtons (cognitive 18) src/main/webapp/js/diagramly/EditorUi.js:34189— EditorUi.EditorUi.addEmbedButtons has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (7 pts), boolean chains 2 (nesting depth added 6). None of this is in the body itself: all 18 points belong to one function literal inside it that branches (line 34191). 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.
EditorUi.EditorUi.getUrl (cognitive 18) src/main/webapp/js/diagramly/EditorUi.js:41666— EditorUi.EditorUi.getUrl has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 1 (2 pts), ternaries 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.
EditorUi.EditorUi.getJsonForExportCell (cognitive 18) src/main/webapp/js/diagramly/EditorUi.js:42172— EditorUi.EditorUi.getJsonForExportCell has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ElkLayout.ElkLayoutBindings.run (cognitive 18) src/main/webapp/js/diagramly/ElkLayout.js:54— ElkLayout.ElkLayoutBindings.run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6 (nesting depth added 3). Of this number, 15 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ForceExplorer.ForceExplorer.moveHighlight (cognitive 18) src/main/webapp/js/diagramly/ForceExplorer.js:1292— ForceExplorer.ForceExplorer.moveHighlight has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (7 pts), if/else 3 (6 pts), boolean chains 4, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FusionTheme.EditorUi.doSetCurrentTheme (cognitive 18) src/main/webapp/js/diagramly/FusionTheme.js:753— FusionTheme.EditorUi.doSetCurrentTheme has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3 (nesting depth added 6). Of this number, 9 points are the body's own statements and 9 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Pages.ChangePage.execute (cognitive 18) src/main/webapp/js/diagramly/Pages.js:655— Pages.ChangePage.execute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 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.
Pages.EditorUi.prepareOtherPages (cognitive 18) src/main/webapp/js/diagramly/Pages.js:1307— Pages.EditorUi.prepareOtherPages has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, error handling 1 (3 pts), loops 2 (nesting depth added 6). Of this number, 13 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SimpleClassic.EditorUi.createMainMenuForTheme (cognitive 18) src/main/webapp/js/diagramly/SimpleClassic.js:54— SimpleClassic.EditorUi.createMainMenuForTheme has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 5 (8 pts), boolean chains 1 (nesting depth added 9). Of this number, 15 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GifEncoder.GifEncoder.colorRange (cognitive 18) src/main/webapp/js/diagramly/gif/GifEncoder.js:792— GifEncoder.GifEncoder.colorRange has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GifEncoder.GifEncoder.lzwEncode (cognitive 18) src/main/webapp/js/diagramly/gif/GifEncoder.js:862— GifEncoder.GifEncoder.lzwEncode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2, boolean chains 1 (nesting depth added 7). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TidyWindow.TidyWindow.prefetch (cognitive 18) src/main/webapp/js/diagramly/tidy/TidyWindow.js:173— TidyWindow.TidyWindow.prefetch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, error handling 1, loops 1 (nesting depth added 2). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to one function item inside it that branches (next). 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.
Editor.Editor.stripImageMetadata (cognitive 18) src/main/webapp/js/grapheditor/Editor.js:529— Editor.Editor.stripImageMetadata has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (6 pts), loops 2 (5 pts), boolean chains 3, 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.
Editor.installMxWindowEdgeResizeHandles (cognitive 18) src/main/webapp/js/grapheditor/Editor.js:2600— Editor.installMxWindowEdgeResizeHandles has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 4 (nesting depth added 2). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 3 function items inside it that branch (addHandle::move, addHandle::down, addHandle::up). 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.
Editor.PageSetupDialog::applyFn (cognitive 18) src/main/webapp/js/grapheditor/Editor.js:3959— Editor.PageSetupDialog::applyFn has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 5, ternaries 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (Editor.PageSetupDialog) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
EditorUi.EditorUi.getInnerTabStop (cognitive 18) REDACTED:4606— EditorUi.EditorUi.getInnerTabStop has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (4 pts), boolean chains 3, ternaries 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.executeLayouts (cognitive 18) REDACTED:10492— EditorUi.EditorUi.executeLayouts has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 8). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 3 function items inside it that branch (next, a function literal at line 10507, a function literal at line 10535). 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.
Format.BaseFormatPanel.addStyleRuleHint (cognitive 18) src/main/webapp/js/grapheditor/Format.js:956— Format.BaseFormatPanel.addStyleRuleHint has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (6 pts), boolean chains 5, loops 2 (4 pts), ternaries 2 (3 pts) (nesting depth added 6). Of this number, 14 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.removeLightDarkColors (cognitive 18) REDACTED:3006— Graph.Graph.removeLightDarkColors has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (4 pts), error handling 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.getGivenColor (cognitive 18) REDACTED:3150— Graph.Graph.getGivenColor has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, error handling 1 (2 pts) (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.
Graph.Graph.updateFileBaseLinks (cognitive 18) REDACTED:12712— Graph.Graph.updateFileBaseLinks has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (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.
Graph.Graph.getStyleRuleBase (cognitive 18) REDACTED:18376— Graph.Graph.getStyleRuleBase has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (7 pts), error handling 1 (5 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.getCollapsedTableRegions (cognitive 18) REDACTED:26091— Graph.Graph.getCollapsedTableRegions has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (8 pts), if/else 5 (7 pts), boolean chains 3 (nesting depth added 6). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 26157, addRegion). 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.
Graph.Graph.setTableRowHeight (cognitive 18) REDACTED:26567— Graph.Graph.setTableRowHeight has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (18 pts) (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Graph.TableLayout.layoutRow (cognitive 18) REDACTED:27115— Graph.TableLayout.layoutRow has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InlineToolbar.InlineToolbar.addHandleBounds (cognitive 18) src/main/webapp/js/grapheditor/InlineToolbar.js:978— InlineToolbar.InlineToolbar.addHandleBounds has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
InlineToolbar.InlineToolbar.showFillMenu (cognitive 18) src/main/webapp/js/grapheditor/InlineToolbar.js:2704— InlineToolbar.InlineToolbar.showFillMenu has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, ternaries 4, if/else 2 (3 pts), loops 3 (nesting depth added 1). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 3 function items inside it that branch (update, a function literal at line 2805, a function literal at line 2779). 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.
Menus.Menus.applyEdgeStyleChange (cognitive 18) src/main/webapp/js/grapheditor/Menus.js:1144— Menus.Menus.applyEdgeStyleChange has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (7 pts) (nesting depth added 10). None of this is in the body itself: all 18 points belong to one function literal inside it that branches (line 1150). 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.
Shapes.TaperedArrowShape.paintEdgeShape (cognitive 18) src/main/webapp/js/grapheditor/Shapes.js:7988— Shapes.TaperedArrowShape.paintEdgeShape has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 3 (7 pts), loops 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sidebar.Sidebar.isThumbRasterReadable (cognitive 18) src/main/webapp/js/grapheditor/Sidebar.js:4993— Sidebar.Sidebar.isThumbRasterReadable has cognitive complexity 18 (threshold 15). Drivers by points: loops 3 (10 pts), boolean chains 3, if/else 2 (3 pts), error handling 1 (2 pts) (nesting depth added 9). 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.
Sidebar.Sidebar.focusItemInDirection (cognitive 18) src/main/webapp/js/grapheditor/Sidebar.js:7883— Sidebar.Sidebar.focusItemInDirection has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 5 (7 pts), boolean chains 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sidebar.Sidebar.destroy (cognitive 18) src/main/webapp/js/grapheditor/Sidebar.js:8105— Sidebar.Sidebar.destroy has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 4 (8 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.
mxEdgeSegmentHandler.mxEdgeSegmentHandler.createBends (cognitive 18) src/main/webapp/mxgraph/src/handler/mxEdgeSegmentHandler.js:433— mxEdgeSegmentHandler.mxEdgeSegmentHandler.createBends has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 1 (4 pts), loops 1 (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.
mxGraphModel.mxGraphModel.getNearestCommonAncestor (cognitive 18) src/main/webapp/mxgraph/src/model/mxGraphModel.js:933— mxGraphModel.mxGraphModel.getNearestCommonAncestor has cognitive complexity 18 (threshold 15). Drivers by points: loops 3 (6 pts), if/else 3 (5 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 7). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxGraph.mxGraph.getBoundingBox (cognitive 18) src/main/webapp/mxgraph/src/view/mxGraph.js:4526— mxGraph.mxGraph.getBoundingBox has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
mxGraphView.mxGraphView.getBounds (cognitive 18) src/main/webapp/mxgraph/src/view/mxGraphView.js:454— mxGraphView.mxGraphView.getBounds has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
trello.Draw.loadPlugin() (cognitive 18) REDACTED:8— trello.Draw.loadPlugin() has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, ternaries 3 (nesting depth added 2). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 4 function items inside it that branch (main, main::doCreateFile, waitForTrello, …). 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.
check-translations.main (cognitive 18) etc/i18n/check-translations.py:54— check-translations.main has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
create.layerListField::updateChip (cognitive 18) src/main/webapp/js/diagramly/Dialogs.js:7453— create.layerListField::updateChip has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3 (7 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
insertLabel (cognitive 18) REDACTED:6351— insertLabel has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, error handling 1 (2 pts), ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
paint (cognitive 18) src/main/webapp/js/diagramly/Editor.js:2781— paint has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 7 (nesting depth added 5). Of this number, 13 points are the body's own statements and 5 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cellResized (cognitive 18) src/main/webapp/mxgraph/src/view/mxGraph.js:6300— cellResized has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getLabelMargins (cognitive 18) src/main/webapp/js/grapheditor/Shapes.js:18— getLabelMargins has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, if/else 3 (6 pts), loops 2 (5 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.
EditorUi::setDefaultStyle (cognitive 18) REDACTED:97— EditorUi::setDefaultStyle has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, error handling 1, loops 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
installTypingShim (cognitive 18) REDACTED:4871— installTypingShim has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 7 (nesting depth added 1). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 4941, 5028, 4903, …). 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.
createArrayCellColorOption (cognitive 18) src/main/webapp/js/grapheditor/Format.js:1805— createArrayCellColorOption has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 8). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 6 function items inside it that branch ((anonymous)::install::listener, a function literal at line 1819, a function literal at line 1824, …). 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.
addGroupOps (cognitive 18) src/main/webapp/js/grapheditor/Format.js:2793— addGroupOps has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, ternaries 1 (3 pts), loops 1 (nesting depth added 5). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
updateStyleToLibs (cognitive 18) src/main/webapp/js/grapheditor/Sidebar.js:2141— updateStyleToLibs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (5 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 9). Of this number, 13 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addPageFormatPanel.update (cognitive 18) src/main/webapp/js/grapheditor/Editor.js:4272— addPageFormatPanel.update has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 5 (7 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
equalEntries (cognitive 18) src/main/webapp/mxgraph/src/util/mxUtils.js:2790— equalEntries has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 3 (5 pts), loops 2 (4 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.
getShapeEntries (cognitive 18) src/main/webapp/js/grapheditor/InlineToolbar.js:4559— getShapeEntries has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 6, if/else 2 (4 pts), loops 2 (4 pts), ternaries 1 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
renderModel (cognitive 18) src/main/webapp/js/diagramly/ForceExplorer.js:4346— renderModel has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 3, ternaries 1 (3 pts), loops 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.
getPageGroupRun (cognitive 18) src/main/webapp/js/diagramly/Pages.js:2815— getPageGroupRun has cognitive complexity 18 (threshold 15). Drivers by points: loops 3 (9 pts), if/else 3 (5 pts), boolean chains 4 (nesting depth added 8). Of this number, 16 points are the body's own statements and 2 belong to one function item inside it that branches. 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.
fileChanged (cognitive 18) REDACTED:4007— fileChanged has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, ternaries 1 (nesting depth added 4). Of this number, 15 points are the body's own statements and 3 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.
install (cognitive 18) src/main/webapp/js/diagramly/ConfigEditor.js:48— install has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, ternaries 4 (nesting depth added 1). Of this number, 14 points are the body's own statements and 4 belong to 5 function literals inside it that branch. 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.
createMarker (cognitive 18) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:564— createMarker has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (6 pts), ternaries 3 (nesting depth added 1). None of this is in the body itself: all 18 points belong to 2 function items inside it that branch (getCell, isValidState). 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.
redrawInnerBends (cognitive 18) src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:2858— redrawInnerBends has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 1 (4 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getExportFormats (cognitive 18) src/main/webapp/js/diagramly/ViewerModern.js:1429— getExportFormats has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (5 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
mouseDown (cognitive 18) src/main/webapp/mxgraph/src/handler/mxConnectionHandler.js:949— mouseDown has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 7 (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.
createSizers (cognitive 18) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:2303— createSizers has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 8 (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.
getLabelBounds (cognitive 18) src/main/webapp/mxgraph/src/view/mxCellRenderer.js:1320— getLabelBounds has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, ternaries 2 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
configureCanvas (cognitive 18) src/main/webapp/mxgraph/src/shape/mxShape.js:1274— configureCanvas has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
redrawHtmlShapeWithCss3 (cognitive 18) src/main/webapp/mxgraph/src/shape/mxText.js:888— redrawHtmlShapeWithCss3 has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 6, boolean chains 3 (nesting depth added 1). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 901). 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.
documentKeyDown (cognitive 18) src/main/webapp/mxgraph/src/util/mxPopupMenu.js:960— documentKeyDown has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 6 (8 pts) (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.
getFormatControl (cognitive 18) src/main/webapp/js/diagramly/Omnibox.js:458— getFormatControl has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 6, ternaries 2 (3 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
writeFile (cognitive 18) REDACTED:332— writeFile has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 8). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 363, 344, 348). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
(anonymous) (cognitive 18) REDACTED:319— (anonymous) has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (8 pts), error handling 1 (2 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
listLocalStorageFiles (cognitive 18) src/main/webapp/js/diagramly/StorageFile.js:523— listLocalStorageFiles has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 2 (5 pts), ternaries 1 (4 pts), 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.
getPersistentToken (cognitive 18) src/main/webapp/js/diagramly/DrawioClient.js:65— getPersistentToken has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, 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.
mxReader.DrawioViewer.init (cognitive 17) src/main/webapp/connect/common/js/mxReader.js:181— mxReader.DrawioViewer.init has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 6). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 363, 234, 254, …). 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.
Dialogs.ChatWindow (cognitive 17) src/main/webapp/js/diagramly/Dialogs.js:11644— Dialogs.ChatWindow has cognitive complexity 17 (threshold 15). Drivers by points: if/else 111 (168 pts), boolean chains 51, ternaries 19 (33 pts), error handling 11 (18 pts), loops 12 (17 pts) (nesting depth added 83). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Dialogs.ChatWindow::addExchange) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Dialogs.EditShapeDialog::updateShape (cognitive 17) src/main/webapp/js/diagramly/Dialogs.js:21081— Dialogs.EditShapeDialog::updateShape has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 1 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DrawioFile.DrawioFile.reloadFile (cognitive 17) REDACTED:1066— DrawioFile.DrawioFile.reloadFile has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 1, ternaries 1 (nesting depth added 7). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1105, 1080). 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.
Editor.Editor.extractGraphModelFromXref (cognitive 17) src/main/webapp/js/diagramly/Editor.js:3348— Editor.Editor.extractGraphModelFromXref 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.
Editor.Editor.embedExtFonts (cognitive 17) src/main/webapp/js/diagramly/Editor.js:7288— Editor.Editor.embedExtFonts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 1 (2 pts) (nesting depth added 8). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 7312, 7302). 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.
EditorUi.EditorUi.getHiddenTagsMap (cognitive 17) src/main/webapp/js/diagramly/EditorUi.js:4552— EditorUi.EditorUi.getHiddenTagsMap has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (8 pts), if/else 3 (5 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.
EditorUi.EditorUi.setHashObject (cognitive 17) src/main/webapp/js/diagramly/EditorUi.js:4716— EditorUi.EditorUi.setHashObject has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, error handling 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.
EditorUi.EditorUi.createUrlParameters (cognitive 17) src/main/webapp/js/diagramly/EditorUi.js:10528— EditorUi.EditorUi.createUrlParameters has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 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.
EditorUi.EditorUi.getEmbeddedPng (cognitive 17) src/main/webapp/js/diagramly/EditorUi.js:13478— EditorUi.EditorUi.getEmbeddedPng has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, error handling 2 (nesting depth added 3). Of this number, 11 points are the body's own statements and 6 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.
EditorUi.EditorUi.loadMermaidFonts (cognitive 17) src/main/webapp/js/diagramly/EditorUi.js:16082— EditorUi.EditorUi.loadMermaidFonts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (2 pts) (nesting depth added 5). Of this number, 9 points are the body's own statements and 8 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.loadExternalImages (cognitive 17) src/main/webapp/js/diagramly/EditorUi.js:19010— EditorUi.EditorUi.loadExternalImages has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, loops 2, error handling 1 (nesting depth added 2). Of this number, 10 points are the body's own statements and 7 belong to 3 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.
EditorUi.EditorUi.loadExternalImage (cognitive 17) src/main/webapp/js/diagramly/EditorUi.js:19091— EditorUi.EditorUi.loadExternalImage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, loops 1 (2 pts), error handling 1 (nesting depth added 4). None of this is in the body itself: all 17 points belong to 5 function items inside it that branch (a function literal at line 19143, finish, a function literal at line 19117, …). 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.
EditorUi.EditorUi.createDockManager (cognitive 17) src/main/webapp/js/diagramly/EditorUi.js:25819— EditorUi.EditorUi.createDockManager has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 17. 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.
EditorUi.EditorUi.applyChildLayouts (cognitive 17) src/main/webapp/js/diagramly/EditorUi.js:32125— EditorUi.EditorUi.applyChildLayouts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 2 (3 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 5). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (needsElk, run). 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.
EditorUi.EditorUi.installKeyboardShortcut (cognitive 17) src/main/webapp/js/diagramly/EditorUi.js:32289— EditorUi.EditorUi.installKeyboardShortcut has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, ternaries 3 (6 pts), if/else 4 (5 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ForceExplorer.ForceExplorer.updateParallelEdges (cognitive 17) src/main/webapp/js/diagramly/ForceExplorer.js:4097— ForceExplorer.ForceExplorer.updateParallelEdges has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), ternaries 2 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
P2PCollab.P2PCollab (cognitive 17) src/main/webapp/js/diagramly/P2PCollab.js:11— P2PCollab.P2PCollab has cognitive complexity 17 (threshold 15). Drivers by points: if/else 90 (141 pts), boolean chains 63, ternaries 11 (20 pts), loops 5 (14 pts), error handling 5 (6 pts), match/switch 1 (nesting depth added 70). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SpringMove.SpringMove.updateRoutes (cognitive 17) src/main/webapp/js/diagramly/SpringMove.js:503— SpringMove.SpringMove.updateRoutes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (6 pts), ternaries 2 (4 pts), loops 2 (3 pts), boolean chains 2, error handling 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.
AnimationExport.AnimationExport.renderFrames (cognitive 17) src/main/webapp/js/diagramly/gif/AnimationExport.js:1562— AnimationExport.AnimationExport.renderFrames has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), error handling 4 (5 pts), boolean chains 1 (nesting depth added 2). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 1622, 1655, 1596, …). 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.
mxGraphMlCodec.mxGraphMlCodec.addRow (cognitive 17) REDACTED:1868— mxGraphMlCodec.mxGraphMlCodec.addRow has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Tidy.Tidy.getLayoutSpec (cognitive 17) src/main/webapp/js/diagramly/tidy/Tidy.js:2336— Tidy.Tidy.getLayoutSpec 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.
EditorUi.ChangePageSetup.execute (cognitive 17) REDACTED:8714— EditorUi.ChangePageSetup.execute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4 (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.
Format.TextFormatPanel.createLabelBackgroundOption (cognitive 17) src/main/webapp/js/grapheditor/Format.js:4839— Format.TextFormatPanel.createLabelBackgroundOption has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, ternaries 5 (7 pts), if/else 2, loops 1 (nesting depth added 2). Of this number, 12 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Graph.Graph.getRemovedNewEdgeStyleKeys (cognitive 17) REDACTED:10197— Graph.Graph.getRemovedNewEdgeStyleKeys has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 1 (3 pts), boolean chains 2, error handling 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.
Graph.Graph.getSequenceMessageRow (cognitive 17) REDACTED:10742— Graph.Graph.getSequenceMessageRow has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 4). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 10758, 10753). 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.
Graph.Graph.mergeStyle (cognitive 17) REDACTED:11213— Graph.Graph.mergeStyle has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (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.
Graph.Graph.getPlaceholderCell (cognitive 17) REDACTED:16522— Graph.Graph.getPlaceholderCell has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (3 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.
Graph.Graph.bundleEdges (cognitive 17) REDACTED:20853— Graph.Graph.bundleEdges has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 3 (6 pts), boolean chains 3, 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.
Graph.Graph.fitWindow (cognitive 17) REDACTED:22355— Graph.Graph.fitWindow has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (15 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.
Graph.Graph.convertTableSides (cognitive 17) REDACTED:25737— Graph.Graph.convertTableSides has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (9 pts), boolean chains 3, if/else 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 7). Of this number, 15 points are the body's own statements and 2 belong to one function literal inside it that branches. 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.
Graph.mxCellRenderer.resolveColor (cognitive 17) REDACTED:28198— Graph.mxCellRenderer.resolveColor has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (9 pts), boolean chains 5, if/else 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.mxGraphView.flushCollapsedTableRepaints (cognitive 17) REDACTED:28295— Graph.mxGraphView.flushCollapsedTableRepaints has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 1 (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.
Graph.mxCellRenderer.getPaintedLabelBox (cognitive 17) REDACTED:28522— Graph.mxCellRenderer.getPaintedLabelBox has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (6 pts), ternaries 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Graph.mxGraphView.updateMultipleTerminalPoint (cognitive 17) REDACTED:30962— Graph.mxGraphView.updateMultipleTerminalPoint has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, ternaries 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.
InlineToolbar.InlineToolbar.createColorSwatch (cognitive 17) src/main/webapp/js/grapheditor/InlineToolbar.js:1967— InlineToolbar.InlineToolbar.createColorSwatch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 5, boolean chains 3, loops 1 (nesting depth added 1). None of this is in the body itself: all 17 points belong to 6 function items inside it that branch (updateSwatch, a function literal at line 2040, a function literal at line 2052, …). 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.
Omnibox.Omnibox.getScore (cognitive 17) src/main/webapp/js/grapheditor/Omnibox.js:2096— Omnibox.Omnibox.getScore has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 4 (6 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.
Shapes.mxShapeBasicRect2.paintNW (cognitive 17) src/main/webapp/js/grapheditor/Shapes.js:6901— Shapes.mxShapeBasicRect2.paintNW has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 12, if/else 4 (5 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 3 other methods here (Shapes.mxShapeBasicRect2.paintNE, Shapes.mxShapeBasicRect2.paintSE, Shapes.mxShapeBasicRect2.paintSW) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.paintNE (cognitive 17) src/main/webapp/js/grapheditor/Shapes.js:6938— Shapes.mxShapeBasicRect2.paintNE has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 12, if/else 4 (5 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 3 other methods here (Shapes.mxShapeBasicRect2.paintNW, Shapes.mxShapeBasicRect2.paintSE, Shapes.mxShapeBasicRect2.paintSW) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.paintSE (cognitive 17) src/main/webapp/js/grapheditor/Shapes.js:6987— Shapes.mxShapeBasicRect2.paintSE has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 12, if/else 4 (5 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 3 other methods here (Shapes.mxShapeBasicRect2.paintNW, Shapes.mxShapeBasicRect2.paintNE, Shapes.mxShapeBasicRect2.paintSW) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.paintSW (cognitive 17) src/main/webapp/js/grapheditor/Shapes.js:7024— Shapes.mxShapeBasicRect2.paintSW has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 12, if/else 4 (5 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: 3 other methods here (Shapes.mxShapeBasicRect2.paintNW, Shapes.mxShapeBasicRect2.paintNE, Shapes.mxShapeBasicRect2.paintSE) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.paintTopInner (cognitive 17) src/main/webapp/js/grapheditor/Shapes.js:7070— Shapes.mxShapeBasicRect2.paintTopInner has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 7. 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. This shape REPEATS in the file: 2 other methods here (Shapes.mxShapeBasicRect2.paintRightInner, Shapes.mxShapeBasicRect2.paintLeftInner) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.paintRightInner (cognitive 17) src/main/webapp/js/grapheditor/Shapes.js:7124— Shapes.mxShapeBasicRect2.paintRightInner has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 7. 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. This shape REPEATS in the file: 2 other methods here (Shapes.mxShapeBasicRect2.paintTopInner, Shapes.mxShapeBasicRect2.paintLeftInner) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.paintLeftInner (cognitive 17) src/main/webapp/js/grapheditor/Shapes.js:7157— Shapes.mxShapeBasicRect2.paintLeftInner has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 7. 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. This shape REPEATS in the file: 2 other methods here (Shapes.mxShapeBasicRect2.paintTopInner, Shapes.mxShapeBasicRect2.paintRightInner) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.paintBottomInner (cognitive 17) src/main/webapp/js/grapheditor/Shapes.js:7211— Shapes.mxShapeBasicRect2.paintBottomInner has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 11, if/else 6. 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.
Shapes.mxShapeBasicRect2.moveNEInner (cognitive 17) src/main/webapp/js/grapheditor/Shapes.js:7357— Shapes.mxShapeBasicRect2.moveNEInner has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 13, if/else 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. This shape REPEATS in the file: one other method here (Shapes.mxShapeBasicRect2.lineNEInner) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.lineNEInner (cognitive 17) src/main/webapp/js/grapheditor/Shapes.js:7379— Shapes.mxShapeBasicRect2.lineNEInner has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 13, if/else 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. This shape REPEATS in the file: one other method here (Shapes.mxShapeBasicRect2.moveNEInner) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Sidebar.Sidebar.getShapeIndex (cognitive 17) src/main/webapp/js/grapheditor/Sidebar.js:1568— Sidebar.Sidebar.getShapeIndex has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (5 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.
mxObjectCodec.mxObjectCodec.decode (cognitive 17) src/main/webapp/mxgraph/src/io/mxObjectCodec.js:931— mxObjectCodec.mxObjectCodec.decode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxCellState.mxCellState.updateScreenBounds (cognitive 17) src/main/webapp/mxgraph/src/view/mxCellState.js:513— mxCellState.mxCellState.updateScreenBounds has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (7 pts), if/else 6, loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxGraphView.mxGraphView.updateVertexLabelOffset (cognitive 17) src/main/webapp/mxgraph/src/view/mxGraphView.js:2817— mxGraphView.mxGraphView.updateVertexLabelOffset has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (17 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.
Utils.validatedAddress (cognitive 17) REDACTED:860— Utils.validatedAddress has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, ternaries 2 (5 pts), if/else 3 (4 pts), error handling 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.
DraftDialog::init (cognitive 17) src/main/webapp/js/diagramly/Dialogs.js:9725— DraftDialog::init has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
postProcessCellStyle (cognitive 17) src/main/webapp/mxgraph/src/view/mxGraph.js:3476— postProcessCellStyle has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getConnectionConstraint (cognitive 17) src/main/webapp/mxgraph/src/view/mxGraph.js:7326— getConnectionConstraint has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (13 pts), if/else 3 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
installScreenReaderSupport (cognitive 17) REDACTED:9431— installScreenReaderSupport has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, ternaries 2 (3 pts) (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 4 function literals inside it that branch (lines 9444, 9499, 9475, …). 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.
addEdgeGeometry (cognitive 17) src/main/webapp/js/grapheditor/Format.js:4442— addEdgeGeometry has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5 (nesting depth added 2). None of this is in the body itself: all 17 points belong to 10 function items inside it that branch (a function literal at line 4504, a function literal at line 4547, a function literal at line 4555, …). 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.
getPaletteShapes (cognitive 17) src/main/webapp/js/grapheditor/Sidebar.js:1754— getPaletteShapes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 3, 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.
prepareCellsForInsert (cognitive 17) src/main/webapp/js/grapheditor/Sidebar.js:5381— prepareCellsForInsert has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), boolean chains 7, 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.
setMode (cognitive 17) src/main/webapp/js/diagramly/App.js:3880— setMode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 6). Of this number, 12 points are the body's own statements and 5 belong to 2 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.
getLightDarkColor (cognitive 17) src/main/webapp/mxgraph/src/util/mxUtils.js:2568— getLightDarkColor has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 2 (8 pts), boolean chains 1 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
getScaleForPageCount (cognitive 17) src/main/webapp/mxgraph/src/util/mxUtils.js:5364— getScaleForPageCount has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, ternaries 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
routeCells (cognitive 17) src/main/webapp/js/diagramly/LibavoidRouting.js:1903— routeCells has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 2 (5 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getVertex (cognitive 17) src/main/webapp/js/diagramly/LibavoidRouting.js:2440— getVertex has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, 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.
checkOwnPage (cognitive 17) src/main/webapp/js/diagramly/DrawioFileSync.js:2727— checkOwnPage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 5, ternaries 1 (3 pts), error handling 1 (2 pts) (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.
handleButtonKeys (cognitive 17) src/main/webapp/js/diagramly/ForceExplorer.js:628— handleButtonKeys has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (9 pts), boolean chains 4, if/else 3 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
updateLevelDistance (cognitive 17) src/main/webapp/js/diagramly/ForceExplorer.js:2626— updateLevelDistance has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 4, loops 2, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
updateEdgeState (cognitive 17) src/main/webapp/mxgraph/src/view/mxGraphView.js:2767— updateEdgeState has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 12, if/else 4 (5 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
itemClicked (cognitive 17) src/main/webapp/js/diagramly/sidebar/Sidebar.js:2580— itemClicked has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, error handling 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.
focusTabContainerControl (cognitive 17) src/main/webapp/js/diagramly/Pages.js:3841— focusTabContainerControl has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (7 pts), loops 2 (5 pts), boolean chains 3, 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.
refresh (cognitive 17) src/main/webapp/js/diagramly/LayoutPicker.js:2470— refresh has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 5, loops 2, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
popoverKeyDown (cognitive 17) src/main/webapp/js/diagramly/LightboxModern.js:2499— popoverKeyDown has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 4 (5 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.
findTextContents (cognitive 17) REDACTED:107— findTextContents has cognitive complexity 17 (threshold 15). Drivers by points: if/else 2 (6 pts), ternaries 1 (5 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.
isValidGeometry (cognitive 17) src/main/webapp/js/diagramly/DiffSync.js:156— isValidGeometry has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 3 (7 pts), loops 2, ternaries 1 (nesting depth added 4). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 5 function items inside it that branch (fieldsValid, pointsValid, a function literal at line 203, …). 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.
resetEdges (cognitive 17) src/main/webapp/js/diagramly/tidy/Tidy.js:1733— resetEdges has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (7 pts), boolean chains 5, loops 3 (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.
configure (cognitive 17) src/main/webapp/js/diagramly/ElectronApp.js:313— configure has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), error handling 1 (3 pts), boolean chains 2 (nesting depth added 9). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 326, 338). 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.
watchFile (cognitive 17) src/main/webapp/js/diagramly/ElectronApp.js:1074— watchFile has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), error handling 2 (4 pts), boolean chains 3, 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.
setRoleRules (cognitive 17) src/main/webapp/js/diagramly/tidy/TidyStyle.js:1939— setRoleRules has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 5, loops 2 (3 pts), error handling 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.
rotateLabelBounds (cognitive 17) src/main/webapp/mxgraph/src/view/mxCellRenderer.js:1462— rotateLabelBounds has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, ternaries 4 (6 pts), if/else 3 (4 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
selectCellForEvent (cognitive 17) src/main/webapp/mxgraph/src/handler/mxGraphHandler.js:527— selectCellForEvent has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 6, loops 1 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getFile (cognitive 17) src/main/webapp/js/diagramly/GitLabClient.js:422— getFile has cognitive complexity 17 (threshold 15). Drivers by points: error handling 2 (5 pts), if/else 4 (5 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 6). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 426, 453, 479, …). 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.
RectanglePerimeter (cognitive 17) src/main/webapp/mxgraph/src/view/mxPerimeter.js:84— RectanglePerimeter has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
addItem (cognitive 17) src/main/webapp/js/grapheditor/Toolbar.js:635— addItem has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 6). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 645, updateTitle). 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.
writeFile (cognitive 17) src/main/webapp/js/diagramly/StorageFile.js:403— writeFile has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 3, error handling 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 5). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 446, 417). 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.
getLoopDuration (cognitive 17) src/main/webapp/js/diagramly/gif/AnimatedExport.js:383— getLoopDuration has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 2 (3 pts), loops 2, boolean chains 1 (nesting depth added 7). Of this number, 16 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
load (cognitive 17) etc/dependencies/dompurify-smoke.js:26— load has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (5 pts), ternaries 1 (2 pts), loops 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 2 function literals inside it that branch (lines 39, 52). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
(anonymous) (cognitive 17) src/main/webapp/plugins/svgdata.js:19— (anonymous) has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (5 pts), loops 2 (5 pts), ternaries 3 (5 pts), boolean chains 2 (nesting depth added 6). None of this is in the body itself: all 17 points belong to 3 function items inside it that branch (createSvgImageExport::addCellData, createSvgImageExport::drawCellState, createSvgImageExport). 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.
bootstrap.mxscript (cognitive 16) src/main/webapp/js/bootstrap.js:164— bootstrap.mxscript has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 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.
ConfigEditor.DrawioConfigEditor.install.setupFieldHandlers (cognitive 16) src/main/webapp/js/diagramly/ConfigEditor.js:530— ConfigEditor.DrawioConfigEditor.install.setupFieldHandlers has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 4). None of this is in the body itself: all 16 points belong to 3 function literals inside it that branch (lines 539, 532, 565). 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.
Dialogs.SelectorChips.create.layerListField::updateChip (cognitive 16) src/main/webapp/js/diagramly/Dialogs.js:7453— Dialogs.SelectorChips.create.layerListField::updateChip has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 2 (5 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DiffSync.EditorUi.adoptTheirPages (cognitive 16) src/main/webapp/js/diagramly/DiffSync.js:2920— DiffSync.EditorUi.adoptTheirPages has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (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.
DrawioFileSync.DrawioFileSync.compareAppVersions (cognitive 16) src/main/webapp/js/diagramly/DrawioFileSync.js:100— DrawioFileSync.DrawioFileSync.compareAppVersions has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 2 (6 pts), if/else 3 (5 pts), boolean chains 3, loops 1 (2 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.
EditorUi.EditorUi.logError (cognitive 16) src/main/webapp/js/diagramly/EditorUi.js:606— EditorUi.EditorUi.logError has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (5 pts), boolean chains 4, error handling 2 (4 pts), ternaries 1 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.anonymizeXml::anonymizeNode (cognitive 16) src/main/webapp/js/diagramly/EditorUi.js:3402— EditorUi.EditorUi.anonymizeXml::anonymizeNode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (5 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.
EditorUi.EditorUi.resizeImage (cognitive 16) src/main/webapp/js/diagramly/EditorUi.js:18231— EditorUi.EditorUi.resizeImage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, error handling 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.
EditorUi.EditorUi.createEmbedSvgData (cognitive 16) src/main/webapp/js/diagramly/EditorUi.js:19352— EditorUi.EditorUi.createEmbedSvgData has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 3, loops 1 (3 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.repairCapturePage (cognitive 16) src/main/webapp/js/diagramly/EditorUi.js:21120— EditorUi.repairCapturePage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.scopeLayoutsToCells (cognitive 16) src/main/webapp/js/diagramly/EditorUi.js:34369— EditorUi.EditorUi.scopeLayoutsToCells has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 6, loops 2 (nesting depth added 4). Of this number, 9 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.getOutlineTrees (cognitive 16) src/main/webapp/js/diagramly/EditorUi.js:35158— EditorUi.EditorUi.getOutlineTrees has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (8 pts), if/else 3 (4 pts), boolean chains 3, loops 1 (nesting depth added 6). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 35176, 35178, 35192). 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.
EditorUi.EditorUi.setOutlineSides (cognitive 16) src/main/webapp/js/diagramly/EditorUi.js:35806— EditorUi.EditorUi.setOutlineSides has cognitive complexity 16 (threshold 15). Drivers by points: loops 8 (13 pts), if/else 1 (3 pts) (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.
EditorUi.EditorUi.matchBoxItems (cognitive 16) src/main/webapp/js/diagramly/EditorUi.js:36715— EditorUi.EditorUi.matchBoxItems has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 5, loops 4 (5 pts), if/else 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EditorUi.EditorUi.refreshCommentCache (cognitive 16) src/main/webapp/js/diagramly/EditorUi.js:43379— EditorUi.EditorUi.refreshCommentCache has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 8). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 43393, 43407). 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.
EditorUi.EditorUi.restoreRevision (cognitive 16) src/main/webapp/js/diagramly/EditorUi.js:43864— EditorUi.EditorUi.restoreRevision has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 1 (2 pts) (nesting depth added 7). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 43877, 43902). 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.
Extensions.getFontColor (cognitive 16) REDACTED:5017— Extensions.getFontColor 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.
ForceExplorer.ForceExplorer.initEndLabels (cognitive 16) src/main/webapp/js/diagramly/ForceExplorer.js:3476— ForceExplorer.ForceExplorer.initEndLabels has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), ternaries 2 (6 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GitHubClient.GitHubClient.createGitHubFile (cognitive 16) src/main/webapp/js/diagramly/GitHubClient.js:579— GitHubClient.GitHubClient.createGitHubFile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GitLabClient.GitLabClient.getFileContent (cognitive 16) src/main/webapp/js/diagramly/GitLabClient.js:499— GitLabClient.GitLabClient.getFileContent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 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.
GraphViewer.GraphViewer.reserveSize (cognitive 16) REDACTED:3310— GraphViewer.GraphViewer.reserveSize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 9). Of this number, 13 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GraphViewer.GraphViewer.blockedAncestorFrames (cognitive 16) REDACTED:3607— GraphViewer.GraphViewer.blockedAncestorFrames has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, loops 1 (2 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LibavoidRouting.LibavoidRouting.installAutoRouting::onMoveResize (cognitive 16) src/main/webapp/js/diagramly/LibavoidRouting.js:620— LibavoidRouting.LibavoidRouting.installAutoRouting::onMoveResize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (3 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.
Minimal.EditorUi.initMinimalTheme::toggleShapes (cognitive 16) src/main/webapp/js/diagramly/Minimal.js:114— Minimal.EditorUi.initMinimalTheme::toggleShapes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 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. This shape REPEATS in the file: one other method here (Minimal.EditorUi.initMinimalTheme) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
OneDriveClient.OneDriveClient.executeRequest (cognitive 16) src/main/webapp/js/diagramly/OneDriveClient.js:545— OneDriveClient.OneDriveClient.executeRequest has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5 (nesting depth added 3). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 557, 587). 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.
OneDriveClient.OneDriveClient.pickFileOD (cognitive 16) src/main/webapp/js/diagramly/OneDriveClient.js:1813— OneDriveClient.OneDriveClient.pickFileOD has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, ternaries 2 (nesting depth added 4). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1820, 1826, 1849, …). 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.
Pages.EditorUi.updatePageRoot (cognitive 16) src/main/webapp/js/diagramly/Pages.js:1990— Pages.EditorUi.updatePageRoot has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 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.
Pages.EditorUi.getCollapsedPageGroups (cognitive 16) src/main/webapp/js/diagramly/Pages.js:2861— Pages.EditorUi.getCollapsedPageGroups has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), error handling 1 (3 pts), loops 1 (3 pts), boolean chains 2, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ViewerModern.ViewerModern.addCustomButton (cognitive 16) src/main/webapp/js/diagramly/ViewerModern.js:1316— ViewerModern.ViewerModern.addCustomButton has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 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.
ViewerModern.ViewerModern.updateSeparators (cognitive 16) src/main/webapp/js/diagramly/ViewerModern.js:1696— ViewerModern.ViewerModern.updateSeparators has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ViewerModern.ViewerModern.installListeners (cognitive 16) src/main/webapp/js/diagramly/ViewerModern.js:1801— ViewerModern.ViewerModern.installListeners has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 3, loops 2 (nesting depth added 2). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 1816, a function literal at line 1837, stopKey, …). 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.
GifEncoder.GifEncoder.medianCut (cognitive 16) src/main/webapp/js/diagramly/gif/GifEncoder.js:715— GifEncoder.GifEncoder.medianCut has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 4 (6 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.
mxGraphMlCodec.mxGraphMlCodec.addColumn (cognitive 16) REDACTED:1935— mxGraphMlCodec.mxGraphMlCodec.addColumn has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TidyWindow.TidyWindow.run (cognitive 16) src/main/webapp/js/diagramly/tidy/TidyWindow.js:681— TidyWindow.TidyWindow.run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, error handling 1 (nesting depth added 2). Most of this is not in the body itself: 5 of the 16 points are its own statements 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.
Editor.PageSetupDialog.addPageFormatPanel.update (cognitive 16) src/main/webapp/js/grapheditor/Editor.js:4272— Editor.PageSetupDialog.addPageFormatPanel.update has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 3 (5 pts), boolean chains 4 (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.
EditorUi.EditorUi.save (cognitive 16) REDACTED:10422— EditorUi.EditorUi.save has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Format.BaseFormatPanel.getStyleRuleKeys (cognitive 16) src/main/webapp/js/grapheditor/Format.js:913— Format.BaseFormatPanel.getStyleRuleKeys has cognitive complexity 16 (threshold 15). Drivers by points: loops 3 (9 pts), if/else 3 (6 pts), boolean chains 1 (nesting depth added 9). 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.
Format.ArrangePanel.addEdgeGeometryHandler.update (cognitive 16) src/main/webapp/js/grapheditor/Format.js:4221— Format.ArrangePanel.addEdgeGeometryHandler.update 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.
Format.DiagramStylePanel.addView (cognitive 16) src/main/webapp/js/grapheditor/Format.js:8989— Format.DiagramStylePanel.addView has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). Of this number, 13 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.DOMPurify.addHook("afterSanitizeAttributes") (cognitive 16) REDACTED:5106— Graph.DOMPurify.addHook("afterSanitizeAttributes") has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.getCssVariables (cognitive 16) REDACTED:5349— Graph.Graph.getCssVariables 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.
Graph.Graph.setSvgDataUriCssVars (cognitive 16) REDACTED:5391— Graph.Graph.setSvgDataUriCssVars has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 7). 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.
Graph.Graph.applyNewEdgeStyle (cognitive 16) REDACTED:10061— Graph.Graph.applyNewEdgeStyle has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (6 pts), ternaries 1 (4 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.keepLoopOutsideShape (cognitive 16) REDACTED:11108— Graph.Graph.keepLoopOutsideShape has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.getLockedGroupAncestor (cognitive 16) REDACTED:16881— Graph.Graph.getLockedGroupAncestor has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (6 pts), boolean chains 4, ternaries 3 (4 pts), loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.selectTableRange (cognitive 16) REDACTED:17083— Graph.Graph.selectTableRange has cognitive complexity 16 (threshold 15). Drivers by points: loops 2 (7 pts), if/else 3 (6 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.Graph.getDataStyleValue (cognitive 16) REDACTED:18021— Graph.Graph.getDataStyleValue has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, 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.
Graph.Graph.isSafeCssColor (cognitive 16) REDACTED:19520— Graph.Graph.isSafeCssColor has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Graph.Graph.convertValueToTooltip (cognitive 16) REDACTED:22434— Graph.Graph.convertValueToTooltip has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 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.
Graph.Graph.getCellTypeName (cognitive 16) REDACTED:22755— Graph.Graph.getCellTypeName has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 6, ternaries 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Graph.Graph.getTextOutline::collect (cognitive 16) REDACTED:23075— Graph.Graph.getTextOutline::collect has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (13 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Graph.Graph.getTextOutline) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Graph.mxGraphView.validateCellState (cognitive 16) REDACTED:30676— Graph.mxGraphView.validateCellState has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), ternaries 3 (6 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Graph.mxEdgeStyle.ElbowConnector (cognitive 16) REDACTED:32873— Graph.mxEdgeStyle.ElbowConnector has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, 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.
Graph.mxGraphView.updateTiedPoints (cognitive 16) REDACTED:33364— Graph.mxGraphView.updateTiedPoints has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (5 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.
Omnibox.Omnibox.getFormatRowLabel (cognitive 16) src/main/webapp/js/grapheditor/Omnibox.js:1620— Omnibox.Omnibox.getFormatRowLabel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Shapes.mxPerimeter.TrapezoidPerimeter (cognitive 16) src/main/webapp/js/grapheditor/Shapes.js:4643— Shapes.mxPerimeter.TrapezoidPerimeter has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 6 (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. This shape REPEATS in the file: one other method here (Shapes.mxPerimeter.StepPerimeter) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxPerimeter.StepPerimeter (cognitive 16) src/main/webapp/js/grapheditor/Shapes.js:4699— Shapes.mxPerimeter.StepPerimeter has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 6 (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. This shape REPEATS in the file: one other method here (Shapes.mxPerimeter.TrapezoidPerimeter) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.paintSWInner (cognitive 16) src/main/webapp/js/grapheditor/Shapes.js:7240— Shapes.mxShapeBasicRect2.paintSWInner has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 6. 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.
Shapes.mxShapeBasicRect2.moveSWInner (cognitive 16) src/main/webapp/js/grapheditor/Shapes.js:7269— Shapes.mxShapeBasicRect2.moveSWInner has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 12, if/else 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. This shape REPEATS in the file: 3 other methods here (Shapes.mxShapeBasicRect2.lineSWInner, Shapes.mxShapeBasicRect2.moveSEInner, Shapes.mxShapeBasicRect2.lineSEInner) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.lineSWInner (cognitive 16) src/main/webapp/js/grapheditor/Shapes.js:7291— Shapes.mxShapeBasicRect2.lineSWInner has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 12, if/else 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. This shape REPEATS in the file: 3 other methods here (Shapes.mxShapeBasicRect2.moveSWInner, Shapes.mxShapeBasicRect2.moveSEInner, Shapes.mxShapeBasicRect2.lineSEInner) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.moveSEInner (cognitive 16) src/main/webapp/js/grapheditor/Shapes.js:7313— Shapes.mxShapeBasicRect2.moveSEInner has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 12, if/else 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. This shape REPEATS in the file: 3 other methods here (Shapes.mxShapeBasicRect2.moveSWInner, Shapes.mxShapeBasicRect2.lineSWInner, Shapes.mxShapeBasicRect2.lineSEInner) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Shapes.mxShapeBasicRect2.lineSEInner (cognitive 16) src/main/webapp/js/grapheditor/Shapes.js:7335— Shapes.mxShapeBasicRect2.lineSEInner has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 12, if/else 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. This shape REPEATS in the file: 3 other methods here (Shapes.mxShapeBasicRect2.moveSWInner, Shapes.mxShapeBasicRect2.lineSWInner, Shapes.mxShapeBasicRect2.moveSEInner) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
libavoid-routing.AvoidRouting.cappedJetty (cognitive 16) src/main/webapp/js/libavoid-js/libavoid-routing.js:238— libavoid-routing.AvoidRouting.cappedJetty has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 3 (4 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.
mxConnectionHandler.mxConnectionHandler.createTargetVertex (cognitive 16) src/main/webapp/mxgraph/src/handler/mxConnectionHandler.js:2142— mxConnectionHandler.mxConnectionHandler.createTargetVertex has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
mxVertexHandler.mxVertexHandler.resizeCell (cognitive 16) src/main/webapp/mxgraph/src/handler/mxVertexHandler.js:1566— mxVertexHandler.mxVertexHandler.resizeCell has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 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.
mxDragSource.mxDragSource.mouseMove (cognitive 16) src/main/webapp/mxgraph/src/util/mxDragSource.js:455— mxDragSource.mxDragSource.mouseMove has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 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.
mxSvgCanvas2D.mxSvgCanvas2D.convertHtml (cognitive 16) REDACTED:2000— mxSvgCanvas2D.mxSvgCanvas2D.convertHtml has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxGraphView.mxGraphView.validateBackgroundPage (cognitive 16) src/main/webapp/mxgraph/src/view/mxGraphView.js:2199— mxGraphView.mxGraphView.validateBackgroundPage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2 (nesting depth added 7). Of this number, 8 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxGraphView.mxGraphView.updateFloatingTerminalPoints (cognitive 16) src/main/webapp/mxgraph/src/view/mxGraphView.js:3230— mxGraphView.mxGraphView.updateFloatingTerminalPoints has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 2 (6 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxGraphView.mxGraphView.updateEdgeLabelOffset (cognitive 16) src/main/webapp/mxgraph/src/view/mxGraphView.js:4327— mxGraphView.mxGraphView.updateEdgeLabelOffset has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 2 (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.
mxOutline.mxOutline.addGestureListeners (cognitive 16) src/main/webapp/mxgraph/src/view/mxOutline.js:234— mxOutline.mxOutline.addGestureListeners has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2 (nesting depth added 5). None of this is in the body itself: all 16 points belong to 3 function literals inside it that branch (lines 241, 284, 305). 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.
mxSwimlaneManager.mxSwimlaneManager.resizeSwimlane (cognitive 16) src/main/webapp/mxgraph/src/view/mxSwimlaneManager.js:389— mxSwimlaneManager.mxSwimlaneManager.resizeSwimlane has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
nextcloud.Draw.loadPlugin() (cognitive 16) src/main/webapp/plugins/nextcloud.js:8— nextcloud.Draw.loadPlugin() has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 3 (5 pts), error handling 1 (nesting depth added 2). Of this number, 10 points are the body's own statements and 6 belong to 21 function literals inside it that branch. 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.
mxBootstrap.mxShapeBootstrapLeftButtonStriped.paintVertexShape (cognitive 16) src/main/webapp/shapes/mxBootstrap.js:300— mxBootstrap.mxShapeBootstrapLeftButtonStriped.paintVertexShape has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 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.
mxBootstrap.mxShapeBootstrapRating.paintVertexShape (cognitive 16) src/main/webapp/shapes/mxBootstrap.js:1015— mxBootstrap.mxShapeBootstrapRating.paintVertexShape has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (8 pts), boolean chains 4, if/else 4 (nesting depth added 4). 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.
mxElectrical.mxShapeElectricalMux.paintVertexShape (cognitive 16) src/main/webapp/shapes/mxElectrical.js:1567— mxElectrical.mxShapeElectricalMux.paintVertexShape has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), loops 3 (5 pts), match/switch 2 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
mxSysML.mxShapeSysMLItemFlow.paintVertexShape (cognitive 16) src/main/webapp/shapes/mxSysML.js:665— mxSysML.mxShapeSysMLItemFlow.paintVertexShape has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (16 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
finish (cognitive 16) src/main/webapp/js/diagramly/Dialogs.js:27942— finish has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
splitEdge (cognitive 16) src/main/webapp/mxgraph/src/view/mxGraph.js:5441— splitEdge has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 3 (6 pts), ternaries 2 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getDirectionMap (cognitive 16) src/main/webapp/js/grapheditor/Shapes.js:1091— getDirectionMap has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (9 pts), if/else 3 (4 pts), boolean chains 3 (nesting depth added 4). Of this number, 11 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
addEdgeGeometryHandler::update (cognitive 16) src/main/webapp/js/grapheditor/Format.js:4221— addEdgeGeometryHandler::update 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.
reportDriveUse (cognitive 16) src/main/webapp/js/diagramly/App.js:3088— reportDriveUse has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 3 (6 pts), ternaries 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
parseCssFontFamily (cognitive 16) src/main/webapp/mxgraph/src/util/mxUtils.js:227— parseCssFontFamily has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
arcToCurves (cognitive 16) src/main/webapp/mxgraph/src/util/mxUtils.js:2955— arcToCurves has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 4, ternaries 3, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
getOffset (cognitive 16) src/main/webapp/mxgraph/src/util/mxUtils.js:3653— getOffset has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MarkupDialog::applyFormat (cognitive 16) REDACTED:2656— MarkupDialog::applyFormat has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 3 (6 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.
getCellBounds (cognitive 16) src/main/webapp/js/grapheditor/InlineToolbar.js:1081— getCellBounds has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (5 pts), ternaries 3 (5 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
showFillMenu::update (cognitive 16) src/main/webapp/js/grapheditor/InlineToolbar.js:2829— showFillMenu::update has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, ternaries 6. 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.
init (cognitive 16) src/main/webapp/js/diagramly/ForceExplorer.js:173— init has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 10, boolean chains 3, if/else 3. Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 6 function items inside it that branch (getPoint, replacePlaceholders, applyDataStyles, …). 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.
updateLinkOpacity (cognitive 16) src/main/webapp/js/diagramly/ForceExplorer.js:4233— updateLinkOpacity has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), boolean chains 4, ternaries 1 (3 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getState (cognitive 16) src/main/webapp/mxgraph/src/view/mxGraphView.js:4389— getState has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxSvgCanvas2D (cognitive 16) REDACTED:57— mxSvgCanvas2D has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 1 (2 pts), boolean chains 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pageSelected (cognitive 16) src/main/webapp/js/diagramly/Pages.js:1095— pageSelected has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
install.setupFieldHandlers (cognitive 16) src/main/webapp/js/diagramly/ConfigEditor.js:530— install.setupFieldHandlers has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 4). None of this is in the body itself: all 16 points belong to 3 function literals inside it that branch (lines 539, 532, 565). 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.
applyHiddenTags (cognitive 16) src/main/webapp/js/diagramly/LightboxModern.js:1323— applyHiddenTags has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 2 (6 pts), error handling 2 (4 pts), boolean chains 3, if/else 2 (3 pts) (nesting depth added 7). Of this number, 9 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getChanges (cognitive 16) src/main/webapp/js/diagramly/tidy/Tidy.js:2713— getChanges has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 1 (3 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.
installDiagramLanguage (cognitive 16) src/main/webapp/js/diagramly/ViewerModern.js:518— installDiagramLanguage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 5). Of this number, 11 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
endSegment (cognitive 16) src/main/webapp/js/libavoid-js/libavoid-routing.js:829— endSegment has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
resetLivePreview (cognitive 16) src/main/webapp/mxgraph/src/handler/mxGraphHandler.js:1777— resetLivePreview has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3 (nesting depth added 7). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to one function literal inside it that branches (line 1781). 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.
ElbowConnector (cognitive 16) src/main/webapp/mxgraph/src/view/mxEdgeStyle.js:345— ElbowConnector has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, 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.
getBatches (cognitive 16) src/main/webapp/js/diagramly/gif/AnimationExport.js:120— getBatches has cognitive complexity 16 (threshold 15). Drivers by points: if/else 2 (7 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
insertFile (cognitive 16) src/main/webapp/js/diagramly/GitLabClient.js:568— insertFile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (4 pts), error handling 1 (3 pts) (nesting depth added 7). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 588, 612, 573, …). 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.
frame (cognitive 16) src/main/webapp/js/diagramly/SpringMove.js:920— frame has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mxText (cognitive 16) src/main/webapp/mxgraph/src/shape/mxText.js:59— mxText has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 11, boolean chains 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
paint (cognitive 16) src/main/webapp/mxgraph/src/shape/mxText.js:255— paint has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (6 pts), boolean chains 5, ternaries 3 (5 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
getConstraints (cognitive 16) src/main/webapp/shapes/mxAtlassian2.js:495— getConstraints has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 1 (3 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
redrawDistanceGuides (cognitive 16) src/main/webapp/mxgraph/src/util/mxGuide.js:748— redrawDistanceGuides has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 3 (4 pts), 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.
setPersistentToken (cognitive 16) src/main/webapp/js/diagramly/DrawioClient.js:115— setPersistentToken has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 1 (3 pts), error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fadeOut (cognitive 16) src/main/webapp/mxgraph/src/util/mxEffects.js:168— fadeOut has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6 (nesting depth added 4). Of this number, 9 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (4 members, 50+ identical tokens) src/main/server/java/com/mxgraph/online/DropboxAuth.java:39— src/main/server/java/com/mxgraph/online/DropboxAuth.java:39-64 | src/main/server/java/com/mxgraph/online/GitHubAuth.java:50-75 | src/main/server/java/com/mxgraph/online/GitlabAuth.java:48-73 | src/main/server/java/com/mxgraph/online/MSGraphAuth.java:48-83 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Edited copy of a member (49 corresponding lines) · ×1
Edited copy of a member (49 corresponding lines) src/main/server/java/com/mxgraph/online/mxBase64.java:103— src/main/server/java/com/mxgraph/online/mxBase64.java:103-151 | src/main/server/java/com/mxgraph/online/mxBase64.java:292-340 — These two members are one piece of code written twice and then edited apart: 49 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 58+ corresponding lines) · ×1
Edited copies of one member (3 members, 58+ corresponding lines) src/main/server/java/com/mxgraph/online/mxBase64.java:221— src/main/server/java/com/mxgraph/online/mxBase64.java:221-278 | src/main/server/java/com/mxgraph/online/mxBase64.java:410-467 | src/main/server/java/com/mxgraph/online/mxBase64.java:557-615 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 58 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 50+ corresponding lines) · ×1
Edited copies of one member (3 members, 50+ corresponding lines) src/main/server/java/com/mxgraph/online/mxBase64.java:160— src/main/server/java/com/mxgraph/online/mxBase64.java:160-209 | src/main/server/java/com/mxgraph/online/mxBase64.java:349-398 | src/main/server/java/com/mxgraph/online/mxBase64.java:495-545 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 50 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×1
Edited copy of a member (13 corresponding lines) src/main/server/java/com/mxgraph/online/DropboxAuth.java:17— src/main/server/java/com/mxgraph/online/DropboxAuth.java:17-29 | src/main/server/java/com/mxgraph/online/GoogleAuth.java:25-37 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (21 lines × 2) src/main/server/java/com/mxgraph/online/GitHubAuth.java:19— src/main/server/java/com/mxgraph/online/GitHubAuth.java:19-39 | src/main/server/java/com/mxgraph/online/GitlabAuth.java:19-39 — before extracting anything, compare `src/main/server/java/com/mxgraph/online/GitHubAuth.java` and `src/main/server/java/com/mxgraph/online/GitlabAuth.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (19–20 lines × 4) src/main/server/java/com/mxgraph/online/DropboxAuth.java:40— src/main/server/java/com/mxgraph/online/DropboxAuth.java:40-58 | src/main/server/java/com/mxgraph/online/GitHubAuth.java:51-69 | src/main/server/java/com/mxgraph/online/GitlabAuth.java:49-67 | src/main/server/java/com/mxgraph/online/MSGraphAuth.java:49-68 — before extracting anything, compare `src/main/server/java/com/mxgraph/online/GitHubAuth.java` and `src/main/server/java/com/mxgraph/online/GitlabAuth.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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/main/server/java/com/mxgraph/online/DropboxAuth.java:40` 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–18 lines × 3) src/main/server/java/com/mxgraph/online/mxBase64.java:194— src/main/server/java/com/mxgraph/online/mxBase64.java:194-209 | src/main/server/java/com/mxgraph/online/mxBase64.java:381-398 | src/main/server/java/com/mxgraph/online/mxBase64.java:530-545 — 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/main/server/java/com/mxgraph/online/mxBase64.java:194` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `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 (44 lines × 2) src/main/server/java/com/mxgraph/online/mxBase64.java:235— src/main/server/java/com/mxgraph/online/mxBase64.java:235-278 | src/main/server/java/com/mxgraph/online/mxBase64.java:424-467 — 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/main/server/java/com/mxgraph/online/mxBase64.java:235` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `sArr` to `char[]` in one and `byte[]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (17 lines × 3) src/main/server/java/com/mxgraph/online/mxBase64.java:254— src/main/server/java/com/mxgraph/online/mxBase64.java:254-270 | src/main/server/java/com/mxgraph/online/mxBase64.java:443-459 | src/main/server/java/com/mxgraph/online/mxBase64.java:591-607 — 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/main/server/java/com/mxgraph/online/mxBase64.java:254` 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 (14–17 lines × 2) REDACTED:484— REDACTED:484-497 | REDACTED:607-623 — 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:484` 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 (10–15 lines × 2) REDACTED:556— REDACTED:556-565 | REDACTED:615-629 — 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:615` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (15 lines × 2) src/main/server/java/com/mxgraph/online/mxBase64.java:128— src/main/server/java/com/mxgraph/online/mxBase64.java:128-142 | src/main/server/java/com/mxgraph/online/mxBase64.java:317-331 — 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/main/server/java/com/mxgraph/online/mxBase64.java:128` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (12–13 lines × 4) src/main/server/java/com/mxgraph/online/DropboxAuth.java:53— src/main/server/java/com/mxgraph/online/DropboxAuth.java:53-64 | src/main/server/java/com/mxgraph/online/GitHubAuth.java:64-75 | src/main/server/java/com/mxgraph/online/GitlabAuth.java:62-73 | src/main/server/java/com/mxgraph/online/MSGraphAuth.java:71-83 — before extracting anything, compare `src/main/server/java/com/mxgraph/online/GitHubAuth.java` and `src/main/server/java/com/mxgraph/online/GitlabAuth.java` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. 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/main/server/java/com/mxgraph/online/DropboxAuth.java:53` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13 lines × 2) src/main/server/java/com/mxgraph/online/mxBase64.java:180— src/main/server/java/com/mxgraph/online/mxBase64.java:180-192 | src/main/server/java/com/mxgraph/online/mxBase64.java:367-379 — 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/main/server/java/com/mxgraph/online/mxBase64.java:180` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `sArr` to `char[]` in one and `byte[]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (12 lines × 3) src/main/server/java/com/mxgraph/online/mxBase64.java:181— src/main/server/java/com/mxgraph/online/mxBase64.java:181-192 | src/main/server/java/com/mxgraph/online/mxBase64.java:368-379 | src/main/server/java/com/mxgraph/online/mxBase64.java:517-528 — 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/main/server/java/com/mxgraph/online/mxBase64.java:181` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 3) REDACTED:526— REDACTED:526-535 | REDACTED:538-546 | REDACTED:549-557 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:526` 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/main/server/java/com/mxgraph/online/mxBase64.java:242— src/main/server/java/com/mxgraph/online/mxBase64.java:242-248 | src/main/server/java/com/mxgraph/online/mxBase64.java:431-437 | src/main/server/java/com/mxgraph/online/mxBase64.java:577-585 — 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/main/server/java/com/mxgraph/online/mxBase64.java:242` 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 × 4) REDACTED:569— REDACTED:569-575 | REDACTED:608-614 | REDACTED:656-661 | REDACTED:671-677 — 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 `REDACTED:569` 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 (5–6 lines × 2) REDACTED:664— REDACTED:664-669 | REDACTED:673-677 — 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:664` 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 (5 lines × 4) REDACTED:564— REDACTED:564-568 | REDACTED:639-643 | REDACTED:656-661 | REDACTED:671-677 — 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 `REDACTED:564` 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 (5 lines × 2) src/main/server/java/com/mxgraph/online/mxBase64.java:115— src/main/server/java/com/mxgraph/online/mxBase64.java:115-119 | src/main/server/java/com/mxgraph/online/mxBase64.java:304-308 — 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/main/server/java/com/mxgraph/online/mxBase64.java:115` 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.
IC1 · Incompleteness & stubs· Guard cannot change the result · ×1
Guard cannot change the result — returns what the code already falls through to src/main/webapp/js/diagramly/miro/MiroImporter.js:183— The guard above `return style;` also returns `style`, so no input can make it matter. Implement the distinction that was intended, or delete the guard.
Duplication concentrated across 2 sibling directories (16 clone groups) src/main/webapp/js/diagramly/ForceExplorer.js:1089— 16 duplicated blocks under src/main/webapp/js/ have copies in at least two of the sibling directories diagramly, grapheditor — 4 of them are reported below, and 12 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 16 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 16 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 16 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication· Duplicated block with local edits (379 matched lines × 2 locations) · ×1
Duplicated block with local edits (379 matched lines × 2 locations) src/main/webapp/js/diagramly/GitHubClient.js:135— src/main/webapp/js/diagramly/GitHubClient.js:135 · src/main/webapp/js/diagramly/GitLabClient.js:94 — the two spans are one implementation copied and then locally edited — 2048 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (378 matched lines × 2 locations) · ×1
Duplicated block with local edits (378 matched lines × 2 locations) src/main/webapp/js/diagramly/GitHubClient.js:950— src/main/webapp/js/diagramly/GitHubClient.js:950 · src/main/webapp/js/diagramly/GitLabClient.js:845 — the two spans are one implementation copied and then locally edited — 2460 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.
Wholesale file copy (375 identical lines × 2 files) REDACTED:5— REDACTED:5 · src/main/webapp/js/embed.dev.js:5 — these 2 files are line-for-line copies of one another — 375 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication· Duplicated block with local edits (121 matched lines × 2 locations) · ×1
Duplicated block with local edits (121 matched lines × 2 locations) src/main/webapp/js/diagramly/Editor.js:13312— src/main/webapp/js/diagramly/Editor.js:13312 · src/main/webapp/js/diagramly/gif/AnimationExport.js:894 — the two spans are one implementation copied and then locally edited — 733 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (111 matched lines × 2 locations) · ×1
Duplicated block with local edits (111 matched lines × 2 locations) src/main/webapp/js/diagramly/GitHubClient.js:776— src/main/webapp/js/diagramly/GitHubClient.js:776 · src/main/webapp/js/diagramly/GitLabClient.js:647 — the two spans are one implementation copied and then locally edited — 708 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (110 matched lines × 2 locations) · ×1
Duplicated block with local edits (110 matched lines × 2 locations) src/main/webapp/js/diagramly/GitHubFile.js:151— src/main/webapp/js/diagramly/GitHubFile.js:151 · src/main/webapp/js/diagramly/OneDriveFile.js:470 — the two spans are one implementation copied and then locally edited — 558 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (89 matched lines × 2 locations) · ×1
Duplicated block with local edits (89 matched lines × 2 locations) src/main/webapp/js/diagramly/DriveFile.js:275— src/main/webapp/js/diagramly/DriveFile.js:275 · src/main/webapp/js/diagramly/OneDriveFile.js:667 — the two spans are one implementation copied and then locally edited — 352 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 (51 lines × 2 locations) src/main/webapp/js/diagramly/Dialogs.js:7650— src/main/webapp/js/diagramly/Dialogs.js:7650 · src/main/webapp/js/diagramly/Dialogs.js:7803 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (46 matched lines × 2 locations) · ×1
Duplicated block with local edits (46 matched lines × 2 locations) src/main/webapp/js/diagramly/Pages.js:742— src/main/webapp/js/diagramly/Pages.js:742 · src/main/webapp/js/diagramly/Pages.js:843 — the two spans are one implementation copied and then locally edited — 204 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.
R10 · Code Duplication· Duplicated block with local edits (44 matched lines × 2 locations) · ×1
Duplicated block with local edits (44 matched lines × 2 locations) src/main/webapp/js/diagramly/LightboxModern.js:2709— src/main/webapp/js/diagramly/LightboxModern.js:2709 · src/main/webapp/js/diagramly/ViewerModern.js:2264 — the two spans are one implementation copied and then locally edited — 348 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (40 matched lines × 2 locations) · ×1
Duplicated block with local edits (40 matched lines × 2 locations) src/main/webapp/js/diagramly/Minimal.js:60— src/main/webapp/js/diagramly/Minimal.js:60 · src/main/webapp/js/diagramly/Minimal.js:129 — the two spans are one implementation copied and then locally edited — 239 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 (39 lines × 2 locations) src/main/webapp/js/diagramly/App.js:6241— src/main/webapp/js/diagramly/App.js:6241 · src/main/webapp/js/diagramly/ElectronApp.js:2518 — 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 (37 matched lines × 2 locations) · ×1
Duplicated block with local edits (37 matched lines × 2 locations) etc/integrate/Integrate.js:35— etc/integrate/Integrate.js:35 · src/main/webapp/js/diagramly/Editor.js:6227 — the two spans are one implementation copied and then locally edited — 164 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 (37 lines × 2 locations) src/main/webapp/js/diagramly/DriveClient.js:2058— src/main/webapp/js/diagramly/DriveClient.js:2058 · src/main/webapp/js/diagramly/OneDriveClient.js:746 — 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 (36 lines × 2 locations) src/main/webapp/js/diagramly/Dialogs.js:27360— src/main/webapp/js/diagramly/Dialogs.js:27360 · src/main/webapp/js/diagramly/Dialogs.js:28323 — 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 (34 lines × 2 locations) REDACTED:8537— REDACTED:8537 · REDACTED:8752 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (33 matched lines × 2 locations) · ×1
Duplicated block with local edits (33 matched lines × 2 locations) src/main/webapp/js/diagramly/Editor.js:2563— src/main/webapp/js/diagramly/Editor.js:2563 · src/main/webapp/js/diagramly/util/mxJsCanvas.js:463 — the two spans are one implementation copied and then locally edited — 326 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication· Duplicated block with local edits (31 matched lines × 2 locations) · ×1
Duplicated block with local edits (31 matched lines × 2 locations) src/main/webapp/js/diagramly/sidebar/Sidebar-UML25.js:85— src/main/webapp/js/diagramly/sidebar/Sidebar-UML25.js:85 · src/main/webapp/js/diagramly/sidebar/Sidebar-UML25.js:257 — the two spans are one implementation copied and then locally edited — 300 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.
R10 · Code Duplication· Duplicated block with local edits (29 matched lines × 2 locations) · ×1
Duplicated block with local edits (29 matched lines × 2 locations) src/main/webapp/js/export.js:292— src/main/webapp/js/export.js:292 · src/main/webapp/js/export.js:364 — the two spans are one implementation copied and then locally edited — 157 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.
R10 · Code Duplication· Duplicated block with local edits (28 matched lines × 2 locations) · ×1
Duplicated block with local edits (28 matched lines × 2 locations) src/main/webapp/js/diagramly/LibavoidRouting.js:2007— src/main/webapp/js/diagramly/LibavoidRouting.js:2007 · src/main/webapp/js/diagramly/LibavoidRouting.js:3732 — the two spans are one implementation copied and then locally edited — 354 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 (26 lines × 2 locations) src/main/webapp/js/diagramly/EditorUi.js:21424— src/main/webapp/js/diagramly/EditorUi.js:21424 · src/main/webapp/js/diagramly/EditorUi.js:21641 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Complex function addCompositeShape (cyclomatic 842, cognitive 1222) REDACTED:7711— addCompositeShape has cyclomatic complexity 842 and cognitive complexity 1222; 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 doImportCsv (cyclomatic 319, cognitive 732) src/main/webapp/js/diagramly/EditorUi.js:39560— doImportCsv has cyclomatic complexity 319 and cognitive complexity 732; 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 configure (cyclomatic 202, cognitive 415) src/main/webapp/js/diagramly/Editor.js:3441— configure has cyclomatic complexity 202 and cognitive complexity 415; 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 176, cognitive 415) src/main/webapp/js/diagramly/EditorUi.js:32406— (anonymous) has cyclomatic complexity 176 and cognitive complexity 415; 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 strictDrawShape (cyclomatic 165, cognitive 211) src/main/webapp/js/grapheditor/Shapes.js:6106— strictDrawShape has cyclomatic complexity 165 and cognitive complexity 211; 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 renderPage (cyclomatic 124, cognitive 217) src/main/webapp/js/export.js:1626— renderPage has cyclomatic complexity 124 and cognitive complexity 217; 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 124, cognitive 193) src/main/webapp/js/grapheditor/Sidebar.js:6836— (anonymous) has cyclomatic complexity 124 and cognitive complexity 193; 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 getHexagonPerimeterPoint (cyclomatic 114, cognitive 187) src/main/webapp/mxgraph/src/view/mxPerimeter.js:487— getHexagonPerimeterPoint has cyclomatic complexity 114 and cognitive complexity 187; 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 OrthConnector (cyclomatic 106, cognitive 152) src/main/webapp/mxgraph/src/view/mxEdgeStyle.js:1141— OrthConnector has cyclomatic complexity 106 and cognitive complexity 152; 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 SegmentConnector (cyclomatic 105, cognitive 162) src/main/webapp/mxgraph/src/view/mxEdgeStyle.js:600— SegmentConnector has cyclomatic complexity 105 and cognitive complexity 162; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity· Complex function main (cyclomatic 103, cognitive 179) · ×1
Complex function main (cyclomatic 103, cognitive 179) src/main/webapp/js/diagramly/App.js:1006— main has cyclomatic complexity 103 and cognitive complexity 179; 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 102, cognitive 262) REDACTED:643— (anonymous) has cyclomatic complexity 102 and cognitive complexity 262; 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 101, cognitive 305) src/main/webapp/js/diagramly/Editor.js:13055— (anonymous) has cyclomatic complexity 101 and cognitive complexity 305; 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 101, cognitive 158) src/main/webapp/js/export.js:234— render has cyclomatic complexity 101 and cognitive complexity 158; 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 90, cognitive 157) src/main/webapp/js/diagramly/Menus.js:7058— (anonymous) has cyclomatic complexity 90 and cognitive complexity 157; 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 drawNode (cyclomatic 85, cognitive 202) src/main/webapp/mxgraph/src/shape/mxStencil.js:650— drawNode has cyclomatic complexity 85 and cognitive complexity 202; 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 paintVertexShape (cyclomatic 81, cognitive 119) src/main/webapp/shapes/mxKubernetes.js:196— paintVertexShape has cyclomatic complexity 81 and cognitive complexity 119; 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 executeBatch (cyclomatic 80, cognitive 201) src/main/webapp/js/diagramly/gif/AnimationExport.js:714— executeBatch has cyclomatic complexity 80 and cognitive complexity 201; 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 extract (cyclomatic 79, cognitive 116) src/main/webapp/js/diagramly/tidy/TidyFeatures.js:133— extract has cyclomatic complexity 79 and cognitive complexity 116; 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 init (cyclomatic 79, cognitive 101) src/main/webapp/js/diagramly/EditorUi.js:22767— init has cyclomatic complexity 79 and cognitive complexity 101; 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 getControlPoints (cyclomatic 78, cognitive 124) REDACTED:13860— getControlPoints has cyclomatic complexity 78 and cognitive complexity 124; 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 search (cyclomatic 77, cognitive 138) src/main/webapp/js/diagramly/Dialogs.js:10115— search has cyclomatic complexity 77 and cognitive complexity 138; 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 applyEdgesText (cyclomatic 76, cognitive 122) src/main/webapp/js/diagramly/EditorUi.js:36312— applyEdgesText has cyclomatic complexity 76 and cognitive complexity 122; 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 showExportDialog (cyclomatic 76, cognitive 93) src/main/webapp/js/diagramly/EditorUi.js:11787— showExportDialog has cyclomatic complexity 76 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 handleCompoundShape (cyclomatic 72, cognitive 124) REDACTED:1267— handleCompoundShape has cyclomatic complexity 72 and cognitive complexity 124; 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 mouseMove (cyclomatic 69, cognitive 157) src/main/webapp/mxgraph/src/handler/mxConnectionHandler.js:1248— mouseMove has cyclomatic complexity 69 and cognitive complexity 157; 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 mouseMove (cyclomatic 69, cognitive 112) src/main/webapp/mxgraph/src/handler/mxGraphHandler.js:1237— mouseMove has cyclomatic complexity 69 and cognitive complexity 112; 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 fireMouseEvent (cyclomatic 69, cognitive 102) src/main/webapp/mxgraph/src/view/mxGraph.js:14371— fireMouseEvent has cyclomatic complexity 69 and cognitive complexity 102; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity· Complex function plan (cyclomatic 68, cognitive 61) · ×1
Complex function plan (cyclomatic 68, cognitive 61) src/main/webapp/js/diagramly/tidy/Tidy.js:1412— plan has cyclomatic complexity 68 and cognitive complexity 61; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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 addLabels (cyclomatic 67, cognitive 170) REDACTED:2486— addLabels has cyclomatic complexity 67 and cognitive complexity 170; 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 execute (cyclomatic 67, cognitive 139) src/main/webapp/js/diagramly/EditorUi.js:22110— execute has cyclomatic complexity 67 and cognitive complexity 139; 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 NewDialog (cyclomatic 67, cognitive 73) src/main/webapp/js/diagramly/Dialogs.js:2386— NewDialog has cyclomatic complexity 67 and cognitive complexity 73; 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 setTextColor (cyclomatic 66, cognitive 108) REDACTED:3297— setTextColor has cyclomatic complexity 66 and cognitive complexity 108; 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 init (cyclomatic 66, cognitive 89) src/main/webapp/js/diagramly/App.js:2032— init has cyclomatic complexity 66 and cognitive complexity 89; 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 addFont (cyclomatic 66, cognitive 79) src/main/webapp/js/grapheditor/Format.js:5025— addFont has cyclomatic complexity 66 and cognitive complexity 79; 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 updateCell (cyclomatic 65, cognitive 196) REDACTED:5951— updateCell has cyclomatic complexity 65 and cognitive complexity 196; 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 dropAndConnect (cyclomatic 65, cognitive 121) src/main/webapp/js/grapheditor/Sidebar.js:5793— dropAndConnect has cyclomatic complexity 65 and cognitive complexity 121; 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 applyTableText (cyclomatic 65, cognitive 119) src/main/webapp/js/diagramly/EditorUi.js:37416— applyTableText has cyclomatic complexity 65 and cognitive complexity 119; 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 parse (cyclomatic 64, cognitive 171) src/main/webapp/js/diagramly/Dialogs.js:1520— parse has cyclomatic complexity 64 and cognitive complexity 171; 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 handleError (cyclomatic 64, cognitive 113) src/main/webapp/js/diagramly/EditorUi.js:7701— handleError has cyclomatic complexity 64 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.
R3 · Large Files· src/main/webapp/js/diagramly/Dialogs.js · ×1
src/main/webapp/js/diagramly/Dialogs.js: 24518 lines of code src/main/webapp/js/diagramly/Dialogs.js:1— src/main/webapp/js/diagramly/Dialogs.js has 24518 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: 14753 lines of code REDACTED:1— REDACTED has 14753 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/main/webapp/js/diagramly/Editor.js · ×1
src/main/webapp/js/diagramly/Editor.js: 14132 lines of code src/main/webapp/js/diagramly/Editor.js:1— src/main/webapp/js/diagramly/Editor.js has 14132 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/main/webapp/mxgraph/src/view/mxGraph.js · ×1
src/main/webapp/mxgraph/src/view/mxGraph.js: 13127 lines of code src/main/webapp/mxgraph/src/view/mxGraph.js:1— src/main/webapp/mxgraph/src/view/mxGraph.js has 13127 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: 12679 lines of code REDACTED:1— REDACTED has 12679 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: 10530 lines of code REDACTED:1— REDACTED has 10530 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/main/webapp/js/grapheditor/Shapes.js · ×1
src/main/webapp/js/grapheditor/Shapes.js: 9956 lines of code src/main/webapp/js/grapheditor/Shapes.js:1— src/main/webapp/js/grapheditor/Shapes.js has 9956 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/main/webapp/js/diagramly/App.js · ×1
src/main/webapp/js/diagramly/App.js: 8813 lines of code src/main/webapp/js/diagramly/App.js:1— src/main/webapp/js/diagramly/App.js has 8813 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/main/webapp/js/grapheditor/Format.js · ×1
src/main/webapp/js/grapheditor/Format.js: 8694 lines of code src/main/webapp/js/grapheditor/Format.js:1— src/main/webapp/js/grapheditor/Format.js has 8694 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/main/webapp/shapes/mxAWS3D.js · ×1
src/main/webapp/shapes/mxAWS3D.js: 8646 lines of code src/main/webapp/shapes/mxAWS3D.js:1— src/main/webapp/shapes/mxAWS3D.js has 8646 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/main/webapp/js/grapheditor/Sidebar.js · ×1
src/main/webapp/js/grapheditor/Sidebar.js: 7034 lines of code src/main/webapp/js/grapheditor/Sidebar.js:1— src/main/webapp/js/grapheditor/Sidebar.js has 7034 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/main/webapp/js/diagramly/Menus.js · ×1
src/main/webapp/js/diagramly/Menus.js: 6575 lines of code src/main/webapp/js/diagramly/Menus.js:1— src/main/webapp/js/diagramly/Menus.js has 6575 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/main/webapp/mxgraph/src/util/mxUtils.js · ×1
src/main/webapp/mxgraph/src/util/mxUtils.js: 6081 lines of code src/main/webapp/mxgraph/src/util/mxUtils.js:1— src/main/webapp/mxgraph/src/util/mxUtils.js has 6081 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/main/webapp/shapes/mockup/mxMockupiOS.js · ×1
src/main/webapp/shapes/mockup/mxMockupiOS.js: 6028 lines of code src/main/webapp/shapes/mockup/mxMockupiOS.js:1— src/main/webapp/shapes/mockup/mxMockupiOS.js has 6028 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: 5347 lines of code REDACTED:1— REDACTED has 5347 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/main/webapp/shapes/mxElectrical.js · ×1
src/main/webapp/shapes/mxElectrical.js: 5027 lines of code src/main/webapp/shapes/mxElectrical.js:1— src/main/webapp/shapes/mxElectrical.js has 5027 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/main/webapp/js/grapheditor/Editor.js · ×1
src/main/webapp/js/grapheditor/Editor.js: 4602 lines of code src/main/webapp/js/grapheditor/Editor.js:1— src/main/webapp/js/grapheditor/Editor.js has 4602 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/main/webapp/js/grapheditor/InlineToolbar.js · ×1
src/main/webapp/js/grapheditor/InlineToolbar.js: 4571 lines of code src/main/webapp/js/grapheditor/InlineToolbar.js:1— src/main/webapp/js/grapheditor/InlineToolbar.js has 4571 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/main/webapp/mxgraph/src/view/mxGraphView.js · ×1
src/main/webapp/mxgraph/src/view/mxGraphView.js: 4527 lines of code src/main/webapp/mxgraph/src/view/mxGraphView.js:1— src/main/webapp/mxgraph/src/view/mxGraphView.js has 4527 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/main/webapp/js/diagramly/ForceExplorer.js · ×1
src/main/webapp/js/diagramly/ForceExplorer.js: 4391 lines of code src/main/webapp/js/diagramly/ForceExplorer.js:1— src/main/webapp/js/diagramly/ForceExplorer.js has 4391 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: 4213 lines of code REDACTED:1— REDACTED has 4213 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/main/webapp/js/diagramly/DrawioFileSync.js · ×1
src/main/webapp/js/diagramly/DrawioFileSync.js: 4162 lines of code src/main/webapp/js/diagramly/DrawioFileSync.js:1— src/main/webapp/js/diagramly/DrawioFileSync.js has 4162 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: 4024 lines of code REDACTED:1— REDACTED has 4024 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/main/webapp/js/diagramly/Pages.js · ×1
src/main/webapp/js/diagramly/Pages.js: 3978 lines of code src/main/webapp/js/diagramly/Pages.js:1— src/main/webapp/js/diagramly/Pages.js has 3978 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: 3946 lines of code REDACTED:1— REDACTED has 3946 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/main/webapp/shapes/mxArchiMate3.js · ×1
src/main/webapp/shapes/mxArchiMate3.js: 3882 lines of code src/main/webapp/shapes/mxArchiMate3.js:1— src/main/webapp/shapes/mxArchiMate3.js has 3882 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/main/webapp/js/diagramly/LibavoidRouting.js · ×1
src/main/webapp/js/diagramly/LibavoidRouting.js: 3838 lines of code src/main/webapp/js/diagramly/LibavoidRouting.js:1— src/main/webapp/js/diagramly/LibavoidRouting.js has 3838 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: 3516 lines of code REDACTED:1— REDACTED has 3516 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/main/webapp/js/diagramly/LayoutPicker.js · ×1
src/main/webapp/js/diagramly/LayoutPicker.js: 3473 lines of code src/main/webapp/js/diagramly/LayoutPicker.js:1— src/main/webapp/js/diagramly/LayoutPicker.js has 3473 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/main/webapp/js/diagramly/LightboxModern.js · ×1
src/main/webapp/js/diagramly/LightboxModern.js: 3321 lines of code src/main/webapp/js/diagramly/LightboxModern.js:1— src/main/webapp/js/diagramly/LightboxModern.js has 3321 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/main/webapp/shapes/mxBasic.js · ×1
src/main/webapp/shapes/mxBasic.js: 3180 lines of code src/main/webapp/shapes/mxBasic.js:1— src/main/webapp/shapes/mxBasic.js has 3180 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/main/webapp/js/diagramly/emf/emf-svg.js · ×1
src/main/webapp/js/diagramly/emf/emf-svg.js: 2997 lines of code src/main/webapp/js/diagramly/emf/emf-svg.js:1— src/main/webapp/js/diagramly/emf/emf-svg.js has 2997 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
REDACTED: 2955 lines of code REDACTED:1— REDACTED has 2955 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· src/main/webapp/js/diagramly/DriveClient.js · ×1
src/main/webapp/js/diagramly/DriveClient.js: 2933 lines of code src/main/webapp/js/diagramly/DriveClient.js:1— src/main/webapp/js/diagramly/DriveClient.js has 2933 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/main/webapp/js/diagramly/tidy/Tidy.js · ×1
src/main/webapp/js/diagramly/tidy/Tidy.js: 2863 lines of code src/main/webapp/js/diagramly/tidy/Tidy.js:1— src/main/webapp/js/diagramly/tidy/Tidy.js has 2863 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/main/webapp/js/diagramly/DiffSync.js · ×1
src/main/webapp/js/diagramly/DiffSync.js: 2846 lines of code src/main/webapp/js/diagramly/DiffSync.js:1— src/main/webapp/js/diagramly/DiffSync.js has 2846 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/main/webapp/shapes/mxSysML.js · ×1
src/main/webapp/shapes/mxSysML.js: 2805 lines of code src/main/webapp/shapes/mxSysML.js:1— src/main/webapp/shapes/mxSysML.js has 2805 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/main/webapp/mxgraph/src/handler/mxEdgeHandler.js · ×1
src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js: 2754 lines of code src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:1— src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js has 2754 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/main/webapp/js/diagramly/ElectronApp.js · ×1
src/main/webapp/js/diagramly/ElectronApp.js: 2689 lines of code src/main/webapp/js/diagramly/ElectronApp.js:1— src/main/webapp/js/diagramly/ElectronApp.js has 2689 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/main/webapp/js/diagramly/sidebar/Sidebar-Sysml.js · ×1
src/main/webapp/js/diagramly/sidebar/Sidebar-Sysml.js: 2609 lines of code src/main/webapp/js/diagramly/sidebar/Sidebar-Sysml.js:1— src/main/webapp/js/diagramly/sidebar/Sidebar-Sysml.js has 2609 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 345 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
R6 · Tooling· No test, lint or typecheck script · ×1
No test, lint or typecheck script — test ✗ · lint ✗ · typecheck ✗ — read from this repository's package.json scripts and corroborated against its CI workflows. A script counts when its name or command matches the step: `test` for the suite, `lint` or `prettier` for linting, `typecheck`/`type-check`/`tsc` for type checking. ✗ therefore means no script or CI step under those names was found, NOT that the step is absent from your pipeline — a task invoked by a runner this check does not read, or named something else entirely, is not seen and is worth confirming before acting on a cross. A ✓ means the wiring is DECLARED — a script or CI step under those names exists. It is not a statement that the step passes, or that it runs at all: nothing here installs a dependency or executes a suite.
Dead file (~55270 LoC) REDACTED— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~14351 LoC) REDACTED— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~12215 LoC) REDACTED— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~11759 LoC) src/main/webapp/js/grapheditor/Shapes.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~10143 LoC) src/main/webapp/js/grapheditor/Format.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~8977 LoC) src/main/webapp/shapes/mxAWS3D.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~8158 LoC) src/main/webapp/js/grapheditor/Sidebar.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~6274 LoC) REDACTED— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~5746 LoC) src/main/webapp/shapes/mxElectrical.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~5400 LoC) src/main/webapp/js/grapheditor/Editor.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~5336 LoC) src/main/webapp/js/grapheditor/InlineToolbar.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~4433 LoC) src/main/webapp/shapes/mxArchiMate3.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~4075 LoC) REDACTED— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~3866 LoC) src/main/webapp/shapes/mxBasic.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~3274 LoC) src/main/webapp/shapes/mxSysML.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~3108 LoC) src/main/webapp/js/diagramly/ElectronApp.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~2956 LoC) src/main/webapp/shapes/mxArrows.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~2700 LoC) src/main/webapp/shapes/mxInfographic.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~2683 LoC) src/main/webapp/js/grapheditor/Omnibox.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~2551 LoC) src/main/webapp/js/grapheditor/Actions.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~2527 LoC) src/main/webapp/js/diagramly/ViewerModern.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~2237 LoC) src/main/webapp/shapes/mxLeanMap.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~2191 LoC) src/main/webapp/js/grapheditor/Menus.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~1792 LoC) src/main/webapp/shapes/mxFloorplan.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~1558 LoC) src/main/webapp/shapes/mxAndroid.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~1516 LoC) src/main/webapp/shapes/mxBootstrap.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~1222 LoC) src/main/webapp/shapes/mxArchiMate.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~973 LoC) src/main/webapp/shapes/mxGmdl.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~831 LoC) src/main/webapp/connect/common/js/mxReader.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~829 LoC) REDACTED— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~827 LoC) src/main/webapp/js/embed.dev.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~777 LoC) src/main/webapp/shapes/mxAtlassian2.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~708 LoC) src/main/webapp/js/grapheditor/Toolbar.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~670 LoC) src/main/webapp/mxgraph/src/mxClient.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~620 LoC) src/main/webapp/shapes/mxEip.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~593 LoC) src/main/webapp/shapes/mxKubernetes.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~470 LoC) src/main/webapp/shapes/mxC4.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~456 LoC) src/main/webapp/shapes/mxDFD.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Dead file (~453 LoC) src/main/webapp/js/diagramly/Devel.js— no import path from any entry point (287 application, 0 tooling, 0 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Unused dependency 'crypto-js' etc/dependencies/package.json:16— Declared in etc/dependencies/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Unused dependency 'dompurify' etc/dependencies/package.json:17— Declared in etc/dependencies/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Unused dependency 'jquery' etc/dependencies/package.json:14— Declared in etc/dependencies/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Unused dependency 'jsZip' etc/dependencies/package.json:12— Declared in etc/dependencies/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Unused dependency 'mathjax' etc/dependencies/package.json:20— Declared in etc/dependencies/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Unused dependency 'pako' etc/dependencies/package.json:15— Declared in etc/dependencies/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Unused dependency 'perfect-freehand' etc/dependencies/package.json:13— Declared in etc/dependencies/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Unused dependency 'roughjs' etc/dependencies/package.json:19— Declared in etc/dependencies/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Unused dependency 'spin.js' etc/dependencies/package.json:18— Declared in etc/dependencies/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
Third-party script without Subresource Integrity src/main/webapp/onedrive3.html:5— `https://js.live.net/v7.2/OneDrive.js` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session.
SC1 · Supply-chain hygiene· JavaScript dependencies are not locked · ×1
JavaScript dependencies are not locked etc/dependencies/package.json:11— etc/dependencies/package.json declares dependencies that no committed lockfile resolves — there is no package-lock.json / yarn.lock / pnpm-lock.yaml / bun.lock beside it, and no locked workspace above it names it — so its installs aren't reproducible (SSDF PW.4.4). Commit its package manager's lockfile (or add it to the locked workspace) and install from it (`npm ci`, `yarn --immutable`, `pnpm i --frozen-lockfile` or `bun i --frozen-lockfile`). Advisory — never scored.
X24 · Document value interpolated into markup unescaped· Document value reaches a markup attribute unescaped · ×1
Document value reaches a markup attribute unescaped REDACTED:22462— `tmp` carries text this program read out of a document — an attribute or a text node, which the DOM hands back already decoded, so an entity its author wrote is a live character again — and it is written straight into the text of an element of markup built here with nothing escaping it on the way. The value is chosen by whoever authored that document, not by this program, so it can close the attribute or element it sits in and open another — a crafted document becomes markup in what this code renders. Escape `tmp` at this site, or validate it against the shape the position accepts before interpolating it.
redundant comment src/main/webapp/js/diagramly/App.js:1876— "Extends EditorUi" repeats the code it sits on: 3 of its 3 words (extends, editor, ui) are already in `mxUtils.extend(App, EditorUi);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/App.js:3713— "Uses client-side canvas export" repeats the code it sits on: 4 of its 5 words (uses, client, canvas, export) are already in `if (mxClient.IS_CHROMEAPP || Editor.useCanvasForExport)`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/DesktopLibrary.js:14— "Extends LocalLibrary" repeats the code it sits on: 3 of its 3 words (extends, local, library) are already in `mxUtils.extend(DesktopLibrary, LocalLibrary);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/DrawioClient.js:14— "Extends mxEventSource" repeats the code it sits on: 4 of its 4 words (extends, mx, event, source) are already in `mxUtils.extend(DrawioClient, mxEventSource);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment REDACTED:57— "Extends mxEventSource" repeats the code it sits on: 4 of its 4 words (extends, mx, event, source) are already in `mxUtils.extend(DrawioFile, mxEventSource);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/DrawioFileSync.js:179— "Extends mxEventSource" repeats the code it sits on: 4 of its 4 words (extends, mx, event, source) are already in `mxUtils.extend(DrawioFileSync, mxEventSource);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/DriveClient.js:63— "Extends mxEventSource" repeats the code it sits on: 4 of its 4 words (extends, mx, event, source) are already in `mxUtils.extend(DriveClient, mxEventSource);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/DriveClient.js:66— "Extends DrawioClient" repeats the code it sits on: 3 of its 3 words (extends, drawio, client) are already in `mxUtils.extend(DriveClient, DrawioClient);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/DriveComment.js:11— "Extends DrawioComment" repeats the code it sits on: 3 of its 3 words (extends, drawio, comment) are already in `mxUtils.extend(DriveComment, DrawioComment);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/Editor.js:15319— "Execute fit page on page setup changes" repeats the code it sits on: 4 of its 5 words (execute, page, setup, changes) are already in `var changePageSetupExecute = ChangePageSetup.prototype.execute;`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/EditorUi.js:5147— 5 comments in this file only repeat the code they sit on (lines 5147, 8358, 22909, 28018, 42510), for example "end of while". Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/ElectronApp.js:118— "Disables preview option in embed dialog" repeats the code it sits on: 4 of its 5 words (preview, option, embed, dialog) are already in `EmbedDialog.showPreviewOption = false;`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/ElectronApp.js:121— "Disables new window option in edit diagram dialog" repeats the code it sits on: 6 of its 7 words (new, window, option, edit, diagram, dialog) are already in `EditDiagramDialog.showNewWindowOption = false;`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/ElectronApp.js:2740— "Extends mxXmlRequest" repeats the code it sits on: 4 of its 4 words (extends, mx, xml, request) are already in `mxUtils.extend(mxElectronRequest, mxXmlRequest);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/EmbedFile.js:13— "Extends DrawioFile" repeats the code it sits on: 3 of its 3 words (extends, drawio, file) are already in `mxUtils.extend(EmbedFile, DrawioFile);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/GitHubClient.js:16— "Extends DrawioClient" repeats the code it sits on: 3 of its 3 words (extends, drawio, client) are already in `mxUtils.extend(GitHubClient, DrawioClient);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/Menus.js:6409— "Edit cell menu" repeats the code it sits on: 3 of its 3 words (edit, cell, menu) are already in `this.put('editCell', new Menu(mxUtils.bind(this, function(menu, parent)`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/Menus.js:6422— "Current page menu" repeats the code it sits on: 3 of its 3 words (current, page, menu) are already in `this.put('currentPage', new Menu(mxUtils.bind(this, function(menu, parent)`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/Minimal.js:329— "Installs the format toolbar" repeats the code it sits on: 3 of its 3 words (installs, format, toolbar) are already in `EditorUi.prototype.installFormatToolbar = function(container)`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/OneDriveClient.js:72— "Extends DrawioClient" repeats the code it sits on: 3 of its 3 words (extends, drawio, client) are already in `mxUtils.extend(OneDriveClient, DrawioClient);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/OneDriveClient.js:841— "Replaces ObjectHandle is Invalid error message" repeats the code it sits on: 5 of its 6 words (object, handle, invalid, error, message) are already in `if (err != null && err.error != null &&`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/Pages.js:2506— "Updates custom links" repeats the code it sits on: 3 of its 3 words (updates, custom, links) are already in `graph.updateCustomLinks(graph.createCellMapping(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/Pages.js:3501— "The tab of a group is dragged with the tabs of its pages" repeats the code it sits on: 4 of its 5 words (tab, group, tabs, pages) are already in `while (tab.classList.contains('gePageGroupTab') &&`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment REDACTED:11— "Extends DrawioClient" repeats the code it sits on: 3 of its 3 words (extends, drawio, client) are already in `mxUtils.extend(TrelloClient, DrawioClient);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
redundant comment src/main/webapp/js/diagramly/emf/emf-svg.js:1605— "Set up the DC with the number of handles from the header" repeats the code it sits on: 4 of its 5 words (set, dc, handles, header) are already in `this._dc = new DeviceContext(header.nHandles || 128);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
+ 37 more in this group — see findings.md.
GD1 · Unfinished & placeholder code· Placeholder literal left in code · ×40
Placeholder literal left in code REDACTED:39— A placeholder string ("<font style="font-size: 14px">Lorem ipsu…") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code REDACTED:42— A placeholder string ("<span style="font-family: "open san…") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code REDACTED:553— A placeholder string ("Lorem ipsum dolor sit amet, consectetur …") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code REDACTED:1190— A placeholder string ("<font style="font-size: 18px">Lorem ipsu…") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code REDACTED:1204— A placeholder string ("<font style="font-size: 18px">Lorem ipsu…") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code REDACTED:1219— A placeholder string ("<font style="font-size: 18px">Lorem ipsu…") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:72— A placeholder string (" - Lorem ipsum dolor sit amet<br>") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:89— A placeholder string ("Lorem ipsum dolor sit amet, consectetur …") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:137— A placeholder string (" - Lorem ipsum dolor sit amet<br>") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:208— A placeholder string ("Lorem ipsum dolor sit amet, consectetur …") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:216— A placeholder string ("Lorem ipsum dolor sit amet, consectetur …") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:224— A placeholder string ("Lorem ipsum dolor sit amet, consectetur …") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:232— A placeholder string ("Lorem ipsum dolor sit amet, consectetur …") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:240— A placeholder string ("Lorem ipsum dolor sit amet, consectetur …") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:321— A placeholder string ("Lorem ipsum dolor sit amet, consectetur …") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:325— A placeholder string ("Lorem ipsum dolor sit amet, consectetur …") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:329— A placeholder string ("Lorem ipsum dolor sit amet, consectetur …") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:333— A placeholder string ("Lorem ipsum dolor sit amet, consectetur …") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:337— A placeholder string ("Lorem ipsum dolor sit amet, consectetur …") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:369— A placeholder string ("Lorem ipsum dolor sit amet, consectetur …") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:373— A placeholder string ("Lorem ipsum dolor sit amet, consectetur …") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:377— A placeholder string ("Lorem ipsum dolor sit amet, consectetur …") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:381— A placeholder string ("Lorem ipsum dolor sit amet, consectetur …") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:385— A placeholder string ("Lorem ipsum dolor sit amet, consectetur …") is still in shipped code — typical of generated boilerplate that was never filled in.
Placeholder literal left in code src/main/webapp/js/diagramly/sidebar/Sidebar-Infographic.js:469— A placeholder string ("Lorem ipsum dolor sit amet, consectetur …") is still in shipped code — typical of generated boilerplate that was never filled in.
Duplicated predicate src/main/webapp/js/diagramly/GitHubClient.js:508— `!checkExists && (/\.v(dx|sdx?)$/i.test(path) || /\.gliffy$/i.test(path) || /\.pdf$/i.test(path) || (!Editor.useCanvasForExport && binary))` appears character-identically in 2 files — src/main/webapp/js/diagramly/GitHubClient.js, src/main/webapp/js/diagramly/GitLabClient.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/main/webapp/js/diagramly/EditorUi.js:25139— `!graph.isEditing() && !graph.isCellLocked(graph.getDefaultParent())` appears character-identically in 2 files — src/main/webapp/js/diagramly/EditorUi.js, REDACTED. 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/main/webapp/js/grapheditor/Actions.js:1704— `!graph.isSelectionEmpty() && graph.isEnabled()` appears character-identically in 2 files — src/main/webapp/js/grapheditor/Actions.js, REDACTED. 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/main/webapp/js/diagramly/EditorUi.js:4204— `!ignorePageName && this.pages != null && this.pages.length > 1 && this.currentPage != null && this.currentPage.node.getAttribute('name') != …` appears character-identically in 2 files — src/main/webapp/js/diagramly/EditorUi.js, src/main/webapp/js/diagramly/ElectronApp.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/main/webapp/js/diagramly/EditorUi.js:9329— `!mxClient.IS_IOS || !navigator.standalone` appears character-identically in 2 files — src/main/webapp/js/diagramly/EditorUi.js, src/main/webapp/js/diagramly/Menus.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 REDACTED:758— `!mxClient.IS_POINTER && !mxClient.IS_TOUCH` appears character-identically in 2 files — REDACTED, src/main/webapp/js/embed.dev.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/main/webapp/js/diagramly/DrawioFileSync.js:71— `!mxClient.IS_POINTER && mxClient.IS_TOUCH` appears character-identically in 4 files — src/main/webapp/js/diagramly/DrawioFileSync.js, REDACTED, src/main/webapp/js/embed.dev.js, src/main/webapp/mxgraph/src/util/mxEvent.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 REDACTED:11704— `!mxEvent.isAltDown(evt) && !mxEvent.isControlDown(evt) && !mxEvent.isMetaDown(evt)` appears character-identically in 2 files — REDACTED, src/main/webapp/mxgraph/src/util/mxPopupMenu.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/main/webapp/js/diagramly/Pages.js:4561— `!mxEvent.isTouchEvent(evt) || !menuWasVisible` appears character-identically in 2 files — src/main/webapp/js/diagramly/Pages.js, src/main/webapp/js/diagramly/mxRuler.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/main/webapp/js/bootstrap.js:190— `!r && (!this.readyState || this.readyState == 'complete')` appears character-identically in 2 files — src/main/webapp/js/bootstrap.js, src/main/webapp/js/export.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/main/webapp/js/diagramly/EditorUi.js:2475— `!this.editor.chromeless || this.editor.editable` appears character-identically in 2 files — src/main/webapp/js/diagramly/EditorUi.js, REDACTED. 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/main/webapp/js/diagramly/EditorUi.js:5371— `!this.editor.isChromelessView() || this.editor.editable` appears character-identically in 2 files — src/main/webapp/js/diagramly/EditorUi.js, src/main/webapp/js/diagramly/Trees.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/main/webapp/mxgraph/src/handler/mxEdgeHandler.js:2971— `!this.graph.isCellLocked(this.state.cell) && (mxGraphHandler.prototype.maxCells <= 0 || this.graph.getSelectionCount() <= mxGraphHandler.pro…` appears character-identically in 2 files — src/main/webapp/mxgraph/src/handler/mxEdgeHandler.js, src/main/webapp/mxgraph/src/handler/mxVertexHandler.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/main/webapp/mxgraph/src/shape/mxCylinder.js:61— `!this.outline || this.style == null || mxUtils.getValue( this.style, mxConstants.STYLE_BACKGROUND_OUTLINE, 0) == 0` appears character-identically in 2 files — src/main/webapp/mxgraph/src/shape/mxCylinder.js, src/main/webapp/mxgraph/src/shape/mxShape.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 REDACTED:293— `(container.style.width != '100%' && fit != '1' && resize != '0') || (container.style.width == '' && container.style.height == '')` appears character-identically in 2 files — REDACTED, src/main/webapp/js/embed.dev.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/main/webapp/js/diagramly/Pages.js:4304— `(evt.keyCode == 13 || evt.keyCode == 32 ) && !mxEvent.isAltDown(evt) && !mxEvent.isControlDown(evt) && !mxEvent.isMetaDown(evt)` appears character-identically in 2 files — src/main/webapp/js/diagramly/Pages.js, src/main/webapp/mxgraph/src/util/mxWindow.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/main/webapp/js/diagramly/EditorUi.js:42053— `(format == 'png' || format == 'jpg' || format == 'jpeg') && editorUi.editor.isExportToCanvas()` appears character-identically in 2 files — src/main/webapp/js/diagramly/EditorUi.js, src/main/webapp/js/diagramly/ElectronApp.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/main/webapp/js/diagramly/Trees.js:1220— `(hor && after != sibling.getCenterX() < state.getCenterX()) || (!hor && after != sibling.getCenterY() < state.getCenterY())` appears character-identically in 2 files — src/main/webapp/js/diagramly/Trees.js, src/main/webapp/plugins/trees/trees.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/main/webapp/js/grapheditor/Shapes.js:1414— `(isForeground && this.fill != null) || (!isForeground && this.fill == null)` appears character-identically in 2 files — src/main/webapp/js/grapheditor/Shapes.js, src/main/webapp/mxgraph/src/shape/mxCylinder.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/main/webapp/js/diagramly/GitHubClient.js:349— `(req.getStatus() >= 200 && req.getStatus() <= 299) || (ignoreNotFound && req.getStatus() == 404)` appears character-identically in 2 files — src/main/webapp/js/diagramly/GitHubClient.js, src/main/webapp/js/diagramly/GitLabClient.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/main/webapp/js/diagramly/Menus.js:1133— `Action.prototype.isEnabled.apply(this, arguments) && graph.isEnabled()` appears character-identically in 2 files — src/main/webapp/js/diagramly/Menus.js, src/main/webapp/js/grapheditor/Actions.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/main/webapp/js/diagramly/EditorUi.js:34446— `Array.isArray(this.lastLayoutSpec) && this.lastLayoutSpec.length > 0` appears character-identically in 2 files — src/main/webapp/js/diagramly/EditorUi.js, src/main/webapp/js/diagramly/LayoutPicker.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/main/webapp/js/diagramly/EditorUi.js:34171— `Editor.currentTheme == 'kennedy' || Editor.currentTheme == 'atlas'` appears character-identically in 2 files — src/main/webapp/js/diagramly/EditorUi.js, src/main/webapp/js/grapheditor/Menus.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/main/webapp/js/diagramly/EditorUi.js:27028— `Editor.currentTheme == 'simple' || Editor.currentTheme == 'sketch'` appears character-identically in 2 files — src/main/webapp/js/diagramly/EditorUi.js, src/main/webapp/js/diagramly/Menus.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/main/webapp/js/diagramly/Menus.js:2028— `Editor.currentTheme == 'sketch' || Editor.currentTheme == 'min'` appears character-identically in 2 files — src/main/webapp/js/diagramly/Menus.js, src/main/webapp/js/diagramly/Omnibox.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.
Silent fallback default in catch src/main/server/java/com/mxgraph/online/AbsAuth.java:462— `getExpiresIn` swallows every exception into `return -1` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the Javadoc, and the row stops firing.
Silent fallback default in catch src/main/webapp/js/diagramly/App.js:845— `App.getServiceWorkerFailures` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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 in catch src/main/webapp/js/diagramly/tidy/Tidy.js:2256— `Tidy.ops.route` swallows every exception into `return 0` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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 in catch src/main/webapp/js/diagramly/tidy/TidyWindow.js:1670— `TidyWindow.isFocusVisible` swallows every exception into `return true` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. 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.
Documentation: no build, run or usage example README.md:1— the repository holds project manifests and neither `README.md` nor the documents it links hold a code block or a command. Show the command that builds or runs it, or a usage snippet.
Documentation: no build, run or usage example etc/dependencies/README.md:1— `dependencies` is a published package (`package.json` without `"private": true`) and neither `etc/dependencies/README.md` nor the documents it links hold a code block or a command. Show the command that builds or runs it, or a usage snippet.
D21 · Naming Consistency· `mxGraphMlCodec` spells `Ml` where 43 names in the project spell it `ML` · ×1
`mxGraphMlCodec` spells `Ml` where 43 names in the project spell it `ML` REDACTED:5— 43 of 44 names in project repository spell the token `ML` (43 of 44; unit: names in project repository containing `ML`). Peers: mxSysML.mxShapeSysMLComposite (src/main/webapp/shapes/mxSysML.js:8); mxSysML.mxShapeSysMLPackage (src/main/webapp/shapes/mxSysML.js:118); mxSysML.mxShapeSysMLPackage2 (src/main/webapp/shapes/mxSysML.js:226); mxSysML.mxShapeSysMLNone (src/main/webapp/shapes/mxSysML.js:312); mxSysML.mxShapeSysMLRect (src/main/webapp/shapes/mxSysML.js:347). Rename to `mxGraphMLCodec`. [rule N6]
D21 · Naming Consistency· `mxShapeDFDDataStoreID` spells `ID` where 16 names in the project spell it `Id` · ×1
`mxShapeDFDDataStoreID` spells `ID` where 16 names in the project spell it `Id` src/main/webapp/shapes/mxDFD.js:243— 16 of 17 names in project repository spell the token `Id` (16 of 17; unit: names in project repository containing `Id`). Peers: mxReader.DrawioViewer(attachmentId) (src/main/webapp/connect/common/js/mxReader.js:28); mxReader.DrawioViewer(ceoId) (src/main/webapp/connect/common/js/mxReader.js:28); Dialogs.AspectDialog(pageId) (src/main/webapp/js/diagramly/Dialogs.js:24251); EditorUi.repairFindById (src/main/webapp/js/diagramly/EditorUi.js:21088); Extensions.getLucidId (REDACTED:6954). Rename to `mxShapeDFDDataStoreId`. [rule N6]
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.
Logging is not universal — Only 1/2 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`.
No SAST — No static application security testing detected. For this repository's stack, add spotbugs with find-sec-bugs (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 3 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.
No dependency-update automation etc/dependencies/package.json:11— `etc/dependencies/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
No release approval gate REDACTED:28— The release is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever the release trigger points at is published to users unreviewed, so a mistagged or unverified commit ships and the only remedy is a follow-up release.
X23 · Unguarded diagnostic materialisation· Diagnostic log message is built whether or not it is wanted · ×1
Diagnostic log message is built whether or not it is wanted src/main/webapp/js/diagramly/EditorUi.js:940— `debug` at line 940 is called with an argument built by `args.join(' ')` (line 940), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
X5 · Nullable reference types· Java packages are not null-marked everywhere · ×1
Java packages are not null-marked everywhere — 0/1 of this repository's Java package directories are under a non-null default: a `package-info.java` declaring `@NullMarked` (JSpecify) or `@NonNullApi`, `@ParametersAreNonnullByDefault`, `@NonNullByDefault`, `@DefaultQualifier(NonNull.class)`; a `module-info.java` declaring `@NullMarked`; every type in it `@NullMarked`; or a build that runs NullAway with the package in `AnnotatedPackages`, or the Checker Framework's `NullnessChecker`. Elsewhere every reference admits null and no checker warns on the dereference that throws a `NullPointerException`.
Hand-rolled JSON/XML parsing via regex src/main/webapp/js/diagramly/EditorUi.js:17238— A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This JavaScript/TypeScript code already uses a real parser in the same package; use it here too.
Outdated (npm): image-size — image-size is pinned at 2.0.4; registry.npmjs.org publishes 2.1.0 as the latest release. Upgrading is a judgement call — read that package's changelog for what changed between the two — but a direct production dependency several releases behind is where security and compatibility debt accumulates silently.
Outdated (npm): yargs — yargs is pinned at 18.1.0; registry.npmjs.org publishes 18.2.0 as the latest release. Upgrading is a judgement call — read that package's changelog for what changed between the two — but a direct production dependency several releases behind is where security and compatibility debt accumulates silently.
doc comments repeat the names src/main/webapp/js/diagramly/EditorUi.js:22742— 0 of 35 documented parameters and 3 of 1948 summaries in `.` only repeat the member or parameter name (e.g. "Initializes the UI." for `editorUiInit`). Delete the restating tags, or add what the name does not say.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
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 5 file(s) — `src/main/webapp/js/diagramly/Dialogs.js`, `REDACTED`, `src/main/webapp/js/embed.dev.js`, `src/main/webapp/js/grapheditor/Shapes.js`, `src/main/webapp/mxgraph/mxClient.js` — so the PII/GDPR sweep did not cover them at all.
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.
Run 01a1eaf0-e36a-7022-a455-0beb9023b1a0 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 130 · Warnings: 3243 · Recommendations: 163 · Info: 3 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 17-11-2026 @ 19:16 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.