Public report — pulsar, published 29 Jul 2026.
Concrete security findings (CVE IDs, secret matches, dependency versions) are hidden in this version;
ask the repo owner for the full report.
1307findings with an exact file:lineof 1324 — the remainder are repo-wide signals (a dimension-level measurement, not a single line); open any file:line and verify
23/95dimensions across the health lenses450492 LoC — wide & deep
Executive summary
Read through the Production lens — the standard calibration. *Green* means good enough to run in production. The score is absolute and comparable across repos.
apache/pulsar is sound in substance but carries real gaps (59%). It is not in crisis, but the issues below raise the cost of changing it — friction its consumers ultimately inherit.
It is strongest in Architecture (97%) — the structure is clean and changes stay contained.
Most urgent: a critical security exposure was detected (see the Security & Compliance lens). Treat it as a priority regardless of the overall grade.
The area that most needs attention is Security (41%) — exposure to security and compliance incidents is elevated.
How the score is built — each lens's share of the headlineWidth is the lens's weight in the worst-heaviest fold (the weakest area pulls hardest); colour is that lens's own band. A lens fixes the score in proportion to its width.
599 finding(s) are new versus the previous scan (2026-07-20) — surfaced by this scheduled scan itself, no pull request required. Showing the first 100; the full set is in the report.
A full-fidelity diff against the previous run's complete recorded findings — line-move tolerant: a finding that only shifted line counts as unchanged, only genuinely new titles/files surface here.
Rebuild cost & value ~ Modeled — €310,000–€1,500,000
0.8× (at 59% quality) — the last 20% of quality is most of the work
Size & shape
Large · effort split not classified (source measured from disk; the effort-tier breakdown is a C#-only syntax walk)
This codebase represents roughly ~6.3 person-years of build effort (about ~€920,000 to rebuild). Its weakest lens is Security at 41% — the part of that asset most exposed by the findings below.
How we model this: boilerplate at a scaffolding rate + logic × domain Standard (×1.0) — standard service × a 0.8× quality factor, at €60–95/h; indicative, ±~30% · size measured directly from source · effort from total production LoC as straight-line logic (the tier split is a C#-only syntax walk), a conservative lower bound. Indicative only — most sensitive to the hourly rate and the domain tier (both tunable in config).
Top priorities
The highest-leverage moves; the full ranked list is in the Roadmap below.
1
Resolve the 5 Secret finding(s) in Secrets (history) — start with broker.key-pk8.pem, broker.key.pem, ca.key.pem.
Value concentrated against a weak lens · High · Value at risk
This is a Large asset (~6.3 person-years to rebuild), and its weakest lens is Security at 41%. The operational and business risk on an asset this size concentrates there — that's where remediation buys the most protection.
→ Direct remediation budget at Security first — highest risk-reduction per euro on an asset this size.
Highest-leverage move · Medium · Leverage
Of everything flagged, the best return on effort is: Resolve the 50 High finding(s) in Static Analysis (SAST) — start with pulsar-ci.yaml (21), pulsar-ci-flaky.yaml (10), ci-go-functions.yaml (5). The rest can wait behind it.
Evidence: priority ranking: top of 5 ranked by impact/effort
→ Resolve the 50 High finding(s) in Static Analysis (SAST) — start with pulsar-ci.yaml (21), pulsar-ci-flaky.yaml (10), ci-go-functions.yaml (5).
A velocity tax on every change · Medium · Economics
The code-quality signals (complexity, duplication, cohesion) average 7.1/10, which acts as a tax on every change in the weaker areas: modifications there plausibly cost on the order of 2–5% more than in clean code, and the tax compounds as the codebase grows. (A modelled estimate, not a measured fact.)
Evidence: D1/D2 complexity, D4 duplication, D6 cohesion: averaging 7.1/10 across the code-quality signals
→ Pay it down where churn is highest — the hotspots — not everywhere; that's where the tax is actually paid.
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
A03:2021 — Injection
50
High / Critical
A05:2021 — Security Misconfiguration
17
High / Critical
A02:2021 — Cryptographic Failures
6
High / Critical
A06:2021 — Vulnerable & Outdated Components
5
Medium
Roadmap
Begin by resolving the 50 high-priority static analysis findings, focusing first on the CI configuration files. Next, address the five secret history issues by removing exposed keys. Then, remediate the eight high-severity IaC and container security findings, prioritizing the main infrastructure and Docker files. Finally, improve documentation by adding a testing section to the root README and establishing an architecture decision record log.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 5 Secret finding(s) in Secrets (history) — start with broker.key-pk8.pem, broker.key.pem, ca.key.pem.
Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 22 of 23 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 1 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 0.6 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.
Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.
What we checked — 23 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, 1307 of 1324 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D19 Documentation Quality — LLM provider failed — The model provider returned an unusable result, so this LLM-assisted dimension fell back to a measurement gap (confidence 0) rather than a penalty. Re-run with a reachable provider to score it.
D30 Dependency Vulnerabilities — scanner not present in this environment — The backing tool was not installed where this scan ran, so this dimension was not scored. Install the tool (or run in the hosted environment, where it is always present) for a graded result.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity (jscpd) — 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.
D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
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").
D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
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.
M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
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".
The LLM boundary
LLM-set scores this run (2): D21, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score (documentation, ADR quality, naming, comment value, onboarding) — D25 sets the ADR-conformance fraction over sampled code, D22 judges API accuracy over a sample. These are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
166 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was PulsarDecoder.channelRead at 80. A further 9 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 PulsarAuthorizationProvider.allowTopicOperationAsync at 28 — they are counted neither in the figure above nor in this dimension's score.
+ 161 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 PulsarDecoder.channelRead (cyclomatic 80) finding(s) in Cyclomatic Complexity — start with PulsarDecoder.java. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 FunctionConfigUtils.convert (cyclomatic 70) finding(s) in Cyclomatic Complexity — start with FunctionConfigUtils.java. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 TransferShedder.findBundlesForUnloading (cyclomatic 66) finding(s) in Cyclomatic Complexity — start with TransferShedder.java. — One of this dimension's main actionable groups (1 warning-level).
Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 405 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 TransferShedder.findBundlesForUnloading (cognitive 182) finding(s) in Cognitive Complexity — start with TransferShedder.java. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 PerformanceTransaction.run (cognitive 130) finding(s) in Cognitive Complexity — start with PerformanceTransaction.java. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 PerformanceProducer.runProducer (cognitive 111) finding(s) in Cognitive Complexity — start with PerformanceProducer.java. — One of this dimension's main actionable groups (1 warning-level).
Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes8.5 / 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 101 TooManyMethods finding(s) in God Classes — start with TopicsImpl.java, NamespacesImpl.java, ManagedLedgerImpl.java. — One of this dimension's main actionable groups (101 warning-level).
Resolve the 95 FileTooLong finding(s) in God Classes — start with Commands.java (2), FunctionsImpl.java (2), PersistentTopics.java. — One of this dimension's main actionable groups (95 warning-level).
Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Copy-pasted code that should be shared instead.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor9.2 / 10Exemplary✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
116 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is pulsar-broker/src/main/java/org/apache/pulsar/broker/service/scalable/ScalableTopicController.java.
Off-boarding risk: anonymized user #1 · ×4
Further sole-owners (lower concentration)
✓ On the Gold path — maintain.
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: Git-history secret scan via gitleaks detect over full history in an isolated checkout; each match flagged High. Exhaustive; degrades cleanly when tool absent.
16 finding(s): 0 critical, 16 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
Secret: private-key · ×5.ci/tls/servers/broker/broker.key-pk8.pem:1detected by gitleaks finding
Rotate the exposed credentials — git history can't be un-committed
What to do
Resolve the 5 Secret finding(s) in Secrets (history) — start with broker.key-pk8.pem, broker.key.pem, ca.key.pem. — One of this dimension's main actionable groups (5 issue-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
High: run-shell-injection · ×50.github/actions/ssh-access/action.yml:50detected by semgrep finding
What to do
Resolve the 50 High finding(s) in Static Analysis (SAST) — start with pulsar-ci.yaml (21), pulsar-ci-flaky.yaml (10), ci-go-functions.yaml (5). — One of this dimension's main actionable groups (50 issue-level).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
High IaC: AWS-0028 · ×8deployment/terraform-ansible/aws/instances.tfdetected by trivy finding
Critical IaC: AWS-0104deployment/terraform-ansible/aws/security.tfdetected by trivy finding
Medium IaC: AWS-0178 · ×4deployment/terraform-ansible/aws/network.tfdetected by trivy finding
Low IaC: AWS-0099 · ×4deployment/terraform-ansible/aws/security.tfdetected by trivy finding
What to do
Resolve the 8 High IaC finding(s) in IaC & Container Security — start with instances.tf (2), network.tf (2), Dockerfile.wolfi (2). — One of this dimension's main actionable groups (8 issue-level).
Resolve the 1 Critical IaC finding(s) in IaC & Container Security — start with security.tf. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 4 Medium IaC finding(s) in IaC & Container Security — start with Dockerfile (2), network.tf, Dockerfile.wolfi. — One of this dimension's main actionable groups (4 warning-level).
Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
605 of 1505 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/FunctionsBase.java.
Resolve the 22 Orphaned knowledge finding(s) in Knowledge Freshness — start with FunctionsImpl.java (2), SinksImpl.java (2), FunctionsBase.java. — One of this dimension's main actionable groups (22 issue-level).
Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling; coupling through a build step, config, or non-source file isn't seen.
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.
Resolve the 1 Build action pinned to a mutable branch finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 Unpinned build actions finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 PR-triggered workflow without a permissions block finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-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 dependencies have known published vulnerabilities (CVEs) per the OSV database — read natively from whatever lockfile the repository ships (Cargo, npm, Go, Python, Maven, RubyGems, …). D33 and D30 add ecosystem-specific scanners on top for npm and .NET.
Method: Multi-ecosystem dependency-CVE scan via osv-scanner --recursive (queries the osv.dev database + parses lockfiles natively across ecosystems: npm package-lock/yarn/pnpm/bun, Go go.mod, Rust Cargo.lock, Maven/Gradle pom.xml/gradle.lockfile, PyPI requirements.txt/poetry.lock/Pipfile.lock, Composer composer.lock, RubyGems Gemfile.lock, Hex mix.lock, pub pubspec.lock, Swift Package.resolved); severity tally (Critical/High/Medium/Low) to 0-10 tight normalizer (8.0). NotApplicable only when the repo declares no supported non-.NET dependency lockfile (a NuGet-only repo stays NotApplicable — .NET CVEs are D30's domain); coverage needs a resolved lockfile. Additive to D33 (trivy fs); exhaustive + deterministic, DB kept fresh.
Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
What to do
Add a 'Testing' section to the root README — how to run the test suite.
Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
Add a README to the 71 of 72 project(s) that lack one — worth up to 2 pts.
Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).
Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.
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.
What to do
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.
Deployment automation exists but no readiness/liveness probes, rolling-update strategy, lifecycle hooks or migration job were evidenced — a bad release is harder to detect and reverse.
What to do
Add readiness/liveness probes and a rolling-update (or blue/green) strategy so a bad release is caught and rolled back automatically.
Add an approval/environment gate (required reviewers / protection rules) before production promotion.
Do you agree with this assessment?
Reference — by lens
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.
Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Not included — 72 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.
AC1 Text alternatives — Frontend below the scale floor (4 DOM element(s) < 25) — too little surface to assess accessibility.
AC2 Forms & labels — Frontend below the scale floor (4 DOM element(s) < 25) — too little surface to assess accessibility.
AC3 Page structure — Frontend below the scale floor (4 DOM element(s) < 25) — too little surface to assess accessibility.
AC4 Keyboard semantics — Frontend below the scale floor (4 DOM element(s) < 25) — too little surface to assess accessibility.
AC5 ARIA correctness — Frontend below the scale floor (4 DOM element(s) < 25) — too little surface to assess accessibility.
AC6 Visual & motion safety — Frontend below the scale floor (4 DOM element(s) < 25) — too little surface to assess accessibility.
AC7 A11y enforcement — Frontend below the scale floor (4 DOM element(s) < 25) — too little surface to assess accessibility.
AX1 Captive dependencies — no DI registrations detected
AX10 Code composition — not assessed — code composition is computed by ROLE over the .NET document set and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
AX2 Stateful singletons — no singleton implementations detected
AX3 Project dependency cycles — not assessed — project cycles and dependency direction are computed over the .NET project-reference graph and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
AX4 Dependency direction — not assessed — project cycles and dependency direction are computed over the .NET project-reference graph and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
AX5 Architecture & structure — not assessed — architecture style/structure is computed from the .NET project graph (projects, types, namespaces) and no such graph was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
AX6 Interface segregation — not assessed — interface segregation is computed over the .NET type surface and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — not assessed — test isolation is computed from the .NET project graph (which projects are test projects, and what they reference) and no such graph was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
AXB2 Runtime readiness — no data
C1 Data Protection — Not assessed: these personal data controls are read from C# source (attributes, middleware, entity/column names, guard methods) and no C# source was loaded for this repository — because it is written in another language, or the solution failed to load. Absence of a .NET idiom is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C2 Access Controls — Not assessed: these authorization controls are read from C# source (attributes, middleware, entity/column names, guard methods) and no C# source was loaded for this repository — because it is written in another language, or the solution failed to load. Absence of a .NET idiom is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C3 Audit Trail — Not assessed: these audit controls are read from C# source (attributes, middleware, entity/column names, guard methods) and no C# source was loaded for this repository — because it is written in another language, or the solution failed to load. Absence of a .NET idiom is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C4 Data Retention — Not assessed: these retention controls are read from C# source (attributes, middleware, entity/column names, guard methods) and no C# source was loaded for this repository — because it is written in another language, or the solution failed to load. Absence of a .NET idiom is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from C# source (attributes, middleware, entity/column names, guard methods) and no C# source was loaded for this repository — because it is written in another language, or the solution failed to load. Absence of a .NET idiom is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
D10 Test Quality — ~426053 lines of test source are present (.java) but the test-quality collector reads C# only, so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
D11 Test Reliability — Test reliability not included
D12 Dependency Hygiene — Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
D14 License Compliance — Not scored — this repository's package manifest is not parsed for licence data yet. A gap in the analyzer's language coverage, NOT a finding that the repository's licenses are compliant (a Gradle version catalogue, a Go module (go.mod/go.sum)), which this pass does not parse yet — so this dimension asserts nothing about this repository's licensing in either direction.
D17 Explicit Debt — explicit-debt markers are read through a C# workspace today, so they were not read for this repository's language — this asserts nothing about how many markers the code carries. Not scored — this is a gap in the analyzer, not a finding about this repository
D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
D19 Documentation Quality — LLM evaluation failed
D20 ADR Quality — N/A — ADRs are expected on deployable products with a user-facing host, not consumed libraries; no ADR log is required here.
D22 Internal API Consistency — No exposed public API
D23 Boundary Type-Coupling — Production source is present (.go, .java, .kt, .py) but bounded contexts are resolved over the C#/VB project set, which exposed none, so context scope could not be assessed. Not scored — this is a gap in the analyzer, not a verdict about this repository. Declaring the codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed — see the recommendation on this dimension for where. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["Acme.Billing"]`, `Catalog: ["Acme.Catalog"]`.
D24 Comment Value — No inline comments to assess — comment value is not applicable here.
D25 ADR Conformance — no ADRs to check
D26 Project Cohesion — Project cohesion is assessed over the .NET project set; this target exposed no projects, so project size and spread could not be assessed. Not scored — this is a gap in the analyzer's reach, not a verdict about this repository.
D27 Navigability — No calls could be sampled, so navigability was not assessed — tracing effort is measured over resolved call sites and this target exposed none. Not scored — this is a gap in the analyzer's reach, not a verdict about this repository.
D30 Dependency Vulnerabilities — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Gradle version catalogue, a Go module (go.mod/go.sum) — not scanned yet) — where an OSV-supported manifest exists, dependency vulnerabilities for this repository are reported under D38 instead.
D32 Data Compliance (PII/GDPR) — No PII/GDPR ruleset is bundled (the public p/gdpr semgrep pack was retired) — data compliance is not assessed in this scan.
D33 JS/npm Dependency Vulnerabilities — No JS/npm manifest or lockfile found outside build output (package.json, package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb); no JS dependencies to scan.
D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D5 Coupling — Inter-project coupling could not be assessed — no analyzable project graph was found for this repository. Not scored: a gap in the analyzer's reach, not a verdict about this repository. (Coupling here is Martin afferent/efferent/instability plus reference cycles across a project-reference graph, read today from .NET project files; other ecosystems' module graphs are not read yet.)
D6 Cohesion (LCOM4) — Cohesion (LCOM4) is measured over a C#/VB class graph, and this repository's production source is .go, .java, .kt, .py, which this pass does not read — so no class could be assessed. Not scored — this is a gap in the analyzer, not a finding about this repository.
D7 Architectural Integrity — no checkable ADRs and no dependency cycles — architectural integrity not assessed
D8 Code Coverage — Coverage not included — suite not readable by the collector
D9 Test Distribution — Test source is present (.java) but the test-pyramid classifier reads C# only, so its unit/integration/BDD/E2E split couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
DM1 Domain Modelling — applicable but skipped (1/2 markers — below the conservative bar): 448 value object(s)
ED1 Event-Driven — not run — 0/3 markers found
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not run — 0/3 markers found
GD1 Unfinished & placeholder code — no source files
IC1 Incompleteness & stubs — not analysed — these correctness checks are read from C# source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
P12 CI test-gate honesty — no data
P2 Observability — Observability was not assessed: this check reads .NET source (ILogger/Serilog, OpenTelemetry, health checks) and no such source carries this repository's product — because it is written in another language, or because the solution failed to load. Absence of a .NET logging idiom is NOT evidence that this repo lacks structured logging (it may log through its own ecosystem's logger). This is a gap in the analyzer, not a finding about this repository.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
P6 Release Hygiene — not evidenced — no changelog, version stamp or semver release tag in the repo
P7 Outbound HTTP resilience — not applicable — this isn't a service/API/worker
P8 Schema migrations — not assessed — schema-migration practice is read from EF Core usage in .NET source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (JaCoCo XML — the Gradle `jacocoTestReport` task) into the repo working tree before the scan — a CI step is the usual place, since the artefact is commonly gitignored, or wire coverage collection into CI, to enable this cross-layer check
PF1 Benchmark discipline — Performance was not assessed: this lens reads .NET source (allocation-aware APIs — Span/Memory, ArrayPool/ObjectPool, stackalloc — and a BenchmarkDotNet suite) and no such source was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
PF2 Allocation hygiene — Performance was not assessed: this lens reads .NET source (allocation-aware APIs — Span/Memory, ArrayPool/ObjectPool, stackalloc — and a BenchmarkDotNet suite) and no such source was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
PF3 Async & latency hygiene — Performance was not assessed: this lens reads .NET source (allocation-aware APIs — Span/Memory, ArrayPool/ObjectPool, stackalloc — and a BenchmarkDotNet suite) and no such source was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
S1 Web-Security Posture — Not assessed: these web-security controls are read from C# source (attributes, middleware, entity/column names, guard methods) and no C# source was loaded for this repository — because it is written in another language, or the solution failed to load. Absence of a .NET idiom is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
SC1 Supply-chain hygiene — no data
X1 Async correctness — not analysed — these correctness checks are read from C# source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
X2 Cancellation propagation — not analysed — these correctness checks are read from C# source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
X3 Exception handling — not analysed — these correctness checks are read from C# source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
X4 Structured logging — not analysed — these correctness checks are read from C# source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
X5 Nullable reference types — not analysed — these correctness checks are read from C# source and none was loaded for this repository, because it is written in another language or the solution failed to load. This is a gap in the analyzer, not a finding about this repository
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.
High: run-shell-injection .github/actions/ssh-access/action.yml:50— Using variable interpolation `${{...}}` with a workflow input in a `run:` step could allow an attacker to inject their own code into the runner. This would allow them to steal secrets and code. A workflow input is not bounded by this step and should be treated as untrusted. Instead, use an intermediate environment variable with `env:` to store the data and use the environment variable in the `run:` script. Reference it as a shell VARIABLE rather than a `${{ }}` interpolation, using your shell's own syntax (`"$ENVVAR"` in bash, `$env:ENVVAR` in PowerShell), so the value is passed as data and never re-expanded as code.
High: github-actions-mutable-action-tag .github/actions/upload-coverage/action.yml:58— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: codecov/codecov-action@<40-character SHA>`. This step references `codecov/codecov-action@v5`; resolve the SHA it points at today with `gh api repos/codecov/codecov-action/commits/v5 --jq .sha`.
High: github-actions-mutable-action-tag .github/actions/upload-coverage/action.yml:72— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: codecov/codecov-action@<40-character SHA>`. This step references `codecov/codecov-action@v5`; resolve the SHA it points at today with `gh api repos/codecov/codecov-action/commits/v5 --jq .sha`.
High: github-actions-mutable-action-tag .github/actions/upload-coverage/action.yml:86— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: codecov/codecov-action@<40-character SHA>`. This step references `codecov/codecov-action@v5`; resolve the SHA it points at today with `gh api repos/codecov/codecov-action/commits/v5 --jq .sha`.
High: github-actions-mutable-action-tag .github/workflows/ci-go-functions.yaml:42— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v6`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v6 --jq .sha`.
High: github-actions-mutable-action-tag .github/workflows/ci-go-functions.yaml:46— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: apache/pulsar-test-infra/paths-filter@<40-character SHA>`. This step references `apache/pulsar-test-infra/paths-filter@master`; resolve the SHA it points at today with `gh api repos/apache/pulsar-test-infra/commits/master --jq .sha`.
High: github-actions-mutable-action-tag .github/workflows/ci-go-functions.yaml:71— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v6`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v6 --jq .sha`.
High: github-actions-mutable-action-tag .github/workflows/ci-go-functions.yaml:77— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/setup-go@<40-character SHA>`. This step references `actions/setup-go@v6`; resolve the SHA it points at today with `gh api repos/actions/setup-go/commits/v6 --jq .sha`.
High: gha-curl-pipe-shell .github/workflows/ci-go-functions.yaml:83— A `run:` step pipes the output of `curl` or `wget` directly into a shell interpreter. This is the "curl | bash" install pattern — if the remote server is compromised or the URL is hijacked, an attacker can execute arbitrary code in your CI runner. Consider downloading the file first, verifying its checksum or signature, and then executing it.
High: github-actions-mutable-action-tag .github/workflows/ci-gradle-cache-update.yaml:56— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v6`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v6 --jq .sha`.
High: github-actions-mutable-action-tag .github/workflows/ci-gradle-cache-update.yaml:62— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/setup-java@<40-character SHA>`. This step references `actions/setup-java@v5`; resolve the SHA it points at today with `gh api repos/actions/setup-java/commits/v5 --jq .sha`.
High: github-actions-mutable-action-tag .github/workflows/ci-gradle-dependency-submission.yaml:52— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v6`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v6 --jq .sha`.
High: github-actions-mutable-action-tag .github/workflows/ci-gradle-dependency-submission.yaml:58— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/setup-java@<40-character SHA>`. This step references `actions/setup-java@v5`; resolve the SHA it points at today with `gh api repos/actions/setup-java/commits/v5 --jq .sha`.
High: github-actions-mutable-action-tag .github/workflows/ci-pulsarbot.yaml:38— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/github-script@<40-character SHA>`. This step references `actions/github-script@v8`; resolve the SHA it points at today with `gh api repos/actions/github-script/commits/v8 --jq .sha`.
High: github-actions-mutable-action-tag .github/workflows/codeql.yaml:56— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/setup-java@<40-character SHA>`. This step references `actions/setup-java@v5`; resolve the SHA it points at today with `gh api repos/actions/setup-java/commits/v5 --jq .sha`.
High: github-actions-mutable-action-tag .github/workflows/codeql.yaml:62— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v6`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v6 --jq .sha`.
High: github-actions-mutable-action-tag .github/workflows/codeql.yaml:83— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: github/codeql-action/init@<40-character SHA>`. This step references `github/codeql-action/init@v4`; resolve the SHA it points at today with `gh api repos/github/codeql-action/commits/v4 --jq .sha`.
High: github-actions-mutable-action-tag .github/workflows/codeql.yaml:89— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: github/codeql-action/analyze@<40-character SHA>`. This step references `github/codeql-action/analyze@v4`; resolve the SHA it points at today with `gh api repos/github/codeql-action/commits/v4 --jq .sha`.
High: github-actions-mutable-action-tag .github/workflows/labeler.yml:36— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/labeler@<40-character SHA>`. This step references `actions/labeler@v6`; resolve the SHA it points at today with `gh api repos/actions/labeler/commits/v6 --jq .sha`.
High: github-actions-mutable-action-tag .github/workflows/pulsar-ci-flaky.yaml:98— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/github-script@<40-character SHA>`. This step references `actions/github-script@v8`; resolve the SHA it points at today with `gh api repos/actions/github-script/commits/v8 --jq .sha`.
High: run-shell-injection .github/workflows/pulsar-ci-flaky.yaml:106— Using variable interpolation `${{...}}` with `github` context data in a `run:` step could allow an attacker to inject their own code into the runner. This would allow them to steal secrets and code. `github` context data can have arbitrary user input and should be treated as untrusted. Instead, use an intermediate environment variable with `env:` to store the data and use the environment variable in the `run:` script. Reference it as a shell VARIABLE rather than a `${{ }}` interpolation, using your shell's own syntax (`"$ENVVAR"` in bash, `$env:ENVVAR` in PowerShell), so the value is passed as data and never re-expanded as code.
High: github-actions-mutable-action-tag .github/workflows/pulsar-ci-flaky.yaml:117— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v6`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v6 --jq .sha`.
High: github-actions-mutable-action-tag .github/workflows/pulsar-ci-flaky.yaml:122— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: apache/pulsar-test-infra/paths-filter@<40-character SHA>`. This step references `apache/pulsar-test-infra/paths-filter@master`; resolve the SHA it points at today with `gh api repos/apache/pulsar-test-infra/commits/master --jq .sha`.
High: run-shell-injection .github/workflows/pulsar-ci-flaky.yaml:139— Using variable interpolation `${{...}}` with `github` context data in a `run:` step could allow an attacker to inject their own code into the runner. This would allow them to steal secrets and code. `github` context data can have arbitrary user input and should be treated as untrusted. Instead, use an intermediate environment variable with `env:` to store the data and use the environment variable in the `run:` script. Reference it as a shell VARIABLE rather than a `${{ }}` interpolation, using your shell's own syntax (`"$ENVVAR"` in bash, `$env:ENVVAR` in PowerShell), so the value is passed as data and never re-expanded as code.
High: run-shell-injection .github/workflows/pulsar-ci-flaky.yaml:148— Using variable interpolation `${{...}}` with `github` context data in a `run:` step could allow an attacker to inject their own code into the runner. This would allow them to steal secrets and code. `github` context data can have arbitrary user input and should be treated as untrusted. Instead, use an intermediate environment variable with `env:` to store the data and use the environment variable in the `run:` script. Reference it as a shell VARIABLE rather than a `${{ }}` interpolation, using your shell's own syntax (`"$ENVVAR"` in bash, `$env:ENVVAR` in PowerShell), so the value is passed as data and never re-expanded as code.
Orphaned knowledge pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/FunctionsBase.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SinksImpl.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/SchedulerManager.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/SinksBase.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SourcesImpl.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/LoadManagerShared.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSinks.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/FunctionsImpl.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSources.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-broker/src/main/java/org/apache/pulsar/broker/resourcegroup/ResourceGroup.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/SourcesBase.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Functions.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-broker/src/main/java/org/apache/pulsar/broker/TransactionMetadataStoreService.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentLongLongPairHashMap.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-testclient/src/main/java/org/apache/pulsar/testclient/BrokerMonitor.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-client-api/src/main/java/org/apache/pulsar/client/api/Consumer.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-websocket/src/main/java/org/apache/pulsar/websocket/ConsumerHandler.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Clusters.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdClusters.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/SinksImpl.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Orphaned knowledge pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/AuthorizationProvider.java— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Boundary-crossing change coupling: Transactions.java ↔ CmdTransactions.java pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Transactions.java— `pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Transactions.java` (context pulsar-client-admin-api) and `pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTransactions.java` (context pulsar-client-tools) sit in DIFFERENT parts of the tree yet change together 76% of the time (13 of the 17 commits that touched the less-changed of the two, renames followed) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see.
Boundary-crossing change coupling: PersistentTopic.java ↔ HierarchyTopicPolicies.java pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java— `pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java` (context pulsar-broker) and `pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/HierarchyTopicPolicies.java` (context pulsar-common) sit in DIFFERENT parts of the tree yet change together 76% of the time (22 of the 29 commits that touched the less-changed of the two, renames followed) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see.
Boundary-crossing change coupling: TransactionsImpl.java ↔ CmdTransactions.java pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/TransactionsImpl.java— `pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/TransactionsImpl.java` (context pulsar-client-admin) and `pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTransactions.java` (context pulsar-client-tools) sit in DIFFERENT parts of the tree yet change together 72% of the time (13 of the 18 commits that touched the less-changed of the two, renames followed) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see.
Boundary-crossing change coupling: TransactionsBase.java ↔ CmdTransactions.java pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/TransactionsBase.java— `pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/TransactionsBase.java` (context pulsar-broker) and `pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTransactions.java` (context pulsar-client-tools) sit in DIFFERENT parts of the tree yet change together 72% of the time (13 of the 18 commits that touched the less-changed of the two, renames followed) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see.
Boundary-crossing change coupling: Transactions.java ↔ CmdTransactions.java pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v3/Transactions.java— `pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v3/Transactions.java` (context pulsar-broker) and `pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTransactions.java` (context pulsar-client-tools) sit in DIFFERENT parts of the tree yet change together 72% of the time (13 of the 18 commits that touched the less-changed of the two, renames followed) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see.
Boundary-crossing change coupling: NamespacesImpl.java ↔ CmdNamespaces.java pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/NamespacesImpl.java— `pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/NamespacesImpl.java` (context pulsar-client-admin) and `pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java` (context pulsar-client-tools) sit in DIFFERENT parts of the tree yet change together 70% of the time (43 of the 61 commits that touched the less-changed of the two, renames followed) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see.
Boundary-crossing change coupling: PersistentTopic.java ↔ TopicStats.java pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java— `pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java` (context pulsar-broker) and `pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/TopicStats.java` (context pulsar-client-admin-api) sit in DIFFERENT parts of the tree yet change together 69% of the time (11 of the 16 commits that touched the less-changed of the two, renames followed) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see.
Boundary-crossing change coupling: NamespacesImpl.java ↔ PolicyName.java pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/NamespacesImpl.java— `pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/NamespacesImpl.java` (context pulsar-client-admin) and `pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/PolicyName.java` (context pulsar-common) sit in DIFFERENT parts of the tree yet change together 62% of the time (10 of the 16 commits that touched the less-changed of the two, renames followed) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see.
Boundary-crossing change coupling: Namespaces.java ↔ PolicyName.java pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Namespaces.java— `pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Namespaces.java` (context pulsar-client-admin-api) and `pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/PolicyName.java` (context pulsar-common) sit in DIFFERENT parts of the tree yet change together 62% of the time (10 of the 16 commits that touched the less-changed of the two, renames followed) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see.
High IaC: AWS-0028 deployment/terraform-ansible/aws/instances.tf— aws_instance should activate session tokens for Instance Metadata Service.
High IaC: AWS-0131 deployment/terraform-ansible/aws/instances.tf— Instance with unencrypted block device.
High IaC: AWS-0053 deployment/terraform-ansible/aws/network.tf— Load balancer is exposed to the internet.
High IaC: AWS-0164 deployment/terraform-ansible/aws/network.tf— Instances in a subnet should not receive a public IP address by default.
High IaC: AWS-0107 deployment/terraform-ansible/aws/security.tf— Security groups should not allow unrestricted ingress to SSH or RDP from any IP address.
High IaC: DS-0025 docker/pulsar/Dockerfile— 'apk add' is missing '--no-cache'
High IaC: DS-0015 docker/pulsar/Dockerfile.wolfi— 'yum clean all' missing
High IaC: DS-0025 docker/pulsar/Dockerfile.wolfi— 'apk add' is missing '--no-cache'
Critical IaC: AWS-0104 deployment/terraform-ansible/aws/security.tf— A security group rule should not allow unrestricted egress to any IP address.
D36 · Supply-chain Provenance & Signing· Build action pinned to a mutable branch · ×1
Build action pinned to a mutable branch — 3 CI action reference(s) point at a mutable BRANCH rather than a version tag or a commit SHA, 3 of them on a THIRD-PARTY action: `apache/pulsar-test-infra/paths-filter@master` (.github/workflows/pulsar-ci.yaml:115), `apache/pulsar-test-infra/paths-filter@master` (.github/workflows/pulsar-ci-flaky.yaml:122), `apache/pulsar-test-infra/paths-filter@master` (.github/workflows/ci-go-functions.yaml:46). A branch re-points on every upstream push, so whatever its tip holds when the job runs executes inside your pipeline with that job's secrets — a version tag at least moves only when the publisher cuts a release. Pin these to a full commit SHA first; the remaining tag refs are the same control at a lower blast radius.
Hotspot: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java— pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java changed 19 times in last 90 days, max complexity 38. 13 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
Hotspot: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java— pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java changed 15 times in last 90 days, max complexity 37. 8 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
Hotspot: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java— pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java changed 12 times in last 90 days, max complexity 31. 5 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
Hotspot: pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java— pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java changed 6 times in last 90 days, max complexity 55. 1 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
Hotspot: managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java— managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java changed 7 times in last 90 days, max complexity 25. 4 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
Hotspot: pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedDeliveryTracker.java pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedDeliveryTracker.java— pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedDeliveryTracker.java changed 9 times in last 90 days, max complexity 18. 7 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
Hotspot: pulsar-common/src/main/java/org/apache/pulsar/common/protocol/PulsarDecoder.java pulsar-common/src/main/java/org/apache/pulsar/common/protocol/PulsarDecoder.java— pulsar-common/src/main/java/org/apache/pulsar/common/protocol/PulsarDecoder.java changed 2 times in last 90 days, max complexity 80.
Hotspot: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java— pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java changed 5 times in last 90 days, max complexity 27. 3 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
Hotspot: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java— pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java changed 6 times in last 90 days, max complexity 21. 3 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
Hotspot: managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java— managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java changed 5 times in last 90 days, max complexity 24. 2 of those changes were fix/bug commits — a defect-dense hotspot worth prioritising.
Medium IaC: AWS-0178 deployment/terraform-ansible/aws/network.tf— VPC Flow Logs is a feature that enables you to capture information about the IP traffic going to and from network interfaces in your VPC. After you've created a flow log, you can view and retrieve its data in Amazon CloudWatch Logs. It is recommended that VPC Flow Logs be enabled for packet "Rejects" for VPCs.
Medium IaC: DS-0001 docker/pulsar/Dockerfile— ':latest' tag used
Medium IaC: DS-0013 docker/pulsar/Dockerfile— 'RUN cd ...' to change directory
Medium IaC: DS-0001 docker/pulsar/Dockerfile.wolfi— ':latest' tag used
D38 · OSV Dependency Vulnerabilities· Medium CVE · ×4
Medium CVE: GO-2026-5046 pulsar-function-go/go.mod— github.com/hamba/avro/v2 2.29.0 (github.com/hamba/avro/v2): GO-2026-5046 — no fixed version has been published yet. Track the advisory, and remove or replace github.com/hamba/avro/v2 if the exposure is not acceptable until one lands. One upgrade of github.com/hamba/avro/v2 2.29.0 clears all 3 advisories it raises: GO-2026-5046, GO-2026-5047, GO-2026-5048.
Medium CVE: GO-2026-5942 pulsar-function-go/go.mod— golang.org/x/net 0.55.0 (golang.org/x/net/dns/dnsmessage): GO-2026-5942 — golang.org/x/net is not a DIRECT requirement of this module: go.mod records it as `// indirect`, pulled in transitively, so raise it in place (run `go get golang.org/x/net@v0.56.0`, which updates the require line go.mod already holds for it).
Medium CVE: GO-2026-5970 pulsar-function-go/go.mod— golang.org/x/text 0.37.0 (golang.org/x/text/unicode/norm): GO-2026-5970 — golang.org/x/text is not a DIRECT requirement of this module: go.mod records it as `// indirect`, pulled in transitively, so raise it in place (run `go get golang.org/x/text@v0.39.0`, which updates the require line go.mod already holds for it).
Medium CVE: GO-2025-3955 pulsar-function-go/go.mod— stdlib 1.25.0 (net/http): GO-2025-3955 — fixed in Go 1.25.1; pin a build toolchain at or above it (go.mod `toolchain` directive, or your CI's Go version) — the `go` directive is a minimum language version, not the compiler that builds your binaries. One upgrade of stdlib 1.25.0 clears all 39 advisories it raises: GO-2025-3955, GO-2025-4006, GO-2025-4007, GO-2025-4008, GO-2025-4009, GO-2025-4010, GO-2025-4011, GO-2025-4012, GO-2025-4013, GO-2025-4014, GO-2025-4015, GO-2025-4155, GO-2025-4175, GO-2026-4337, GO-2026-4340, GO-2026-4341, GO-2026-4342, GO-2026-4601, GO-2026-4602, GO-2026-4603, GO-2026-4864, GO-2026-4865, GO-2026-4869, GO-2026-4870, GO-2026-4918, GO-2026-4946, GO-2026-4947, GO-2026-4970, GO-2026-4971, GO-2026-4976, GO-2026-4977, GO-2026-4980, GO-2026-4981, GO-2026-4982, GO-2026-4986, GO-2026-5037, GO-2026-5038, GO-2026-5039, GO-2026-5856.
PulsarDecoder.channelRead (cyclomatic 80) pulsar-common/src/main/java/org/apache/pulsar/common/protocol/PulsarDecoder.java:118— PulsarDecoder.channelRead has cyclomatic complexity 80 (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.
FunctionConfigUtils.convert (cyclomatic 70) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfigUtils.java:102— FunctionConfigUtils.convert has cyclomatic complexity 70 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TransferShedder.findBundlesForUnloading (cyclomatic 66) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/scheduler/TransferShedder.java:317— TransferShedder.findBundlesForUnloading has cyclomatic complexity 66 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FunctionDetailsCommand.processArguments (cyclomatic 66) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java:441— FunctionDetailsCommand.processArguments has cyclomatic complexity 66 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PulsarService.closeAsync (cyclomatic 55) pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java:517— PulsarService.closeAsync 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.
FunctionConfigUtils.doCommonChecks (cyclomatic 54) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfigUtils.java:793— FunctionConfigUtils.doCommonChecks 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.
SinkConfigUtils.convert (cyclomatic 51) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SinkConfigUtils.java:81— SinkConfigUtils.convert 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.
PerformanceTransaction.run (cyclomatic 51) pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceTransaction.java:191— PerformanceTransaction.run 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.
TopicsImpl.getMessagesFromHttpResponse (cyclomatic 50) pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/TopicsImpl.java:1286— TopicsImpl.getMessagesFromHttpResponse 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.
SinkDetailsCommand.processArguments (cyclomatic 46) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSinks.java:448— SinkDetailsCommand.processArguments has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FunctionConfigUtils.validateUpdate (cyclomatic 46) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfigUtils.java:989— FunctionConfigUtils.validateUpdate has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PerformanceProducer.runProducer (cyclomatic 45) pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceProducer.java:526— PerformanceProducer.runProducer 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.
SinkConfigUtils.validateAndExtractDetails (cyclomatic 42) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SinkConfigUtils.java:414— SinkConfigUtils.validateAndExtractDetails 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.
AbstractBaseDispatcher.filterEntriesForConsumer (cyclomatic 40) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractBaseDispatcher.java:126— AbstractBaseDispatcher.filterEntriesForConsumer has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PulsarClientException.unwrap (cyclomatic 40) pulsar-client-api/src/main/java/org/apache/pulsar/client/api/PulsarClientException.java:1055— PulsarClientException.unwrap has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SinkConfigUtils.validateUpdate (cyclomatic 39) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SinkConfigUtils.java:609— SinkConfigUtils.validateUpdate 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.
PersistentTopic.internalSubscribe (cyclomatic 38) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:915— PersistentTopic.internalSubscribe 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.
PulsarClientException.wrap (cyclomatic 38) pulsar-client-api/src/main/java/org/apache/pulsar/client/api/PulsarClientException.java:973— PulsarClientException.wrap 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.
RuntimeUtils.getGoInstanceCmd (cyclomatic 38) pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/RuntimeUtils.java:132— RuntimeUtils.getGoInstanceCmd 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.
ServerCnx.handleProducer (cyclomatic 37) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:2248— ServerCnx.handleProducer 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.
ServerCnx.handleSubscribe (cyclomatic 36) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:1814— ServerCnx.handleSubscribe 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.
PersistentTopicsBase.generateResponseWithEntry (cyclomatic 36) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:3219— PersistentTopicsBase.generateResponseWithEntry 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.
ProducerImpl.connectionOpened (cyclomatic 34) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:1933— ProducerImpl.connectionOpened 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.
SourceDetailsCommand.processArguments (cyclomatic 34) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSources.java:395— SourceDetailsCommand.processArguments 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.
RuntimeUtils.getCmd (cyclomatic 34) pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/RuntimeUtils.java:303— RuntimeUtils.getCmd 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.
DefaultNamespaceBundleSplitStrategyImpl.findBundlesToSplit (cyclomatic 33) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/strategy/DefaultNamespaceBundleSplitStrategyImpl.java:74— DefaultNamespaceBundleSplitStrategyImpl.findBundlesToSplit 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.
SinksImpl.updateSink (cyclomatic 33) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SinksImpl.java:265— SinksImpl.updateSink 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.
ProducerImpl.sendAsync (cyclomatic 32) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:564— ProducerImpl.sendAsync 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.
BrokerService.getManagedLedgerConfig (cyclomatic 31) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:2168— BrokerService.getManagedLedgerConfig 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.
FunctionDetailsCommand.mergeArgs (cyclomatic 31) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java:390— FunctionDetailsCommand.mergeArgs 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.
FunctionsImpl.updateFunction (cyclomatic 31) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java:259— FunctionsImpl.updateFunction 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.
SourcesImpl.updateSource (cyclomatic 31) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SourcesImpl.java:259— SourcesImpl.updateSource 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.
PerformanceClient.runPerformanceTest (cyclomatic 31) pulsar-testclient/src/main/java/org/apache/pulsar/proxy/socket/client/PerformanceClient.java:204— PerformanceClient.runPerformanceTest 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.
ConsumerBuilderImpl.subscribeAsync (cyclomatic 30) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBuilderImpl.java:138— ConsumerBuilderImpl.subscribeAsync 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.
SinksImpl.registerSink (cyclomatic 30) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SinksImpl.java:77— SinksImpl.registerSink 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.
ServiceUnitStateChannelImpl.monitorOwnerships (cyclomatic 29) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java:1736— ServiceUnitStateChannelImpl.monitorOwnerships 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.
ProducerImpl.recoverProcessOpSendMsgFrom (cyclomatic 29) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:2620— ProducerImpl.recoverProcessOpSendMsgFrom 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.
SourcesImpl.registerSource (cyclomatic 29) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SourcesImpl.java:76— SourcesImpl.registerSource 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.
PulsarService.start (cyclomatic 28) pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java:850— PulsarService.start 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.
FunctionsImpl.registerFunction (cyclomatic 28) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java:78— FunctionsImpl.registerFunction 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.
SourceConfigUtils.validateAndExtractDetails (cyclomatic 28) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SourceConfigUtils.java:262— SourceConfigUtils.validateAndExtractDetails 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.
PerformanceConsumer.pollLoop (cyclomatic 28) pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java:458— PerformanceConsumer.pollLoop 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.
PersistentStickyKeyDispatcherMultipleConsumers.filterAndGroupEntriesForDispatching (cyclomatic 27) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumers.java:444— PersistentStickyKeyDispatcherMultipleConsumers.filterAndGroupEntriesForDispatching 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.
ConsumerImpl.connectionOpened (cyclomatic 27) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:873— ConsumerImpl.connectionOpened 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.
ProxyServiceStarter.<init> (cyclomatic 27) pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyServiceStarter.java:130— ProxyServiceStarter.<init> 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.
ServiceUnitStateDataConflictResolver.shouldKeepLeft (cyclomatic 26) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateDataConflictResolver.java:69— ServiceUnitStateDataConflictResolver.shouldKeepLeft has cyclomatic complexity 26 (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.
IsolatedBookieEnsemblePlacementPolicy.getExcludedBookiesWithIsolationGroups (cyclomatic 26) pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/IsolatedBookieEnsemblePlacementPolicy.java:199— IsolatedBookieEnsemblePlacementPolicy.getExcludedBookiesWithIsolationGroups 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.
ConsumerImpl.messageReceived (cyclomatic 26) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:1431— ConsumerImpl.messageReceived 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.
PerformanceConsumer.run (cyclomatic 26) pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java:249— PerformanceConsumer.run 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.
RangeEntryCacheImpl.doAsyncReadEntriesByPosition (cyclomatic 26) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/cache/RangeEntryCacheImpl.java:385— RangeEntryCacheImpl.doAsyncReadEntriesByPosition 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.
PersistentStickyKeyDispatcherMultipleConsumersClassic.trySendMessagesToConsumers (cyclomatic 25) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumersClassic.java:273— PersistentStickyKeyDispatcherMultipleConsumersClassic.trySendMessagesToConsumers 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.
PulsarClientImpl.shutdown (cyclomatic 25) pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java:1047— PulsarClientImpl.shutdown has cyclomatic complexity 25 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
ClusterDetails.getClusterData (cyclomatic 25) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdClusters.java:384— ClusterDetails.getClusterData 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.
BasicKubernetesManifestCustomizer.mergeRuntimeOpts (cyclomatic 25) pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/BasicKubernetesManifestCustomizer.java:193— BasicKubernetesManifestCustomizer.mergeRuntimeOpts 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.
SinkConfigUtils.convertFromDetails (cyclomatic 25) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SinkConfigUtils.java:280— SinkConfigUtils.convertFromDetails 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.
ManagedLedgerImpl.internalTrimLedgers (cyclomatic 25) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:3065— ManagedLedgerImpl.internalTrimLedgers 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.
PersistentTopic.close (cyclomatic 24) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:1768— PersistentTopic.close 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.
BrokerServiceException.getClientErrorCode (cyclomatic 24) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerServiceException.java:241— BrokerServiceException.getClientErrorCode 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.
UniformLoadShedder.findBundlesForUnloading (cyclomatic 24) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/UniformLoadShedder.java:60— UniformLoadShedder.findBundlesForUnloading 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.
ConsumerImpl.processMessageChunk (cyclomatic 24) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:1575— ConsumerImpl.processMessageChunk 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.
ProducerBuilderFactory.createProducerBuilder (cyclomatic 24) pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/ProducerBuilderFactory.java:70— ProducerBuilderFactory.createProducerBuilder 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.
JavaInstanceStarter.inferringMissingTypeClassName (cyclomatic 24) pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/JavaInstanceStarter.java:330— JavaInstanceStarter.inferringMissingTypeClassName 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.
FunctionConfigUtils.doJavaChecks (cyclomatic 24) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfigUtils.java:625— FunctionConfigUtils.doJavaChecks 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.
SourceConfigUtils.convert (cyclomatic 24) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SourceConfigUtils.java:69— SourceConfigUtils.convert 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.
EntryCountEstimator.internalEstimateEntryCountByBytesSize (cyclomatic 24) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/EntryCountEstimator.java:71— EntryCountEstimator.internalEstimateEntryCountByBytesSize 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.
ManagedCursorImpl.asyncDelete (cyclomatic 24) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:2575— ManagedCursorImpl.asyncDelete 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.
PositionRangeSet.remove (cyclomatic 24) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/PositionRangeSet.java:389— PositionRangeSet.remove 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.
Consumer.individualAck (cyclomatic 23) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java:587— Consumer.individualAck 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.
ComponentImpl.triggerFunction (cyclomatic 23) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java:1098— ComponentImpl.triggerFunction 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.
LocalRunner.start (cyclomatic 23) pulsar-functions/localrun/src/main/java/org/apache/pulsar/functions/LocalRunner.java:347— LocalRunner.start 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.
PulsarClusterMetadataSetup.initializeCluster (cyclomatic 23) pulsar-broker/src/main/java/org/apache/pulsar/PulsarClusterMetadataSetup.java:295— PulsarClusterMetadataSetup.initializeCluster 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.
PersistentTopic.updateRates (cyclomatic 22) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:2673— PersistentTopic.updateRates 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.
ConsumerHashAssignmentsSnapshot.diffRanges (cyclomatic 22) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ConsumerHashAssignmentsSnapshot.java:176— ConsumerHashAssignmentsSnapshot.diffRanges 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.
SimpleLoadManagerImpl.findBrokerForPlacement (cyclomatic 22) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/SimpleLoadManagerImpl.java:753— SimpleLoadManagerImpl.findBrokerForPlacement 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.
TGTRefreshThread.run (cyclomatic 22) pulsar-common/src/main/java/org/apache/pulsar/common/sasl/TGTRefreshThread.java:99— TGTRefreshThread.run 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.
MembershipManager.checkFailures (cyclomatic 22) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/MembershipManager.java:121— MembershipManager.checkFailures 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.
PulsarWorkerService.stop (cyclomatic 22) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/PulsarWorkerService.java:622— PulsarWorkerService.stop 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.
FunctionConfigUtils.convertFromDetails (cyclomatic 22) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfigUtils.java:402— FunctionConfigUtils.convertFromDetails 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.
ServerCnx.channelInactive (cyclomatic 21) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:437— ServerCnx.channelInactive 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.
NamespacesBase.internalRetryableDeleteNamespaceAsync0 (cyclomatic 21) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:288— NamespacesBase.internalRetryableDeleteNamespaceAsync0 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.
TopicPolicies.clone (cyclomatic 21) pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/TopicPolicies.java:96— TopicPolicies.clone 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.
HttpClient.executeGet (cyclomatic 21) pulsar-client/src/main/java/org/apache/pulsar/client/impl/HttpClient.java:200— HttpClient.executeGet 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.
JavaInstanceRunnable.setupInput (cyclomatic 21) pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java:833— JavaInstanceRunnable.setupInput 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.
SourceConfigUtils.validateUpdate (cyclomatic 21) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SourceConfigUtils.java:380— SourceConfigUtils.validateUpdate 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.
ProducerHandler.onWebSocketText (cyclomatic 21) pulsar-websocket/src/main/java/org/apache/pulsar/websocket/ProducerHandler.java:179— ProducerHandler.onWebSocketText 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.
BrokerStarter.call (cyclomatic 21) pulsar-broker/src/main/java/org/apache/pulsar/PulsarBrokerStarter.java:154— BrokerStarter.call 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.
ManagedLedgerImpl.getNumberOfEntries (cyclomatic 21) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:4041— ManagedLedgerImpl.getNumberOfEntries 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.
ThreadLeakDetectorListener.shouldSkipThread (cyclomatic 20) buildtools/src/main/java/org/apache/pulsar/tests/ThreadLeakDetectorListener.java:230— ThreadLeakDetectorListener.shouldSkipThread 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.
PersistentDispatcherMultipleConsumersClassic.readMoreEntries (cyclomatic 20) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumersClassic.java:314— PersistentDispatcherMultipleConsumersClassic.readMoreEntries 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.
AdminResource.internalCreatePartitionedTopic (cyclomatic 20) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java:534— AdminResource.internalCreatePartitionedTopic 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.
FieldSchemaBuilderImpl.build (cyclomatic 20) pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/FieldSchemaBuilderImpl.java:102— FieldSchemaBuilderImpl.build 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.
PulsarClientImpl.<init> (cyclomatic 20) pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java:204— PulsarClientImpl.<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.
CmdConsume.consume (cyclomatic 20) pulsar-client-tools/src/main/java/org/apache/pulsar/client/cli/CmdConsume.java:178— CmdConsume.consume 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.
AbstractTwoPhaseCompactor.phaseTwoLoop (cyclomatic 20) pulsar-broker/src/main/java/org/apache/pulsar/compaction/AbstractTwoPhaseCompactor.java:282— AbstractTwoPhaseCompactor.phaseTwoLoop 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.
PulsarShell.run (cyclomatic 20) pulsar-client-tools/src/main/java/org/apache/pulsar/shell/PulsarShell.java:337— PulsarShell.run 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.
NonPersistentSubscription.addConsumer (cyclomatic 19) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentSubscription.java:111— NonPersistentSubscription.addConsumer 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.
GeoPersistentReplicator.replicateEntries (cyclomatic 19) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/GeoPersistentReplicator.java:149— GeoPersistentReplicator.replicateEntries 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.
PersistentSubscription.getStatsAsync (cyclomatic 19) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java:1419— PersistentSubscription.getStatsAsync 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.
ServerCnx.handleConnect (cyclomatic 19) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:1658— ServerCnx.handleConnect 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.
PulsarPrometheusMetricsServlet.doGet (cyclomatic 19) pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/PulsarPrometheusMetricsServlet.java:67— PulsarPrometheusMetricsServlet.doGet 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.
ServiceUnitStateChannelImpl.doCleanup (cyclomatic 19) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java:1610— ServiceUnitStateChannelImpl.doCleanup 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.
ClientCnx.revertClientExToErrorCode (cyclomatic 19) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java:1760— ClientCnx.revertClientExToErrorCode 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.
FunctionDetailsCommand.validateFunctionConfigs (cyclomatic 19) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java:695— FunctionDetailsCommand.validateFunctionConfigs 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.
LocalRunner.mergeArgs (cyclomatic 19) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java:814— LocalRunner.mergeArgs 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.
KubernetesRuntimeFactory.initialize (cyclomatic 19) pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeFactory.java:135— KubernetesRuntimeFactory.initialize 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.
ComponentImpl.getFunctionPackageLocation (cyclomatic 19) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java:290— ComponentImpl.getFunctionPackageLocation 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.
FunctionRuntimeCommon.getClassLoaderFromPackage (cyclomatic 19) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionRuntimeCommon.java:47— FunctionRuntimeCommon.getClassLoaderFromPackage 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.
PerformanceProducer.run (cyclomatic 19) pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceProducer.java:258— PerformanceProducer.run has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ActiveManagedCursorContainerImpl.moveNodeToNewPosition (cyclomatic 19) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ActiveManagedCursorContainerImpl.java:464— ActiveManagedCursorContainerImpl.moveNodeToNewPosition 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.
ShadowManagedLedgerImpl.processSourceManagedLedgerInfo (cyclomatic 19) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ShadowManagedLedgerImpl.java:283— ShadowManagedLedgerImpl.processSourceManagedLedgerInfo 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.
BucketDelayedDeliveryTracker.getScheduledMessages (cyclomatic 18) pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedDeliveryTracker.java:665— BucketDelayedDeliveryTracker.getScheduledMessages 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.
PersistentStickyKeyDispatcherMultipleConsumers.trySendMessagesToConsumers (cyclomatic 18) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumers.java:231— PersistentStickyKeyDispatcherMultipleConsumers.trySendMessagesToConsumers 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.
PersistentTopic.delete (cyclomatic 18) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:1563— PersistentTopic.delete 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.
BrokerService.getTopic (cyclomatic 18) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:1298— BrokerService.getTopic 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.
ServerCnx.handlePartitionMetadataRequest (cyclomatic 18) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:1181— ServerCnx.handlePartitionMetadataRequest 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.
MultipleListenerValidator.parseAdvertisedListeners (cyclomatic 18) pulsar-broker-common/src/main/java/org/apache/pulsar/broker/validator/MultipleListenerValidator.java:162— MultipleListenerValidator.parseAdvertisedListeners 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.
ConcurrentOpenLongPairRangeSet.remove (cyclomatic 18) pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentOpenLongPairRangeSet.java:392— ConcurrentOpenLongPairRangeSet.remove 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.
OpenLongPairRangeSet.remove (cyclomatic 18) pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/OpenLongPairRangeSet.java:394— OpenLongPairRangeSet.remove 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.
ConsumerImpl.receiveIndividualMessagesFromBatch (cyclomatic 18) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:1784— ConsumerImpl.receiveIndividualMessagesFromBatch 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.
GeoReplicationProducerImpl.ackReceivedReplicatedMsg (cyclomatic 18) pulsar-client/src/main/java/org/apache/pulsar/client/impl/GeoReplicationProducerImpl.java:92— GeoReplicationProducerImpl.ackReceivedReplicatedMsg 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.
WindowConfigUtils.validate (cyclomatic 18) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/WindowConfigUtils.java:28— WindowConfigUtils.validate 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.
ProxyService.close (cyclomatic 18) pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyService.java:393— ProxyService.close has cyclomatic complexity 18 (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.
PerformanceClient.loadArguments (cyclomatic 18) pulsar-testclient/src/main/java/org/apache/pulsar/proxy/socket/client/PerformanceClient.java:143— PerformanceClient.loadArguments 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.
PersistentDispatcherMultipleConsumers.readMoreEntries (cyclomatic 17) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:341— PersistentDispatcherMultipleConsumers.readMoreEntries 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.
PersistentDispatcherMultipleConsumers.trySendMessagesToConsumers (cyclomatic 17) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:780— PersistentDispatcherMultipleConsumers.trySendMessagesToConsumers 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.
PersistentDispatcherMultipleConsumersClassic.trySendMessagesToConsumers (cyclomatic 17) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumersClassic.java:677— PersistentDispatcherMultipleConsumersClassic.trySendMessagesToConsumers 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.
PersistentSubscription.reuseOrCreateDispatcher (cyclomatic 17) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java:302— PersistentSubscription.reuseOrCreateDispatcher 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.
AutoScaleConfig.applyOverride (cyclomatic 17) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/scalable/AutoScaleConfig.java:128— AutoScaleConfig.applyOverride 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.
PersistentTopicsBase.internalUpdatePartitionedTopicAsync (cyclomatic 17) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:382— PersistentTopicsBase.internalUpdatePartitionedTopicAsync 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.
NonPersistentTopics.getPartitionedStats (cyclomatic 17) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/NonPersistentTopics.java:252— NonPersistentTopics.getPartitionedStats 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.
Section.put (cyclomatic 17) pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentLongHashMap.java:388— Section.put 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.
SSLContextValidatorEngine.handshake (cyclomatic 17) pulsar-common/src/main/java/org/apache/pulsar/common/util/keystoretls/SSLContextValidatorEngine.java:80— SSLContextValidatorEngine.handshake has cyclomatic complexity 17 (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.
Reflections.loadClass (cyclomatic 17) pulsar-common/src/main/java/org/apache/pulsar/common/util/Reflections.java:282— Reflections.loadClass 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.
OpenTelemetryConsumerInterceptor.onAcknowledgeCumulative (cyclomatic 17) pulsar-client/src/main/java/org/apache/pulsar/client/impl/tracing/OpenTelemetryConsumerInterceptor.java:184— OpenTelemetryConsumerInterceptor.onAcknowledgeCumulative 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.
ConsumerImpl.<init> (cyclomatic 17) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:293— ConsumerImpl.<init> 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.
PartitionedProducerImpl.internalSendWithTxnAsync (cyclomatic 17) pulsar-client/src/main/java/org/apache/pulsar/client/impl/PartitionedProducerImpl.java:239— PartitionedProducerImpl.internalSendWithTxnAsync has cyclomatic complexity 17 (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.
ProducerImpl.serializeAndSendMessage (cyclomatic 17) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:761— ProducerImpl.serializeAndSendMessage 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.
CmdRead.read (cyclomatic 17) pulsar-client-tools/src/main/java/org/apache/pulsar/client/cli/CmdRead.java:138— CmdRead.read 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.
SinkDetailsCommand.mergeArgs (cyclomatic 17) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSinks.java:419— SinkDetailsCommand.mergeArgs 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.
ProxyServiceStarter.addWebServerHandlers (cyclomatic 17) pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyServiceStarter.java:371— ProxyServiceStarter.addWebServerHandlers 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.
ManagedLedgerWriter.run (cyclomatic 17) pulsar-testclient/src/main/java/org/apache/pulsar/testclient/ManagedLedgerWriter.java:142— ManagedLedgerWriter.run 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.
PulsarClusterMetadataSetup.main (cyclomatic 17) pulsar-broker/src/main/java/org/apache/pulsar/PulsarClusterMetadataSetup.java:221— PulsarClusterMetadataSetup.main has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PersistentDispatcherSingleActiveConsumer.readMoreEntries (cyclomatic 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherSingleActiveConsumer.java:335— PersistentDispatcherSingleActiveConsumer.readMoreEntries 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.
PersistentTopic.asyncGetStats (cyclomatic 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:2954— PersistentTopic.asyncGetStats 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.
AbstractDispatcherSingleActiveConsumer.internalAddConsumer (cyclomatic 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractDispatcherSingleActiveConsumer.java:170— AbstractDispatcherSingleActiveConsumer.internalAddConsumer 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.
Consumer.sendMessages (cyclomatic 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java:345— Consumer.sendMessages 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.
AuthenticationProviderOpenID.verifyJWT (cyclomatic 16) pulsar-broker-auth-oidc/src/main/java/org/apache/pulsar/broker/authentication/oidc/AuthenticationProviderOpenID.java:404— AuthenticationProviderOpenID.verifyJWT 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.
PulsarAuthorizationProvider.checkPermission (cyclomatic 16) pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/PulsarAuthorizationProvider.java:495— PulsarAuthorizationProvider.checkPermission 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.
WebService.<init> (cyclomatic 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/web/WebService.java:125— WebService.<init> 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.
PersistentTopicsBase.internalCreateSubscription (cyclomatic 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:2359— PersistentTopicsBase.internalCreateSubscription 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.
SimpleLoadManagerImpl.writeLoadReportOnZookeeper (cyclomatic 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/SimpleLoadManagerImpl.java:1148— SimpleLoadManagerImpl.writeLoadReportOnZookeeper 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.
LocalBookkeeperEnsemble.stop (cyclomatic 16) pulsar-broker/src/main/java/org/apache/pulsar/zookeeper/LocalBookkeeperEnsemble.java:480— LocalBookkeeperEnsemble.stop 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.
ConsumerImpl.doReconsumeLater (cyclomatic 16) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:683— ConsumerImpl.doReconsumeLater 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.
PersistentAcknowledgmentsGroupingTracker.flushAsync (cyclomatic 16) pulsar-client/src/main/java/org/apache/pulsar/client/impl/PersistentAcknowledgmentsGroupingTracker.java:440— PersistentAcknowledgmentsGroupingTracker.flushAsync 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.
PulsarClientImpl.subscribeAsync (cyclomatic 16) pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java:670— PulsarClientImpl.subscribeAsync 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.
CmdConsume.consumeFromWebSocket (cyclomatic 16) pulsar-client-tools/src/main/java/org/apache/pulsar/client/cli/CmdConsume.java:309— CmdConsume.consumeFromWebSocket 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.
CmdRead.readFromWebSocket (cyclomatic 16) pulsar-client-tools/src/main/java/org/apache/pulsar/client/cli/CmdRead.java:223— CmdRead.readFromWebSocket 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.
PulsarSource.createConsumeBuilder (cyclomatic 16) pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/source/PulsarSource.java:62— PulsarSource.createConsumeBuilder 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.
SinksImpl.validateUpdateRequestParams (cyclomatic 16) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SinksImpl.java:746— SinksImpl.validateUpdateRequestParams 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.
ProxyConnection.channelRead (cyclomatic 16) pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java:290— ProxyConnection.channelRead 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.
ConsumerHandler.getConsumerConfiguration (cyclomatic 16) pulsar-websocket/src/main/java/org/apache/pulsar/websocket/ConsumerHandler.java:446— ConsumerHandler.getConsumerConfiguration 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.
PulsarStandaloneStarter.<init> (cyclomatic 16) pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandaloneStarter.java:48— PulsarStandaloneStarter.<init> 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.
ManagedCursorImpl.recoverFromLedger (cyclomatic 16) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:611— ManagedCursorImpl.recoverFromLedger 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.
ManagedLedgerImpl.maybeOffload (cyclomatic 16) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:2892— ManagedLedgerImpl.maybeOffload 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.
OpFindNewest.readEntryFailed (cyclomatic 16) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpFindNewest.java:147— OpFindNewest.readEntryFailed 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.
BlobStoreBackedReadHandleImplV2.readAsync (cyclomatic 16) tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreBackedReadHandleImplV2.java:173— BlobStoreBackedReadHandleImplV2.readAsync 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.
LLM evaluation failed — JSON parse error: Expected end of string, but instead reached end of data. Path: $.findings[0].issue | LineNumber: 0 | BytePositionInLine: 1081.
TransferShedder.findBundlesForUnloading (cognitive 182) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/scheduler/TransferShedder.java:317— TransferShedder.findBundlesForUnloading has cognitive complexity 182 (threshold 15). Drivers by points: if/else 161, loops 8, boolean chains 6, ternaries 5, error handling 2 (nesting depth added 111). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PerformanceTransaction.run (cognitive 130) pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceTransaction.java:191— PerformanceTransaction.run has cognitive complexity 130 (threshold 15). Drivers by points: if/else 73, error handling 26, loops 26, ternaries 3, boolean chains 2 (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.
PerformanceProducer.runProducer (cognitive 111) pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceProducer.java:526— PerformanceProducer.runProducer has cognitive complexity 111 (threshold 15). Drivers by points: if/else 81, error handling 17, loops 12, boolean chains 1 (nesting depth added 61). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FunctionConfigUtils.convert (cognitive 87) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfigUtils.java:102— FunctionConfigUtils.convert has cognitive complexity 87 (threshold 15). Drivers by points: if/else 75, boolean chains 9, error handling 3 (nesting depth added 10). 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.
AbstractBaseDispatcher.filterEntriesForConsumer (cognitive 84) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractBaseDispatcher.java:126— AbstractBaseDispatcher.filterEntriesForConsumer has cognitive complexity 84 (threshold 15). Drivers by points: if/else 71, boolean chains 6, ternaries 6, loops 1 (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.
FunctionDetailsCommand.processArguments (cognitive 81) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java:441— FunctionDetailsCommand.processArguments has cognitive complexity 81 (threshold 15). Drivers by points: if/else 80, boolean chains 1 (nesting depth added 13). 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.
IsolatedBookieEnsemblePlacementPolicy.getExcludedBookiesWithIsolationGroups (cognitive 71) pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/IsolatedBookieEnsemblePlacementPolicy.java:199— IsolatedBookieEnsemblePlacementPolicy.getExcludedBookiesWithIsolationGroups has cognitive complexity 71 (threshold 15). Drivers by points: if/else 34, loops 27, ternaries 6, boolean chains 3, error handling 1 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DefaultNamespaceBundleSplitStrategyImpl.findBundlesToSplit (cognitive 70) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/strategy/DefaultNamespaceBundleSplitStrategyImpl.java:74— DefaultNamespaceBundleSplitStrategyImpl.findBundlesToSplit has cognitive complexity 70 (threshold 15). Drivers by points: if/else 60, error handling 4, loops 4, boolean chains 2 (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.
PerformanceClient.runPerformanceTest (cognitive 70) pulsar-testclient/src/main/java/org/apache/pulsar/proxy/socket/client/PerformanceClient.java:204— PerformanceClient.runPerformanceTest has cognitive complexity 70 (threshold 15). Drivers by points: if/else 40, loops 13, error handling 10, ternaries 4, boolean chains 3 (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.
ProducerImpl.recoverProcessOpSendMsgFrom (cognitive 69) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:2620— ProducerImpl.recoverProcessOpSendMsgFrom has cognitive complexity 69 (threshold 15). Drivers by points: if/else 50, ternaries 10, error handling 5, boolean chains 3, loops 1 (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.
SinkConfigUtils.validateAndExtractDetails (cognitive 68) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SinkConfigUtils.java:414— SinkConfigUtils.validateAndExtractDetails has cognitive complexity 68 (threshold 15). Drivers by points: if/else 53, loops 7, boolean chains 5, error handling 3 (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.
PerformanceConsumer.pollLoop (cognitive 68) pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java:458— PerformanceConsumer.pollLoop has cognitive complexity 68 (threshold 15). Drivers by points: if/else 45, error handling 15, boolean chains 4, loops 4 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PulsarService.closeAsync (cognitive 67) pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java:517— PulsarService.closeAsync has cognitive complexity 67 (threshold 15). Drivers by points: if/else 51, error handling 13, boolean chains 3 (nesting depth added 10). 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.
TGTRefreshThread.run (cognitive 66) pulsar-common/src/main/java/org/apache/pulsar/common/sasl/TGTRefreshThread.java:99— TGTRefreshThread.run has cognitive complexity 66 (threshold 15). Drivers by points: if/else 34, error handling 24, loops 6, 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.
PersistentStickyKeyDispatcherMultipleConsumers.filterAndGroupEntriesForDispatching (cognitive 65) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumers.java:444— PersistentStickyKeyDispatcherMultipleConsumers.filterAndGroupEntriesForDispatching has cognitive complexity 65 (threshold 15). Drivers by points: if/else 52, loops 7, boolean chains 4, ternaries 2 (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.
FunctionConfigUtils.doCommonChecks (cognitive 65) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfigUtils.java:793— FunctionConfigUtils.doCommonChecks has cognitive complexity 65 (threshold 15). Drivers by points: if/else 48, boolean chains 16, 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.
RangeEntryCacheImpl.doAsyncReadEntriesByPosition (cognitive 64) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/cache/RangeEntryCacheImpl.java:385— RangeEntryCacheImpl.doAsyncReadEntriesByPosition has cognitive complexity 64 (threshold 15). Drivers by points: if/else 41, loops 20, boolean chains 3 (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.
RuntimeUtils.getCmd (cognitive 61) pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/RuntimeUtils.java:303— RuntimeUtils.getCmd has cognitive complexity 61 (threshold 15). Drivers by points: if/else 58, boolean chains 3 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumerHashAssignmentsSnapshot.diffRanges (cognitive 60) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ConsumerHashAssignmentsSnapshot.java:176— ConsumerHashAssignmentsSnapshot.diffRanges has cognitive complexity 60 (threshold 15). Drivers by points: ternaries 33, if/else 23, loops 3, boolean chains 1 (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.
TopicsImpl.getMessagesFromHttpResponse (cognitive 59) pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/TopicsImpl.java:1286— TopicsImpl.getMessagesFromHttpResponse has cognitive complexity 59 (threshold 15). Drivers by points: if/else 50, loops 5, boolean chains 4 (nesting depth added 8). 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.
SinkConfigUtils.convert (cognitive 58) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SinkConfigUtils.java:81— SinkConfigUtils.convert has cognitive complexity 58 (threshold 15). Drivers by points: if/else 48, boolean chains 8, ternaries 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ComponentImpl.getFunctionPackageLocation (cognitive 52) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java:290— ComponentImpl.getFunctionPackageLocation has cognitive complexity 52 (threshold 15). Drivers by points: if/else 47, match/switch 3, boolean chains 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SinkDetailsCommand.processArguments (cognitive 50) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSinks.java:448— SinkDetailsCommand.processArguments has cognitive complexity 50 (threshold 15). Drivers by points: if/else 46, boolean chains 3, error handling 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ServerCnx.handleProducer (cognitive 49) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:2248— ServerCnx.handleProducer has cognitive complexity 49 (threshold 15). Drivers by points: if/else 40, ternaries 5, boolean chains 4 (nesting depth added 10). 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.
MultipleListenerValidator.parseAdvertisedListeners (cognitive 49) pulsar-broker-common/src/main/java/org/apache/pulsar/broker/validator/MultipleListenerValidator.java:162— MultipleListenerValidator.parseAdvertisedListeners has cognitive complexity 49 (threshold 15). Drivers by points: if/else 42, loops 4, error handling 3 (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.
Section.put (cognitive 49) pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentLongHashMap.java:388— Section.put has cognitive complexity 49 (threshold 15). Drivers by points: ternaries 26, if/else 22, loops 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProducerBuilderFactory.createProducerBuilder (cognitive 49) pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/ProducerBuilderFactory.java:70— ProducerBuilderFactory.createProducerBuilder has cognitive complexity 49 (threshold 15). Drivers by points: if/else 40, boolean chains 6, loops 3 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MembershipManager.checkFailures (cognitive 49) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/MembershipManager.java:121— MembershipManager.checkFailures has cognitive complexity 49 (threshold 15). Drivers by points: if/else 38, loops 11 (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.
ServerCnx.handleSubscribe (cognitive 48) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:1814— ServerCnx.handleSubscribe has cognitive complexity 48 (threshold 15). Drivers by points: if/else 26, ternaries 10, error handling 7, boolean chains 5 (nesting depth added 8). 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.
SimpleLoadManagerImpl.writeLoadReportOnZookeeper (cognitive 48) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/SimpleLoadManagerImpl.java:1148— SimpleLoadManagerImpl.writeLoadReportOnZookeeper has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 25, if/else 21, boolean chains 2 (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.
ProducerImpl.connectionOpened (cognitive 47) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:1933— ProducerImpl.connectionOpened has cognitive complexity 47 (threshold 15). Drivers by points: if/else 38, boolean chains 9 (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.
ProducerImpl.sendAsync (cognitive 47) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:564— ProducerImpl.sendAsync has cognitive complexity 47 (threshold 15). Drivers by points: if/else 26, ternaries 9, boolean chains 8, error handling 2, 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.
PersistentDispatcherMultipleConsumersClassic.readMoreEntries (cognitive 46) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumersClassic.java:314— PersistentDispatcherMultipleConsumersClassic.readMoreEntries has cognitive complexity 46 (threshold 15). Drivers by points: if/else 40, boolean chains 3, ternaries 3 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PersistentStickyKeyDispatcherMultipleConsumersClassic.trySendMessagesToConsumers (cognitive 46) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumersClassic.java:273— PersistentStickyKeyDispatcherMultipleConsumersClassic.trySendMessagesToConsumers has cognitive complexity 46 (threshold 15). Drivers by points: if/else 33, loops 9, boolean chains 4 (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.
PersistentTopic.internalSubscribe (cognitive 46) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:915— PersistentTopic.internalSubscribe has cognitive complexity 46 (threshold 15). Drivers by points: if/else 27, boolean chains 11, error handling 5, ternaries 3 (nesting depth added 7). 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.
FunctionConfigUtils.validateUpdate (cognitive 45) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfigUtils.java:989— FunctionConfigUtils.validateUpdate has cognitive complexity 45 (threshold 15). Drivers by points: if/else 36, boolean chains 9. 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.
Consumer.individualAck (cognitive 44) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java:587— Consumer.individualAck has cognitive complexity 44 (threshold 15). Drivers by points: if/else 30, loops 5, ternaries 5, boolean chains 4 (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.
OpenTelemetryConsumerInterceptor.onAcknowledgeCumulative (cognitive 44) pulsar-client/src/main/java/org/apache/pulsar/client/impl/tracing/OpenTelemetryConsumerInterceptor.java:184— OpenTelemetryConsumerInterceptor.onAcknowledgeCumulative has cognitive complexity 44 (threshold 15). Drivers by points: if/else 32, error handling 10, loops 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumerBuilderImpl.subscribeAsync (cognitive 44) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBuilderImpl.java:138— ConsumerBuilderImpl.subscribeAsync has cognitive complexity 44 (threshold 15). Drivers by points: if/else 34, boolean chains 10 (nesting depth added 8). 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.
FunctionRuntimeCommon.getClassLoaderFromPackage (cognitive 43) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionRuntimeCommon.java:47— FunctionRuntimeCommon.getClassLoaderFromPackage has cognitive complexity 43 (threshold 15). Drivers by points: if/else 25, error handling 18 (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.
LocalRunner.start (cognitive 43) pulsar-functions/localrun/src/main/java/org/apache/pulsar/functions/LocalRunner.java:347— LocalRunner.start has cognitive complexity 43 (threshold 15). Drivers by points: if/else 29, loops 6, ternaries 5, 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.
Consumer.sendMessages (cognitive 42) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java:345— Consumer.sendMessages has cognitive complexity 42 (threshold 15). Drivers by points: if/else 35, ternaries 5, boolean chains 1, loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PersistentAcknowledgmentsGroupingTracker.flushAsync (cognitive 41) pulsar-client/src/main/java/org/apache/pulsar/client/impl/PersistentAcknowledgmentsGroupingTracker.java:440— PersistentAcknowledgmentsGroupingTracker.flushAsync has cognitive complexity 41 (threshold 15). Drivers by points: if/else 28, loops 12, boolean chains 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PulsarClientException.unwrap (cognitive 40) pulsar-client-api/src/main/java/org/apache/pulsar/client/api/PulsarClientException.java:1055— PulsarClientException.unwrap has cognitive complexity 40 (threshold 15). Drivers by points: if/else 40. 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.
RuntimeUtils.getGoInstanceCmd (cognitive 40) pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/RuntimeUtils.java:132— RuntimeUtils.getGoInstanceCmd has cognitive complexity 40 (threshold 15). Drivers by points: if/else 36, boolean chains 4 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ManagedCursorImpl.asyncDelete (cognitive 40) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:2575— ManagedCursorImpl.asyncDelete has cognitive complexity 40 (threshold 15). Drivers by points: if/else 34, boolean chains 3, error handling 2, 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.
ConsumerImpl.messageReceived (cognitive 39) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:1431— ConsumerImpl.messageReceived has cognitive complexity 39 (threshold 15). Drivers by points: if/else 28, boolean chains 6, loops 2, ternaries 2, error handling 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.
SinksImpl.updateSink (cognitive 39) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SinksImpl.java:265— SinksImpl.updateSink has cognitive complexity 39 (threshold 15). Drivers by points: if/else 22, boolean chains 10, error handling 7 (nesting depth added 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.
ProxyServiceStarter.addWebServerHandlers (cognitive 39) pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyServiceStarter.java:371— ProxyServiceStarter.addWebServerHandlers has cognitive complexity 39 (threshold 15). Drivers by points: if/else 18, error handling 14, loops 3, match/switch 3, boolean chains 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PersistentTopicsBase.generateResponseWithEntry (cognitive 38) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:3219— PersistentTopicsBase.generateResponseWithEntry has cognitive complexity 38 (threshold 15). Drivers by points: if/else 34, loops 2, boolean chains 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ConsumerImpl.processMessageChunk (cognitive 38) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:1575— ConsumerImpl.processMessageChunk has cognitive complexity 38 (threshold 15). Drivers by points: if/else 29, boolean chains 7, ternaries 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.
SourceDetailsCommand.processArguments (cognitive 38) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSources.java:395— SourceDetailsCommand.processArguments has cognitive complexity 38 (threshold 15). Drivers by points: if/else 35, boolean chains 2, error handling 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
JavaInstanceStarter.inferringMissingTypeClassName (cognitive 38) pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/JavaInstanceStarter.java:330— JavaInstanceStarter.inferringMissingTypeClassName has cognitive complexity 38 (threshold 15). Drivers by points: if/else 21, boolean chains 10, ternaries 6, match/switch 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.
SinkConfigUtils.validateUpdate (cognitive 38) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SinkConfigUtils.java:609— SinkConfigUtils.validateUpdate has cognitive complexity 38 (threshold 15). Drivers by points: if/else 32, boolean chains 6. 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.
EntryCountEstimator.internalEstimateEntryCountByBytesSize (cognitive 38) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/EntryCountEstimator.java:71— EntryCountEstimator.internalEstimateEntryCountByBytesSize has cognitive complexity 38 (threshold 15). Drivers by points: if/else 25, boolean chains 8, loops 4, error handling 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.
PersistentTopic.delete (cognitive 37) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:1563— PersistentTopic.delete has cognitive complexity 37 (threshold 15). Drivers by points: if/else 30, ternaries 5, boolean chains 1, 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.
BrokerService.getManagedLedgerConfig (cognitive 37) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:2168— BrokerService.getManagedLedgerConfig has cognitive complexity 37 (threshold 15). Drivers by points: if/else 23, boolean chains 10, error handling 2, ternaries 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.
PulsarClientException.wrap (cognitive 37) pulsar-client-api/src/main/java/org/apache/pulsar/client/api/PulsarClientException.java:973— PulsarClientException.wrap has cognitive complexity 37 (threshold 15). Drivers by points: if/else 37. 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.
ProducerImpl.serializeAndSendMessage (cognitive 37) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:761— ProducerImpl.serializeAndSendMessage has cognitive complexity 37 (threshold 15). Drivers by points: if/else 32, boolean chains 3, ternaries 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.
FunctionsImpl.updateFunction (cognitive 37) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java:259— FunctionsImpl.updateFunction has cognitive complexity 37 (threshold 15). Drivers by points: if/else 21, boolean chains 9, error handling 7 (nesting depth added 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.
SourcesImpl.updateSource (cognitive 37) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SourcesImpl.java:259— SourcesImpl.updateSource has cognitive complexity 37 (threshold 15). Drivers by points: if/else 21, boolean chains 9, error handling 7 (nesting depth added 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.
ThreadLeakDetectorListener.compareThreads (cognitive 36) buildtools/src/main/java/org/apache/pulsar/tests/ThreadLeakDetectorListener.java:185— ThreadLeakDetectorListener.compareThreads has cognitive complexity 36 (threshold 15). Drivers by points: if/else 30, boolean chains 4, loops 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.
PrometheusMetricsGenerator.parseMetricsToPrometheusMetrics (cognitive 36) pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/PrometheusMetricsGenerator.java:429— PrometheusMetricsGenerator.parseMetricsToPrometheusMetrics has cognitive complexity 36 (threshold 15). Drivers by points: if/else 24, loops 6, error handling 4, boolean chains 2 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AbstractTwoPhaseCompactor.phaseTwoLoop (cognitive 36) pulsar-broker/src/main/java/org/apache/pulsar/compaction/AbstractTwoPhaseCompactor.java:282— AbstractTwoPhaseCompactor.phaseTwoLoop has cognitive complexity 36 (threshold 15). Drivers by points: if/else 23, error handling 8, ternaries 4, 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.
FunctionRuntimeManager.updateAssignment (cognitive 36) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/FunctionRuntimeManager.java:729— FunctionRuntimeManager.updateAssignment has cognitive complexity 36 (threshold 15). Drivers by points: if/else 36 (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.
ManagedLedgerImpl.internalTrimLedgers (cognitive 36) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:3065— ManagedLedgerImpl.internalTrimLedgers has cognitive complexity 36 (threshold 15). Drivers by points: if/else 26, boolean chains 5, loops 4, error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NamespacesBase.internalRetryableDeleteNamespaceAsync0 (cognitive 35) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:288— NamespacesBase.internalRetryableDeleteNamespaceAsync0 has cognitive complexity 35 (threshold 15). Drivers by points: if/else 28, boolean chains 3, error handling 2, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ServiceUnitStateChannelImpl.monitorOwnerships (cognitive 35) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java:1736— ServiceUnitStateChannelImpl.monitorOwnerships has cognitive complexity 35 (threshold 15). Drivers by points: if/else 20, boolean chains 8, loops 5, error handling 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.
PulsarShell.run (cognitive 35) pulsar-client-tools/src/main/java/org/apache/pulsar/shell/PulsarShell.java:337— PulsarShell.run has cognitive complexity 35 (threshold 15). Drivers by points: if/else 20, error handling 7, loops 5, boolean chains 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SinksImpl.registerSink (cognitive 35) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SinksImpl.java:77— SinksImpl.registerSink has cognitive complexity 35 (threshold 15). Drivers by points: if/else 21, error handling 8, boolean chains 6 (nesting depth added 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.
FunctionRuntimeManager.restartFunctionInstances (cognitive 35) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/FunctionRuntimeManager.java:406— FunctionRuntimeManager.restartFunctionInstances has cognitive complexity 35 (threshold 15). Drivers by points: if/else 26, loops 9 (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.
PerformanceConsumer.run (cognitive 35) pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceConsumer.java:249— PerformanceConsumer.run has cognitive complexity 35 (threshold 15). Drivers by points: if/else 20, loops 9, error handling 3, boolean chains 2, ternaries 1 (nesting depth added 9). 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.
TransactionLogReplayer.start (cognitive 35) pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/impl/MLTransactionLogImpl.java:248— TransactionLogReplayer.start has cognitive complexity 35 (threshold 15). Drivers by points: if/else 24, loops 6, error handling 3, 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.
SourcesImpl.registerSource (cognitive 34) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SourcesImpl.java:76— SourcesImpl.registerSource has cognitive complexity 34 (threshold 15). Drivers by points: if/else 20, error handling 8, boolean chains 6 (nesting depth added 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.
SourceConfigUtils.validateAndExtractDetails (cognitive 34) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SourceConfigUtils.java:262— SourceConfigUtils.validateAndExtractDetails has cognitive complexity 34 (threshold 15). Drivers by points: if/else 27, boolean chains 5, error handling 2 (nesting depth added 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.
PerformanceClient.loadArguments (cognitive 34) pulsar-testclient/src/main/java/org/apache/pulsar/proxy/socket/client/PerformanceClient.java:143— PerformanceClient.loadArguments has cognitive complexity 34 (threshold 15). Drivers by points: if/else 25, ternaries 4, boolean chains 3, error handling 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.
PerformanceProducer.run (cognitive 34) pulsar-testclient/src/main/java/org/apache/pulsar/testclient/PerformanceProducer.java:258— PerformanceProducer.run has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18, loops 8, error handling 5, ternaries 2, 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.
ActiveManagedCursorContainerImpl.moveNodeToNewPosition (cognitive 34) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ActiveManagedCursorContainerImpl.java:464— ActiveManagedCursorContainerImpl.moveNodeToNewPosition has cognitive complexity 34 (threshold 15). Drivers by points: if/else 22, boolean chains 4, loops 4, ternaries 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.
ThreadLeakDetectorListener.shouldSkipThread (cognitive 33) buildtools/src/main/java/org/apache/pulsar/tests/ThreadLeakDetectorListener.java:230— ThreadLeakDetectorListener.shouldSkipThread has cognitive complexity 33 (threshold 15). Drivers by points: if/else 32, 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.
PersistentDispatcherMultipleConsumers.readMoreEntries (cognitive 33) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:341— PersistentDispatcherMultipleConsumers.readMoreEntries has cognitive complexity 33 (threshold 15). Drivers by points: if/else 26, ternaries 5, 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.
SubscriptionCoordinator.computeAssignment (cognitive 33) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/scalable/SubscriptionCoordinator.java:559— SubscriptionCoordinator.computeAssignment has cognitive complexity 33 (threshold 15). Drivers by points: loops 15, if/else 11, ternaries 5, 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.
SimpleLoadManagerImpl.findBrokerForPlacement (cognitive 33) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/SimpleLoadManagerImpl.java:753— SimpleLoadManagerImpl.findBrokerForPlacement has cognitive complexity 33 (threshold 15). Drivers by points: if/else 21, ternaries 6, boolean chains 5, 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.
PersistentAcknowledgmentsGroupingTracker.newMessageAckCommandAndWrite (cognitive 33) pulsar-client/src/main/java/org/apache/pulsar/client/impl/PersistentAcknowledgmentsGroupingTracker.java:581— PersistentAcknowledgmentsGroupingTracker.newMessageAckCommandAndWrite has cognitive complexity 33 (threshold 15). Drivers by points: if/else 33 (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.
KubernetesRuntimeFactory.initialize (cognitive 33) pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeFactory.java:135— KubernetesRuntimeFactory.initialize has cognitive complexity 33 (threshold 15). Drivers by points: if/else 28, ternaries 4, 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.
FunctionsImpl.registerFunction (cognitive 33) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java:78— FunctionsImpl.registerFunction has cognitive complexity 33 (threshold 15). Drivers by points: if/else 20, error handling 8, boolean chains 5 (nesting depth added 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.
ServerCnx.handlePartitionMetadataRequest (cognitive 32) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:1181— ServerCnx.handlePartitionMetadataRequest has cognitive complexity 32 (threshold 15). Drivers by points: if/else 31, 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.
Reflections.loadClass (cognitive 32) pulsar-common/src/main/java/org/apache/pulsar/common/util/Reflections.java:282— Reflections.loadClass has cognitive complexity 32 (threshold 15). Drivers by points: if/else 21, loops 6, error handling 4, boolean chains 1 (nesting depth added 13). 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.
ConsumerImpl.<init> (cognitive 32) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:293— ConsumerImpl.<init> has cognitive complexity 32 (threshold 15). Drivers by points: if/else 26, error handling 3, boolean chains 2, ternaries 1 (nesting depth added 7). 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.
HttpClient.executeGet (cognitive 32) pulsar-client/src/main/java/org/apache/pulsar/client/impl/HttpClient.java:200— HttpClient.executeGet has cognitive complexity 32 (threshold 15). Drivers by points: if/else 22, error handling 7, 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.
ManagedLedgerImpl.getNumberOfEntries (cognitive 32) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:4041— ManagedLedgerImpl.getNumberOfEntries has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 13, if/else 11, boolean chains 7, 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.
OpFindNewest.readEntryFailed (cognitive 32) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpFindNewest.java:147— OpFindNewest.readEntryFailed has cognitive complexity 32 (threshold 15). Drivers by points: if/else 24, boolean chains 6, error handling 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.
GeoPersistentReplicator.replicateEntries (cognitive 31) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/GeoPersistentReplicator.java:149— GeoPersistentReplicator.replicateEntries has cognitive complexity 31 (threshold 15). Drivers by points: if/else 23, boolean chains 4, error handling 3, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PendingAcksMap.internalRemoveAllUpTo (cognitive 31) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/PendingAcksMap.java:437— PendingAcksMap.internalRemoveAllUpTo has cognitive complexity 31 (threshold 15). Drivers by points: if/else 28, loops 3 (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.
PulsarAuthorizationProvider.checkPermission (cognitive 31) pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/PulsarAuthorizationProvider.java:495— PulsarAuthorizationProvider.checkPermission has cognitive complexity 31 (threshold 15). Drivers by points: if/else 26, 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.
ServiceUnitStateDataConflictResolver.shouldKeepLeft (cognitive 31) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateDataConflictResolver.java:69— ServiceUnitStateDataConflictResolver.shouldKeepLeft has cognitive complexity 31 (threshold 15). Drivers by points: match/switch 17, if/else 10, boolean chains 4 (nesting depth added 12). 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.
PulsarService.addBrokerAdditionalServlets (cognitive 31) pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java:1273— PulsarService.addBrokerAdditionalServlets has cognitive complexity 31 (threshold 15). Drivers by points: error handling 14, if/else 12, match/switch 3, loops 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.
GenericJsonRecord.getField (cognitive 31) pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/generic/GenericJsonRecord.java:61— GenericJsonRecord.getField has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16, error handling 15 (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.
AutoClusterFailover.probeAndUpdateServiceUrl (cognitive 31) pulsar-client/src/main/java/org/apache/pulsar/client/impl/AutoClusterFailover.java:194— AutoClusterFailover.probeAndUpdateServiceUrl has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 20, if/else 8, loops 3 (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.
PulsarClientImpl.shutdown (cognitive 31) pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java:1047— PulsarClientImpl.shutdown has cognitive complexity 31 (threshold 15). Drivers by points: error handling 18, if/else 10, 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.
JavaInstanceRunnable.setupInput (cognitive 31) pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java:833— JavaInstanceRunnable.setupInput has cognitive complexity 31 (threshold 15). Drivers by points: if/else 26, boolean chains 2, ternaries 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.
ManagedLedgerWriter.run (cognitive 31) pulsar-testclient/src/main/java/org/apache/pulsar/testclient/ManagedLedgerWriter.java:142— ManagedLedgerWriter.run has cognitive complexity 31 (threshold 15). Drivers by points: if/else 21, loops 6, error handling 3, 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.
BucketDelayedDeliveryTracker.getScheduledMessages (cognitive 30) pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedDeliveryTracker.java:665— BucketDelayedDeliveryTracker.getScheduledMessages has cognitive complexity 30 (threshold 15). Drivers by points: if/else 22, boolean chains 4, loops 2, ternaries 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.
PersistentStickyKeyDispatcherMultipleConsumers.trySendMessagesToConsumers (cognitive 30) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumers.java:231— PersistentStickyKeyDispatcherMultipleConsumers.trySendMessagesToConsumers has cognitive complexity 30 (threshold 15). Drivers by points: if/else 23, loops 4, 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.
FormerPendingAcksMapStore.internalRemoveAllUpTo (cognitive 30) microbench/src/main/java/org/apache/pulsar/broker/service/PendingAcksMapPackingBenchmark.java:379— FormerPendingAcksMapStore.internalRemoveAllUpTo has cognitive complexity 30 (threshold 15). Drivers by points: if/else 25, loops 3, ternaries 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.
PulsarService.start (cognitive 30) pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java:850— PulsarService.start has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17, ternaries 8, boolean chains 4, error handling 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Section.remove (cognitive 30) pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentLongHashMap.java:460— Section.remove has cognitive complexity 30 (threshold 15). Drivers by points: if/else 20, loops 6, 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.
FunctionDetailsCommand.mergeArgs (cognitive 30) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java:390— FunctionDetailsCommand.mergeArgs has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 15, if/else 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.
KubernetesRuntimeFactory.validateResourcesGranularityAndProportion (cognitive 30) pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeFactory.java:496— KubernetesRuntimeFactory.validateResourcesGranularityAndProportion has cognitive complexity 30 (threshold 15). Drivers by points: if/else 26, 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.
ProxyServiceStarter.<init> (cognitive 30) pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyServiceStarter.java:130— ProxyServiceStarter.<init> has cognitive complexity 30 (threshold 15). Drivers by points: if/else 22, boolean chains 6, error handling 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ManagedLedgerImpl.internalReadFromLedger (cognitive 30) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:2353— ManagedLedgerImpl.internalReadFromLedger has cognitive complexity 30 (threshold 15). Drivers by points: if/else 27, loops 2, 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.
NonPersistentSubscription.addConsumer (cognitive 29) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentSubscription.java:111— NonPersistentSubscription.addConsumer has cognitive complexity 29 (threshold 15). Drivers by points: if/else 22, boolean chains 5, match/switch 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.
ServiceUnitStateChannelImpl.doCleanup (cognitive 29) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java:1610— ServiceUnitStateChannelImpl.doCleanup has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17, error handling 6, boolean chains 4, loops 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.
UniformLoadShedder.findBundlesForUnloading (cognitive 29) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/UniformLoadShedder.java:60— UniformLoadShedder.findBundlesForUnloading has cognitive complexity 29 (threshold 15). Drivers by points: if/else 20, boolean chains 9 (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.
ConsumerImpl.connectionOpened (cognitive 29) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:873— ConsumerImpl.connectionOpened has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17, boolean chains 11, 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.
BasicKubernetesManifestCustomizer.mergeRuntimeOpts (cognitive 29) pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/BasicKubernetesManifestCustomizer.java:193— BasicKubernetesManifestCustomizer.mergeRuntimeOpts has cognitive complexity 29 (threshold 15). Drivers by points: if/else 21, boolean chains 6, loops 2 (nesting depth added 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.
FunctionRuntimeManager.getFunctionStats (cognitive 29) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/FunctionRuntimeManager.java:621— FunctionRuntimeManager.getFunctionStats has cognitive complexity 29 (threshold 15). Drivers by points: if/else 21, loops 8 (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.
ThreadLeakDetectorListener.detectLeakedThreads (cognitive 28) buildtools/src/main/java/org/apache/pulsar/tests/ThreadLeakDetectorListener.java:129— ThreadLeakDetectorListener.detectLeakedThreads has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15, error handling 10, loops 2, boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PersistentTopic.close (cognitive 28) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:1768— PersistentTopic.close has cognitive complexity 28 (threshold 15). Drivers by points: if/else 21, error handling 3, boolean chains 2, match/switch 2 (nesting depth added 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.
PersistentTopic.updateRates (cognitive 28) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:2673— PersistentTopic.updateRates has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16, ternaries 9, error handling 2, loops 1 (nesting depth added 6). 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.
BrokerService.getTopic (cognitive 28) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:1298— BrokerService.getTopic has cognitive complexity 28 (threshold 15). Drivers by points: if/else 24, boolean chains 2, error handling 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.
PulsarPrometheusMetricsServlet.doGet (cognitive 28) pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/PulsarPrometheusMetricsServlet.java:67— PulsarPrometheusMetricsServlet.doGet has cognitive complexity 28 (threshold 15). Drivers by points: if/else 20, boolean chains 3, loops 3, error handling 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.
SimpleLoadManagerImpl.doNamespaceBundleSplit (cognitive 28) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/SimpleLoadManagerImpl.java:1369— SimpleLoadManagerImpl.doNamespaceBundleSplit has cognitive complexity 28 (threshold 15). Drivers by points: if/else 19, boolean chains 3, error handling 3, loops 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TopicPolicies.clone (cognitive 28) pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/TopicPolicies.java:96— TopicPolicies.clone has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 20, if/else 4, loops 4 (nesting depth added 6). 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.
ConsumerImpl.doTransactionAcknowledgeForResponse (cognitive 28) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:3204— ConsumerImpl.doTransactionAcknowledgeForResponse has cognitive complexity 28 (threshold 15). Drivers by points: if/else 18, loops 8, 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.
ComponentImpl.triggerFunction (cognitive 28) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java:1098— ComponentImpl.triggerFunction has cognitive complexity 28 (threshold 15). Drivers by points: if/else 19, error handling 5, boolean chains 3, loops 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BlobStoreBackedReadHandleImplV2.readAsync (cognitive 28) tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreBackedReadHandleImplV2.java:173— BlobStoreBackedReadHandleImplV2.readAsync has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16, loops 7, error handling 3, 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.
ServerCnx.authChallengeSuccessCallback (cognitive 27) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:1480— ServerCnx.authChallengeSuccessCallback has cognitive complexity 27 (threshold 15). Drivers by points: if/else 24, ternaries 2, error handling 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.
ConsumerImpl.receiveIndividualMessagesFromBatch (cognitive 27) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:1784— ConsumerImpl.receiveIndividualMessagesFromBatch has cognitive complexity 27 (threshold 15). Drivers by points: if/else 22, boolean chains 3, error handling 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PulsarClientImpl.<init> (cognitive 27) pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java:204— PulsarClientImpl.<init> has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15, ternaries 7, error handling 3, boolean chains 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.
CmdConsume.consume (cognitive 27) pulsar-client-tools/src/main/java/org/apache/pulsar/client/cli/CmdConsume.java:178— CmdConsume.consume has cognitive complexity 27 (threshold 15). Drivers by points: if/else 21, boolean chains 3, error handling 1, loops 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SinkConfigUtils.convertFromDetails (cognitive 27) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SinkConfigUtils.java:280— SinkConfigUtils.convertFromDetails has cognitive complexity 27 (threshold 15). Drivers by points: if/else 25, error handling 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WindowConfigUtils.validate (cognitive 27) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/WindowConfigUtils.java:28— WindowConfigUtils.validate has cognitive complexity 27 (threshold 15). Drivers by points: if/else 25, 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.
PulsarLedgerUnderreplicationManager.markLedgerReplicated (cognitive 27) pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/PulsarLedgerUnderreplicationManager.java:430— PulsarLedgerUnderreplicationManager.markLedgerReplicated has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15, error handling 6, boolean chains 3, loops 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ProxyConnection.channelRead (cognitive 27) pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java:290— ProxyConnection.channelRead has cognitive complexity 27 (threshold 15). Drivers by points: if/else 19, ternaries 5, boolean chains 2, match/switch 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.
PositionRangeSet.remove (cognitive 27) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/PositionRangeSet.java:389— PositionRangeSet.remove has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11, boolean chains 8, ternaries 8 (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.
ShadowManagedLedgerImpl.processSourceManagedLedgerInfo (cognitive 27) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ShadowManagedLedgerImpl.java:283— ShadowManagedLedgerImpl.processSourceManagedLedgerInfo has cognitive complexity 27 (threshold 15). Drivers by points: if/else 18, boolean chains 5, error handling 2, 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.
PersistentSubscription.getStatsAsync (cognitive 26) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java:1419— PersistentSubscription.getStatsAsync has cognitive complexity 26 (threshold 15). Drivers by points: if/else 21, ternaries 3, boolean chains 2 (nesting depth added 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.
ExtensibleLoadManagerImpl.playLeader (cognitive 26) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImpl.java:881— ExtensibleLoadManagerImpl.playLeader has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17, error handling 7, boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SimpleLoadManagerImpl.updateRealtimeResourceQuota (cognitive 26) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/SimpleLoadManagerImpl.java:492— SimpleLoadManagerImpl.updateRealtimeResourceQuota has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14, loops 10, 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.
GracefulExecutorServicesTerminationHandler.awaitTermination (cognitive 26) pulsar-common/src/main/java/org/apache/pulsar/common/util/GracefulExecutorServicesTerminationHandler.java:109— GracefulExecutorServicesTerminationHandler.awaitTermination has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13, error handling 5, loops 5, 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.
TopicName.<init> (cognitive 26) pulsar-common/src/main/java/org/apache/pulsar/common/naming/TopicName.java:119— TopicName.<init> has cognitive complexity 26 (threshold 15). Drivers by points: if/else 22, ternaries 2, boolean chains 1, 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.
ProducerImpl.<init> (cognitive 26) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:203— ProducerImpl.<init> has cognitive complexity 26 (threshold 15). Drivers by points: if/else 21, error handling 4, ternaries 1 (nesting depth added 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.
GetStatus.getComponentInstanceStatus (cognitive 26) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java:127— GetStatus.getComponentInstanceStatus has cognitive complexity 26 (threshold 15). Drivers by points: if/else 18, error handling 3, ternaries 3, loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PulsarWorkerService.stop (cognitive 26) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/PulsarWorkerService.java:622— PulsarWorkerService.stop has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16, error handling 10 (nesting depth added 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.
FunctionFilePackage.<init> (cognitive 26) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionFilePackage.java:54— FunctionFilePackage.<init> has cognitive complexity 26 (threshold 15). Drivers by points: error handling 10, if/else 10, ternaries 3, loops 2, 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.
SourceConfigUtils.convert (cognitive 26) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SourceConfigUtils.java:69— SourceConfigUtils.convert has cognitive complexity 26 (threshold 15). Drivers by points: if/else 24, boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
LocalMemoryMetadataStore.storePut (cognitive 26) pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/LocalMemoryMetadataStore.java:196— LocalMemoryMetadataStore.storePut has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13, ternaries 11, 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.
PulsarClusterMetadataSetup.initializeCluster (cognitive 26) pulsar-broker/src/main/java/org/apache/pulsar/PulsarClusterMetadataSetup.java:295— PulsarClusterMetadataSetup.initializeCluster has cognitive complexity 26 (threshold 15). Drivers by points: if/else 21, boolean chains 3, error handling 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.
ManagedLedgerImpl.getPositionAfterN (cognitive 26) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:4134— ManagedLedgerImpl.getPositionAfterN has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16, ternaries 8, boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PersistentDispatcherMultipleConsumers.trySendMessagesToConsumers (cognitive 25) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:780— PersistentDispatcherMultipleConsumers.trySendMessagesToConsumers has cognitive complexity 25 (threshold 15). Drivers by points: if/else 18, ternaries 3, boolean chains 2, 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.
PersistentDispatcherSingleActiveConsumer.readMoreEntries (cognitive 25) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherSingleActiveConsumer.java:335— PersistentDispatcherSingleActiveConsumer.readMoreEntries has cognitive complexity 25 (threshold 15). Drivers by points: if/else 17, ternaries 5, 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.
PersistentTopicsBase.internalCreateSubscription (cognitive 25) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:2359— PersistentTopicsBase.internalCreateSubscription has cognitive complexity 25 (threshold 15). Drivers by points: if/else 18, error handling 3, loops 2, boolean chains 1, ternaries 1 (nesting depth added 6). 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.
NonPersistentTopics.getPartitionedStats (cognitive 25) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/NonPersistentTopics.java:252— NonPersistentTopics.getPartitionedStats has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11, error handling 10, boolean chains 2, 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.
Section.get (cognitive 25) pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentLongHashMap.java:335— Section.get has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15, ternaries 8, boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LocalBookkeeperEnsemble.stop (cognitive 25) pulsar-broker/src/main/java/org/apache/pulsar/zookeeper/LocalBookkeeperEnsemble.java:480— LocalBookkeeperEnsemble.stop has cognitive complexity 25 (threshold 15). Drivers by points: error handling 13, if/else 9, loops 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.
ClusterDetails.getClusterData (cognitive 25) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdClusters.java:384— ClusterDetails.getClusterData has cognitive complexity 25 (threshold 15). Drivers by points: if/else 25. 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.
FunctionsStatsGenerator.generate (cognitive 25) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/FunctionsStatsGenerator.java:35— FunctionsStatsGenerator.generate has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15, error handling 7, loops 2, 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.
FunctionConfigUtils.convertFromDetails (cognitive 25) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfigUtils.java:402— FunctionConfigUtils.convertFromDetails has cognitive complexity 25 (threshold 15). Drivers by points: if/else 25 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
FunctionConfigUtils.doJavaChecks (cognitive 25) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfigUtils.java:625— FunctionConfigUtils.doJavaChecks has cognitive complexity 25 (threshold 15). Drivers by points: if/else 19, boolean chains 4, error handling 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ProducerHandler.onWebSocketText (cognitive 25) pulsar-websocket/src/main/java/org/apache/pulsar/websocket/ProducerHandler.java:179— ProducerHandler.onWebSocketText has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14, error handling 8, boolean chains 3 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BrokerStarter.call (cognitive 25) pulsar-broker/src/main/java/org/apache/pulsar/PulsarBrokerStarter.java:154— BrokerStarter.call has cognitive complexity 25 (threshold 15). Drivers by points: if/else 21, boolean chains 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PersistentDispatcherMultipleConsumersClassic.trySendMessagesToConsumers (cognitive 24) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumersClassic.java:677— PersistentDispatcherMultipleConsumersClassic.trySendMessagesToConsumers has cognitive complexity 24 (threshold 15). Drivers by points: if/else 17, ternaries 3, boolean chains 2, 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.
PersistentReplicator.readMoreEntries (cognitive 24) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentReplicator.java:300— PersistentReplicator.readMoreEntries has cognitive complexity 24 (threshold 15). Drivers by points: if/else 23, 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.
PersistentSubscription.acknowledgeMessageAsync (cognitive 24) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java:458— PersistentSubscription.acknowledgeMessageAsync has cognitive complexity 24 (threshold 15). Drivers by points: if/else 21, 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.
PersistentSubscription.reuseOrCreateDispatcher (cognitive 24) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java:302— PersistentSubscription.reuseOrCreateDispatcher has cognitive complexity 24 (threshold 15). Drivers by points: if/else 19, boolean chains 4, match/switch 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.
BrokerServiceException.getClientErrorCode (cognitive 24) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerServiceException.java:241— BrokerServiceException.getClientErrorCode has cognitive complexity 24 (threshold 15). Drivers by points: if/else 22, boolean chains 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Consumer.applyPendingAckCompletions (cognitive 24) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java:733— Consumer.applyPendingAckCompletions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 22, boolean chains 1, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ServerCnx.channelInactive (cognitive 24) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:437— ServerCnx.channelInactive has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14, boolean chains 5, error handling 5 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
WebService.<init> (cognitive 24) pulsar-broker/src/main/java/org/apache/pulsar/broker/web/WebService.java:125— WebService.<init> has cognitive complexity 24 (threshold 15). Drivers by points: if/else 18, boolean chains 3, error handling 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.
ExtensibleLoadManagerImpl.playFollower (cognitive 24) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImpl.java:957— ExtensibleLoadManagerImpl.playFollower has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15, error handling 7, boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PendingAckReplay.run (cognitive 24) pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/pendingack/impl/MLPendingAckStore.java:405— PendingAckReplay.run has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13, loops 6, error handling 4, 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.
MessageImpl.init (cognitive 24) pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessageImpl.java:188— MessageImpl.init has cognitive complexity 24 (threshold 15). Drivers by points: if/else 20, loops 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.
MetadataStoreTableViewImpl.handleSessionEvent (cognitive 24) pulsar-metadata/src/main/java/org/apache/pulsar/metadata/tableview/impl/MetadataStoreTableViewImpl.java:212— MetadataStoreTableViewImpl.handleSessionEvent has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15, loops 5, error handling 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.
PulsarStandaloneStarter.<init> (cognitive 24) pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandaloneStarter.java:48— PulsarStandaloneStarter.<init> has cognitive complexity 24 (threshold 15). Drivers by points: if/else 21, boolean chains 2, error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ScalableTopicResources.handleNotification (cognitive 23) pulsar-broker-common/src/main/java/org/apache/pulsar/broker/resources/ScalableTopicResources.java:201— ScalableTopicResources.handleNotification has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11, error handling 7, loops 4, 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.
AdminResource.internalCreatePartitionedTopic (cognitive 23) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java:534— AdminResource.internalCreatePartitionedTopic has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15, boolean chains 6, loops 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ServiceUnitStateChannelImpl.waitForCleanups (cognitive 23) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java:1522— ServiceUnitStateChannelImpl.waitForCleanups has cognitive complexity 23 (threshold 15). Drivers by points: error handling 9, if/else 9, loops 3, 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.
TopicsBase.buildMessage (cognitive 23) pulsar-broker/src/main/java/org/apache/pulsar/broker/rest/TopicsBase.java:563— TopicsBase.buildMessage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 20, 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.
ConsumerImpl.doReconsumeLater (cognitive 23) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:683— ConsumerImpl.doReconsumeLater has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15, error handling 4, boolean chains 2, 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.
GeoReplicationProducerImpl.ackReceivedReplicatedMsg (cognitive 23) pulsar-client/src/main/java/org/apache/pulsar/client/impl/GeoReplicationProducerImpl.java:92— GeoReplicationProducerImpl.ackReceivedReplicatedMsg has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14, boolean chains 8, 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.
CmdConsume.consumeFromWebSocket (cognitive 23) pulsar-client-tools/src/main/java/org/apache/pulsar/client/cli/CmdConsume.java:309— CmdConsume.consumeFromWebSocket has cognitive complexity 23 (threshold 15). Drivers by points: error handling 9, if/else 8, loops 4, boolean chains 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CmdRead.readFromWebSocket (cognitive 23) pulsar-client-tools/src/main/java/org/apache/pulsar/client/cli/CmdRead.java:223— CmdRead.readFromWebSocket has cognitive complexity 23 (threshold 15). Drivers by points: error handling 9, if/else 8, loops 4, boolean chains 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FunctionActioner.getDeleteSubscriptionSupplier (cognitive 23) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/FunctionActioner.java:442— FunctionActioner.getDeleteSubscriptionSupplier has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12, error handling 8, ternaries 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.
IOConfigUtils.loadWithSecrets (cognitive 23) pulsar-io/common/src/main/java/org/apache/pulsar/io/common/IOConfigUtils.java:58— IOConfigUtils.loadWithSecrets has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14, error handling 5, loops 3, 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.
PulsarLedgerUnderreplicationManager.getLedgerToRereplicateFromHierarchy (cognitive 23) pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/PulsarLedgerUnderreplicationManager.java:556— PulsarLedgerUnderreplicationManager.getLedgerToRereplicateFromHierarchy has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14, error handling 6, 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.
1.hasNext (cognitive 23) pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/PulsarLedgerUnderreplicationManager.java:515— 1.hasNext has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14, error handling 4, loops 3, 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.
AbstractWebSocketHandler.checkAuth (cognitive 23) pulsar-websocket/src/main/java/org/apache/pulsar/websocket/AbstractWebSocketHandler.java:94— AbstractWebSocketHandler.checkAuth has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12, error handling 10, 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.
PersistentTopic.addFailed (cognitive 22) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:766— PersistentTopic.addFailed has cognitive complexity 22 (threshold 15). Drivers by points: if/else 20, 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.
SchemaRegistryServiceImpl.getSchemaVersionBySchemaData (cognitive 22) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/SchemaRegistryServiceImpl.java:397— SchemaRegistryServiceImpl.getSchemaVersionBySchemaData has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14, boolean chains 4, loops 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.
BrokerService.unloadServiceUnit (cognitive 22) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:2650— BrokerService.unloadServiceUnit has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15, boolean chains 3, error handling 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.
ServerCnx.handleConnect (cognitive 22) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:1658— ServerCnx.handleConnect has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16, ternaries 3, boolean chains 2, error handling 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PrometheusMetricsGeneratorUtils.generateSystemMetrics (cognitive 22) pulsar-broker-common/src/main/java/org/apache/pulsar/broker/stats/prometheus/PrometheusMetricsGeneratorUtils.java:56— PrometheusMetricsGeneratorUtils.generateSystemMetrics has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15, loops 6, 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.
PersistentTopicsBase.internalGetPartitionedStats (cognitive 22) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:1552— PersistentTopicsBase.internalGetPartitionedStats has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13, error handling 5, boolean chains 2, loops 2 (nesting depth added 6). 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.
MetadataTransactionBuffer.recomputeMaxReadPositionLocked (cognitive 22) pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/MetadataTransactionBuffer.java:600— MetadataTransactionBuffer.recomputeMaxReadPositionLocked has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14, boolean chains 3, ternaries 3, 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.
TransactionMetadataStoreService.handleTcClientConnect (cognitive 22) pulsar-broker/src/main/java/org/apache/pulsar/broker/TransactionMetadataStoreService.java:109— TransactionMetadataStoreService.handleTcClientConnect has cognitive complexity 22 (threshold 15). Drivers by points: if/else 20, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Section.put (cognitive 22) pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentLongLongPairHashMap.java:400— Section.put has cognitive complexity 22 (threshold 15). Drivers by points: if/else 20, boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NamespaceBundleFactory.splitBundles (cognitive 22) pulsar-broker/src/main/java/org/apache/pulsar/common/naming/NamespaceBundleFactory.java:325— NamespaceBundleFactory.splitBundles has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9, loops 9, 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.
FileUtils.deleteFilesInDirectory (cognitive 22) pulsar-common/src/main/java/org/apache/pulsar/common/nar/FileUtils.java:145— FileUtils.deleteFilesInDirectory has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13, boolean chains 4, ternaries 3, loops 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClientCnx.handleLookupResponse (cognitive 22) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java:699— ClientCnx.handleLookupResponse has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11, ternaries 9, 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.
PulsarClientImpl.shutdownExecutors (cognitive 22) pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java:1169— PulsarClientImpl.shutdownExecutors has cognitive complexity 22 (threshold 15). Drivers by points: error handling 10, if/else 8, 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.
CmdRead.read (cognitive 22) pulsar-client-tools/src/main/java/org/apache/pulsar/client/cli/CmdRead.java:138— CmdRead.read has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16, boolean chains 2, ternaries 2, error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CmdTopics.printMessages (cognitive 22) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java:1349— CmdTopics.printMessages has cognitive complexity 22 (threshold 15). Drivers by points: if/else 20, boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DeleteCmd.run (cognitive 22) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java:631— DeleteCmd.run has cognitive complexity 22 (threshold 15). Drivers by points: error handling 10, if/else 6, loops 5, 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.
SinksImpl.validateUpdateRequestParams (cognitive 22) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/SinksImpl.java:746— SinksImpl.validateUpdateRequestParams has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15, error handling 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.
LocalRunner.extractClassLoader (cognitive 22) pulsar-functions/localrun/src/main/java/org/apache/pulsar/functions/LocalRunner.java:486— LocalRunner.extractClassLoader has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 10, if/else 9, boolean chains 2, 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.
ZKMetadataStoreBatchStrategy.nextBatch (cognitive 22) pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/batching/ZKMetadataStoreBatchStrategy.java:64— ZKMetadataStoreBatchStrategy.nextBatch has cognitive complexity 22 (threshold 15). Drivers by points: if/else 17, boolean chains 2, match/switch 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.
ProxyService.close (cognitive 22) pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyService.java:393— ProxyService.close has cognitive complexity 22 (threshold 15). Drivers by points: error handling 12, if/else 9, 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.
FixedColumnLengthTableMaker.make (cognitive 22) pulsar-testclient/src/main/java/org/apache/pulsar/testclient/utils/FixedColumnLengthTableMaker.java:103— FixedColumnLengthTableMaker.make has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13, loops 7, 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.
1.handleMetadataEntry (cognitive 22) pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/impl/MLTransactionMetadataStore.java:147— 1.handleMetadataEntry has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16, ternaries 3, boolean chains 1, error handling 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ActiveManagedCursorContainerImpl.add (cognitive 22) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ActiveManagedCursorContainerImpl.java:105— ActiveManagedCursorContainerImpl.add has cognitive complexity 22 (threshold 15). Drivers by points: if/else 22 (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.
ActiveManagedCursorContainerImpl.checkOrderingAndNumberOfCursorsState (cognitive 22) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ActiveManagedCursorContainerImpl.java:786— ActiveManagedCursorContainerImpl.checkOrderingAndNumberOfCursorsState has cognitive complexity 22 (threshold 15). Drivers by points: if/else 19, 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.
AbstractDispatcherSingleActiveConsumer.internalAddConsumer (cognitive 21) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractDispatcherSingleActiveConsumer.java:170— AbstractDispatcherSingleActiveConsumer.internalAddConsumer has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17, boolean chains 4 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PrometheusMetricsGenerator.renderToBuffer (cognitive 21) pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/PrometheusMetricsGenerator.java:521— PrometheusMetricsGenerator.renderToBuffer has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13, boolean chains 4, ternaries 2, error handling 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ServiceUnitStateChannelImpl.getActiveOwnerAsync (cognitive 21) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java:469— ServiceUnitStateChannelImpl.getActiveOwnerAsync has cognitive complexity 21 (threshold 15). Drivers by points: if/else 18, match/switch 2, 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.
LoadStats.update (cognitive 21) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/scheduler/TransferShedder.java:202— LoadStats.update has cognitive complexity 21 (threshold 15). Drivers by points: if/else 20, 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.
LoadManagerShared.applyNamespacePolicies (cognitive 21) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/LoadManagerShared.java:87— LoadManagerShared.applyNamespacePolicies has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15, boolean chains 2, error handling 2, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LoadManagerShared.applyNamespacePoliciesAsync (cognitive 21) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/LoadManagerShared.java:173— LoadManagerShared.applyNamespacePoliciesAsync has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15, boolean chains 2, error handling 2, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ModularLoadManagerImpl.updateBundleData (cognitive 21) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java:547— ModularLoadManagerImpl.updateBundleData has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12, loops 6, 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.
FunctionStatsImpl.calculateOverall (cognitive 21) pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/FunctionStatsImpl.java:80— FunctionStatsImpl.calculateOverall has cognitive complexity 21 (threshold 15). Drivers by points: if/else 19, 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.
RawBatchConverter.rebatchMessage (cognitive 21) pulsar-broker/src/main/java/org/apache/pulsar/client/impl/RawBatchConverter.java:124— RawBatchConverter.rebatchMessage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17, loops 3, 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.
ClientCnx.checkRequestTimeout (cognitive 21) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java:1814— ClientCnx.checkRequestTimeout has cognitive complexity 21 (threshold 15). Drivers by points: if/else 18, boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PatternTopicsChangedListener.onTopicsAdded (cognitive 21) pulsar-client/src/main/java/org/apache/pulsar/client/impl/PatternMultiTopicsConsumerImpl.java:384— PatternTopicsChangedListener.onTopicsAdded has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17, loops 3, 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.
TableViewImpl.handleMessage (cognitive 21) pulsar-client/src/main/java/org/apache/pulsar/client/impl/TableViewImpl.java:208— TableViewImpl.handleMessage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12, error handling 4, loops 3, ternaries 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.
CmdProduce.publish (cognitive 21) pulsar-client-tools/src/main/java/org/apache/pulsar/client/cli/CmdProduce.java:283— CmdProduce.publish has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13, loops 4, boolean chains 2, error handling 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GetStatus.getComponentStatus (cognitive 21) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java:209— GetStatus.getComponentStatus has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16, loops 3, error handling 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.
PulsarWorkerService.initializeStandaloneWorkerService (cognitive 21) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/PulsarWorkerService.java:208— PulsarWorkerService.initializeStandaloneWorkerService has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12, error handling 8, 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.
LocalRunner.startThreadedMode (cognitive 21) pulsar-functions/localrun/src/main/java/org/apache/pulsar/functions/LocalRunner.java:625— LocalRunner.startThreadedMode has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17, 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.
BlobStoreManagedLedgerOffloader.scanContainer (cognitive 21) tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreManagedLedgerOffloader.java:724— BlobStoreManagedLedgerOffloader.scanContainer has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 10, if/else 8, error handling 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.
PersistentDispatcherSingleActiveConsumer.readEntriesComplete (cognitive 20) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherSingleActiveConsumer.java:167— PersistentDispatcherSingleActiveConsumer.readEntriesComplete has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, boolean chains 2, loops 2, 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.
PersistentReplicator.readEntriesComplete (cognitive 20) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentReplicator.java:353— PersistentReplicator.readEntriesComplete has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, boolean chains 4, loops 2 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AutoScalePolicyEvaluator.tryMerge (cognitive 20) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/scalable/AutoScalePolicyEvaluator.java:155— AutoScalePolicyEvaluator.tryMerge has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, loops 3, 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.
DagWatchSession.buildDagProto (cognitive 20) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/scalable/DagWatchSession.java:315— DagWatchSession.buildDagProto has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9, loops 9, 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.
SchemaRegistryServiceImpl.checkCompatibilityWithAll (cognitive 20) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/SchemaRegistryServiceImpl.java:482— SchemaRegistryServiceImpl.checkCompatibilityWithAll has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, error handling 3, loops 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.
BacklogQuotaManager.dropBacklogForTimeLimit (cognitive 20) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BacklogQuotaManager.java:235— BacklogQuotaManager.dropBacklogForTimeLimit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, error handling 2, loops 2, 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.
BrokerService.createPersistentTopic0 (cognitive 20) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:1962— BrokerService.createPersistentTopic0 has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, loops 2, ternaries 2, boolean chains 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BrokerService.unloadNamespaceBundlesGracefully (cognitive 20) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:1131— BrokerService.unloadNamespaceBundlesGracefully has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10, error handling 5, ternaries 3, boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ServerCnx.buildProducerAndAddTopic (cognitive 20) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:2533— ServerCnx.buildProducerAndAddTopic has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16, error handling 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.
AuthenticationService.<init> (cognitive 20) pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationService.java:57— AuthenticationService.<init> has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, loops 4, error handling 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.
PersistentTopicsBase.internalUnloadTopic (cognitive 20) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:974— PersistentTopicsBase.internalUnloadTopic has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, error handling 3, loops 2 (nesting depth added 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.
LeastResourceUsageWithWeight.select (cognitive 20) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/strategy/LeastResourceUsageWithWeight.java:82— LeastResourceUsageWithWeight.select has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16, loops 3, 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.
DefaultPulsarSslFactory.initialize (cognitive 20) pulsar-common/src/main/java/org/apache/pulsar/common/util/DefaultPulsarSslFactory.java:67— DefaultPulsarSslFactory.initialize has cognitive complexity 20 (threshold 15). Drivers by points: if/else 18, 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.
PulsarConfigurationLoader.isComplete (cognitive 20) pulsar-broker-common/src/main/java/org/apache/pulsar/common/configuration/PulsarConfigurationLoader.java:119— PulsarConfigurationLoader.isComplete has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13, boolean chains 3, error handling 3, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TopicName.toFullTopicName (cognitive 20) pulsar-common/src/main/java/org/apache/pulsar/common/naming/TopicName.java:518— TopicName.toFullTopicName has cognitive complexity 20 (threshold 15). Drivers by points: if/else 19, 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.
NegativeAcksTracker.triggerRedelivery (cognitive 20) pulsar-client/src/main/java/org/apache/pulsar/client/impl/NegativeAcksTracker.java:74— NegativeAcksTracker.triggerRedelivery has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16, loops 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.
BaseResource.getApiException (cognitive 20) pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/BaseResource.java:268— BaseResource.getApiException has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, match/switch 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.
PublishingOrderCompactor.compactBatchMessage (cognitive 20) pulsar-broker/src/main/java/org/apache/pulsar/compaction/PublishingOrderCompactor.java:76— PublishingOrderCompactor.compactBatchMessage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 18, error handling 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
JavaInstanceRunnable.augmentAndFilterConnectorConfig (cognitive 20) pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java:1009— JavaInstanceRunnable.augmentAndFilterConnectorConfig has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, error handling 3, loops 3, 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.
SourceConfigUtils.convertFromDetails (cognitive 20) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SourceConfigUtils.java:191— SourceConfigUtils.convertFromDetails has cognitive complexity 20 (threshold 15). Drivers by points: if/else 20 (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.
SourceConfigUtils.validateUpdate (cognitive 20) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SourceConfigUtils.java:380— SourceConfigUtils.validateUpdate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 19, boolean chains 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.
ProxyConnection.completeConnect (cognitive 20) pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java:372— ProxyConnection.completeConnect has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16, boolean chains 2, 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.
DefaultMessageFormatter.formatMessage (cognitive 20) pulsar-testclient/src/main/java/org/apache/pulsar/testclient/DefaultMessageFormatter.java:30— DefaultMessageFormatter.formatMessage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, boolean chains 3, loops 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ManagedLedgerImpl.asyncOffloadPrefix (cognitive 20) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:3648— ManagedLedgerImpl.asyncOffloadPrefix has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, boolean chains 4, loops 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.
ManagedLedgerImpl.internalAsyncAddEntry (cognitive 20) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:862— ManagedLedgerImpl.internalAsyncAddEntry has cognitive complexity 20 (threshold 15). Drivers by points: if/else 19, 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.
ManagedLedgerImpl.isValidPosition (cognitive 20) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:4265— ManagedLedgerImpl.isValidPosition has cognitive complexity 20 (threshold 15). Drivers by points: if/else 17, 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.
ManagedLedgerImpl.maybeOffload (cognitive 20) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:2892— ManagedLedgerImpl.maybeOffload has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12, boolean chains 5, error handling 2, loops 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.
FastThreadLocalStateCleaner.cleanupAllFastThreadLocals (cognitive 19) buildtools/src/main/java/org/apache/pulsar/tests/FastThreadLocalStateCleaner.java:99— FastThreadLocalStateCleaner.cleanupAllFastThreadLocals has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, loops 2, boolean chains 1, 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.
InMemoryDelayedDeliveryTracker.getScheduledMessages (cognitive 19) pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/InMemoryDelayedDeliveryTracker.java:221— InMemoryDelayedDeliveryTracker.getScheduledMessages has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, loops 5, 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.
MessageDeduplication.setContextPropsIfRepl (cognitive 19) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/MessageDeduplication.java:339— MessageDeduplication.setContextPropsIfRepl has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, boolean chains 2, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PersistentDispatcherMultipleConsumers.addUnAckedMessages (cognitive 19) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:1174— PersistentDispatcherMultipleConsumers.addUnAckedMessages has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, 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.
PersistentDispatcherMultipleConsumersClassic.addUnAckedMessages (cognitive 19) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumersClassic.java:1023— PersistentDispatcherMultipleConsumersClassic.addUnAckedMessages has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, 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.
PersistentTopic.getInternalStats (cognitive 19) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:3156— PersistentTopic.getInternalStats has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, boolean chains 2, error handling 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ServerCnx.getLargestBatchIndexWhenPossible (cognitive 19) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:3101— ServerCnx.getLargestBatchIndexWhenPossible has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, ternaries 4, boolean chains 3 (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.
ServerCnx.handleLookup (cognitive 19) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:672— ServerCnx.handleLookup has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, ternaries 4, loops 3, boolean chains 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AuthenticationService.authenticateHttpRequest (cognitive 19) pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationService.java:124— AuthenticationService.authenticateHttpRequest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, error handling 5, 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.
PersistentTopicsBase.internalGetManagedLedgerInfo (cognitive 19) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:1427— PersistentTopicsBase.internalGetManagedLedgerInfo has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, error handling 4, loops 4 (nesting depth added 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.
PersistentTopicsBase.internalGetSubscriptions (cognitive 19) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:1269— PersistentTopicsBase.internalGetSubscriptions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9, loops 6, error handling 3, boolean chains 1 (nesting depth added 6). 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.
TransactionsBase.internalGetSlowTransactions (cognitive 19) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/TransactionsBase.java:300— TransactionsBase.internalGetSlowTransactions has cognitive complexity 19 (threshold 15). Drivers by points: error handling 7, if/else 7, loops 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.
PendingAckHandleImpl.internalIndividualAcknowledgeMessage (cognitive 19) pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/pendingack/impl/PendingAckHandleImpl.java:219— PendingAckHandleImpl.internalIndividualAcknowledgeMessage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Section.get (cognitive 19) pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentLongLongPairHashMap.java:345— Section.get has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, 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.
Section.contains (cognitive 19) pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentLongPairSet.java:352— Section.contains has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, 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.
VipStatus.checkStatus (cognitive 19) pulsar-broker-common/src/main/java/org/apache/pulsar/common/configuration/VipStatus.java:85— VipStatus.checkStatus has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, 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.
Commands.newSubscribe (cognitive 19) pulsar-common/src/main/java/org/apache/pulsar/common/protocol/Commands.java:659— Commands.newSubscribe has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, loops 3, 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.
MessageIdV5.toByteArray (cognitive 19) pulsar-client-v5/src/main/java/org/apache/pulsar/client/impl/v5/MessageIdV5.java:186— MessageIdV5.toByteArray has cognitive complexity 19 (threshold 15). Drivers by points: loops 12, if/else 5, ternaries 2 (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
ClientCnx.handlePartitionResponse (cognitive 19) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java:743— ClientCnx.handlePartitionResponse has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, ternaries 6, 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.
ConsumerBase.<init> (cognitive 19) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBase.java:137— ConsumerBase.<init> has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, ternaries 4, boolean chains 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.
PatternTopicsChangedListener.onTopicsRemoved (cognitive 19) pulsar-client/src/main/java/org/apache/pulsar/client/impl/PatternMultiTopicsConsumerImpl.java:319— PatternTopicsChangedListener.onTopicsRemoved has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14, loops 5 (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.
PulsarClientImpl.subscribeAsync (cognitive 19) pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java:670— PulsarClientImpl.subscribeAsync has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14, boolean chains 4, loops 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.
CmdProduce.publishToWebSocket (cognitive 19) pulsar-client-tools/src/main/java/org/apache/pulsar/client/cli/CmdProduce.java:395— CmdProduce.publishToWebSocket has cognitive complexity 19 (threshold 15). Drivers by points: error handling 6, if/else 6, loops 6, 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.
EventTimeOrderCompactor.compactBatchMessage (cognitive 19) pulsar-broker/src/main/java/org/apache/pulsar/compaction/EventTimeOrderCompactor.java:91— EventTimeOrderCompactor.compactBatchMessage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, boolean chains 1, error handling 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.
FunctionDetailsCommand.validateFunctionConfigs (cognitive 19) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java:695— FunctionDetailsCommand.validateFunctionConfigs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, boolean chains 7 (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.
CustomCommandsUtils.generateCustomCommand (cognitive 19) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CustomCommandsUtils.java:134— CustomCommandsUtils.generateCustomCommand has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8, loops 4, ternaries 3, match/switch 2, boolean chains 1, 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.
JavaInstanceRunnable.setupOutput (cognitive 19) pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java:1091— JavaInstanceRunnable.setupOutput has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, ternaries 6, 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.
ComponentImpl.getPackageFile (cognitive 19) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java:1922— ComponentImpl.getPackageFile has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, error handling 3, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
KubernetesSecretsProviderConfigurator.doAdmissionChecks (cognitive 19) pulsar-functions/secrets/src/main/java/org/apache/pulsar/functions/secretsproviderconfigurator/KubernetesSecretsProviderConfigurator.java:117— KubernetesSecretsProviderConfigurator.doAdmissionChecks has cognitive complexity 19 (threshold 15). Drivers by points: if/else 17, loops 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.
RocksdbMetadataStore.storeScanChildren (cognitive 19) pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/RocksdbMetadataStore.java:411— RocksdbMetadataStore.storeScanChildren has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, error handling 2, loops 2, ternaries 2, 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.
PulsarStandalone.start (cognitive 19) pulsar-broker/src/main/java/org/apache/pulsar/PulsarStandalone.java:267— PulsarStandalone.start has cognitive complexity 19 (threshold 15). Drivers by points: if/else 19 (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.
MockZooKeeper.delete (cognitive 19) testmocks/src/main/java/org/apache/zookeeper/MockZooKeeper.java:917— MockZooKeeper.delete has cognitive complexity 19 (threshold 15). Drivers by points: if/else 18, 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.
ManagedLedgerFactoryImpl.asyncOpen (cognitive 19) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerFactoryImpl.java:432— ManagedLedgerFactoryImpl.asyncOpen has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, error handling 3, 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.
ManagedLedgerFactoryImpl.shutdownAsync (cognitive 19) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerFactoryImpl.java:659— ManagedLedgerFactoryImpl.shutdownAsync has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, error handling 4, boolean chains 2, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpReadEntry.internalReadEntriesFailed (cognitive 19) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpReadEntry.java:137— OpReadEntry.internalReadEntriesFailed has cognitive complexity 19 (threshold 15). Drivers by points: if/else 18, 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.
ReadTask.skipPreviousEntry (cognitive 19) tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreBackedReadHandleImpl.java:230— ReadTask.skipPreviousEntry has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 10, if/else 8, 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.
BlobStoreBackedReadHandleImplV2.closeAsync (cognitive 19) tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreBackedReadHandleImplV2.java:127— BlobStoreBackedReadHandleImplV2.closeAsync has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, error handling 5, loops 2, 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.
PersistentTopic.asyncGetStats (cognitive 18) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:2954— PersistentTopic.asyncGetStats has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11, boolean chains 3, loops 2, ternaries 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PersistentTopic.getNonDurableSubscription (cognitive 18) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:1208— PersistentTopic.getNonDurableSubscription has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11, boolean chains 3, error handling 2, ternaries 2 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SchemaRegistryServiceImpl.putSchemaIfAbsent (cognitive 18) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/schema/SchemaRegistryServiceImpl.java:182— SchemaRegistryServiceImpl.putSchemaIfAbsent has cognitive complexity 18 (threshold 15). Drivers by points: if/else 18 (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.
BrokerService.start (cognitive 18) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:629— BrokerService.start has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, boolean chains 3, error handling 2, ternaries 2, 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.
Consumer.messageAcked (cognitive 18) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java:523— Consumer.messageAcked has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, loops 3, 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.
SystemTopicBasedTopicPoliciesService.refreshTopicPoliciesCache (cognitive 18) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java:1043— SystemTopicBasedTopicPoliciesService.refreshTopicPoliciesCache has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13, ternaries 3, match/switch 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.
SystemTopicBasedTopicPoliciesService.updateTopicPoliciesAsync (cognitive 18) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java:235— SystemTopicBasedTopicPoliciesService.updateTopicPoliciesAsync has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, boolean chains 4, 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.
AuthenticationProviderToken.authenticateToken (cognitive 18) pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProviderToken.java:233— AuthenticationProviderToken.authenticateToken has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, error handling 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.
PulsarAuthorizationProvider.canConsumeAsync (cognitive 18) pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/PulsarAuthorizationProvider.java:109— PulsarAuthorizationProvider.canConsumeAsync has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13, match/switch 4, 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.
PulsarWebResource.validateAdminAccessForTenantAsync (cognitive 18) pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java:325— PulsarWebResource.validateAdminAccessForTenantAsync has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, boolean chains 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PersistentTopicsBase.internalExpireMessagesByTimestamp (cognitive 18) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:4092— PersistentTopicsBase.internalExpireMessagesByTimestamp has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, error handling 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.
PersistentTopicsBase.internalGetReplicatedSubscriptionStatus (cognitive 18) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:5391— PersistentTopicsBase.internalGetReplicatedSubscriptionStatus has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, error handling 2, loops 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.
ExtensibleLoadManagerImpl.monitor (cognitive 18) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImpl.java:1057— ExtensibleLoadManagerImpl.monitor has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, error handling 2, 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.
LoadManagerShared.shouldAntiAffinityNamespaceUnload (cognitive 18) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/LoadManagerShared.java:649— LoadManagerShared.shouldAntiAffinityNamespaceUnload has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, loops 4, 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.
TransactionBufferHandlerImpl.checkPendingRequests (cognitive 18) pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TransactionBufferHandlerImpl.java:249— TransactionBufferHandlerImpl.checkPendingRequests has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Section.add (cognitive 18) pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentLongPairSet.java:405— Section.add has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PulsarDecoder.channelRead (cognitive 18) pulsar-common/src/main/java/org/apache/pulsar/common/protocol/PulsarDecoder.java:118— PulsarDecoder.channelRead has cognitive complexity 18 (threshold 15). Drivers by points: error handling 16, if/else 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClientCnx.revertClientExToErrorCode (cognitive 18) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java:1760— ClientCnx.revertClientExToErrorCode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 18. 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.
ConsumerImpl.hasMessageAvailableAsync (cognitive 18) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java:2734— ConsumerImpl.hasMessageAvailableAsync has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, 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.
SameAuthParamsLookupAutoClusterFailover.checkPulsarServices (cognitive 18) pulsar-client/src/main/java/org/apache/pulsar/client/impl/SameAuthParamsLookupAutoClusterFailover.java:170— SameAuthParamsLookupAutoClusterFailover.checkPulsarServices has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11, match/switch 6, 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.
LocalRunner.mergeArgs (cognitive 18) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java:814— LocalRunner.mergeArgs has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 9. 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.
CmdNamespaceIsolationPolicy.createNamespaceIsolationData (cognitive 18) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaceIsolationPolicy.java:176— CmdNamespaceIsolationPolicy.createNamespaceIsolationData has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, loops 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FunctionActioner.getDeleteTopicSupplier (cognitive 18) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/FunctionActioner.java:499— FunctionActioner.getDeleteTopicSupplier has cognitive complexity 18 (threshold 15). Drivers by points: error handling 8, if/else 7, 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.
ConnectorUtils.getConnectorConfigDefinition (cognitive 18) pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/io/ConnectorUtils.java:121— ConnectorUtils.getConnectorConfigDefinition has cognitive complexity 18 (threshold 15). Drivers by points: loops 7, if/else 5, ternaries 5, 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.
PulsarLedgerUnderreplicationManager.checkLayout (cognitive 18) pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/PulsarLedgerUnderreplicationManager.java:183— PulsarLedgerUnderreplicationManager.checkLayout has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, error handling 6, boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ZKSessionWatcher.checkState (cognitive 18) pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKSessionWatcher.java:152— ZKSessionWatcher.checkState has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, boolean chains 1, match/switch 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.
ConsumerHandler.getConsumerConfiguration (cognitive 18) pulsar-websocket/src/main/java/org/apache/pulsar/websocket/ConsumerHandler.java:446— ConsumerHandler.getConsumerConfiguration has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, error handling 2, boolean chains 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.
ActiveManagedCursorContainerImpl.insertNodeIntoList (cognitive 18) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ActiveManagedCursorContainerImpl.java:149— ActiveManagedCursorContainerImpl.insertNodeIntoList has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, boolean chains 1, loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BlobStoreManagedLedgerOffloader.offload (cognitive 18) tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreManagedLedgerOffloader.java:201— BlobStoreManagedLedgerOffloader.offload has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, error handling 7, boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PersistentTopic.checkReplication (cognitive 17) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:2027— PersistentTopic.checkReplication has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SharedConsumerAssignor.assign (cognitive 17) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SharedConsumerAssignor.java:57— SharedConsumerAssignor.assign has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, loops 2, 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.
PersistentTopicsBase.internalUpdatePartitionedTopicAsync (cognitive 17) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:382— PersistentTopicsBase.internalUpdatePartitionedTopicAsync has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, boolean chains 3, error handling 1, loops 1, ternaries 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SimpleLoadManagerImpl.doLoadShedding (cognitive 17) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/SimpleLoadManagerImpl.java:1311— SimpleLoadManagerImpl.doLoadShedding has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, loops 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.
NamespaceService.checkNonPersistentNonPartitionedTopicExists (cognitive 17) pulsar-broker/src/main/java/org/apache/pulsar/broker/namespace/NamespaceService.java:1499— NamespaceService.checkNonPersistentNonPartitionedTopicExists has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, boolean chains 2, 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.
NamespaceService.splitAndOwnBundleOnceAndRetry (cognitive 17) pulsar-broker/src/main/java/org/apache/pulsar/broker/namespace/NamespaceService.java:970— NamespaceService.splitAndOwnBundleOnceAndRetry has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, error handling 3, boolean chains 2, loops 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.
ResourceGroupNamespaceConfigListener.accept (cognitive 17) pulsar-broker/src/main/java/org/apache/pulsar/broker/resourcegroup/ResourceGroupNamespaceConfigListener.java:144— ResourceGroupNamespaceConfigListener.accept has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, error handling 5, match/switch 3, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PendingAckHandleImpl.handleIndividualAckRecover (cognitive 17) pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/pendingack/impl/PendingAckHandleImpl.java:886— PendingAckHandleImpl.handleIndividualAckRecover has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Section.remove (cognitive 17) pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentLongLongPairHashMap.java:460— Section.remove has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, boolean chains 5, 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.
ConcurrentOpenLongPairRangeSet.remove (cognitive 17) pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/ConcurrentOpenLongPairRangeSet.java:392— ConcurrentOpenLongPairRangeSet.remove has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 4, ternaries 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
OpenLongPairRangeSet.remove (cognitive 17) pulsar-common/src/main/java/org/apache/pulsar/common/util/collections/OpenLongPairRangeSet.java:394— OpenLongPairRangeSet.remove has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 4, ternaries 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
AutoTopicCreationOverrideImpl.validateOverride (cognitive 17) pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/impl/AutoTopicCreationOverrideImpl.java:39— AutoTopicCreationOverrideImpl.validateOverride has cognitive complexity 17 (threshold 15). Drivers by points: if/else 17 (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.
TopicStatsImpl.add (cognitive 17) pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/stats/TopicStatsImpl.java:271— TopicStatsImpl.add has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, boolean chains 3, loops 3 (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.
MessageCryptoBc.decrypt (cognitive 17) pulsar-client-messagecrypto-bc/src/main/java/org/apache/pulsar/client/impl/crypto/MessageCryptoBc.java:606— MessageCryptoBc.decrypt has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, loops 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.
MessageIdV5.fromByteArray (cognitive 17) pulsar-client-v5/src/main/java/org/apache/pulsar/client/impl/v5/MessageIdV5.java:265— MessageIdV5.fromByteArray has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, loops 3, boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConsumerBase.doPendingBatchReceiveTask (cognitive 17) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBase.java:1146— ConsumerBase.doPendingBatchReceiveTask has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, 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.
PersistentAcknowledgmentsGroupingTracker.newImmediateAckAndFlush (cognitive 17) pulsar-client/src/main/java/org/apache/pulsar/client/impl/PersistentAcknowledgmentsGroupingTracker.java:549— PersistentAcknowledgmentsGroupingTracker.newImmediateAckAndFlush has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, loops 6, 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.
ProducerImpl.run (cognitive 17) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:2316— ProducerImpl.run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, 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.
PulsarClientSharedResourcesImpl.<init> (cognitive 17) pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientSharedResourcesImpl.java:60— PulsarClientSharedResourcesImpl.<init> has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9, if/else 7, 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.
TransactionMetaStoreHandler.run (cognitive 17) pulsar-client/src/main/java/org/apache/pulsar/client/impl/TransactionMetaStoreHandler.java:802— TransactionMetaStoreHandler.run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, 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.
FunctionCommand.processArguments (cognitive 17) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java:138— FunctionCommand.processArguments has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15, 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.
GetMessageById.run (cognitive 17) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopics.java:1207— GetMessageById.run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 17 (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.
BatchSourceExecutor.stop (cognitive 17) pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/source/batch/BatchSourceExecutor.java:218— BatchSourceExecutor.stop has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, error handling 7 (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.
PulsarSource.createConsumeBuilder (cognitive 17) pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/source/PulsarSource.java:62— PulsarSource.createConsumeBuilder has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, boolean chains 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
KubernetesRuntime.deleteStatefulSet (cognitive 17) pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntime.java:600— KubernetesRuntime.deleteStatefulSet has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, ternaries 6, error handling 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.
KubernetesRuntime.getFunctionContainer (cognitive 17) pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntime.java:1017— KubernetesRuntime.getFunctionContainer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, boolean chains 2, match/switch 2, 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.
FunctionsImpl.validateUpdateRequestParams (cognitive 17) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/FunctionsImpl.java:779— FunctionsImpl.validateUpdateRequestParams has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, boolean chains 2, error handling 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FunctionRuntimeManager.getFunctionInstanceStats (cognitive 17) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/FunctionRuntimeManager.java:560— FunctionRuntimeManager.getFunctionInstanceStats has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15, 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.
LegacyHierarchicalLedgerRangeIterator.preload (cognitive 17) pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/LegacyHierarchicalLedgerRangeIterator.java:99— LegacyHierarchicalLedgerRangeIterator.preload has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, error handling 4, 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.
PulsarRegistrationClient.getBookiesThenFreshCache (cognitive 17) pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/PulsarRegistrationClient.java:137— PulsarRegistrationClient.getBookiesThenFreshCache has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, 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.
PulsarRegistrationClient.updatedBookies (cognitive 17) pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/PulsarRegistrationClient.java:219— PulsarRegistrationClient.updatedBookies has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, boolean chains 2, match/switch 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.
AbstractMetadataStore.put (cognitive 17) pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/AbstractMetadataStore.java:671— AbstractMetadataStore.put has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, ternaries 6, boolean chains 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.
RocksdbMetadataStore.storePut (cognitive 17) pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/RocksdbMetadataStore.java:592— RocksdbMetadataStore.storePut has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, ternaries 4, boolean chains 3, error handling 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.
ProducerHandler.popularProducerBuilderForServerSideEncrypt (cognitive 17) pulsar-websocket/src/main/java/org/apache/pulsar/websocket/ProducerHandler.java:500— ProducerHandler.popularProducerBuilderForServerSideEncrypt has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15, 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.
PulsarClusterMetadataSetup.main (cognitive 17) pulsar-broker/src/main/java/org/apache/pulsar/PulsarClusterMetadataSetup.java:221— PulsarClusterMetadataSetup.main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, boolean chains 4, ternaries 3, error handling 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PulsarClusterMetadataTeardown.main (cognitive 17) pulsar-broker/src/main/java/org/apache/pulsar/PulsarClusterMetadataTeardown.java:103— PulsarClusterMetadataTeardown.main has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6, loops 6, error handling 3, boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PendingReadsManager.findPendingRead (cognitive 17) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/cache/PendingReadsManager.java:146— PendingReadsManager.findPendingRead has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, 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.
ManagedCursorContainerImpl.siftDown (cognitive 17) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorContainerImpl.java:349— ManagedCursorContainerImpl.siftDown has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, 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.
ManagedCursorImpl.setAcknowledgedPosition (cognitive 17) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:2179— ManagedCursorImpl.setAcknowledgedPosition has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, ternaries 3, loops 2, 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.
ManagedLedgerImpl.checkCursorsToCacheEntries (cognitive 17) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:5205— ManagedLedgerImpl.checkCursorsToCacheEntries has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, loops 4, 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.
ManagedLedgerImpl.internalEvictOffloadedLedgers (cognitive 17) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:3012— ManagedLedgerImpl.internalEvictOffloadedLedgers has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, 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.
ManagedLedgerImpl.maybeUpdateCursorBeforeTrimmingConsumedLedger (cognitive 17) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:2737— ManagedLedgerImpl.maybeUpdateCursorBeforeTrimmingConsumedLedger has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15, 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.
ManagedLedgerImpl.offloadLoop (cognitive 17) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:3739— ManagedLedgerImpl.offloadLoop has cognitive complexity 17 (threshold 15). Drivers by points: if/else 17 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
1.operationComplete (cognitive 17) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:443— 1.operationComplete has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, loops 3, boolean chains 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.
BucketDelayedDeliveryTracker.recoverBucketSnapshot (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedDeliveryTracker.java:185— BucketDelayedDeliveryTracker.recoverBucketSnapshot has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, loops 7, error handling 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.
BucketDelayedDeliveryTracker.selectMergedBuckets (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedDeliveryTracker.java:469— BucketDelayedDeliveryTracker.selectMergedBuckets has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, 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.
MutableBucket.createImmutableBucketAndAsyncPersistent (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/MutableBucket.java:60— MutableBucket.createImmutableBucketAndAsyncPersistent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, loops 5, 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.
NonPersistentTopic.internalSubscribe (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentTopic.java:292— NonPersistentTopic.internalSubscribe has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, error handling 2, boolean chains 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.
AutoScaleConfig.applyOverride (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/scalable/AutoScaleConfig.java:128— AutoScaleConfig.applyOverride has cognitive complexity 16 (threshold 15). Drivers by points: if/else 16. 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.
AbstractTopic.incrementTopicEpochIfNeeded (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java:957— AbstractTopic.incrementTopicEpochIfNeeded has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 4, 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.
BrokerService.closeAsync (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:939— BrokerService.closeAsync has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, error handling 5, loops 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Consumer.getAckOwnerConsumerAndBatchSize (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Consumer.java:842— Consumer.getAckOwnerConsumerAndBatchSize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, loops 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.
DrainingHashesTracker.reduceRefCount (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/service/DrainingHashesTracker.java:327— DrainingHashesTracker.reduceRefCount has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15, 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.
MultiRolesTokenAuthorizationProvider.getRoles (cognitive 16) pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/MultiRolesTokenAuthorizationProvider.java:156— MultiRolesTokenAuthorizationProvider.getRoles has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, boolean chains 3 (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.
GzipByteBufferWriter.compressAndAppend (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/PrometheusMetricsGenerator.java:220— GzipByteBufferWriter.compressAndAppend has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, 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.
PersistentTopicsBase.internalGetMessageIDByIndexAsync (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:5700— PersistentTopicsBase.internalGetMessageIDByIndexAsync has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, boolean chains 2, error handling 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PersistentTopicsBase.internalSetReplicatedSubscriptionStatus (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:5238— PersistentTopicsBase.internalSetReplicatedSubscriptionStatus has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, error handling 3, loops 2 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PersistentTopicsBase.internalTriggerCompaction (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:4424— PersistentTopicsBase.internalTriggerCompaction has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, error handling 3, loops 2 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
UnloadScheduler.execute (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/scheduler/UnloadScheduler.java:113— UnloadScheduler.execute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15, 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.
BundleSplitterTask.findBundlesToSplit (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/BundleSplitterTask.java:64— BundleSplitterTask.findBundlesToSplit has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, error handling 3, boolean chains 2, 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.
SimpleLoadManagerImpl.doLoadRanking (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/SimpleLoadManagerImpl.java:650— SimpleLoadManagerImpl.doLoadRanking has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ResourceGroupService.calculateQuotaForAllResourceGroups (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/resourcegroup/ResourceGroupService.java:634— ResourceGroupService.calculateQuotaForAllResourceGroups has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, error handling 2, boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TopicTransactionBufferRecover.run (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java:820— TopicTransactionBufferRecover.run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, error handling 5, loops 2, 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.
PendingAckHandleImpl.checkPositionInPendingAckState (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/pendingack/impl/PendingAckHandleImpl.java:1099— PendingAckHandleImpl.checkPositionInPendingAckState has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15, 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.
PendingAckHandleImpl.handleIndividualAck (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/pendingack/impl/PendingAckHandleImpl.java:809— PendingAckHandleImpl.handleIndividualAck has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15, 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.
DefaultPulsarSslFactory.createSSLEngine (cognitive 16) pulsar-common/src/main/java/org/apache/pulsar/common/util/DefaultPulsarSslFactory.java:307— DefaultPulsarSslFactory.createSSLEngine has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, boolean chains 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.
FlowOrQpsEquallyDivideBundleSplitAlgorithm.getSplitBoundary (cognitive 16) pulsar-broker/src/main/java/org/apache/pulsar/common/naming/FlowOrQpsEquallyDivideBundleSplitAlgorithm.java:50— FlowOrQpsEquallyDivideBundleSplitAlgorithm.getSplitBoundary has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 5, 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.
OffloadPoliciesImpl.mergeConfiguration (cognitive 16) pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/OffloadPoliciesImpl.java:432— OffloadPoliciesImpl.mergeConfiguration has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, boolean chains 2, error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NarUnpacker.doUnpackNar (cognitive 16) pulsar-common/src/main/java/org/apache/pulsar/common/nar/NarUnpacker.java:68— NarUnpacker.doUnpackNar has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, error handling 5 (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.
AsyncSemaphoreImpl.internalProcessQueue (cognitive 16) pulsar-common/src/main/java/org/apache/pulsar/common/semaphore/AsyncSemaphoreImpl.java:241— AsyncSemaphoreImpl.internalProcessQueue has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, 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.
PublicSuffixMatcher.getDomainRoot (cognitive 16) pulsar-common/src/main/java/org/apache/pulsar/common/tls/PublicSuffixMatcher.java:134— PublicSuffixMatcher.getDomainRoot has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, ternaries 2, 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.
BatchMessageContainerImpl.add (cognitive 16) pulsar-client/src/main/java/org/apache/pulsar/client/impl/BatchMessageContainerImpl.java:115— BatchMessageContainerImpl.add has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, boolean chains 2, error handling 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.
ConnectionHandler.grabCnx (cognitive 16) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConnectionHandler.java:115— ConnectionHandler.grabCnx has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, boolean chains 1, 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.
ConsumerBase.callMessageListener (cognitive 16) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBase.java:1245— ConsumerBase.callMessageListener has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 3, ternaries 3, error handling 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.
ProducerImpl.failPendingMessages (cognitive 16) pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java:2380— ProducerImpl.failPendingMessages has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, error handling 3, ternaries 3, 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.
SinkDetailsCommand.mergeArgs (cognitive 16) pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdSinks.java:419— SinkDetailsCommand.mergeArgs has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 8. 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.
BKStateStoreProviderImpl.createStateTable (cognitive 16) pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/state/BKStateStoreProviderImpl.java:95— BKStateStoreProviderImpl.createStateTable has cognitive complexity 16 (threshold 15). Drivers by points: error handling 15, 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.
JavaInstance.handleMessage (cognitive 16) pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstance.java:115— JavaInstance.handleMessage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, error handling 4, ternaries 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ProcessRuntimeFactory.initialize (cognitive 16) pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/process/ProcessRuntimeFactory.java:117— ProcessRuntimeFactory.initialize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 16 (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.
ComponentImpl.getStreamingOutput (cognitive 16) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java:1454— ComponentImpl.getStreamingOutput has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, error handling 5, 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.
WorkerServer.init (cognitive 16) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/WorkerServer.java:103— WorkerServer.init has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, error handling 3, boolean chains 1, 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.
WorkerUtils.getFunctionInstanceStats (cognitive 16) pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/WorkerUtils.java:327— WorkerUtils.getFunctionInstanceStats has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 9, if/else 4, error handling 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.
MigrationCoordinator.copyPersistentData (cognitive 16) pulsar-metadata/src/main/java/org/apache/pulsar/metadata/coordination/impl/MigrationCoordinator.java:182— MigrationCoordinator.copyPersistentData has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ZooWorker.syncCallWithRetries (cognitive 16) pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/PulsarZooKeeperClient.java:1573— ZooWorker.syncCallWithRetries has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 3, error handling 2, 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.
ZKMetadataStore.internalStorePut (cognitive 16) pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKMetadataStore.java:438— ZKMetadataStore.internalStorePut has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, boolean chains 1, error handling 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ManagedCursorImpl.asyncFindNewestMatching (cognitive 16) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:1506— ManagedCursorImpl.asyncFindNewestMatching has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, ternaries 7, 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.
ManagedCursorImpl.recoverFromLedger (cognitive 16) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:611— ManagedCursorImpl.recoverFromLedger has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, boolean chains 5, error handling 2, loops 2 (nesting depth added 1). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpAddEntry.initiate (cognitive 16) managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java:129— OpAddEntry.initiate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, error handling 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.
ReadTask.run (cognitive 16) tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreBackedReadHandleImpl.java:138— ReadTask.run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, loops 4, boolean chains 1, 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.
Change coupling clique: PersistentSubscription.java, AggregatedSubscriptionStats.java, SubscriptionStats.java pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java— 3 files — `pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java`, `pulsar-broker/src/main/java/org/apache/pulsar/broker/stats/prometheus/AggregatedSubscriptionStats.java`, `pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/SubscriptionStats.java` — all change together with no explicit dependency: a fully-connected co-change clique, not 3 separate couplings. They share one concern (thin parallel siblings over a common abstraction), so extract the shared part into ONE unit and the whole clique's coupling clears at once — you do not need to break each pair individually.
Unpinned build actions — CI references GitHub Actions by a floating ref (@main / @tag) rather than a pinned commit SHA, weakening build integrity. 62 floating ref(s) across 8 workflow file(s), 3 of them mutable BRANCH refs (reported separately, pin those first): `actions/github-script@v8` (.github/workflows/pulsar-ci.yaml:91), `actions/checkout@v6` (.github/workflows/pulsar-ci.yaml:110), `actions/checkout@v6` (.github/workflows/pulsar-ci.yaml:148), `actions/setup-java@v5` (.github/workflows/pulsar-ci.yaml:162), `actions/upload-artifact@v4` (.github/workflows/pulsar-ci.yaml:185), `actions/upload-artifact@v7` (.github/workflows/pulsar-ci.yaml:203), `actions/checkout@v6` (.github/workflows/pulsar-ci.yaml:269), `actions/setup-java@v5` (.github/workflows/pulsar-ci.yaml:287), … (+51 more)
D36 · Supply-chain Provenance & Signing· PR-triggered workflow without a permissions block · ×1
PR-triggered workflow without a permissions block — 3 workflow(s) triggered by pull_request declare no `permissions:` block (pulsar-ci-flaky.yaml, ci-semantic-pull-request.yml, ci-go-functions.yaml) and so run with the repository's default GITHUB_TOKEN scope, while sibling workflows in the same repository are already scoped. Pull-request runs build the least-trusted code in the repository; give each of these workflows its own least-privilege block — `permissions: {contents: read}` at the top of the workflow, widened per job only where a job genuinely writes.
D38 · OSV Dependency Vulnerabilities· Medium vulnerability · ×1
Medium vulnerability: GO-2026-5841 pulsar-function-go/go.mod— github.com/klauspost/compress 1.18.0 (github.com/klauspost/compress/s2): GO-2026-5841 — github.com/klauspost/compress is not a DIRECT requirement of this module: go.mod records it as `// indirect`, pulled in transitively, so raise it in place (run `go get github.com/klauspost/compress@v1.18.7`, which updates the require line go.mod already holds for it).
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 81 significant file(s) lose their only recent owner: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/scalable/ScalableTopicController.java, pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/MetadataTransactionBuffer.java, pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/coordinator/v5/TransactionCoordinatorV5.java, pulsar-broker/src/main/java/org/apache/pulsar/broker/service/scalable/SubscriptionCoordinator.java, pulsar-client-v5/src/main/java/org/apache/pulsar/client/impl/v5/ScalableStreamConsumer.java, pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/metadata/TxnMetadataStore.java, pulsar-broker-common/src/main/java/org/apache/pulsar/broker/resources/ScalableTopicResources.java, pulsar-client-v5/src/main/java/org/apache/pulsar/client/impl/v5/ScalableQueueConsumer.java (+73 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 8 significant file(s) lose their only recent owner: pulsar-package-management/core/src/main/java/org/apache/pulsar/packages/management/core/impl/PackagesManagementImpl.java, pulsar-broker/src/main/java/org/apache/pulsar/broker/service/TopicPolicyListenerWrapper.java, pulsar-common/src/main/java/org/apache/pulsar/common/util/netty/PulsarFlowControlHandler.java, pulsar-package-management/core/src/main/java/org/apache/pulsar/packages/management/core/common/PackageMetadataUtil.java, build-logic/conventions/src/main/kotlin/CheckBinaryLicenseTask.kt, pulsar-common/src/main/java/org/apache/pulsar/Pulsar...
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.