Public report of owpengram/owpengram-server, published 17 November 2026. It has the same score, grades and number of findings as the full report. The details of security findings (where they are in the code, which known vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive report Measured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey → Signed and filed in the standard's public register, 17 November 2026, 16:11 UTC · Survey ID cd_9909bc07eb9a4d1d97423cba0968fb92

owpengram/owpengram-server

Measured 17 November 2026, 16:07 UTC, at code version fd71728

First survey, so nothing to compare with yet
CAI score 46.2out of 100 At risk

The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.

A large codebase: 347,092 lines of product code in 3 projects, tests not counted · Estimated rebuild effort: about 4.1 person-years · Weakest lens: Production Readiness, 32.6

Findings by how serious they are

91 critical 4885 serious 510 minor

24 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.

This survey was produced by

Assert small markCanine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
17 November 2026, 16:07 UTC

A measurement, not a certificate. The Code Assurance Index records a number together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that implements it, and today the Canine Code Analyzer is the only one that does.

A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.

The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸

71of 71 dimensions measured by tools.
5451of 5486 findings point to an exact file and line, so you can open each one in the code. The other 35 concern the repository as a whole, such as missing documentation.
71dimensions across 8 lenses, read from 347,092 lines of product code in 3 projects.
Chapters

Executive summary

owpengram/owpengram-server is rated At risk because critical security findings are open. Its score is held back because two passwords or keys sit in the current code and we found no working pipeline that builds or tests changes to the code. It scores 46.2 out of 100, which the At risk rating leaves unchanged.

Production Readiness, at 32.6, is the weakest lens and counts most in the score. The best first step is replacing the two exposed passwords or keys and switching the old ones off, worth about 11.2 points. Pinning the dependencies to tagged releases comes next, worth about 6.4 points. Raising Production Readiness to 70 would lift the score to about 57.1.

Seven weaknesses in the code could be used by an attacker. Five known security holes in the packages the code depends on can be used by attackers, and fifty-six parts of the code are no longer understood by anyone working on it. Fixing the weaknesses the scanner points to, updating the vulnerable packages and having someone learn the forgotten files would close these risks. The two passwords or keys in the code need replacing, with the old ones switched off. The unsafe setting in infrastructure or container files needs changing to safe values. The 14 form fields without a label need a label.

The product code is 347,092 lines, about €590,000 to rebuild.

A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.

How the score is built: what each lens counts for The lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
Production Readiness 32.6 · counts for 45%Accessibility 48.9 · counts for 25%Maturity 58.2 · counts for 14%Security and Compliance 64.4 · counts for 8%Code Health 68.7 · counts for 4%Domain Modelling 70.4 · counts for 2%Architecture 94.2 · counts for 1%Performance 97.1 · counts for 1%

If Production Readiness rose from 32.6 to 70, the lowest score rated Strong, the score would rise from 46.2 to about 57.1.

Code composition: what the lines of code are
Product code 61%Tests 39%
Rebuild cost: about €590,000 · Estimate
Cost to rebuild€200,000 to €980,000, for 3,265 to 10,359 hours of work, about 4.1 person-years for 2 to 8 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.7 at a score of 46. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeLarge: 347,092 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.

Top priorities

The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.

1
Resolve the 2 Leaked secret finding(s) in Secret Scanning — start with REDACTED (2).
Raises the score by about 11.2 points · Low effort · Secret Scanning
2
Resolve the 1 Dependency pinned to a stale untagged commit finding(s) in Dependency Hygiene.
Raises the score by about 6.4 points · Low effort · Dependency Hygiene
3
Add a CI workflow that builds and runs the test suite on every push/PR.
Raises the score by about 5.6 points · Medium effort · CI/CD gates

Diagnosis: what the measurements show together

Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.

Files that change often carry extra risk · Combined risk
27 files are changed often and are hard to read, which makes them the likeliest places for a mistake. They also have under half their code tested, or were written almost entirely by one person, so a mistake there is less likely to be caught, or only one person knows the code well enough to avoid it. A change to these files therefore carries more risk than the overall score suggests.
Based on: Churn × Complexity Hotspots (42 files) · Code Coverage (297 files under half tested) · Bus Factor (0 files written almost entirely by one person) · The files: REDACTED, REDACTED and REDACTED
What to do: Add tests to these files and have a second person review every change to them, starting with REDACTED, REDACTED and REDACTED.
Where the investment is most exposed · Value at risk
This code would cost about €590,000 to build again, about 4.1 person-years of work. Its weakest lens is Production Readiness, at 32.6 (Weak). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
Resolve the 2 Leaked secret finding(s) in Secret Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 11.2 points for low effort, because it clears the 2 Secret Scanning findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 4.3 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 9% to 21% on every change. The history of the code shows how much it changes: about 151,277 lines over the last 90 days, which is about 613,512 lines a year. At that pace, the extra work comes to an estimated 140.8 to 844.7 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture: which parts of the code depend on which

The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.

152 modules, with 297 dependencies between them. One loop runs through 22 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 112 more are left out to keep it readable.

Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
uses →1 cmd.telesrv-admin.web.src.pages2 telesrv/internal/domain3 telesrv/internal/readmodelcache4 telesrv/internal/app/giftpack5 telesrv/internal/app/translation6 telesrv/internal/botapi7 telesrv/internal/store8 telesrv/internal/web9 telesrv/internal/adminapi10 telesrv/internal/app/chatlists11 telesrv/internal/app/ephemeral12 telesrv/internal/app/moderation13 telesrv/internal/app/stories14 telesrv/internal/app/telegramlogin15 telesrv/internal/mtprotoedge16 telesrv/internal/admin17 telesrv/cmd/telesrv-admin18 telesrv/internal/app/auth19 telesrv/internal/app/botverification20 telesrv/internal/app/stargifts21 telesrv/internal/app/verification22 telesrv/internal/app/channels23 telesrv/internal/app/files24 telesrv/internal/store/postgres25 telesrv/internal/app/userprojection26 telesrv/internal/app/messages27 telesrv/internal/app/bots28 telesrv/internal/app/donations29 telesrv/internal/rpc30 telesrv/internal/app/account31 telesrv/internal/app/ai32 telesrv/internal/app/contacts33 telesrv/internal/app/dialogs34 telesrv/internal/app/premium35 telesrv/internal/app/stars36 telesrv/internal/app/usernames37 telesrv/internal/app/users38 telesrv/internal/store/memory39 telesrv/cmd/telesrv40 telesrv/internal/app/privacy
1 cmd.telesrv-admin.web.src.pages
2 telesrv/internal/domain
3 telesrv/internal/readmodelcache
4 telesrv/internal/app/giftpack101
5 telesrv/internal/app/translation1112
6 telesrv/internal/botapi53
7 telesrv/internal/store573
8 telesrv/internal/web18
9 telesrv/internal/adminapi52181
10 telesrv/internal/app/chatlists1641
11 telesrv/internal/app/ephemeral2221
12 telesrv/internal/app/moderation787171
13 telesrv/internal/app/stories2622
14 telesrv/internal/app/telegramlogin3321
15 telesrv/internal/mtprotoedge48
16 telesrv/internal/admin1583111
17 telesrv/cmd/telesrv-admin117
18 telesrv/internal/app/auth112312
19 telesrv/internal/app/botverification214111
20 telesrv/internal/app/stargifts681611
21 telesrv/internal/app/verification23511
22 telesrv/internal/app/channels18668111111124
23 telesrv/internal/app/files771414321
24 telesrv/internal/store/postgres79471111081113121131117
25 telesrv/internal/app/userprojection46263
26 telesrv/internal/app/messages7611111174
27 telesrv/internal/app/bots951110312113
28 telesrv/internal/app/donations7211
29 telesrv/internal/rpc10369737551
30 telesrv/internal/app/account6231119
31 telesrv/internal/app/ai2121
32 telesrv/internal/app/contacts1816171
33 telesrv/internal/app/dialogs35412171
34 telesrv/internal/app/premium92111
35 telesrv/internal/app/stars11412
36 telesrv/internal/app/usernames12411
37 telesrv/internal/app/users77173
38 telesrv/internal/store/memory64311104111121315
39 telesrv/cmd/telesrv5221123113123
40 telesrv/internal/app/privacy1135311
Uses a module listed above itPart of a loopThe module itself
1 cmd.telesrv-admin.web.src.pages2 telesrv/internal/domain3 telesrv/internal/readmodelcache4 telesrv/internal/app/giftpack5 telesrv/internal/app/translation6 telesrv/internal/botapi7 telesrv/internal/store8 telesrv/internal/web9 telesrv/internal/adminapi10 telesrv/internal/app/chatlists11 telesrv/internal/app/ephemeral12 telesrv/internal/app/moderation13 telesrv/internal/app/stories14 telesrv/internal/app/telegramlogin15 telesrv/internal/mtprotoedge16 telesrv/internal/admin17 telesrv/cmd/telesrv-admin18 telesrv/internal/app/auth19 telesrv/internal/app/botverification20 telesrv/internal/app/stargifts21 telesrv/internal/app/verification22 telesrv/internal/app/channels23 telesrv/internal/app/files24 telesrv/internal/store/postgres25 telesrv/internal/app/userprojection26 telesrv/internal/app/messages27 telesrv/internal/app/bots28 telesrv/internal/app/donations29 telesrv/internal/rpc30 telesrv/internal/app/account31 telesrv/internal/app/ai32 telesrv/internal/app/contacts33 telesrv/internal/app/dialogs34 telesrv/internal/app/premium35 telesrv/internal/app/stars36 telesrv/internal/app/usernames37 telesrv/internal/app/users38 telesrv/internal/store/memory39 telesrv/cmd/telesrv40 telesrv/internal/app/privacycmd.telesrv-admin.web.src.pages1telesrv/internal/domain2telesrv/internal/readmodelcache3telesrv/internal/app/giftpack4telesrv/internal/app/translation5telesrv/internal/botapi6telesrv/internal/store7telesrv/internal/web8telesrv/internal/adminapi9telesrv/internal/app/chatlists10telesrv/internal/app/ephemeral11telesrv/internal/app/moderation12telesrv/internal/app/stories13telesrv/internal/app/telegramlogin14telesrv/internal/mtprotoedge15telesrv/internal/admin16telesrv/cmd/telesrv-admin17telesrv/internal/app/auth18telesrv/internal/app/botverification19telesrv/internal/app/stargifts20telesrv/internal/app/verification21telesrv/internal/app/channels22telesrv/internal/app/files23telesrv/internal/store/postgres24telesrv/internal/app/userprojection25telesrv/internal/app/messages26telesrv/internal/app/bots27telesrv/internal/app/donations28telesrv/internal/rpc29telesrv/internal/app/account30telesrv/internal/app/ai31telesrv/internal/app/contacts32telesrv/internal/app/dialogs33telesrv/internal/app/premium34telesrv/internal/app/stars35telesrv/internal/app/usernames36telesrv/internal/app/users37telesrv/internal/store/memory38telesrv/cmd/telesrv39telesrv/internal/app/privacy401011112535731852181164122217871712622332148158311111711231221411168161123511186681111111247714143217947111108111312113111746263761111117495111031211372111036973755162311192121181617135412171921111141212411771736431110411112131552211231131231135311+112 more modules (most-connected shown)

At a glance — Code Health · 68.7 · Adequate · gated by D1, D2, D4 ·

At a glance — Architecture · 94.2 · Adequate · gated by D26 ·

At a glance — Maturity · 58.2 · Adequate · gated by M2 ·

At a glance — Readiness · 32.6 · Weak · gated by D13, P1, P3, P5 ·

At a glance — Security · 64.4 · Checked 4 of 11 · gated by D29 ·

At a glance — Domain Modelling · 70.4 · Adequate · gated by DM2 ·

At a glance — Accessibility · 48.9 · Weak · gated by AC4 ·

At a glance — Performance · 97.1 · Exemplary ·

Security & Compliance — OWASP Top-10 mapping

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 categoryFindingsSeverity
A05:2025 — Injection28High / Critical
A03:2025 — Software Supply Chain Failures13High / Critical
A01:2025 — Broken Access Control7Medium
A07:2025 — Authentication Failures2High / Critical
A02:2025 — Security Misconfiguration2High / Critical

Roadmap

Top priorities: Resolve the 2 Leaked secret finding(s) in Secret Scanning — start with REDACTED (2); Resolve the 1 Dependency pinned to a stale untagged commit finding(s) in Dependency Hygiene; Add a CI workflow that builds and runs the test suite on every push/PR.

Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.

Do thisHelpsEffortDimension
Resolve the 2 Leaked secret finding(s) in Secret Scanning — start with REDACTED (2).+11.2 ptsLowSecret Scanning
Resolve the 1 Dependency pinned to a stale untagged commit finding(s) in Dependency Hygiene.+6.4 ptsLowDependency Hygiene
Add a CI workflow that builds and runs the test suite on every push/PR.+5.6 ptsMediumCI/CD gates
Resolve the 1 finding(s) in DR & Backup.+5.6 ptsMediumDR & Backup
Run what this repository's stack ships: gosec / govulncheck (or golangci-lint) — or `semgrep --config=auto`, which runs on any language — locally for now, since there is no CI pipeline here yet, and as a step of the first workflow you add so a security regression fails the build instead of landing.+3.8 ptsMediumSecurity & performance tooling
Resolve the 335 Low coverage finding(s) in Code Coverage — start with REDACTED (16), REDACTED (9), account_rating.go (4).+3.8 ptsHighCode Coverage
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with REDACTED.+1.7 ptsLowADR Quality
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.+3.4 ptsMediumKeyboard semantics

File quality

Per-file score 0–10 — a quality signature. Of 736 files carrying findings, judged against the Production bar: 1% slop · 78% mixed · 21% near-clean.

FileScoreBandWorst signal
REDACTED1.1SlopDependency Vulnerabilities: High CVE: REDACTED
REDACTED1.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED1.5SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.8SlopSecret Scanning: Leaked secret: REDACTED
REDACTED3.1SlopStatic Analysis (SAST): High: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedData Compliance (PII/GDPR): Medium: REDACTED
internal/store/postgres/community.go4.0MixedCyclomatic Complexity: CommunityStore.ToggleCommunityParticipantBanned (cyclomatic 27)
REDACTED4.0MixedData Compliance (PII/GDPR): Medium: REDACTED
REDACTED4.0MixedData Compliance (PII/GDPR): Medium: REDACTED
REDACTED4.0MixedData Compliance (PII/GDPR): Medium: REDACTED
cmd/walletminiapp/main.go4.0MixedCognitive Complexity: main.parseWebAppSession (cognitive 17)
REDACTED4.8MixedGod Classes: TooManyMethods: server

How the grades work

Every finding carries one of four grades. Three say how serious it is. The fourth says this survey could not settle it — and it is a grade, not a gap.

Critical — 91

A definite problem that already costs you something and drags the score down: a missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here tends to cause failures elsewhere.

Serious — 4885

Likely wrong, but not failing yet. It degrades the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to carry for two years either.

Minor — 510

Recorded, with no effect on how the codebase functions. Present so the survey is complete, not because it needs doing.

Could not be resolved — 24

Something this survey could not settle from the outside, and which could be critical or serious. Either a control was required and no positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean result. These are excluded from the score rather than awarded a pass, so the number on the cover neither rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each one is named under Limitations.

Methodology & how to trust this report

This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 71 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 1.0, the weighted average across measured dimensions.

Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.

What we checked — 71 dimensions across the health lenses
D1D2D3D4D6D8D11D12D13D14D15D16D17D19D20D21D23D26D27D29D30D31D32D34D35D43D44AC1AC2AC3AC4AC5AC6AX10AX2AX3AX4AX6DM1DM10DM11DM12DM2DM4DM5DM6DM7DM9M1M2M3M4P1P2P3P4P5P7P8P9PF1PF3X14X19X2X26X27X28X3X30X4

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
  1. 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, 5451 of 5486 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.)
  2. Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
  3. 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.

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Canine Code Analyzer duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivy · checkovSecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3 · 3.2.533✓ deterministic

Every finding is locatable in findings.md. Run 01a1ea43-c94a-7057-813a-60274587fd60.

The exact command behind every deep-scan dimension — tool, version, invocation and retained raw output — is in Appendix B — Reproduction & audit trail.

Run transparency — what happened this run

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.

  • D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares a Go module (REDACTED/go.sum), but the licence verdict published here was taken over its Python distribution dependencies. Nothing was read about its Go dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
  • D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is a COLLECTOR gap, not an environment fault: it declares a published package (REDACTED), but no published-package marker D22 reads admitted any project here, so this ecosystem's public API has no collector, and the remedy is to write one — no change to the scan image can close it.
  • D23 Boundary Type-Coupling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind measured 0/40 valid on a seeded held-out sample of its rows on 98 C# repositories (docs/plans/deterministic-engine/adjudication/P5c-D23-units.md, "Version 1 ON MAIN"): the noise rows were dependencies on layer folders, shared cores and grouping folders read as contexts. By the pre-registered fallback (PREREGISTRATION v37) it publishes no row until version 4 passes its gate. The candidates are counted here, not reported as findings, and the score does not include them.
  • D24 Comment Value — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
  • D28 Secrets (history) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `gitleaks` TIMED OUT after 83.6s against a 83.3s budget, so we killed its process tree. The budget is ours; the work may simply be larger than it allows. Nothing about this repository is asserted by the absence of a result; the budget is ours to raise, and raising it is our backlog item, not an action for this repository's owner.
  • D32 Data Compliance (PII/GDPR) — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. `internal/rpc/channel_full_bot_cache.go`, `internal/rpc/rpc_projection_cache.go`, `internal/store/postgres/saved_dialog.go` produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
  • AC1 Text alternatives — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository builds user interface as HTML STRINGS — 1 script file(s) building 61 markup element(s) as HTML strings, carrying 0 role/aria/tabindex attribute(s) (e.g. cmd/telesrv-admin/web/src/components/BgIcons.tsx) — that this run could NOT read, and the accessibility cards beside it were measured over the 78 parsed markup document(s) only. The markup model reads .html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx, html`…` templates and DOM-assigned HTML strings in .ts/.js, the .erb/.ejs/.eex/.heex/.leex/.twig/.jinja/.j2/.liquid/.njk/.hbs/.mustache/.blade.php/.gohtml template languages, .astro/.templ/.pug/.jade/.haml/.slim, and the kotlinx.html/Compose HTML/kotlin-react, Giraffe/Falco/Fable.React/Feliz/Bolero and Jaspr builder DSLs; the runs counted here are the ones its producer could not take — an element whose TAG NAME is a concatenated expression has no statically knowable identity, and a string-built run inside a .jsx/.tsx file is already read as JSX — so they were not merely unparsed but unenumerated: not one of their elements entered the population any card scored. Their absence from the counts above is a gap in this analyzer's frontend coverage — not a finding that they carry text alternatives, labels, keyboard semantics or correct ARIA.
  • AC2 Forms & labels — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository builds user interface as HTML STRINGS — 1 script file(s) building 61 markup element(s) as HTML strings, carrying 0 role/aria/tabindex attribute(s) (e.g. cmd/telesrv-admin/web/src/components/BgIcons.tsx) — that this run could NOT read, and the accessibility cards beside it were measured over the 78 parsed markup document(s) only. The markup model reads .html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx, html`…` templates and DOM-assigned HTML strings in .ts/.js, the .erb/.ejs/.eex/.heex/.leex/.twig/.jinja/.j2/.liquid/.njk/.hbs/.mustache/.blade.php/.gohtml template languages, .astro/.templ/.pug/.jade/.haml/.slim, and the kotlinx.html/Compose HTML/kotlin-react, Giraffe/Falco/Fable.React/Feliz/Bolero and Jaspr builder DSLs; the runs counted here are the ones its producer could not take — an element whose TAG NAME is a concatenated expression has no statically knowable identity, and a string-built run inside a .jsx/.tsx file is already read as JSX — so they were not merely unparsed but unenumerated: not one of their elements entered the population any card scored. Their absence from the counts above is a gap in this analyzer's frontend coverage — not a finding that they carry text alternatives, labels, keyboard semantics or correct ARIA.
  • AC3 Page structure — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository builds user interface as HTML STRINGS — 1 script file(s) building 61 markup element(s) as HTML strings, carrying 0 role/aria/tabindex attribute(s) (e.g. cmd/telesrv-admin/web/src/components/BgIcons.tsx) — that this run could NOT read, and the accessibility cards beside it were measured over the 78 parsed markup document(s) only. The markup model reads .html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx, html`…` templates and DOM-assigned HTML strings in .ts/.js, the .erb/.ejs/.eex/.heex/.leex/.twig/.jinja/.j2/.liquid/.njk/.hbs/.mustache/.blade.php/.gohtml template languages, .astro/.templ/.pug/.jade/.haml/.slim, and the kotlinx.html/Compose HTML/kotlin-react, Giraffe/Falco/Fable.React/Feliz/Bolero and Jaspr builder DSLs; the runs counted here are the ones its producer could not take — an element whose TAG NAME is a concatenated expression has no statically knowable identity, and a string-built run inside a .jsx/.tsx file is already read as JSX — so they were not merely unparsed but unenumerated: not one of their elements entered the population any card scored. Their absence from the counts above is a gap in this analyzer's frontend coverage — not a finding that they carry text alternatives, labels, keyboard semantics or correct ARIA.
  • AC4 Keyboard semantics — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository builds user interface as HTML STRINGS — 1 script file(s) building 61 markup element(s) as HTML strings, carrying 0 role/aria/tabindex attribute(s) (e.g. cmd/telesrv-admin/web/src/components/BgIcons.tsx) — that this run could NOT read, and the accessibility cards beside it were measured over the 78 parsed markup document(s) only. The markup model reads .html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx, html`…` templates and DOM-assigned HTML strings in .ts/.js, the .erb/.ejs/.eex/.heex/.leex/.twig/.jinja/.j2/.liquid/.njk/.hbs/.mustache/.blade.php/.gohtml template languages, .astro/.templ/.pug/.jade/.haml/.slim, and the kotlinx.html/Compose HTML/kotlin-react, Giraffe/Falco/Fable.React/Feliz/Bolero and Jaspr builder DSLs; the runs counted here are the ones its producer could not take — an element whose TAG NAME is a concatenated expression has no statically knowable identity, and a string-built run inside a .jsx/.tsx file is already read as JSX — so they were not merely unparsed but unenumerated: not one of their elements entered the population any card scored. Their absence from the counts above is a gap in this analyzer's frontend coverage — not a finding that they carry text alternatives, labels, keyboard semantics or correct ARIA.
  • AC5 ARIA correctness — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository builds user interface as HTML STRINGS — 1 script file(s) building 61 markup element(s) as HTML strings, carrying 0 role/aria/tabindex attribute(s) (e.g. cmd/telesrv-admin/web/src/components/BgIcons.tsx) — that this run could NOT read, and the accessibility cards beside it were measured over the 78 parsed markup document(s) only. The markup model reads .html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx, html`…` templates and DOM-assigned HTML strings in .ts/.js, the .erb/.ejs/.eex/.heex/.leex/.twig/.jinja/.j2/.liquid/.njk/.hbs/.mustache/.blade.php/.gohtml template languages, .astro/.templ/.pug/.jade/.haml/.slim, and the kotlinx.html/Compose HTML/kotlin-react, Giraffe/Falco/Fable.React/Feliz/Bolero and Jaspr builder DSLs; the runs counted here are the ones its producer could not take — an element whose TAG NAME is a concatenated expression has no statically knowable identity, and a string-built run inside a .jsx/.tsx file is already read as JSX — so they were not merely unparsed but unenumerated: not one of their elements entered the population any card scored. Their absence from the counts above is a gap in this analyzer's frontend coverage — not a finding that they carry text alternatives, labels, keyboard semantics or correct ARIA.
  • AC6 Visual & motion safety — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository builds user interface as HTML STRINGS — 1 script file(s) building 61 markup element(s) as HTML strings, carrying 0 role/aria/tabindex attribute(s) (e.g. cmd/telesrv-admin/web/src/components/BgIcons.tsx) — that this run could NOT read, and the accessibility cards beside it were measured over the 78 parsed markup document(s) only. The markup model reads .html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx, html`…` templates and DOM-assigned HTML strings in .ts/.js, the .erb/.ejs/.eex/.heex/.leex/.twig/.jinja/.j2/.liquid/.njk/.hbs/.mustache/.blade.php/.gohtml template languages, .astro/.templ/.pug/.jade/.haml/.slim, and the kotlinx.html/Compose HTML/kotlin-react, Giraffe/Falco/Fable.React/Feliz/Bolero and Jaspr builder DSLs; the runs counted here are the ones its producer could not take — an element whose TAG NAME is a concatenated expression has no statically knowable identity, and a string-built run inside a .jsx/.tsx file is already read as JSX — so they were not merely unparsed but unenumerated: not one of their elements entered the population any card scored. Their absence from the counts above is a gap in this analyzer's frontend coverage — not a finding that they carry text alternatives, labels, keyboard semantics or correct ARIA.
  • AX1 Captive dependencies — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in internal/rpc/callback_registry.go, whose lifetimes are not modelled yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • AXB2 Runtime readiness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. The dev server kept running but no port it opened served a page in the time allowed. (rule: no-answer). The renderer reported: the dev server (`npm run dev` in cmd/telesrv-admin/web/) kept running but served no page within 2 minutes. Likely cause (not identified): the dev server kept running but no port it opened served a page in the time allowed. Last output: "> telesrv-admin-ui@0.1.0 dev / > vite / VITE v8.1.0 ready in 214 ms / ➜ Local: http://localhost:2410/ / ➜ Network: use --host to expose" No runtime evidence was gathered.
  • AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DevServer (dev). the dev server (`npm run dev` in cmd/telesrv-admin/web/) kept running but served no page within 2 minutes. Likely cause (not identified): the dev server kept running but no port it opened served a page in the time allowed. Last output: "> telesrv-admin-ui@0.1.0 dev / > vite / VITE v8.1.0 ready in 214 ms / ➜ Local: http://localhost:2410/ / ➜ Network: use --host to expose" No runtime evidence was gathered.
  • C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • C2 Access Controls — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
  • C3 Audit Trail — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
  • C4 Data Retention — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
  • C5 Data-Subject Rights — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
  • DM8 Value-object opportunities — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check finds primitive parameters that travel together through several signatures of the domain (a missing value object). Its deterministic rule has not yet shown 95 % precision on adjudicated rows, so the clumps it finds are counted here and not published as findings, and the card carries no score. That is a limit of the analyzer, not a finding about your code.
  • DM9 Scattered domain decisions — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Arm two tells a construction that PRODUCES a measurement from one that merely passes it along, and this repository's frontend does not compute that fact. A measurement built independently in two places would not appear above.
  • DM9 Scattered domain decisions — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Some of this repository's production types come from a frontend that does not bind comparison operands to the members they read, which arm one needs, and those types were not walked for this dimension. The counts above speak for the languages that declare it.
  • GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java source only, and no C#, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Java was found, and this repository's Go, Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby, Scala and Rust source only, and no C#, JavaScript/TypeScript, Java, Dart, Ruby, Scala or Rust was found, and this repository's Go, Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • S1 Web-Security Posture — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
  • X1 Async correctness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X10 Duplicated predicate — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 437 further occurrence(s) are not listed individually; the score already reflects all 477.
  • X12 Unreachable branch — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala, Kotlin and Rust source only, and no C# was loaded and no JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala, Kotlin or Rust was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X18 Disposal-pattern correctness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala, PHP, Rust and Elixir source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala, PHP, Rust or Elixir was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X24 Document value interpolated into markup unescaped — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X25 Inert configuration knob — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X29 Per-element action decided by a fixed element — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript (Vue and Svelte components included), Java, Rust, Dart, Ruby, Scala, Kotlin and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Rust, Dart, Ruby, Scala or Kotlin was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X3 Exception handling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 227 further occurrence(s) are not listed individually; the score already reflects all 267.
  • X5 Nullable reference types — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, Kotlin source, and Rust source only, and no C# was loaded, no TypeScript was found, and this repository's Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.

Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.

Limitations & what we did not check

We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.

Per-dimension blind spots

For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D8 Code Coverage: Coverage is measured by building and running the test suite inside our isolated image — the target repo is never modified, and nothing on your systems runs. So coverage exists only when the suite builds and runs within the inline time budget; one that needs external services, can't build, or exceeds the budget yields no coverage (D8 then degrades to not-measured, not a low score). Line coverage also says nothing about assertion quality.
  • D11 Test Reliability: Flakiness is inferred from history/markers — we run the suite once (for coverage), not the repeated runs under varied conditions that reveal nondeterminism, so a flaky test never recorded as failing is invisible here.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 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").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
  • D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
  • D23 Boundary Type-Coupling: Boundary leakage is detected from type references across detected contexts — leaks that flow through primitives, serialization or shared infrastructure may not surface as a typed reference.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned REDACTED, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • 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.
  • D32 Data Compliance (PII/GDPR): PII/GDPR signals are heuristic pattern matches in code — they flag likely handling concerns, not legal compliance, and cannot trace where data actually flows at runtime.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (REDACTED, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
  • AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
  • AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
  • AC4 Keyboard semantics: Keyboard semantics are inferred from markup attributes — interactivity wired purely in script, focus managed at runtime, and component-level handlers are invisible. A clean result means "no static keyboard-trap shape", not a keyboard-operability proof.
  • AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
  • AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • DM4 Rich vs anemic model: Behaviour is detected as state mutation inside a method body — a method that enforces an invariant by validating-and-throwing without mutating reads as a query, and mutation delegated through an interface the scan can't resolve isn't credited; entities with zero public properties still drop out of the population. It detects that state changes, not whether the rule is correct.
  • DM6 Domain ↔ infrastructure boundary: Infrastructure reached through a hand-rolled wrapper, a domain-named facade, reflection, or a string-keyed service locator resolves to a non-infra type and isn't seen; the body scan is symbol resolution over syntax, not full dataflow. A clean result means "no resolved infra reference in a domain body", not a proof of purity.
  • M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.

Dimensions

D1 · Cyclomatic Complexity2.0 / 10Critical✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 2.0 / 10 · rule-coverage 100% · ceiling Prevented

868 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was ReadModelChangeListener.handlePayload at 144. A further 26 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 handler.handle at 41 — they are counted neither in the figure above nor in this dimension's score. 5 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: internal/admin/botverification.go (admin.BotVerificationErrorCode at 20), internal/domain/botapi_update.go (BotAPIEphemeralMessage.Validate at 20), internal/domain/channel.go (ChannelAdminLogFilter.Empty at 19), internal/domain/moderation_registry.go (domain.ValidateSponsoredModerationReport at 18), internal/domain/premium.go (PremiumPaymentForm.Valid at 18). They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.

ChannelStore.ListChannelMessagePublicForwards (cyclomatic 20) · ×2internal/store/memory/channel_stats.go:241
CommunityStore.DecideAllCommunityPeerLinkRequests (cyclomatic 16) · ×2internal/store/memory/community.go:590
ReadModelChangeListener.handlePayload (cyclomatic 144)internal/store/postgres/read_model_listener.go:381
main.run (cyclomatic 136)REDACTED:600
config.Load (cyclomatic 109)internal/config/config.go:958

+ 861 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 2 bodies over 120 down to 120 or less in Cyclomatic Complexity — start with ReadModelChangeListener.handlePayload (cyclomatic 144), main.run (cyclomatic 136). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 2 together lifts Cyclomatic Complexity from 2.0 to about 2.2/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.

Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.

D2 · Cognitive Complexity2.0 / 10Critical✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 2.0 / 10 · rule-coverage 100% · ceiling Prevented

1098 method(s) exceeded the cognitive complexity threshold of 15; the worst was Server.prepareInboundLayerRPCBatch at 239.

main.main (cognitive 40) · ×2REDACTED:86
TelegramLoginStore.UpsertTelegramLoginNativeApp (cognitive 22) · ×2internal/store/memory/telegram_login.go:214
Server.prepareInboundLayerRPCBatch (cognitive 239)internal/mtprotoedge/inbound_layer_rpc.go:305
ReadModelChangeListener.handlePayload (cognitive 226)internal/store/postgres/read_model_listener.go:381
main.run (cognitive 165)REDACTED:600

+ 1091 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 76 bodies over 60 down to 60 or less in Cognitive Complexity — start with Server.prepareInboundLayerRPCBatch (cognitive 239), ReadModelChangeListener.handlePayload (cognitive 226), main.run (cognitive 165). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 76 together lifts Cognitive Complexity from 2.0 to about 3.2/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.

Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.

D3 · God Classes7.4 / 10Strong✓ Tool-verified

What it measures: Over-large classes that try to do too much ("god classes").

Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.

Maturity: Documented → Verified → Prevented · effective 7.4 / 10 · rule-coverage 100% · ceiling Prevented

348 god class(es) detected.

FileTooLong: admin/service.go · ×127internal/admin/service.go
MethodTooLong: Router.registerMessages · ×78internal/rpc/messages_register.go:15
TooManyMethods: Router · ×52internal/rpc/router.go:127
ClassTooLong: server · ×50REDACTED:36
TooManyFields: Config · ×26internal/config/config.go:38

+ 1 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 127 FileTooLong finding(s) in God Classes — start with REDACTED (16), REDACTED (5), REDACTED (3). — One of this dimension's main actionable groups (127 warning-level).
  2. Resolve the 78 MethodTooLong finding(s) in God Classes — start with send_media.go (4), message_history.go (4), REDACTED (3). — One of this dimension's main actionable groups (78 warning-level).
  3. Resolve the 52 TooManyMethods finding(s) in God Classes — start with REDACTED (18), REDACTED (4), channel_store.go (2). — One of this dimension's main actionable groups (52 warning-level).

Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.

D4 · Code Duplication3.5 / 10Weak✓ Tool-verified

What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.

Maturity: Documented → Verified → Prevented · effective 3.5 / 10 · rule-coverage 100% · ceiling Verified

1141 duplicated block group(s) detected. 16.3 % of the production lines (56,536 of 347,092) are in a reported copy. A further 913 rows report members as variants of one another; the share counts each copied line once, however many rows cite it.

Duplicated block (10 lines × 2) · ×99REDACTED:298
Duplicated block (8 lines × 2) · ×98cmd/catalogfetch/main.go:105
Duplicated block (9 lines × 2) · ×97cmd/telesrv-admin/main.go:81
Duplicated block (7 lines × 2) · ×96cmd/telegramloginkeygen/main.go:379
Duplicated block (6 lines × 2) · ×78REDACTED:719

+ 296 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 99 Duplicated block (10 lines × 2) finding(s) in Code Duplication — start with REDACTED (11), channel_members.go (5), channel_settings.go (5). — One of this dimension's main actionable groups (99 warning-level).
  2. Resolve the 98 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with REDACTED (7), messages_dialogs.go (4), bot_verification.go (4). — One of this dimension's main actionable groups (98 warning-level).
  3. Resolve the 97 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with REDACTED (10), REDACTED (7), story.go (6). — One of this dimension's main actionable groups (97 warning-level).

Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.

D6 · Cohesion (LCOM4)9.8 / 10Stronggated by 6 serious findings✓ Tool-verified

What it measures: Whether a class's methods are focused on a single responsibility.

Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.

Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 9.8 / 10 · rule-coverage 100% · ceiling Verified

6 of 422 classes have LCOM4 above 3.

Low cohesion: Service (LCOM4 8) · ×6internal/app/account/service.go:38

What to do

  1. Resolve the 6 Low cohesion finding(s) in Cohesion (LCOM4) — start with REDACTED (2), REDACTED, layer_rpc_execution.go. — One of this dimension's main actionable groups (6 warning-level).

Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.

D8 · Code Coverage8.2 / 10Strong✓ Tool-verified

What it measures: How much of the code is actually exercised by tests.

Method: Coverage from the analyzer's own run of the suite, computed per-file with structured exclusions for generated, trivial, and glue code. A coverage report found in the repository is never read. When the suite can't be built/run in-image, coverage is reported NOT-MEASURED (excluded from the score) with the precondition to make it measurable — never a LoC-ratio proxy folded in as if measured. Deterministic.

Maturity: Documented → Verified → Prevented · effective 8.2 / 10 · rule-coverage 100% · ceiling Verified

Line coverage 45.5% — 335 file(s) below 50%. Measured from the Go suite (telesrv: `go test -coverprofile -coverpkg=./...`, the 3 run(s) test reliability made). Taken over 3 runs of the suite: a line counts as covered only when every run executed it. 98 line(s) in 16 file(s) were executed in some runs and not in others, so they are not counted.

Low coverage: cmd/appearancefetch/main.go · ×335cmd/appearancefetch/main.go:1
Tests reach code only in some runs: internal/app/langpack/service.go · ×16internal/app/langpack/service.go:252

What to do

  1. Resolve the 335 Low coverage finding(s) in Code Coverage — start with REDACTED (16), REDACTED (9), account_rating.go (4). — One of this dimension's main actionable groups (335 warning-level).
  2. Resolve the 16 Tests reach code only in some runs finding(s) in Code Coverage — start with REDACTED (2), cpu_unix.go, exchange.go. — One of this dimension's main actionable groups (16 recommendation-level).

Detailed fixes: d8_recommendation.md · top locations in Appendix A, every location in findings.md.

D11 · Test Reliability10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the tests pass reliably, with no flakiness.

Method: Suite re-run N times within tiered wall-clock budgets (unit to e2e); tests failing non-deterministically across runs flagged; guarded tests retried when #if guards detected.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 flaky across 1 measured tier(s). Go (telesrv): measured (0 flaky).

✓ On the Gold path — maintain.

Detailed fixes: d11_recommendation.md.

D12 · Dependency Hygiene8.6 8.3 / 10Strong✓ Tool-verified

What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.

Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.

Maturity: Documented → Verified → Prevented · effective 8.3 / 10 · rule-coverage 97% · ceiling Verified

24 outdated, 0 author-deprecated direct Go module(s), 1 pinning or checksum defect(s). 36 of 36 direct requirement(s) were graded against proxy.golang.org (0 not served there, 1 publishing no tagged release to be behind). Whether any of these modules is UNMAINTAINED is not graded — proxy.golang.org publishes no maintenance status, and release age does not stand in for one. Whether any is UNUSED is not graded either: that is a source question, not a registry one. Known CVEs in this module graph are D30's question, read from REDACTED and go.sum there.

Dependency pinned to a stale untagged commit: github.com/jackc/pgerrcode
Outdated: github.com/ethereum/go-ethereum · ×24

What to do

  1. Resolve the 1 Dependency pinned to a stale untagged commit finding(s) in Dependency Hygiene. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.

D13 · Secret Scanning0.0 / 10Critical✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Prevented

2 secret(s) detected.

REDACTED

What to do

  1. Resolve the 2 Leaked secret finding(s) in Secret Scanning — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).

Detailed fixes: d13_recommendation.md · top locations in Appendix A, every location in findings.md.

D14 · License Compliance10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether the licenses of third-party packages are compatible with your policy.

Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 of 20 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 2 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (18 reached that way). Requirements it states ONLY under an extra, a PEP 735 dependency group, a Poetry dev group or a dev-named requirements file are excluded: pip does not install any of them for a consumer. ★ This repository commits no dependency lockfile that this pass reads, so each licence is the one PyPI publishes for the distribution's CURRENT release rather than for a pinned version. ★ COVERAGE OF THIS VERDICT: it grades this repository's Python distribution dependencies and nothing else. The repository also declares a Go module (REDACTED/go.sum), and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots9.3 / 10Stronggated by 44 serious findings✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 9.3 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: REDACTED (37×136=5032); internal/config/config.go (24×109=2616); internal/rpc/messages_register.go (6×105=630) Repeated repair below the complexity floor: internal/store/postgres/media_refs.go (5 of 6 changes were fixes); internal/domain/system.go (4 of 7 changes were fixes); internal/app/donations/service.go (4 of 4 changes were fixes)

Hotspot: REDACTED · ×39REDACTED:600
Repeated repair: internal/store/postgres/media_refs.go · ×5internal/store/postgres/media_refs.go:66

What to do

  1. Resolve the 39 Hotspot finding(s) in Churn × Complexity Hotspots — start with REDACTED (2), REDACTED, config.go. — One of this dimension's main actionable groups (39 warning-level).
  2. Resolve the 5 Repeated repair finding(s) in Churn × Complexity Hotspots — start with media_refs.go, system.go, REDACTED. — One of this dimension's main actionable groups (5 warning-level).

Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.

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.

Maturity: Documented → Verified → Prevented · effective 9.2 / 10 · rule-coverage 100% · ceiling Documented

68 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is internal/botapi/server.go. Counted over 819 of the 1037 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Off-boarding risk: anonymized user #1 · ×2
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.

D17 · Explicit Debt10.0 / 10Stronggated by 1 serious finding✓ Tool-verified

What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.

Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

1 deducted task-comment markers across 347092 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.

TodoCommentinternal/domain/message.go:598

What to do

  1. Resolve the 1 TodoComment finding(s) in Explicit Debt — start with message.go. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.

D19 · Documentation Quality10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether the project's documentation is clear, complete, and useful.

Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

2 of 2 documentation facets pass in full. 18 document(s) read across 50 unit(s).

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

D20 · ADR Quality0.0 / 10Critical✓ Tool-verified

What it measures: Whether architecture decisions are recorded well (context, decision, consequences).

Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

No architecture decision records were found.

No ADRs foundcmd/walletminiapp/main.go:6

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.

D21 · Naming Consistency7.0 / 10Adequate✓ Tool-verified

What it measures: Whether names — types, methods, variables — are clear and consistent.

Method: Seven vocabulary-free rules (N1-N7) mine each naming convention from the repository and flag a name that breaks a convention its structural peers in the same unit follow; production C# and TypeScript, each its own population. Deterministic, no model, no sample. Advisory.

Maturity: Documented → Verified → Prevented · effective 7.0 / 10 · rule-coverage 100% · ceiling Verified

5 naming inconsistencies among 166 declarations measured against a convention their peers follow.

`defaultBulkACKWindow` spells `ACK` where 38 names in the project spell it `Ack`internal/mtprotoedge/outbound.go:59
`registerAiCompose` spells `Ai` where 77 names in the project spell it `AI`internal/rpc/aicompose.go:15
`DeliveryEffectAccountPTS` spells `PTS` where 70 names in the project spell it `Pts`internal/store/delivery_effect.go:27
`AccountPTSDeliveryEffect` spells `PTS` where 70 names in the project spell it `Pts`internal/store/delivery_effect.go:32
`nextBID` spells `BID` where 12 names in the project spell it `Bid`internal/store/memory/broadcast.go:23

What to do

  1. Resolve the 1 `defaultBulkACKWindow` spells `ACK` where 38 names in the project spell… finding(s) in Naming Consistency — start with outbound.go. — One of this dimension's main actionable groups (1 recommendation-level).
  2. Resolve the 1 `registerAiCompose` spells `Ai` where 77 names in the project spell it… finding(s) in Naming Consistency — start with aicompose.go. — One of this dimension's main actionable groups (1 recommendation-level).
  3. Resolve the 1 `DeliveryEffectAccountPTS` spells `PTS` where 70 names in the project… finding(s) in Naming Consistency — start with delivery_effect.go. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d21_recommendation.md · top locations in Appendix A, every location in findings.md.

D23 · Boundary Type-Coupling10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether domain types (IDs, enums, value objects) leak across bounded-context boundaries.

Method: Cross-context domain-type leakage via Roslyn structural classification (strongly-typed IDs / value objects) over every public surface. Exhaustive, deterministic, type-level aggregate-boundary check.

Coverage: Bounded contexts derived from NAMESPACE prefix (or graph-inferred where available); cross-boundary domain-type leakage then checked exhaustively over every public member of every type.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

41 domain type(s) cross context boundaries across 2 contexts; they are measured and withheld (not published, not scored). Contexts: domain, rpc.

✓ On the Gold path — maintain.

Detailed fixes: d23_recommendation.md.

D26 · Project Cohesion3.3 / 10Weak✓ Tool-verified

What it measures: Whether each project is a focused, coherent unit rather than an oversized grab-bag.

Method: Project size overshoot penalties (LoC / public-type count / namespace count, 2-of-3 flag) weighted by log magnitude. Exhaustive across projects, deterministic.

Maturity: Documented → Verified → Prevented · effective 3.3 / 10 · rule-coverage 100% · ceiling Documented

1 of 3 build units (Go, Python) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesionREDACTED:1

What to do

  1. Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.

D27 · Navigability9.8 / 10Exemplary✓ Tool-verified

What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.

Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.

Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.

Maturity: Documented → Verified → Prevented · effective 9.8 / 10 · rule-coverage 100% · ceiling Documented

5 % of calls cross a namespace and 0 % go through an interface, but 41 % of collaborators are co-located — so following a call takes several hops. Baseline: small — navigation cost is tolerated.

✓ On the Gold path — maintain.

Detailed fixes: d27_recommendation.md.

D29 · Static Analysis (SAST)1.4 / 10Critical✓ Tool-verified

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).

Maturity: Documented → Verified → Prevented · effective 1.4 / 10 · rule-coverage 100% · ceiling Documented

28 finding(s): 0 critical, 7 high, 13 medium, 8 low. semgrep hit a parse error in 4 file(s) — `REDACTED`, `internal/rpc/channel_full_bot_cache.go` (lines 25–27), `internal/rpc/rpc_projection_cache.go` (lines 25–26, line 27, line 29, …), `internal/store/postgres/saved_dialog.go` (line 402) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 8 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 7 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (7 issue-level).
  2. Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 warning-level).
  3. Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 warning-level).

Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.

D30 · Dependency Vulnerabilities4.8 / 10Weak✓ Tool-verified

What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.

Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.

Maturity: Documented → Verified → Prevented · effective 4.8 / 10 · rule-coverage 100% · ceiling Documented

13 finding(s): 1 critical, 4 high, 8 medium, 0 low.

REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 6 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (6). — One of this dimension's main actionable groups (6 warning-level).
  2. Resolve the 4 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (4 issue-level).
  3. Resolve the 1 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).

Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.

D31 · IaC & Container Security9.6 / 10Adequategated by 1 critical finding✓ Tool-verified

What it measures: Whether Dockerfiles / Terraform / Kubernetes config follow security best practices.

Method: IaC/container misconfiguration scan via trivy config (Dockerfile/Terraform/K8s/Helm/CloudFormation); severity rules to 0-10 moderate normalizer. NotApplicable without manifests. Exhaustive, deterministic.

Maturity: Documented → Verified → Prevented · effective 9.6 / 10 · rule-coverage 100% · ceiling Documented

2 finding(s): 0 critical, 1 high, 1 medium, 0 low.

REDACTED
REDACTED

What to do

  1. Resolve the 1 High IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 1 Medium IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.

D32 · Data Compliance (PII/GDPR)4.8 / 10Weak✓ Tool-verified

What it measures: Likely personal-data (PII / GDPR) handling concerns — logging or storing data without safeguards.

Method: Heuristic PII/GDPR LEAK scan via semgrep across the repo, using our own ruleset: personal data crossing a boundary it should not — reaching a log/console sink, a URL or query string, or unprotected browser storage. Matches map to severity and a 0-10 wide normalizer. A clean sweep is unscored rather than an unearned 10, and is a statement about the leak paths checked only — this dimension does not inventory the personal data a repository holds (the personal-data map and the C1-C5 compliance cards do that), so it never reports that a repository has no personal-data surface. Reported LOUDLY as a measurement gap if the ruleset is missing from the analyzer image. Exhaustive over the leak paths, advisory-leaning; degrades on parse failure.

Maturity: Documented → Verified → Prevented · effective 4.8 / 10 · rule-coverage 100% · ceiling Documented

7 finding(s): 0 critical, 0 high, 7 medium, 0 low. semgrep could not parse 3 file(s) — `internal/rpc/channel_full_bot_cache.go`, `internal/rpc/rpc_projection_cache.go`, `internal/store/postgres/saved_dialog.go` — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.

REDACTED
REDACTED

What to do

  1. Resolve the 6 REDACTED finding(s) in Data Compliance (PII/GDPR) — start with REDACTED (2), REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (6 warning-level).
  2. Resolve the 1 REDACTED finding(s) in Data Compliance (PII/GDPR) — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d32_recommendation.md · top locations in Appendix A, every location in findings.md.

D34 · Knowledge Freshness5.1 / 10Adequate✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 5.1 / 10 · rule-coverage 100% · ceiling Documented

400 of 819 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is internal/app/bots/verifierbot.go. Counted over 819 of the 1037 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned knowledge · ×56internal/app/bots/verifierbot.go:1
Orphaned file · ×344internal/rpc/ephemeral.go:1
Further orphaned files (smaller)

What to do

  1. Resolve the 344 Orphaned file finding(s) in Knowledge Freshness — start with REDACTED (9), REDACTED (9), ephemeral.go (5). — One of this dimension's main actionable groups (344 recommendation-level).
  2. Resolve the 56 Orphaned knowledge finding(s) in Knowledge Freshness — start with REDACTED (7), verification.go (4), groupcall.go (3). — One of this dimension's main actionable groups (56 issue-level).
  3. 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.

D35 · Change Coupling10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.

Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.

Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

No strong hidden change-coupling between production files.

✓ On the Gold path — maintain.

Detailed fixes: d35_recommendation.md.

D43 · Malicious Dependencies10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.

Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

No dependency in any ecosystem this repository declares is published as malicious.

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

D44 · Platform End-of-Life10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.

Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 2 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.

✓ On the Gold path — maintain.

Detailed fixes: d44_recommendation.md.

Frontend & cross-cutting dimensions

R = React/JS · M = Maturity · P = Readiness.

AC1 · Text alternatives5.4 / 10Adequate✓ Tool-verified

Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.

Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.

  • Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation). (×2) — cmd/telesrv-admin/web/src/components/chat/ChatMedia.tsx:69, cmd/telesrv-admin/web/src/components/chat/ChatMedia.tsx:191

What to do

  • Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
AC2 · Forms & labels7.4 / 10Strong✓ Tool-verified

Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.

Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label. (×10) — cmd/telesrv-admin/web/src/components/EmojiPicker.tsx:97, cmd/telesrv-admin/web/src/components/EntityPicker.tsx:65, cmd/telesrv-admin/web/src/components/EntityPicker.tsx:175, …
  • This <img> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label. — cmd/telesrv-admin/web/src/components/chat/ChatMedia.tsx:156
  • This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×4) — cmd/telesrv-admin/web/src/pages/BotVerificationPage.tsx:921, cmd/telesrv-admin/web/src/pages/DonationsPage.tsx:729, cmd/telesrv-admin/web/src/pages/GifCatalogPage.tsx:174, …

What to do

  • Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
AC3 · Page structure10.0 / 10Exemplary○ Nothing flagged

Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.

Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

AC4 · Keyboard semantics1.3 / 10Critical✓ Tool-verified

Other · Accessibility — Whether interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.

Coverage: Population: elements that pose a keyboard-semantics question, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) — a non-natively-interactive element carrying a click handler, a double-click or hover enter/leave binding, a pointer-only gesture on a tabindex="0" element, or `cursor: pointer` from the repo's own CSS; an href-less or placeholder-href (#, javascript:) anchor; and any element with a positive tabindex. Natively interactive elements used correctly (<button>, <a href>, form controls) are NOT in the population — there is nothing to judge — so a page of nothing but correct controls gives AC4 nothing to measure. Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".

  • This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. (×20) — cmd/telesrv-admin/web/src/components/ActionButton.tsx:124, cmd/telesrv-admin/web/src/components/AddServerLinkModal.tsx:212, cmd/telesrv-admin/web/src/components/AvatarModal.tsx:71, …
  • A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler. (×4) — cmd/telesrv-admin/web/src/components/DataTable.tsx:113, cmd/telesrv-admin/web/src/components/chat/ChatMedia.tsx:156, cmd/telesrv-admin/web/src/pages/Dashboard.tsx:321, …
  • This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus. — cmd/telesrv-admin/web/src/components/StaticLottie.tsx:56
  • This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. — cmd/telesrv-admin/web/src/components/chat/ChatMedia.tsx:67
  • This <section role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. (×2) — cmd/telesrv-admin/web/src/pages/AdminUsersPage.tsx:278, cmd/telesrv-admin/web/src/pages/AdminUsersPage.tsx:383

What to do

  • Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
AC5 · ARIA correctness10.0 / 10Exemplary○ Nothing flagged

Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.

Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

AC6 · Visual & motion safety4.0 / 10Weak✓ Tool-verified

Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.

Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.

Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • `.nav-section-chevron` moves (`transition: transform 140ms ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/01-foundation.css:309
  • `a.stat-tile.clickable` moves (`transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/02-pages-and-forms.css:57
  • `.launcher` moves (`transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/02-pages-and-forms.css:299
  • `.give-gift-option` moves (`transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:445
  • `.gift-bulk-import-progress-bar > div` moves (`transition: width .2s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:472
  • `.official-gift-option` moves (`transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:500
  • `.gift-switch-track span` moves (`transition: transform .16s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:593
  • `.chain-toggle span` moves (`transition: transform .16s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:602
  • `.chain-preset-card` moves (`transition: border-color .12s ease, transform .12s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:611
  • `.gift-pack-cover .gift-pack-anim` moves (`transition: transform .2s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:843
  • `.gift-pack-tile` moves (`transition: border-color .15s ease, transform .15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:867
  • `.env-group-chevron` moves (`transition: transform 140ms ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:1208
  • `.restart-overlay-spin` moves (`animation: spin 1.4s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:1279
  • `.bg-orb--1` moves (`animation: loginOrbFloat1 20s ease-in-out infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/04-modal-and-login.css:299
  • `.bg-orb--2` moves (`animation: loginOrbFloat2 24s ease-in-out infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/04-modal-and-login.css:308
  • `.bg-orb--3` moves (`animation: loginOrbFloat3 28s ease-in-out infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/04-modal-and-login.css:317
  • `.loader-bar::before` moves (`animation: load 1s infinite ease-in-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/04-modal-and-login.css:568
  • `.spin` moves (`animation: spin 0.8s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/04-modal-and-login.css:572
  • `.switch-track::after` moves (`transition: transform 140ms ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/06-refresh.css:1332
  • `.give-tile` moves (`transition: border-color 0.12s, background 0.12s, transform 0.12s`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — cmd/telesrv-admin/web/src/styles/08-economy.css:53

What to do

  • Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
AX10 · Code composition9.9 / 10Exemplary✓ Tool-verified

Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.

Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.

Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.

AX2 · Stateful singletons10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether singleton services avoid mutable shared instance state that concurrent callers would race on.

Method: Roslyn scan: singleton field mutations unguarded by lock or Interlocked, per type; syntax-based guard detection. Deterministic, traceable per field.

AX3 · Project dependency cycles10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).

Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.

AX4 · Dependency direction10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.

Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.

AX6 · Interface segregation9.6 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').

Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.

  • `BotVerificationService` declares 16 methods: `Icons`, `UpsertIcon`, `SetIconActive`, `Verifiers`, `VerifierSettings`, `GrantVerifier`, `SetVerifierEnabled`, `RevokeVerifier`, `Marks`, `RevokeMark`, `Requests`, `Request`, `RequestCounts`, `Approve`, `Reject`, `RevokeRequest`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/admin/botverification.go:44
  • `Service` declares 119 methods: `AccountAvatar`, `SetAccountFrozen`, `GrantPremium`, `GrantStars`, `UpsertPremiumPlan`, `RefundPremium`, `UpdateDonationChain`, `CreateDonationChain`, `DeleteDonationChain`, `SweepDonationChain`, `UpsertDonationToken`, `DeleteDonationToken`, `DonationChainBalance`, `DonationPricePreview`, `DonationStarPriceMicros`, `SetVerified`, `SetUserFlags`, `SetChannelVerified`, `SetChannelFlags`, `CreateBot`, `CreateBroadcast`, `DeleteBot`, `ExportBotToken`, `SetSupport`, `SetUsername`, `SetProfile`, `SetPhone`, `SetLoginEmail`, `SetAccountAvatar`, `SetAccountAvatarVideo`, `ChannelAvatar`, `SetChannelAvatar`, `SetUserColor`, `SetUserEmojiStatus`, `SetChannelSettings`, `SetChannelUsername`, `SetChannelColor`, `SetChannelEmojiStatus`, `RevokeSessions`, `DeletePrivateMessages`, and 79 more. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/adminapi/server.go:42
  • `AuthService` declares 22 methods: `BindTempAuthKey`, `ResolveAuthKey`, `UserID`, `PendingPasswordUserID`, `CompletePasswordSignIn`, `SendCode`, `CodeDelivery`, `ResendCode`, `CancelCode`, `SignIn`, `SignInWithEmail`, `SignUp`, `AcceptLoginToken`, `BindVerifiedLogin`, `SignInBot`, `LogOut`, `Authorization`, `AuthKeyClientInfo`, `UpdateAuthKeyClientInfo`, `ListAuthorizations`, `ResetAuthorization`, `ResetAuthorizations`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/rpc/deps.go:23
  • `BotsService` declares 37 methods: `BotInfo`, `OwnsBot`, `CheckUsername`, `CreateBot`, `ListOwnedBots`, `ExportBotToken`, `SetBotCommands`, `GetBotCommands`, `SetBotInfo`, `GetBotInfo`, `SetBotMenuButton`, `GetBotMenuButton`, `SetInlinePlaceholder`, `CanSendMessage`, `AllowSendMessage`, `UpsertBotApp`, `GetBotAppByID`, `GetBotAppByShortName`, `GetMainBotApp`, `ListBotApps`, `GetBotAppSettings`, `UpsertBotAppSettings`, `ListBotAppPreviewMedia`, `UpsertBotAppPreviewMedia`, `DeleteBotAppPreviewMedia`, `ReorderBotAppPreviewMedia`, `UpsertAttachMenuBot`, `GetAttachMenuBot`, `ListAttachMenuBots`, `GetAttachMenuState`, `SetAttachMenuState`, `SaveRequestedWebViewButton`, `GetRequestedWebViewButton`, `DeleteRequestedWebViewButton`, `SetBotEmojiStatusPermission`, `BotEmojiStatusPermission`, `PutWebViewCustomMethodQuery`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/rpc/deps.go:346
  • `AccountService` declares 27 methods: `SendChangePhoneCode`, `ChangePhone`, `GetPassword`, `GetPasswordSettings`, `UpdatePasswordSettings`, `CheckPassword`, `IssueTmpPassword`, `CheckTmpPassword`, `RevenueWithdrawalPasswordState`, `RequestPasswordRecovery`, `CheckRecoveryPassword`, `RecoverPassword`, `ConfirmPasswordEmail`, `ResendPasswordEmail`, `CancelPasswordEmail`, `SendLoginEmailCode`, `VerifyLoginEmail`, `SetLoginEmail`, `LoginEmail`, `LoginEmailByPhone`, `ClearLoginEmail`, `ResetPassword`, `DeclinePasswordReset`, `SaveMusic`, `ListSavedMusicIDs`, `ListSavedMusic`, `GetSavedMusicByIDs`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/rpc/deps.go:469
  • `AccountBusinessAutomationService` declares 25 methods: `GetBusinessProfile`, `UpdateBusinessWorkHours`, `UpdateBusinessLocation`, `UpdateBusinessIntro`, `UpdateBusinessGreetingMessage`, `UpdateBusinessAwayMessage`, `ListBusinessChatLinks`, `CreateBusinessChatLink`, `EditBusinessChatLink`, `DeleteBusinessChatLink`, `ResolveBusinessChatLink`, `ListQuickReplies`, `CheckQuickReplyShortcut`, `SaveQuickReplyText`, `GetQuickReplyMessages`, `RenameQuickReplyShortcut`, `ReorderQuickReplies`, `DeleteQuickReplyShortcut`, `DeleteQuickReplyMessages`, `GetConnectedBusinessBot`, `SaveConnectedBusinessBot`, `DeleteConnectedBusinessBot`, `SetConnectedBusinessBotPaused`, `DisableConnectedBusinessBotForPeer`, `GetConnectedBusinessBotPeerState`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/rpc/deps.go:502
  • `UpdatesService` declares 33 methods: `GetState`, `CurrentState`, `ConfirmedState`, `ObserveDifferenceRequest`, `GetDifference`, `CommitDeliveredState`, `ClearAuthKey`, `RecordNewMessage`, `PublishNewMessage`, `RecordStory`, `RecordStoryFanout`, `RecordReadStories`, `RecordSentStoryReaction`, `RecordNewStoryReaction`, `RecordQuickReplyMutation`, `RecordReadHistory`, `RecordContactsReset`, `RecordChannelState`, `RecordDialogPinned`, `RecordPinnedDialogs`, `RecordSavedDialogPinned`, `RecordPinnedSavedDialogs`, `RecordDialogUnreadMark`, `RecordPeerSettings`, `RecordNotifySettings`, `RecordPeerStoryBlocked`, `RecordDialogFilter`, `RecordDialogFilterOrder`, `RecordDialogFiltersReload`, `RecordFolderPeers`, `RecordChannelViewForumAsMessages`, `RecordChannelDiscussionInbox`, `RecordDraftMessage`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/rpc/deps.go:573
  • `ContactsService` declares 17 methods: `GetContacts`, `ContactIDs`, `AddContact`, `AcceptContact`, `ImportContacts`, `Search`, `DeleteContacts`, `EditCloseFriends`, `UpdateContactNote`, `SetPersonalPhoto`, `ClearPersonalPhoto`, `PersonalPhotos`, `GetPeerSettings`, `BlockContact`, `UnblockContact`, `IsBlocked`, `GetBlocked`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/rpc/deps.go:617
  • `DialogsService` declares 21 methods: `GetDialogsHash`, `GetDialogs`, `GetPeerDialogs`, `SaveDraft`, `GetDraft`, `DeleteDraft`, `ListDrafts`, `ClearDrafts`, `TogglePinned`, `ToggleArchivePinned`, `ReorderPinned`, `MarkUnread`, `UnreadMarks`, `HidePeerSettingsBar`, `PeerSettingsBarHidden`, `GetDialogFolders`, `SaveDialogFolder`, `DeleteDialogFolder`, `ReorderDialogFolders`, `ToggleDialogFolderTags`, `EditPeerFolders`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/rpc/deps.go:638
  • `MessagesService` declares 30 methods: `SendPrivateText`, `SetChatTheme`, `ForwardPrivateMessages`, `GetMessages`, `GetHistory`, `Search`, `SearchPrivateMedia`, `CountPrivateMediaCategories`, `ReadHistory`, `ReadMessageContents`, `GetOutboxReadDate`, `SetMessageReactions`, `GetMessageReactions`, `SavedReactionTags`, `UpdateSavedReactionTag`, `VoteMessagePoll`, `CloseMessagePoll`, `ListUnreadReactionMessages`, `ReadPeerReactions`, `EditMessage`, `PinPrivateMessage`, `UnpinAllPrivateMessages`, `DeleteMessages`, `DeleteHistory`, `GetSavedDialogs`, `GetPinnedSavedDialogs`, `GetSavedDialogsByPeers`, `ToggleSavedDialogPin`, `ReorderPinnedSavedDialogs`, `DeleteSavedHistory`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/rpc/deps.go:678
  • `StoriesService` declares 28 methods: `CreateStory`, `GetAllStories`, `GetAllStoriesPage`, `GetAllStoriesDigest`, `ListOwnerActiveStories`, `GetPeerStories`, `GetStoriesByID`, `GetStoriesArchive`, `GetPinnedStories`, `HasPinnedStories`, `ListReadStates`, `GetPeerMaxIDs`, `GetPeerHiddenStates`, `GetPeerStoryProjections`, `ReadStories`, `IncrementViews`, `SendReaction`, `GetStoryViewsList`, `GetStoryReactionsList`, `GetStoryPublicForwards`, `CanViewStoryStats`, `ListStoryViewerIDs`, `EditStory`, `DeleteStories`, `TogglePinned`, `TogglePinnedToTop`, `TogglePeerStoriesHidden`, `CanSendStory`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/rpc/deps.go:734
  • `ChannelsService` declares 137 methods: `CreateMegagroupFromCreateChat`, `CreateChannel`, `GetChannel`, `ResolveChannel`, `GetChannels`, `GetJoinableChannel`, `GetParticipants`, `GetParticipant`, `FutureCreatorAfterLeave`, `InviteToChannel`, `JoinChannel`, `LeaveChannel`, `EditTitle`, `SetWallpaper`, `EditAbout`, `EditAdmin`, `TransferOwnership`, `EditMemberRank`, `EditBanned`, `EditDefaultBannedRights`, `DeleteChannel`, `CheckUsername`, `UpdateUsername`, `ListAdminedPublicChannels`, `ListCommunityLinkableChannels`, `ListStoryPostableChannels`, `ListSendAsChannels`, `ResolvePublicUsername`, `SearchPublicChannels`, `SetSignatures`, `SetPhoto`, `SetPreHistoryHidden`, `SetParticipantsHidden`, `SetForum`, `SetAutotranslation`, `SetRestrictedSponsored`, `SetPaidMessagesPrice`, `SetAntiSpam`, `SetSlowMode`, `SetBoostsToUnblockRestrictions`, and 97 more. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/rpc/deps.go:766
  • `CommunitiesService` declares 21 methods: `Create`, `Get`, `GetMany`, `ListJoined`, `TogglePeerLink`, `SetCollapsed`, `ListPeerLinkRequests`, `DecidePeerLinkRequest`, `DecideAllPeerLinkRequests`, `ToggleParticipantBanned`, `ParticipantJoinedChats`, `Participants`, `EditTitle`, `EditAbout`, `EditAdmin`, `EditDefaultBannedRights`, `SetPhoto`, `Delete`, `SetPinned`, `ReorderPinned`, `SearchScope`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/rpc/deps.go:926
  • `FilesService` declares 45 methods: `SaveFilePart`, `SaveBigFilePart`, `GetFile`, `CreateEncryptedFileFromUpload`, `DeleteEncryptedFileBlob`, `GeoMapTile`, `ListAvailableReactions`, `AvailableEffects`, `GetDocuments`, `ResolveStickerSet`, `ListStickerSets`, `CheckStickerSetShortName`, `SuggestStickerSetShortName`, `CreateStickerSet`, `ListCreatedStickerSets`, `AddStickerToSet`, `RemoveStickerFromSet`, `ChangeStickerPosition`, `RenameStickerSet`, `DeleteStickerSet`, `CreatePhotoFromUpload`, `CreatePhotoFromBytes`, `CreatePhotoFromURL`, `CreateDocumentFromURL`, `ResolveWebPage`, `WebPagePreviewEnabled`, `LookupWebPage`, `CreateAvatarFromUpload`, `CreateAvatarVideoFromUpload`, `CreateAvatarVideoMarkupFromUpload`, `CreateAvatarMarkup`, `CreateDocumentFromUpload`, `CreateDocumentFromBytes`, `GetPhoto`, `GetDocument`, `UploadProfilePhoto`, `UploadProfilePhotoKind`, `SetCurrentProfilePhoto`, `SetCurrentProfilePhotoKind`, `CurrentProfilePhoto`, and 5 more. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/rpc/deps.go:952
  • `GiftsService` declares 50 methods: `Catalog`, `CatalogHash`, `GiftByID`, `GiftRevisionByID`, `CollectiblePreview`, `CollectiblePreviewSample`, `CollectibleAvailability`, `UniqueBySlug`, `UniqueByID`, `UniqueByIDs`, `ListUniqueByOwner`, `Upgrade`, `UpgradeReceipt`, `RecordSavedGift`, `ListSaved`, `ListSavedFiltered`, `GetSaved`, `ResolveSavedIDs`, `CountSaved`, `ToggleSaved`, `ConvertAggregate`, `ListCollections`, `CreateCollection`, `UpdateCollection`, `DeleteCollection`, `ReorderCollections`, `SetPinned`, `ListResale`, `ValueInfo`, `SetListing`, `Transfer`, `PurchaseResale`, `SendOffer`, `ResolveOffer`, `ListCraft`, `Craft`, `AuctionState`, `ActiveAuctions`, `AuctionAcquired`, `BidAuction`, and 10 more. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/rpc/deps.go:1259
  • `GroupCallsService` declares 30 methods: `Create`, `RtmpStreamKey`, `StartScheduled`, `SetScheduleSubscription`, `ScheduleSubscriberIDs`, `CreateConference`, `Get`, `GetBySlug`, `GetByInviteMessage`, `Join`, `Leave`, `RemoveConferenceParticipants`, `Discard`, `Touch`, `Participant`, `Participants`, `UpdateParticipant`, `SetTitle`, `SetJoinMuted`, `SetStartedMessageID`, `SweepStale`, `ResetAllParticipants`, `NextRaiseHandRating`, `SetParticipantOverride`, `ParticipantOverride`, `CreateConferenceInvite`, `SetConferenceInviteStatus`, `ConferenceRecipients`, `AppendChainBlock`, `ChainBlocks`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/rpc/deps.go:1379
  • `BusinessAutomationStore` declares 24 methods: `HasBusinessAutomation`, `GetBusinessProfile`, `SaveBusinessProfile`, `ListBusinessChatLinks`, `CreateBusinessChatLink`, `UpdateBusinessChatLink`, `DeleteBusinessChatLink`, `ResolveBusinessChatLink`, `ListQuickReplies`, `CheckQuickReplyShortcut`, `SaveQuickReplyText`, `GetQuickReplyMessages`, `RenameQuickReplyShortcut`, `ReorderQuickReplies`, `DeleteQuickReplyShortcut`, `DeleteQuickReplyMessages`, `ReserveBusinessAutomationDelivery`, `LastBusinessAutomationDelivery`, `GetConnectedBusinessBot`, `SaveConnectedBusinessBot`, `DeleteConnectedBusinessBot`, `SetConnectedBusinessBotPaused`, `DisableConnectedBusinessBotForPeer`, `GetConnectedBusinessBotPeerState`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/store/account.go:89
  • `BotStore` declares 39 methods: `CreateBotAccount`, `GetBot`, `ListBotsByOwner`, `CountBotsByOwner`, `UpdateBotTokenSecret`, `UpdateBotCommands`, `UpdateBotInfo`, `UpdateBotMenuButton`, `SetBotInlinePlaceholder`, `SetBotInlineGeo`, `SetBotNochats`, `SetBotChatHistory`, `CanBotSendMessage`, `AllowBotSendMessage`, `UpsertBotApp`, `GetBotAppByID`, `GetBotAppByShortName`, `GetMainBotApp`, `ListBotApps`, `GetBotAppSettings`, `UpsertBotAppSettings`, `ListBotAppPreviewMedia`, `UpsertBotAppPreviewMedia`, `DeleteBotAppPreviewMedia`, `ReorderBotAppPreviewMedia`, `UpsertAttachMenuBot`, `GetAttachMenuBot`, `ListAttachMenuBots`, `GetAttachMenuState`, `SetAttachMenuState`, `SaveRequestedWebViewButton`, `GetRequestedWebViewButton`, `DeleteRequestedWebViewButton`, `SetBotEmojiStatusPermission`, `BotEmojiStatusPermission`, `PutWebViewCustomMethodQuery`, `GetBotChatState`, `UpsertBotChatState`, `DeleteBotChatState`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/store/bot.go:13
  • `BotVerificationStore` declares 25 methods: `UpsertVerificationIcon`, `SetVerificationIconActive`, `VerificationIcon`, `VerificationIconByDocument`, `ListVerificationIcons`, `UpsertBotVerifierSettings`, `SetBotVerifierEnabled`, `DeleteBotVerifierSettings`, `BotVerifierSettings`, `BotVerifierSettingsBatch`, `ListBotVerifiers`, `GrantCustomVerification`, `RevokeCustomVerification`, `CustomVerification`, `PeerVerification`, `PeerVerificationBatch`, `CountCustomVerifications`, `ListCustomVerifications`, `CreateCustomVerificationRequest`, `DecideCustomVerificationRequest`, `CustomVerificationRequest`, `PendingCustomVerificationRequest`, `ListCustomVerificationRequests`, `CustomVerificationRequestsForApplicant`, `CustomVerificationRequestCounts`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/store/bot_verification.go:15
  • `ChannelStore` declares 153 methods: `CreateChannel`, `GetChannel`, `ResolveChannel`, `GetChannels`, `GetChannelByID`, `SaveChannelDefaultSendAs`, `GetParticipants`, `GetParticipant`, `FutureCreatorAfterLeave`, `InviteToChannel`, `JoinChannel`, `LeaveChannel`, `EditChannelTitle`, `SetChannelWallpaper`, `EditChannelAbout`, `EditChannelAdmin`, `TransferChannelOwnership`, `EditChannelMemberRank`, `EditChannelBanned`, `EditChannelDefaultBannedRights`, `DeleteChannel`, `CheckUsername`, `UpdateUsername`, `SetChannelVerified`, `SetChannelScamFake`, `SetChannelAdminSettings`, `SetChannelUsernameAdmin`, `SetChannelColorAdmin`, `SetChannelEmojiStatusAdmin`, `SetChannelPhotoAdmin`, `ListAdminedPublicChannels`, `ListCommunityLinkableChannels`, `ListStoryPostableChannels`, `ListSendAsChannels`, `ResolvePublicChannelUsername`, `ResolvePublicChannelInvite`, `SearchPublicChannels`, `SetSignatures`, `SetChannelPhoto`, `SetPreHistoryHidden`, and 113 more. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/store/channel.go:18
  • `CommunityStore` declares 21 methods: `CreateCommunity`, `GetCommunity`, `GetCommunities`, `ListJoinedCommunities`, `ToggleCommunityPeerLink`, `SetCommunityCollapsed`, `ListCommunityPeerLinkRequests`, `DecideCommunityPeerLinkRequest`, `DecideAllCommunityPeerLinkRequests`, `ToggleCommunityParticipantBanned`, `GetCommunityParticipantJoinedChats`, `ListCommunityParticipants`, `EditCommunityTitle`, `EditCommunityAbout`, `EditCommunityAdmin`, `EditCommunityDefaultBannedRights`, `SetCommunityPhoto`, `DeleteCommunity`, `SetCommunityPinned`, `ReorderCommunityPinned`, `CommunitySearchScope`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/store/community.go:12
  • `ContactStore` declares 16 methods: `ListByUser`, `Get`, `GetMany`, `GetReverseContacts`, `ContactProjectionForViewers`, `Upsert`, `UpsertMany`, `UpdateNote`, `SetCloseFriends`, `SetPersonalPhoto`, `PersonalPhotos`, `Delete`, `Block`, `Unblock`, `IsBlocked`, `ListBlocked`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/store/contact.go:10
  • `DialogStore` declares 30 methods: `ListByUser`, `ListByPeers`, `Upsert`, `UpsertInbox`, `SaveDraft`, `GetDraft`, `DeleteDraft`, `ListDrafts`, `ListDraftsByPeers`, `ClearDrafts`, `MarkRead`, `SetPinned`, `ReorderPinned`, `SetUnreadMark`, `ListUnreadMarked`, `SetChatTheme`, `SetPeerSettingsBarHidden`, `PeerSettingsBarHidden`, `SetTranslationDisabled`, `TranslationDisabled`, `ListFolders`, `GetFolder`, `UpsertFolder`, `DeleteFolder`, `ReorderFolders`, `SetFolderTagsEnabled`, `EditPeerFolders`, `CountArchiveUnread`, `SetArchivePinned`, `ArchivePinned`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/store/dialog.go:10
  • `DonationStore` declares 25 methods: `WalletSeed`, `CreateWalletSeed`, `DonationAddressForUser`, `DonationUserByAddress`, `NextDonationAddressIndex`, `InsertDonationAddress`, `ListDonationAddresses`, `CreateDonationChain`, `DeleteDonationChain`, `EnabledDonationChains`, `DonationChain`, `UpdateDonationChainConfig`, `SetDonationChainPrice`, `DonationTokens`, `AllDonationTokens`, `UpsertDonationToken`, `DeleteDonationToken`, `DonationChainCursor`, `SetDonationChainCursor`, `RecordDonationDeposit`, `UpdateDonationDepositConfirmations`, `PendingDonationDeposits`, `ConfirmedUncreditedDeposits`, `CreditDonationDeposit`, `UserDonationDeposits`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/store/donations.go:15
  • `GroupCallStore` declares 31 methods: `CreateGroupCall`, `CreateConferenceCall`, `GetGroupCall`, `GetGroupCallBySlug`, `GetGroupCallByInviteMessage`, `JoinGroupCall`, `LeaveGroupCall`, `RemoveConferenceCallParticipants`, `DiscardGroupCall`, `TouchParticipant`, `GetParticipant`, `ListParticipants`, `UpdateParticipant`, `SetGroupCallTitle`, `SetGroupCallJoinMuted`, `SetStartedMessageID`, `SweepStaleParticipants`, `ResetAllParticipants`, `NextRaiseHandRating`, `SetParticipantOverride`, `GetParticipantOverride`, `CreateConferenceInvite`, `SetConferenceInviteStatus`, `ListConferenceRecipientUserIDs`, `AppendGroupCallChainBlock`, `ListGroupCallChainBlocks`, `GetRtmpStreamKey`, `SetRtmpStreamKey`, `StartScheduledGroupCall`, `SetScheduleStartSubscription`, `ListScheduleSubscriberIDs`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/store/groupcall.go:11
  • `InlineRegistryStore` declares 17 methods: `PutInlinePending`, `GetInlinePending`, `DeleteInlinePending`, `PutInlineResult`, `GetInlineResult`, `DeleteInlineResult`, `PutInlineCache`, `GetInlineCache`, `PutInlineWebDocument`, `GetInlineWebDocument`, `PutInlineWebDocumentBytes`, `PutPreparedInlineMessage`, `GetPreparedInlineMessage`, `PutWebViewSession`, `GetWebViewSession`, `GetWebViewSessionByBotQuery`, `DeleteWebViewSession`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/store/inline_registry.go:88
  • `MediaStore` declares 45 methods: `SaveFilePart`, `UploadPartUsage`, `UploadPartSlot`, `LoadFileParts`, `DeleteFileParts`, `DeleteExpiredUploadParts`, `GetUploadedMediaReceipt`, `PutUploadedMediaReceipt`, `PutFileBlob`, `GetFileBlob`, `GetFileBlobs`, `SumFileBlobBytes`, `DeleteFileBlobRow`, `GetSeedState`, `PutSeedState`, `PutDocument`, `GetDocument`, `GetDocuments`, `PutPhoto`, `GetPhoto`, `PutWebPage`, `GetWebPageByURLHash`, `PutStickerSet`, `CreateStickerSet`, `UpdateStickerSet`, `DeleteStickerSet`, `AdminDeleteStickerSet`, `GetStickerSetByID`, `GetStickerSetByShortName`, `GetStickerSetBySystemKey`, `ListStickerSets`, `ListStickerSetsByCreator`, `StickerSetShortNameAvailable`, `CountStickerSets`, `PutAvailableReaction`, `ListAvailableReactions`, `CountAvailableReactions`, `AddProfilePhotoKind`, `CurrentProfilePhotoKind`, `CurrentProfilePhotos`, and 5 more. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/store/media.go:13
  • `MessageStore` declares 27 methods: `Create`, `SendPrivateText`, `ForwardPrivateMessages`, `ReadHistory`, `ReadMessageContents`, `GetOutboxReadDate`, `SetMessageReactions`, `GetMessageReactions`, `ListSavedReactionTags`, `UpsertSavedReactionTag`, `VoteMessagePoll`, `CloseMessagePoll`, `EditMessage`, `PinPrivateMessage`, `UnpinAllPrivateMessages`, `DeleteMessages`, `DeleteHistory`, `GetByIDs`, `ListByUser`, `SearchPrivateMedia`, `CountPrivateMediaCategories`, `ListSavedDialogs`, `ListPinnedSavedDialogs`, `ListSavedDialogsByPeers`, `ToggleSavedDialogPin`, `ReorderPinnedSavedDialogs`, `DeleteSavedHistory`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/store/message.go:10
  • `StarGiftStore` declares 32 methods: `Catalog`, `CatalogGift`, `CatalogRevision`, `CreateCatalogRevision`, `CreateCatalogBundle`, `SetCatalogEnabled`, `SetCatalogSortOrder`, `AnimationJSON`, `PublishCollectibleRevision`, `ActiveCollectibleRevision`, `ActiveCollectibleProjection`, `CollectibleAvailability`, `CollectibleAnimationJSON`, `UniqueBySlug`, `UniqueByID`, `UniqueByIDs`, `ListUniqueByOwner`, `Create`, `ListByOwner`, `ListByOwnerFiltered`, `GetByRef`, `ResolveUserMessageRef`, `ResolveSavedIDs`, `CountByOwner`, `SetUnsaved`, `MarkConverted`, `ListCollections`, `CreateCollection`, `UpdateCollection`, `DeleteCollection`, `ReorderCollections`, `SetPinned`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/store/star_gift.go:10
  • `StarGiftLifecycleStore` declares 37 methods: `IssueStarGiftPurchaseForm`, `ValidateStarGiftPurchaseForm`, `PurchaseStarGift`, `ConvertStarGift`, `ListResaleStarGifts`, `UniqueStarGiftValueInfo`, `SetStarGiftListing`, `TransferStarGift`, `PurchaseResaleStarGift`, `SendStarGiftOffer`, `ResolveStarGiftOffer`, `ListCraftStarGifts`, `CraftStarGift`, `StarGiftAuctionState`, `ActiveStarGiftAuctions`, `StarGiftAuctionAcquired`, `BidStarGiftAuction`, `PrepaidUpgradeTarget`, `PrepayStarGiftUpgrade`, `DropStarGiftOriginalDetails`, `SetStarGiftNotifications`, `StarGiftNotificationsEnabled`, `RecordStarGiftWithdrawal`, `ResolveStarGiftWithdrawal`, `CompleteStarGiftWithdrawal`, `IssueChannelRevenueWithdrawal`, `ResolveChannelRevenueWithdrawal`, `CompleteChannelRevenueWithdrawal`, `TonBalance`, `TonTransactions`, `ChannelStarsBalance`, `ChannelStarsOverallRevenue`, `ChannelStarsTransactions`, `ChannelTonBalance`, `ChannelTonOverallRevenue`, `ChannelTonTransactions`, `SweepStarGiftLifecycle`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/store/star_gift.go:84
  • `StoryStore` declares 29 methods: `CreateStory`, `UpsertStory`, `ListActiveStories`, `ListActiveStoriesPage`, `ActiveStoriesDigest`, `ListOwnerActiveStories`, `GetPeerStories`, `GetStoriesByID`, `ListPinnedStories`, `HasPinnedStories`, `ListStoriesArchive`, `ListReadStates`, `GetPeerMaxIDs`, `GetPeerHiddenStates`, `GetPeerStoryProjections`, `ActiveStoryPeerExpirations`, `ListHiddenStoryPeers`, `MarkRead`, `IncrementViews`, `SetReaction`, `ListStoryViews`, `ListStoryReactions`, `ListStoryPublicForwards`, `ListStoryViewerIDs`, `EditStory`, `DeleteStories`, `TogglePinned`, `TogglePinnedToTop`, `SetPeerHidden`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/store/story.go:10
  • `TelegramLoginStore` declares 29 methods: `CreateTelegramLoginClient`, `UpsertTelegramLoginClient`, `GetTelegramLoginClient`, `GetTelegramLoginClientByBot`, `RotateTelegramLoginClientSecret`, `SetTelegramLoginClientSigningAlgorithm`, `SetTelegramLoginClientEnabled`, `AddTelegramLoginAllowedURL`, `DeleteTelegramLoginAllowedURL`, `ListTelegramLoginAllowedURLs`, `IsTelegramLoginURLAllowed`, `UpsertTelegramLoginNativeApp`, `DeleteTelegramLoginNativeApp`, `ListTelegramLoginNativeApps`, `CreateTelegramLoginRequest`, `GetTelegramLoginRequest`, `GetTelegramLoginRequestByTokenHash`, `GetTelegramLoginRequestByBrowserTokenHash`, `ApproveTelegramLoginRequest`, `DeclineTelegramLoginRequest`, `PutTelegramLoginAuthorizationCode`, `GetTelegramLoginAuthorizationCodeByRequest`, `GetTelegramLoginAuthorizationCodeByHash`, `ConsumeTelegramLoginAuthorizationCode`, `ConsumeTelegramLoginDirectToken`, `ListTelegramLoginWebAuthorizations`, `RevokeTelegramLoginWebAuthorization`, `RevokeAllTelegramLoginWebAuthorizations`, `DeleteExpiredTelegramLoginArtifacts`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/store/telegram_login.go:14
  • `UserStore` declares 21 methods: `ByID`, `ByIDs`, `ByPhone`, `ByPhones`, `ByEmail`, `ByUsername`, `Search`, `UpdateProfile`, `UpdateUsername`, `UpdatePhone`, `UpdateLastSeen`, `Create`, `SetPremiumUntil`, `SetVerified`, `SetScamFake`, `SetSupport`, `SweepExpiredPremium`, `UpdateEmojiStatus`, `UpdateColor`, `UpdateBirthday`, `UpdatePersonalChannel`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/store/user.go:10
  • `VerificationStore` declares 18 methods: `CreateVerificationDraft`, `SaveVerificationDraft`, `SubmitVerificationApplication`, `CancelVerificationApplication`, `ClaimVerificationApplication`, `DecideVerificationApplication`, `RevokeVerification`, `VerificationApplication`, `ActiveVerificationApplicationForTarget`, `VerificationDraftForApplicant`, `ListVerificationApplications`, `VerificationApplicationsForApplicant`, `VerificationStatusCounts`, `VerificationApplicationEvents`, `LastVerificationRejection`, `PendingVerificationNotifications`, `MarkVerificationNotificationDelivered`, `MarkVerificationNotificationFailed`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — internal/store/verification.go:16

What to do

  • Split fat interfaces into focused role-interfaces so clients depend only on what they use.
DM1 · Aggregate boundaries10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether aggregates reference each other by identity (id) rather than by direct object reference — the core DDD consistency-boundary rule.

Method: Roslyn (DDD-gated): aggregate roots identified by convention; each aggregate field checked for direct references to other aggregates versus id-only. Deterministic, DDD-native.

Coverage: Population: aggregate roots identified by AggregateRoot/IAggregateRoot base/interface NAME convention; reference-by-identity then checked exhaustively within that set — a root not using those names is invisible.

DM10 · One transaction, one aggregate10.0 / 10Exemplary○ Nothing flagged

Other · Domain Modelling — Whether a single operation mutates more than one aggregate root. An aggregate is a consistency boundary, so saving two together fuses them into one — the second's invariants come to depend on the first's transaction, and the pair can no longer be separated. Reads of other aggregates are not counted.

Method: Neutral body surface (DDD-gated): every method body scanned for repository WRITE calls (Add/Update/Save/Remove/Delete/Insert/Store and their async forms), keyed on the ARGUMENT type rather than the repository type — three `IRepository<T>` writes collapse to one repository but are three distinct aggregates. Reads (Get/Find/Load/Query) are excluded, so loading another aggregate for context never counts. Score is offending methods over methods that write at all. Deterministic.

DM11 · Constructible invalid state10.0 / 10Exemplary○ Nothing flagged

Other · Domain Modelling — Whether an aggregate can be constructed in a state its own rules forbid — a public constructor that takes a raw primitive, stores it, and validates nothing, with no factory beside it. A constructor taking only value objects is not counted: each parameter has already validated itself.

Method: Neutral surface (DDD-gated): each non-abstract entity/aggregate checked for a PUBLIC constructor taking at least one RAW PRIMITIVE parameter whose body contains no guard token (throw / Guard. / Ensure. / ArgumentException / CheckRule / an XException.ThrowIf* helper). C#: a static factory beside a public constructor does not exempt it, and a public parameterless constructor followed by public raw-primitive setters that refuse nothing is charged when the type also declares a validating way in (a guarded constructor or a guarding static method returning the type); TypeScript: a static Create/Of/From/New factory exempts the type. A constructor taking only value objects is never charged -- measured: 64 of 87 unguarded public constructors on the C# corpus take value objects only, so ignoring parameter types would be 73% false positives. One finding per entity. Deterministic.

DM12 · Ambient inputs in the domain10.0 / 10Exemplary○ Nothing flagged

Other · Domain Modelling — Whether domain types receive the time and randomness their rules depend on, rather than reading the process clock or a global random source directly — an ambient read makes the rule it feeds untestable at the instant that matters and lets two reads inside one operation disagree.

Method: Roslyn (DDD-gated, C#/VB only): domain-layer types scanned for ambient reads — DateTime/DateTimeOffset.Now/UtcNow/Today, Random.Shared, new Random(), Stopwatch.GetTimestamp — resolved against the semantic model, with a comment/string-stripped token fallback only where resolution fails. Body reads are scored; field/property initialisers are surfaced unscored. Apply/When folds excluded (ES1 owns them). Deterministic, symbol-resolved.

DM2 · Strongly-typed ids3.0 / 10Weak✓ Tool-verified

Other · Domain Modelling — How much of the domain uses strongly-typed ids vs raw Guid/string/int — adoption curve, not all-or-nothing.

Method: Roslyn (DDD-gated): strongly-typed id adoption on domain entities/events; raw Guid/int/string ids counted versus wrapped types. An id wrapper is recognised by VALUE SEMANTICS, not by being a struct — a record struct, a record class (`record ApartmentId(Guid Value)`) or a class declared by a typed-id base (`class MemberId : TypedIdValueBase`) all count, while a plain mutable class (reference equality) and a verb-phrase query record (`GetCustomerById`) do not. Deterministic, adoption percentage.

Coverage: Population: id-like members by *Id/*Key NAME suffix; strongly-typed-ID shape then checked semantically — non-suffixed identifiers are not seen.

  • `StarGiftCatalogWrite.GiftID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — internal/domain/star_gift.go:884
  • `StarGiftCatalogWrite.CommandID` is a raw `string` — give it a strongly-typed id: a dedicated single-field type wrapping the `string`, in whatever form your language spells that. — internal/domain/star_gift.go:895
  • `StarGiftCatalogWrite.OfficialGiftID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that. — internal/domain/star_gift.go:896

What to do

  • Adopt strongly-typed ids across the domain — finish the migration or document the boundary; primitive ids invite transposed-argument bugs.
DM4 · Rich vs anemic model10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether aggregates/entities carry the behaviour that protects their invariants, rather than being data bags driven by external services.

Method: Roslyn (DDD-gated): entity method BODIES classified mutator-vs-query — only methods that mutate the entity's own declared state count as invariant-protecting behaviour, so a getter/passthrough doesn't rescue an anemic class. Deterministic, exhaustive over domain-layer entities.

Coverage: Population: entities by name/base convention; rich-vs-anemic judged by classifying each method body mutator-vs-query — logic-bearing domain types outside the convention are invisible.

DM5 · Encapsulated state4.8 / 10Weak✓ Tool-verified

Other · Domain Modelling — Whether entities protect their state — private/init-only setters, and collections handed out as read-only views rather than the mutable backing collection — instead of exposing writable state that bypasses invariants. Softened when a rehydration framework (Marten/EF) is present.

Method: Roslyn (DDD-gated): entities scanned for publicly writable state — public setters, and (C#/VB) own mutable collections handed out through an auto-property, a public field or a bare-field expression getter, where a computed/copying getter is never charged. One finding per entity; score softened when Marten/EF rehydration frameworks present. Deterministic, framework-aware.

Coverage: Population: entities by convention; encapsulation (setter shape) checked exhaustively within the set.

  • `StarGiftCatalogWrite` exposes publicly writable state (GiftID, Title, Stars, ConvertStars, Enabled, SortOrder, and 32 more). — internal/domain/star_gift.go:883

What to do

  • Make entity setters private/init-only and hand collections out as IReadOnlyList/IReadOnlyCollection over a private backing field; change state only through methods that enforce the invariants (Marten/EF can bind via constructor or private setters).
DM6 · Domain ↔ infrastructure boundary10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether the domain layer stays free of infrastructure dependencies (EF/Marten/HTTP/ASP.NET) — the clean-architecture dependency rule.

Method: Roslyn (DDD-gated): domain-layer types scanned for infrastructure usage in member SIGNATURES and inside method/accessor BODIES — resolved calls and object-creations into EF/Marten/HTTP/Mongo/Redis/message-bus types (not just a namespace allowlist). Deterministic, symbol-resolved, exhaustive over domain-layer bodies, DDD-native.

Coverage: Domain layer identified by NAMESPACE heuristic; infrastructure then resolved by symbol in member SIGNATURES and method/accessor BODIES — rename the layer and the check evaporates.

DM7 · Repository granularity10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether repositories are per aggregate root (not per child entity) and keep the persistence query handle behind the contract, so the root's invariants can't be bypassed.

Method: Roslyn (DDD-gated): repository abstraction detection; repositories over non-aggregate-root entities flagged, and (C#/VB) repository INTERFACES whose members return a live persistence query handle (IQueryable/DbSet/IMongoQueryable) — implementations and specification evaluators are out of population by design, since composing a query internally is what an implementation is for. Deterministic, DDD-native.

Coverage: Population: repositories + aggregate roots by NAME convention; per-root repository rule checked within the set.

DM9 · Scattered domain decisions10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether one domain rule is decided — or one measurement produced — in more than one place, rather than living on the type that owns it.

Method: Neutral body surface plus Roslyn (DDD-gated), two arms. DECISION (Roslyn only): a predicate over a domain type's members judged in two or more types, where none of those decisions live on the owning type — operands of comparisons and relational property patterns only, so a member merely passed as an argument is not judged. DERIVATION: a plain all-numeric carrier of ≥2 members, with no base type and exactly one constructor, CONSTRUCTED as the result of a method (returned or assigned, never inline as an argument) in two or more types other than its own — the same measurement produced twice, which centralising the judgement does not fix. DERIVATION runs on every language whose frontend declares the produced-or-passed fact per construction (Roslyn and the Java sidecar today); a target with only the derivation arm carries an engine gap naming the decision arm as not assessed, and a frontend that declares nothing keeps the dimension not measured rather than clean. Single-member rules, test code and generated code are out of population for both. Advisory.

M1 · Documentation (README)8.0 / 10Strong✓ Tool-verified

Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.

Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.

M2 · Architecture documentation0.0 / 10Critical✓ Tool-verified

Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.

Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.

  • No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
  • No C4/Structurizr/PlantUML/Mermaid/Graphviz/D2 diagram, no drawn diagram named for the architecture, no file named `architecture` or `design` in any markup this check reads, and nothing in the README, docs or contributor guides that announces the shape — no `## Architecture` heading, no "architecture overview"/"high-level design" phrasing, no "the architecture is …" introduction, no guided code tour. A shape laid out in prose that never names itself as the architecture is not visible to this check, and neither is one kept outside the repository, so this row reports the absence of a re-findable shape document — not evidence that nobody wrote the shape down.

What to do

  • Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
  • Add a C4 context/container diagram (Structurizr, PlantUML or Mermaid) or an architecture.md overview.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.

Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.

M4 · Documentation accuracy10.0 / 10Exemplary○ Nothing flagged

Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.

Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.

P1 · CI/CD gates0.0 / 10Critical✓ Tool-verified

Readiness · Readiness — Whether an automated pipeline builds and tests every change.

Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.

  • No CI workflow found (.github/workflows, azure-pipelines.yml, .gitlab-ci.yml, …) — changes aren't gated by an automated build/test.

What to do

  • Add a CI workflow that builds and runs the test suite on every push/PR.
P2 · Observability10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.

Method: Filesystem/Roslyn scan: structured-logging frameworks (Serilog, NLog), OpenTelemetry, and health-check endpoint patterns. Exhaustive, deterministic.

P3 · Security & performance tooling2.0 / 10Critical✓ Tool-verified

Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).

Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.

  • No static application security testing detected. For this repository's stack, add gosec / govulncheck (or golangci-lint) (or `semgrep --config=auto`, which runs on any language) — this repository has no CI pipeline yet, so run it locally to clear the existing findings, then make it a step of the first workflow you add so a regression fails the build. What was searched, so you can tell an absence from a miss: the 0 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
  • `cmd/telesrv-admin/web/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — cmd/telesrv-admin/web/package.json:11

What to do

  • Run what this repository's stack ships: gosec / govulncheck (or golangci-lint) — or `semgrep --config=auto`, which runs on any language — locally for now, since there is no CI pipeline here yet, and as a step of the first workflow you add so a security regression fails the build instead of landing.
  • Enable Dependabot/Renovate or a dependency-review gate.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback8.0 / 10Strong✓ Tool-verified

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.

What to do

  • Add an approval/environment gate (required reviewers / protection rules) before production promotion.
P5 · DR & Backup0.0 / 10Critical✓ Tool-verified

Readiness · Readiness — Whether disaster recovery is planned and codified — backups, geo-recovery, RTO/RPO, persistence guarantees — from IaC + container manifests + docs, never the live cloud.

Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.

  • A persistence guard (data volume / purge-protection) was found, but no backup, geo-recovery or RTO/RPO controls were evidenced — a volume that survives a container recreate is not a tested restore from catastrophic loss.
P7 · Outbound HTTP resilience10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.

Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.

P8 · Schema migrations10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether database schema changes go through versioned migrations rather than being auto-created from the model at startup.

Method: Roslyn scan: EF Core DbContext for a versioned migrations directory versus bare EnsureCreated usage; off .NET, a file scan of dependency manifests, migration histories (Flyway, Liquibase, Alembic, Django, Rails, Prisma, TypeORM, Knex/Sequelize, golang-migrate, goose, Laravel, Doctrine, Diesel/sqlx) and schema auto-create in production source or config. Exhaustive, deterministic.

P9 · Domain vs controller coverage7.5 / 10Strong✓ Tool-verified

Readiness · Readiness — Whether test coverage concentrates on the domain (business rules) rather than the trivial web/controller layer — a focus check a generic tool can't make.

Method: Roslyn plus test-execution analysis: domain-layer versus trivial web/controller coverage ratio. Computed metric, deterministic.

PF1 · Benchmark discipline9.5 / 10Exemplary✓ Tool-verified

Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.

Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.

PF3 · Async & latency hygiene10.0 / 10Exemplary✓ Tool-verified

Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.

Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.

X14 · Bypassable address classification4.8 / 10Weak✓ Tool-verified

Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.

Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.

  • This function unwraps IPv4-MAPPED IPv6 (`To4`, line 508) and then rejects `192.168.0.0/16` on its IPv4 path — but the IPv6 decision at line 530 classifies the address as written, and IPv4 reaches IPv6 through three MORE embeddings this function never mentions: IPv4-compatible (`::a.b.c.d`), 6to4 (`2002::/16`) and NAT64 (`64:ff9b::/96`). So `::192.168.0.1`, `2002:c0a8:0001::` and `64:ff9b::192.168.0.0` all name a host inside `192.168.0.0/16` — the range this same function declares non-public — and all reach the IPv6 decision un-unwrapped, taking the opposite verdict. Unwrap every embedding to its IPv4 form before classifying, or reject any IPv6 address carrying an embedded IPv4 outright. — internal/domain/verification.go:530

What to do

  • Each finding names the IPv4 branch that rejects the host and the IPv6 branch that accepts the same host in another notation. Confirm from the two, then unwrap every IPv4-in-IPv6 embedding before classifying, or reject non-native IPv6 outright.
X19 · Unrestored process-global state10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.

Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.

X2 · Cancellation propagation9.5 / 10Exemplary✓ Tool-verified

Other · Code Health — Whether functions that make a cancellable request accept or pass on a context.Context (adoption curve).

Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.

  • Only 35/38 functions that make a cancellable request (net/http, net.Dial) accept a context.Context or pass one on, so a request keeps running after whatever wanted it has given up — a cancelled request, a shutdown, an expired deadline. Take `ctx context.Context` as the first parameter and build the request with it (`http.NewRequestWithContext`, `DialContext`); where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
  • `listening` calls `net.DialTimeout(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — internal/procctl/supervisor.go:221
  • `fetch` calls `http.NewRequestWithContext(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — internal/app/files/maptile_proxy.go:167
  • `serverListening` calls `net.DialTimeout(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — cmd/telesrv-admin/serverstorage.go:300

What to do

  • Thread a context.Context through functions that make requests, so the work stops when its caller gives up.
X26 · Unsynchronised callback handoff6.7 / 10Adequate✓ Tool-verified

Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.

Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.

  • `projectBatch` starts two goroutines that both write `profileRefs`, a map — `profileRefs = …` on line 392, and again on line 409 — and waits on `g` only after both have started, so the two run at the same time with nothing ordering one write against the other. A Go map is not safe for concurrent use: a write concurrent with any other access is a data race, and the runtime aborts the whole process with `fatal error: concurrent map writes` when it catches one. `g` is an `errgroup.Group`, which orders the handoff's signal and takes no exclusion over the map's own state. Guard every write to `profileRefs` with one `sync.Mutex`, or have each goroutine send its result on a channel that this body alone receives from and writes into `profileRefs`. — internal/app/userprojection/projection.go:392
  • `DashboardActivity` starts two goroutines that both write `err`, a variable — `err = …` on line 68, and again on line 79 — and waits on `g` only after both have started, so the two run at the same time with nothing ordering one write against the other. A goroutine's closure captures `err` by reference, so every goroutine and the body use ONE variable, and a plain variable has no synchronisation of its own: by the Go memory model a write concurrent with any other access to it is a data race (the race detector reports it), a racing `++` loses updates, and a racing read sees a stale or torn value. `g` is an `errgroup.Group`, which orders the handoff's signal and takes no exclusion over the variable's own state. Guard every write to `err` with one `sync.Mutex`, or have each goroutine send its result on a channel that this body alone receives from and writes into `err`. — cmd/telesrv-admin/activity.go:68
  • `DashboardActivity` starts two goroutines that both write `err`, a variable — `err = …` on line 79, and again on line 90 — and waits on `g` only after both have started, so the two run at the same time with nothing ordering one write against the other. A goroutine's closure captures `err` by reference, so every goroutine and the body use ONE variable, and a plain variable has no synchronisation of its own: by the Go memory model a write concurrent with any other access to it is a data race (the race detector reports it), a racing `++` loses updates, and a racing read sees a stale or torn value. `g` is an `errgroup.Group`, which orders the handoff's signal and takes no exclusion over the variable's own state. Guard every write to `err` with one `sync.Mutex`, or have each goroutine send its result on a channel that this body alone receives from and writes into `err`. — cmd/telesrv-admin/activity.go:79

What to do

  • In Go, hand values from a goroutine to the body waiting on it over a channel the body receives from, rather than through a map or slice beside a `sync.WaitGroup` or a signal channel — or hold one `sync.Mutex` over every access to the shared map or slice on both sides. The wait orders the signal; it takes no exclusion over the map's or slice's own state.
X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen. Whether a `for … range` leaves the slice or map it is walking alone — Go raises nothing, but the walk and the collection part: a range evaluates its slice once, so an element appended in the body is never visited and a removal by reslicing (`s = append(s[:i], s[i+1:]...)`, `slices.Delete`) shifts the next element under the index, which is then skipped while the last is read twice; a reslice, a reassignment or a sort leaves every later `s[i]` naming another element; and a map's order is unspecified, so deleting another key (or clearing the map) changes from run to run which entries the loop still sees.

Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.

X28 · Index access outside its own emptiness guard6.8 / 10Adequate✓ Tool-verified

Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.

Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.

  • `parts` holds what `Split` returns, and `parts[2]` takes element 2 of it without checking its length — while this file tests that same result elsewhere before indexing it, because it can be nil or shorter. Here a short result panics with `index out of range`. Test `len(parts)` (or nil) first, as the other call site does. — internal/rpc/stories.go:269
  • `parts` holds what `Split` returns, and `parts[3]` takes element 3 of it without checking its length — while this file tests that same result elsewhere before indexing it, because it can be nil or shorter. Here a short result panics with `index out of range`. Test `len(parts)` (or nil) first, as the other call site does. — internal/rpc/stories.go:273
  • `i%len(groupMembers)` divides by the length of `groupMembers`, and nothing before it checks that `groupMembers` is non-empty. An empty `groupMembers` makes this an integer division by zero, which panics. Test `len(groupMembers) == 0` first and return early. — internal/loadharness/dataset.go:127
  • `message%len(group.MemberAccounts)` divides by the length of `group.MemberAccounts`, and nothing before it checks that `group.MemberAccounts` is non-empty. An empty `group.MemberAccounts` makes this an integer division by zero, which panics. Test `len(group.MemberAccounts) == 0` first and return early. — internal/loadharness/mutate.go:289
  • `%len(targets)` divides by the length of `targets`, and nothing before it checks that `targets` is non-empty. An empty `targets` makes this an integer division by zero, which panics. Test `len(targets) == 0` first and return early. — REDACTED:796
  • `idx` is the result of a search that answers -1 when nothing is found, and `rendered[:idx]` uses it as a bound with no test of `idx` in between. When the search misses, the bound is -1 and the access panics with `slice bounds out of range`. Test `idx < 0` (or use `strings.Cut`) before using it. (×2) — internal/domain/login_code_delivery.go:144, internal/domain/login_code_delivery.go:152

What to do

  • Each finding names the index access that escapes the guard and the line of the correctly bracketed access beside it. Compare the two: they differ only in where one parenthesis sits. Move it so the emptiness test brackets every access to that symbol — and if the value provably cannot be empty at this point, delete the test rather than leave a condition that guards one access and not its neighbour.
X3 · Exception handling7.5 / 10Strong✓ Tool-verified

Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.

Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.

  • `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×3) — REDACTED:208, internal/updatecdn/catalog.go:422, internal/store/postgres/channel_message_history.go:727
  • `zw, _ := gzip.NewWriterLevel(&buf, gzip.DefaultCompression)` writes the call's error to `_` and then uses `zw` as if the call succeeded. When `gzip.NewWriterLevel` fails, `zw` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `zw` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. — REDACTED:229
  • `out, _ := json.Marshal(clientData{Type: typ, Challenge: b64.EncodeToString(challenge), Origin: origin})` writes the call's error to `_` and then uses `out` as if the call succeeded. When `json.Marshal` fails, `out` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `out` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. — internal/webauthn/webauthntest/authenticator.go:66
  • `out, _ := cbor.Marshal(key)` writes the call's error to `_` and then uses `out` as if the call succeeded. When `cbor.Marshal` fails, `out` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `out` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. — internal/webauthn/webauthntest/authenticator.go:82
  • `if err := json.NewEncoder(w).Encode(catalog.DesktopMap()); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — internal/updatecdn/server.go:81
  • `_, found, _ := st.GetParticipantOverride(ctx, call.ID, 101, 102)` writes the call's error to `_` and then uses `found` as if the call succeeded. When `st.GetParticipantOverride` fails, `found` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `found` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. — internal/store/storetest/groupcall.go:579
  • `if err := json.Unmarshal([]byte(raw), &out); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — internal/store/postgres/channel_core.go:700
  • `recipients, _ := s.ListActiveChannelMemberIDs(ctx, 0, channelID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. — internal/store/postgres/channel_groupcall.go:69
  • `recipients, _ := s.ListActiveChannelMemberIDs(ctx, req.UserID, req.ChannelID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. (×16) — internal/store/postgres/channel_helpers.go:97, internal/store/postgres/channel_invite_requests.go:171, internal/store/postgres/channel_member_join_requests.go:177, …
  • `recipients, _ := s.ListActiveChannelMemberIDs(ctx, userID, channelID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. (×3) — internal/store/postgres/channel_history_ttl.go:29, internal/store/postgres/channel_member_join.go:141, internal/store/postgres/channel_settings.go:700
  • `recipients, _ := s.ListActiveChannelMemberIDs(ctx, req.UserID, result.Channel.ID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. — internal/store/postgres/channel_invite_import.go:106
  • `msg, _ := s.getChannelMessage(ctx, tx, req.ChannelID, channel.TopMessageID)` writes the call's error to `_` and then uses `msg` as if the call succeeded. When `s.getChannelMessage` fails, `msg` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `msg` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. (×4) — internal/store/postgres/channel_member_admin.go:147, internal/store/postgres/channel_member_admin.go:262, internal/store/postgres/channel_member_admin.go:458, …
  • `recipients, _ := s.ListActiveChannelMemberIDs(ctx, 0, channel.ID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. — internal/store/postgres/channel_message_delete.go:116
  • `dialog, _ := s.getChannelDialog(ctx, s.db, viewerUserID, channel)` writes the call's error to `_` and then uses `dialog` as if the call succeeded. When `s.getChannelDialog` fails, `dialog` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `dialog` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. (×3) — internal/store/postgres/channel_topics.go:537, internal/store/postgres/channel_topics.go:550, internal/store/postgres/channel_topics.go:584
  • `rights, _ := json.Marshal(c.DefaultBannedRights)` writes the call's error to `_` and then uses `rights` as if the call succeeded. When `json.Marshal` fails, `rights` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `rights` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. — internal/store/postgres/community.go:487
  • `adminRights, _ := json.Marshal(domain.CreatorChannelAdminRights())` writes the call's error to `_` and then uses `adminRights` as if the call succeeded. When `json.Marshal` fails, `adminRights` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `adminRights` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. — internal/store/postgres/community.go:493

What to do

  • Swallowed exception (caught, then discarded)
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.

Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.

X4 · Structured logging7.9 / 10Strong✓ Tool-verified

Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.

Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.

  • `Warn` at line 95 is handed a message assembled at the call — `fmt.Sprintf` with values, or a string concatenated with a value — so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass a constant message and the values as attributes instead: `slog.Warn("order moved", "order_id", orderID, "status", status)` with log/slog, `logger.Warn("order moved", zap.String("order_id", orderID))` with zap, `log.WithFields(log.Fields{"order_id": orderID}).Warn("order moved")` with logrus, or `log.Info().Str("order_id", orderID).Msg("order moved")` with zerolog. — internal/rpc/messages_polls.go:95
  • `Error` at line 1594 is handed a message assembled at the call — `fmt.Sprintf` with values, or a string concatenated with a value — so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass a constant message and the values as attributes instead: `slog.Error("order moved", "order_id", orderID, "status", status)` with log/slog, `logger.Error("order moved", zap.String("order_id", orderID))` with zap, `log.WithFields(log.Fields{"order_id": orderID}).Error("order moved")` with logrus, or `log.Info().Str("order_id", orderID).Msg("order moved")` with zerolog. — internal/app/bots/verifierbot.go:1594
  • `Error` at line 1423 is handed a message assembled at the call — `fmt.Sprintf` with values, or a string concatenated with a value — so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass a constant message and the values as attributes instead: `slog.Error("order moved", "order_id", orderID, "status", status)` with log/slog, `logger.Error("order moved", zap.String("order_id", orderID))` with zap, `log.WithFields(log.Fields{"order_id": orderID}).Error("order moved")` with logrus, or `log.Info().Str("order_id", orderID).Msg("order moved")` with zerolog. — internal/app/bots/verifybot.go:1423

What to do

  • Interpolated log message defeats structured logging

WCAG coverage — what static analysis assessed

Statically assessed 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 40 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).

DimensionWCAG 2.2 A/AA criteriaCoverage
AC1 · Text alternatives1.1.1, 1.2.2, 1.2.5Partial signal
AC2 · Forms & labels1.3.1, 3.3.2, 4.1.2Partial signal
AC3 · Page structure1.4.4, 2.2.1, 2.4.1, 2.4.2, 3.1.1, 4.1.2Partial signal
AC4 · Keyboard semantics2.1.1, 2.4.3Partial signal
AC5 · ARIA correctness4.1.2Partial signal
AC6 · Visual & motion safety1.4.3, 2.4.7Partial — literal CSS only

Not statically assessed — these 40 Level A/AA criteria need runtime or manual evaluation (WCAG-EM): 1.2.1, 1.2.3, 1.2.4, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.4.1, 1.4.2, 1.4.5, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 2.1.2, 2.1.4, 2.2.2, 2.3.1, 2.4.4, 2.4.5, 2.4.6, 2.4.11, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.7, 2.5.8, 3.1.2, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.6, 3.3.1, 3.3.3, 3.3.4, 3.3.7, 3.3.8, 4.1.3.

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.

LensScoreRatingImpact
Code Health68.7Adequate — gated by D1, D2, D4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture94.2Adequate — gated by D26Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity58.2Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness32.6Weak — gated by D13, P1, P3, P5Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security64.4Checked 4 of 11Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Domain Modelling70.4Adequate — gated by DM2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Accessibility48.9Weak — gated by AC4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance97.1ExemplaryStrongest area.
Unscored — 2 check(s) recorded observations but carry no score

These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.

  • X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 21 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 4 control(s) we could not find positive evidence for

These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.

  • C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • P6 Release Hygiene — not evidenced — no changelog, version stamp or semver release tag in the repo
Not included — 51 check(s) not relevant to this codebase

These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.

  • AX1 Captive dependencies — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AX8 Test isolation — no test/production split to check
  • AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility — the dev server (`npm run dev` in cmd/telesrv-admin/web/) kept running but served no page within 2 minutes. Likely cause (not identified): the dev server kept running but no port it opened served a page in the time allowed. Last output: "> telesrv-admin-ui@0.1.0 dev / > vite / VITE v8.1.0 ready in 214 ms / ➜ Local: http://localhost:2410/ / ➜ Network: use --host to expose" No runtime evidence was gathered. This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
  • C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • D10 Test Quality — ~225596 lines of test source are present (.go) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
  • 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.
  • D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
  • D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only — this repository's production source is .go, .py, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D25 ADR Conformance — no ADRs to check
  • D28 Secrets (history) — gitleaks killed before it finished — this repository's working tree not scanned
  • D36 Supply-chain Provenance & Signing — No CI/build pipeline found (.github/.forgejo/.gitea workflows, .circleci, .buildkite, .woodpecker, .teamcity, .gitlab-ci.yml, .travis.yml, bitbucket-pipelines.yml, .drone.yml, .cirrus.yml, .woodpecker.yml, appveyor.yml, azure-pipelines*.yml, .pipelines/, .vsts-ci/, .azuredevops/, Jenkinsfile); there is no build to attest provenance for.
  • D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D5 Coupling — Not applicable — this Go build ships 1 production module(s), so there is no coupling BETWEEN modules to measure. (Its test and non-production modules are not part of the shipped graph.)
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • DM3 Integration-event coupling — no integration events detected — coupling check not applicable
  • DM8 Value-object opportunities — not scored — the deterministic rule found 0 candidate clump(s); its rows are withheld until it has a measured precision of 95 % (a sample of fewer than 10 rows cannot show one)
  • ED1 Event-Driven — applicable but not scored (2 of 3 signals for this style — below the bar we score at): 9 domain event(s); 13 event-sourced shape(s) (event folds / event-recording aggregates)
  • ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
  • ES1 Event Sourcing — applicable but not scored (2 of 3 signals for this style — below the bar we score at): an append-only event-store seam (IEventStore/Append-of-events); 13 Go aggregate(s) recording domain events (own events-slice append / raise-record)
  • GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • P12 CI test-gate honesty — no CI workflow found
  • PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
  • S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X1 Async correctness — X1 reached only 0% of this repository's production lines — go (345,637 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X12 Unreachable branch — X12 reached only 0% of this repository's production lines — go (345,637 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X16 Unfloored truncation loop — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X18 Disposal-pattern correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X21 Side-effecting pattern guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X24 Document value interpolated into markup unescaped — X24 reached only 0% of this repository's production lines — go (345,637 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X25 Inert configuration knob — X25 reached only 0% of this repository's production lines — go (345,637 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X29 Per-element action decided by a fixed element — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.

Critical — 91 finding(s)
D34 · Knowledge Freshness · Orphaned knowledge · ×56
  • Orphaned knowledge internal/app/bots/verifierbot.go:1 — 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 internal/app/bots/verifybot.go:1 — 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 internal/app/botverification/service.go:1 — 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 internal/store/postgres/telegram_login.go:1 — 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 internal/store/postgres/bot_verification.go:1 — 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 internal/store/postgres/community.go:1 — 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 internal/app/telegramlogin/service.go:1 — 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 internal/app/verification/service.go:1 — 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 internal/store/postgres/verification.go:1 — 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 REDACTED:1 — 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 internal/store/postgres/moderation_cases.go:1 — 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 internal/store/postgres/groupcall.go:1 — 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 internal/admin/botverification.go:1 — 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 internal/store/memory/bot_verification.go:1 — 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 internal/store/postgres/channel_topics.go:1 — 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 internal/store/memory/verification.go:1 — 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 internal/store/memory/community.go:1 — 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 internal/store/memory/moderation.go:1 — 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 internal/store/postgres/business.go:1 — 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 internal/store/postgres/collectible_username.go:1 — 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 internal/store/memory/telegram_login.go:1 — 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 internal/botapi/formatted_text.go:1 — 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 internal/app/moderation/evidence.go:1 — 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 cmd/walletminiapp/main.go:1 — 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 internal/app/chatlists/service.go:1 — 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.
  • + 31 more in this group — see findings.md.
AC2 · Forms & labels · <input> without a programmatic label · ×12
  • <input> without a programmatic label cmd/telesrv-admin/web/src/components/EmojiPicker.tsx:97 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label cmd/telesrv-admin/web/src/components/EntityPicker.tsx:65 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label cmd/telesrv-admin/web/src/components/EntityPicker.tsx:175 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label cmd/telesrv-admin/web/src/components/EntityPicker.tsx:274 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label cmd/telesrv-admin/web/src/components/EntityPicker.tsx:367 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label cmd/telesrv-admin/web/src/components/chat/AccountChats.tsx:167 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label cmd/telesrv-admin/web/src/components/chat/AccountChats.tsx:178 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label cmd/telesrv-admin/web/src/pages/DonationsPage.tsx:723 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label cmd/telesrv-admin/web/src/pages/DonationsPage.tsx:729 — This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
  • <input> without a programmatic label cmd/telesrv-admin/web/src/pages/GifCatalogPage.tsx:196 — This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
  • <input> without a programmatic label cmd/telesrv-admin/web/src/pages/StickerSetPreviewModal.tsx:154 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
  • <input> without a programmatic label cmd/telesrv-admin/web/src/pages/StickerSetPreviewModal.tsx:155 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label htmlFor>, a wrapping <label>, or aria-label.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · High CVE · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
AC2 · Forms & labels · <select> without a programmatic label · ×2
  • <select> without a programmatic label cmd/telesrv-admin/web/src/pages/BotVerificationPage.tsx:921 — This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
  • <select> without a programmatic label cmd/telesrv-admin/web/src/pages/GifCatalogPage.tsx:174 — This control has no associated label. Add a <label htmlFor> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC4 · Keyboard semantics · Click handler on a non-interactive <section> · ×2
  • Click handler on a non-interactive <section> cmd/telesrv-admin/web/src/pages/Dashboard.tsx:321 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
  • Click handler on a non-interactive <section> cmd/telesrv-admin/web/src/pages/Dashboard.tsx:375 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
D13 · Secret Scanning · Leaked secret · ×2
  • REDACTED
  • REDACTED
AC2 · Forms & labels · Custom control with no accessible name on <img> · ×1
  • Custom control with no accessible name on <img> cmd/telesrv-admin/web/src/components/chat/ChatMedia.tsx:156 — This <img> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label.
AC4 · Keyboard semantics · Click handler on a non-interactive <tr> · ×1
  • Click handler on a non-interactive <tr> cmd/telesrv-admin/web/src/components/DataTable.tsx:113 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
AC4 · Keyboard semantics · Hover-only interaction on <div> · ×1
  • Hover-only interaction on <div> cmd/telesrv-admin/web/src/components/StaticLottie.tsx:56 — This <div> binds mouse-enter and mouse-leave and nothing else — no click, no key handler, no focus handler, and no tabIndex={0}, so it cannot even take focus. A keyboard user cannot hover, so whatever the pair reveals or highlights is reachable with a mouse only. Bind the same state to focus/blur as well, and add tabIndex={0}="0" so the element can receive that focus.
AC4 · Keyboard semantics · Click handler on a non-interactive <img> · ×1
  • Click handler on a non-interactive <img> cmd/telesrv-admin/web/src/components/chat/ChatMedia.tsx:156 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabIndex={0} + a key handler.
D30 · Dependency Vulnerabilities · Critical CVE · ×1
  • REDACTED
D31 · IaC & Container Security · High IaC · ×1
  • REDACTED
Serious — 4885 finding(s)
D8 · Code Coverage · Low coverage · ×335
  • Low coverage: cmd/appearancefetch/main.go cmd/appearancefetch/main.go:1 — 0.0% line coverage (0/305).
  • Low coverage: cmd/blob-migrate/main.go cmd/blob-migrate/main.go:1 — 0.0% line coverage (0/178).
  • Low coverage: REDACTED REDACTED:1 — 0.0% line coverage (0/209).
  • Low coverage: cmd/bots/botdemo/main.go cmd/bots/botdemo/main.go:1 — 0.0% line coverage (0/289).
  • Low coverage: cmd/catalogfetch/main.go cmd/catalogfetch/main.go:1 — 0.0% line coverage (0/90).
  • Low coverage: cmd/langpackfetch/main.go cmd/langpackfetch/main.go:1 — 24.5% line coverage (47/192).
  • Low coverage: cmd/otpwebhook-example/main.go cmd/otpwebhook-example/main.go:1 — 49.0% line coverage (120/245).
  • Low coverage: cmd/owpengram-ctl/main.go cmd/owpengram-ctl/main.go:1 — 0.0% line coverage (0/146).
  • Low coverage: cmd/stickerfetch/main.go cmd/stickerfetch/main.go:1 — 6.2% line coverage (15/241).
  • Low coverage: cmd/stickerseeddeploy/main.go cmd/stickerseeddeploy/main.go:1 — 20.9% line coverage (56/268).
  • Low coverage: cmd/telesrv-admin/account_rating.go cmd/telesrv-admin/account_rating.go:1 — 0.0% line coverage (0/81).
  • Low coverage: cmd/telesrv-admin/activity.go cmd/telesrv-admin/activity.go:1 — 0.0% line coverage (0/92).
  • Low coverage: cmd/telesrv-admin/addserverlink.go cmd/telesrv-admin/addserverlink.go:1 — 0.0% line coverage (0/11).
  • Low coverage: cmd/telesrv-admin/admin_command_runner.go cmd/telesrv-admin/admin_command_runner.go:1 — 0.0% line coverage (0/254).
  • Low coverage: cmd/telesrv-admin/adminusers.go cmd/telesrv-admin/adminusers.go:1 — 0.0% line coverage (0/55).
  • Low coverage: cmd/telesrv-admin/adminusers_api.go cmd/telesrv-admin/adminusers_api.go:1 — 7.5% line coverage (16/212).
  • Low coverage: cmd/telesrv-admin/audit.go cmd/telesrv-admin/audit.go:1 — 40.7% line coverage (11/27).
  • Low coverage: cmd/telesrv-admin/donations.go cmd/telesrv-admin/donations.go:1 — 5.8% line coverage (10/171).
  • Low coverage: cmd/telesrv-admin/main.go cmd/telesrv-admin/main.go:1 — 11.2% line coverage (13/116).
  • Low coverage: cmd/telesrv-admin/premium.go cmd/telesrv-admin/premium.go:1 — 0.0% line coverage (0/55).
  • Low coverage: cmd/telesrv-admin/privateview.go cmd/telesrv-admin/privateview.go:1 — 27.7% line coverage (119/430).
  • Low coverage: cmd/telesrv-admin/privateview_store.go cmd/telesrv-admin/privateview_store.go:1 — 12.7% line coverage (74/581).
  • Low coverage: cmd/telesrv-admin/publicbranding.go cmd/telesrv-admin/publicbranding.go:1 — 0.0% line coverage (0/27).
  • Low coverage: cmd/telesrv-admin/readstore.go cmd/telesrv-admin/readstore.go:1 — 0.2% line coverage (4/1934).
  • Low coverage: REDACTED REDACTED:1 — 23.3% line coverage (491/2105).
  • + 310 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×127
  • FileTooLong: admin/service.go internal/admin/service.go — FileTooLong — 2701 significant lines (blank, comment-only and punctuation-only lines excluded), about 63% of them inside a single declaration: Service (86 blocks, 624-4071). The bar is 500 significant lines; this is 2201 over it, 5.40× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: rpc/stories.go internal/rpc/stories.go — FileTooLong — 2391 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1891 over it, 4.78× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: mtprotoedge/outbound.go internal/mtprotoedge/outbound.go — FileTooLong — 2249 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1749 over it, 4.50× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 2204 significant lines (blank, comment-only and punctuation-only lines excluded), about 78% of them inside a single declaration: server (97 blocks, 36-2962). The bar is 500 significant lines; this is 1704 over it, 4.41× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: telesrv-admin/readstore.go cmd/telesrv-admin/readstore.go — FileTooLong — 1894 significant lines (blank, comment-only and punctuation-only lines excluded), about 62% of them inside a single declaration: readStore (64 blocks, 63-3502). The bar is 500 significant lines; this is 1394 over it, 3.79× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: mtprotoedge/session_manager.go internal/mtprotoedge/session_manager.go — FileTooLong — 1860 significant lines (blank, comment-only and punctuation-only lines excluded), about 86% of them inside a single declaration: SessionManager (100 blocks, 175-2863). The bar is 500 significant lines; this is 1360 over it, 3.72× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: domain/channel.go internal/domain/channel.go — FileTooLong — 1565 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1065 over it, 3.13× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: rpc/account.go internal/rpc/account.go — FileTooLong — 1556 significant lines (blank, comment-only and punctuation-only lines excluded), about 72% of them inside a single declaration: Router (57 blocks, 27-2121). The bar is 500 significant lines; this is 1056 over it, 3.11× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 1543 significant lines (blank, comment-only and punctuation-only lines excluded), about 72% of them inside a single declaration: run (600-2092). The bar is 500 significant lines; this is 1043 over it, 3.09× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: channels/service.go internal/app/channels/service.go — FileTooLong — 1470 significant lines (blank, comment-only and punctuation-only lines excluded), about 92% of them inside a single declaration: Service (171 blocks, 16-2516). The bar is 500 significant lines; this is 970 over it, 2.94× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: adminapi/server.go internal/adminapi/server.go — FileTooLong — 1437 significant lines (blank, comment-only and punctuation-only lines excluded), about 72% of them inside a single declaration: Server (90 blocks, 202-1811). The bar is 500 significant lines; this is 937 over it, 2.87× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: postgres/story.go internal/store/postgres/story.go — FileTooLong — 1435 significant lines (blank, comment-only and punctuation-only lines excluded), about 72% of them inside a single declaration: StoryStore (42 blocks, 21-2103). The bar is 500 significant lines; this is 935 over it, 2.87× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: config/config.go internal/config/config.go — FileTooLong — 1403 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 903 over it, 2.81× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 1303 significant lines (blank, comment-only and punctuation-only lines excluded), about 72% of them inside a single declaration: ChannelStore (22 blocks, 46-1838). The bar is 500 significant lines; this is 803 over it, 2.61× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: postgres/star_gift_lifecycle.go internal/store/postgres/star_gift_lifecycle.go — FileTooLong — 1300 significant lines (blank, comment-only and punctuation-only lines excluded), about 91% of them inside a single declaration: StarGiftLifecycleStore (35 blocks, 21-1871). The bar is 500 significant lines; this is 800 over it, 2.60× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: rpc/payments_star_gifts.go internal/rpc/payments_star_gifts.go — FileTooLong — 1266 significant lines (blank, comment-only and punctuation-only lines excluded), about 77% of them inside a single declaration: Router (37 blocks, 61-1718). The bar is 500 significant lines; this is 766 over it, 2.53× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: memory/story.go internal/store/memory/story.go — FileTooLong — 1244 significant lines (blank, comment-only and punctuation-only lines excluded), about 65% of them inside a single declaration: StoryStore (49 blocks, 15-1274). The bar is 500 significant lines; this is 744 over it, 2.49× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: rpc/router.go internal/rpc/router.go — FileTooLong — 1208 significant lines (blank, comment-only and punctuation-only lines excluded), about 74% of them inside a single declaration: Router (51 blocks, 127-1891). The bar is 500 significant lines; this is 708 over it, 2.42× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: auth/service.go internal/app/auth/service.go — FileTooLong — 1134 significant lines (blank, comment-only and punctuation-only lines excluded), about 79% of them inside a single declaration: Service (52 blocks, 81-1806). The bar is 500 significant lines; this is 634 over it, 2.27× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: botapi/server.go internal/botapi/server.go — FileTooLong — 1126 significant lines (blank, comment-only and punctuation-only lines excluded), about 69% of them inside a single declaration: handler (22 blocks, 128-1273). The bar is 500 significant lines; this is 626 over it, 2.25× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: mtprotoedge/encrypted.go internal/mtprotoedge/encrypted.go — FileTooLong — 1080 significant lines (blank, comment-only and punctuation-only lines excluded), about 68% of them inside a single declaration: Server (31 blocks, 121-1532). The bar is 500 significant lines; this is 580 over it, 2.16× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 1077 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 577 over it, 2.15× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: postgres/media.go internal/store/postgres/media.go — FileTooLong — 1024 significant lines (blank, comment-only and punctuation-only lines excluded), about 63% of them inside a single declaration: MediaStore (48 blocks, 25-1607). The bar is 500 significant lines; this is 524 over it, 2.05× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: domain/star_gift.go internal/domain/star_gift.go — FileTooLong — 997 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 497 over it, 1.99× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: postgres/message_history.go internal/store/postgres/message_history.go — FileTooLong — 996 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 496 over it, 1.99× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • + 102 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×99
  • Duplicated block (10 lines × 2) REDACTED:298 — REDACTED:298-307 | cmd/bots/botdemo/main.go:470-479 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (10 lines × 2) cmd/telesrv-admin/botverification.go:64 — cmd/telesrv-admin/botverification.go:64-73 | cmd/telesrv-admin/botverification.go:83-92 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) internal/app/account/service.go:264 — internal/app/account/service.go:264-273 | internal/app/account/service.go:334-343 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) internal/app/files/diskspace_windows.go:10 — internal/app/files/diskspace_windows.go:10-19 | internal/hoststats/disk_windows.go:11-20 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (10 lines × 2) internal/app/files/photos.go:356 — internal/app/files/photos.go:356-365 | internal/app/files/photos.go:682-691 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/files/photos.go:356` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (10 lines × 2) internal/app/files/seed.go:1099 — internal/app/files/seed.go:1099-1108 | internal/rpc/channels_stubs.go:457-466 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) internal/app/messages/service.go:672 — internal/app/messages/service.go:672-681 | internal/app/messages/service.go:700-709 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) internal/app/messages/service.go:686 — internal/app/messages/service.go:686-695 | internal/app/messages/service.go:714-723 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) internal/app/moderation/registry_reports.go:32 — internal/app/moderation/registry_reports.go:32-41 | internal/app/moderation/registry_reports.go:72-81 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) internal/app/readmodel/hash.go:27 — internal/app/readmodel/hash.go:27-36 | internal/store/postgres/dialog.go:1295-1304 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/readmodel/hash.go:27` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/store/postgres/dialog.go:1293` calls `PutUint64`, `Write` and `internal/app/readmodel/hash.go:26` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) internal/app/stargifts/service.go:211 — internal/app/stargifts/service.go:211-220 | internal/app/stargifts/service.go:392-401 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/stargifts/service.go:211` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) internal/app/userprojection/projection.go:301 — internal/app/userprojection/projection.go:301-310 | internal/app/userprojection/projection.go:553-562 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) internal/app/users/service.go:497 — internal/app/users/service.go:497-506 | internal/app/users/service.go:599-608 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) internal/app/verification/service.go:714 — internal/app/verification/service.go:714-723 | internal/app/verification/service.go:787-796 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) REDACTED:1280 — REDACTED:1280-1289 | REDACTED:344-353 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1280` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) internal/rpc/account_business.go:334 — internal/rpc/account_business.go:334-343 | internal/rpc/account_business.go:364-373 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) internal/rpc/bots_inline.go:560 — internal/rpc/bots_inline.go:560-569 | internal/rpc/bots_inline.go:586-595 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/bots_inline.go:560` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) internal/rpc/bots_inline.go:825 — internal/rpc/bots_inline.go:825-834 | internal/rpc/send_media.go:719-728 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) internal/rpc/channel_fanout_dispatcher.go:902 — internal/rpc/channel_fanout_dispatcher.go:902-911 | internal/rpc/channels_updates.go:453-462 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/channel_fanout_dispatcher.go:902` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) internal/rpc/messages_delete.go:28 — internal/rpc/messages_delete.go:28-37 | internal/rpc/messages_delete.go:101-110 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_delete.go:28` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/rpc/messages_delete.go:100` calls `GetJustClear` and `internal/rpc/messages_delete.go:27` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) internal/rpc/messages_delete.go:46 — internal/rpc/messages_delete.go:46-55 | internal/rpc/messages_no_forwards.go:21-30 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_delete.go:46` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) internal/rpc/messages_edit.go:261 — internal/rpc/messages_edit.go:261-270 | internal/rpc/messages_edit.go:276-285 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_edit.go:261` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) internal/rpc/messages_forum.go:77 — internal/rpc/messages_forum.go:77-86 | internal/rpc/messages_forum.go:126-135 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) internal/rpc/messages_forward.go:160 — internal/rpc/messages_forward.go:160-169 | internal/rpc/messages_forward.go:420-429 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/rpc/messages_forward.go:417` calls `peerIDInvalidErr` and `internal/rpc/messages_forward.go:158` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) internal/rpc/messages_history.go:341 — internal/rpc/messages_history.go:341-350 | internal/rpc/messages_read.go:126-135 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_history.go:341` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: `internal/rpc/messages_history.go:341` is reached only past a guard at line 316 that tests `req.AddOffset` and leaves the function early, and `internal/rpc/messages_read.go:126` reads `req.AddOffset` with no such check. What separates these copies is not which lines they run but which PRECONDITION they enforce, so one of them is operating on state the other one refuses. Decide which is intended BEFORE unifying them — extract the shared part and whichever copy is missing the check keeps running unchecked, and if the guard is the correct behaviour then that hole is already live.
  • + 74 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×98
  • Duplicated block (8 lines × 2) cmd/catalogfetch/main.go:105 — cmd/catalogfetch/main.go:105-112 | cmd/stickerfetch/main.go:170-177 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/catalogfetch/main.go:105` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (8 lines × 2) cmd/telesrv-admin/readstore.go:2105 — cmd/telesrv-admin/readstore.go:2105-2112 | cmd/telesrv-admin/readstore.go:3368-3375 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) cmd/telesrv-admin/readstore.go:3202 — cmd/telesrv-admin/readstore.go:3202-3209 | internal/store/postgres/donations.go:270-277 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/telesrv-admin/readstore.go:3202` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Check import visibility before settling on that home: `internal/store/postgres/donations.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
  • Duplicated block (8 lines × 2) internal/admin/service.go:2099 — internal/admin/service.go:2099-2106 | internal/admin/service.go:2145-2152 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/admin/service.go:2099` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) internal/adminapi/server.go:1881 — internal/adminapi/server.go:1881-1888 | internal/adminapi/verification.go:217-224 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/adminapi/server.go:1881` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) internal/app/bots/botfather.go:292 — internal/app/bots/botfather.go:292-299 | internal/app/bots/botfather.go:372-379 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) internal/app/channels/service.go:2526 — internal/app/channels/service.go:2526-2533 | internal/config/config.go:1957-1964 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/channels/service.go:2526` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) internal/app/chatlists/service.go:776 — internal/app/chatlists/service.go:776-783 | internal/store/postgres/dialog.go:1073-1080 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/chatlists/service.go:776` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) internal/app/ephemeral/service.go:287 — internal/app/ephemeral/service.go:287-294 | internal/app/ephemeral/service.go:318-325 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) internal/app/stargifts/service.go:649 — internal/app/stargifts/service.go:649-656 | internal/store/postgres/star_gift_purchase.go:89-96 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/stargifts/service.go:649` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) internal/domain/message_entity_autodetect.go:73 — internal/domain/message_entity_autodetect.go:73-80 | internal/domain/message_entity_autodetect.go:169-176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/domain/message_entity_autodetect.go:73` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) internal/mtprotoedge/outbound.go:1730 — internal/mtprotoedge/outbound.go:1730-1737 | internal/mtprotoedge/outbound.go:1828-1835 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/mtprotoedge/outbound.go:1730` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) internal/mtprotoedge/rpc_execution_ledger.go:260 — internal/mtprotoedge/rpc_execution_ledger.go:260-267 | internal/mtprotoedge/rpc_flight.go:517-524 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/mtprotoedge/rpc_execution_ledger.go:260` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (8 lines × 2) internal/rpc/account_business.go:329 — internal/rpc/account_business.go:329-336 | internal/rpc/messages_helpers.go:177-184 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) internal/rpc/bots_longtail.go:179 — internal/rpc/bots_longtail.go:179-186 | internal/rpc/messages_pin.go:79-86 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/bots_longtail.go:179` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) internal/rpc/bots_longtail.go:372 — internal/rpc/bots_longtail.go:372-379 | internal/rpc/bots_longtail.go:631-638 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) internal/rpc/channels_invites.go:18 — internal/rpc/channels_invites.go:18-25 | internal/rpc/payments_star_gifts.go:106-113 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) internal/rpc/channels_settings.go:124 — internal/rpc/channels_settings.go:124-131 | internal/rpc/channels_settings.go:145-152 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) internal/rpc/channels_settings.go:548 — internal/rpc/channels_settings.go:548-555 | internal/rpc/channels_settings.go:557-564 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) internal/rpc/contacts.go:617 — internal/rpc/contacts.go:617-624 | internal/rpc/contacts.go:695-702 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) internal/rpc/ephemeral.go:54 — internal/rpc/ephemeral.go:54-61 | internal/rpc/ephemeral.go:130-137 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) internal/rpc/fragment.go:255 — internal/rpc/fragment.go:255-262 | internal/rpc/story_peer_projection.go:568-575 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/fragment.go:255` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) internal/rpc/messages_dialogs.go:318 — internal/rpc/messages_dialogs.go:318-325 | REDACTED:964-971 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_dialogs.go:318` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) internal/rpc/messages_dialogs.go:632 — internal/rpc/messages_dialogs.go:632-639 | internal/rpc/messages_dialogs.go:693-700 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_dialogs.go:632` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) internal/rpc/messages_dialogs.go:653 — internal/rpc/messages_dialogs.go:653-660 | internal/rpc/messages_saved_dialogs.go:156-163 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • + 73 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×97
  • Duplicated block (9 lines × 2) cmd/telesrv-admin/main.go:81 — cmd/telesrv-admin/main.go:81-89 | cmd/walletminiapp/main.go:86-94 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/telesrv-admin/main.go:81` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (9 lines × 2) cmd/telesrv-admin/readstore.go:793 — cmd/telesrv-admin/readstore.go:793-801 | cmd/telesrv-admin/readstore.go:896-904 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) REDACTED:742 — REDACTED:742-750 | REDACTED:1219-1227 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:742` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) REDACTED:2024 — REDACTED:2024-2032 | REDACTED:2070-2078 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (9 lines × 2) REDACTED:2920 — REDACTED:2920-2928 | cmd/telesrv-admin/star_gift_catalog.go:259-267 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `string` to `fileName` in one and `apiPath` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (9 lines × 2) internal/admin/service.go:2187 — internal/admin/service.go:2187-2195 | internal/admin/service.go:2233-2241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) internal/admin/service.go:2200 — internal/admin/service.go:2200-2208 | internal/admin/service.go:2246-2254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/admin/service.go:2200` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) internal/adminapi/botverification.go:443 — internal/adminapi/botverification.go:443-451 | internal/adminapi/verification.go:270-278 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/adminapi/botverification.go:443` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) internal/adminapi/server.go:192 — internal/adminapi/server.go:192-200 | internal/web/server.go:122-130 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/adminapi/server.go:192` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. ★ These copies have DRIFTED, and that is worth reading before extracting anything: `internal/adminapi/server.go:192` is reached only past a guard at line 169 that tests `cfg.Addr` and leaves the function early, and `internal/web/server.go:122` reads `cfg.Addr` with no such check. What separates these copies is not which lines they run but which PRECONDITION they enforce, so one of them is operating on state the other one refuses. Decide which is intended BEFORE unifying them — extract the shared part and whichever copy is missing the check keeps running unchecked, and if the guard is the correct behaviour then that hole is already live.
  • Duplicated block (9 lines × 2) internal/app/ai/service.go:559 — internal/app/ai/service.go:559-567 | internal/store/memory/ai.go:147-155 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/app/ai/service.go:569` calls `Clone` and `internal/store/memory/ai.go:156` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) internal/app/channels/service.go:459 — internal/app/channels/service.go:459-467 | internal/app/channels/service.go:500-508 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) internal/app/channels/service.go:1088 — internal/app/channels/service.go:1088-1096 | internal/app/channels/service.go:1102-1110 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) internal/app/dialogs/service.go:303 — internal/app/dialogs/service.go:303-311 | internal/store/memory/dialogs.go:117-125 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/dialogs/service.go:303` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) internal/app/files/appearance_seed.go:178 — internal/app/files/appearance_seed.go:178-186 | internal/app/files/appearance_seed.go:203-211 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/files/appearance_seed.go:178` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) internal/app/files/mp4faststart.go:211 — internal/app/files/mp4faststart.go:211-219 | internal/app/files/mp4faststart.go:229-237 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/files/mp4faststart.go:211` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) internal/app/messages/service.go:572 — internal/app/messages/service.go:572-580 | internal/app/messages/service.go:586-594 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) internal/app/usernames/service.go:192 — internal/app/usernames/service.go:192-200 | internal/app/usernames/service.go:517-525 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/usernames/service.go:192` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) internal/mtprotoedge/inbound_layer_rpc.go:623 — internal/mtprotoedge/inbound_layer_rpc.go:623-631 | internal/mtprotoedge/inbound_preflight.go:882-890 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) internal/mtprotoedge/session_manager.go:2359 — internal/mtprotoedge/session_manager.go:2359-2367 | internal/mtprotoedge/session_manager.go:2451-2459 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/mtprotoedge/session_manager.go:2359` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) internal/rpc/account_themes.go:118 — internal/rpc/account_themes.go:118-126 | internal/rpc/send_media.go:684-692 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) internal/rpc/bots_callback.go:171 — internal/rpc/bots_callback.go:171-179 | internal/rpc/bots_callback.go:226-234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/bots_callback.go:171` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) internal/rpc/channel_fanout_dispatcher.go:1029 — internal/rpc/channel_fanout_dispatcher.go:1029-1037 | internal/rpc/channel_fanout_dispatcher.go:1133-1141 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/channel_fanout_dispatcher.go:1029` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) internal/rpc/channels_invites.go:379 — internal/rpc/channels_invites.go:379-387 | internal/rpc/contacts.go:184-192 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/channels_invites.go:379` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) internal/rpc/contacts.go:301 — internal/rpc/contacts.go:301-309 | internal/rpc/contacts.go:335-343 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/contacts.go:301` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) internal/rpc/contacts.go:521 — internal/rpc/contacts.go:521-529 | internal/rpc/contacts.go:546-554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/contacts.go:521` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 72 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×96
  • Duplicated block (7 lines × 2) cmd/telegramloginkeygen/main.go:379 — cmd/telegramloginkeygen/main.go:379-385 | internal/app/telegramlogin/keyfiles.go:155-161 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/telegramloginkeygen/main.go:379` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Check import visibility before settling on that home: `internal/app/telegramlogin/keyfiles.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
  • Duplicated block (7 lines × 2) REDACTED:506 — REDACTED:506-512 | REDACTED:1011-1017 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) internal/admin/botverification.go:356 — internal/admin/botverification.go:356-362 | internal/admin/botverification.go:413-419 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) internal/admin/service.go:1954 — internal/admin/service.go:1954-1960 | internal/admin/service.go:2958-2964 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/admin/service.go:1954` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 2) internal/admin/service.go:2443 — internal/admin/service.go:2443-2449 | internal/admin/service.go:2548-2554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/admin/service.go:2443` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) REDACTED:236 — REDACTED:236-242 | internal/app/account/phone_change.go:87-93 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:236` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (7 lines × 2) internal/app/bots/botfather.go:549 — internal/app/bots/botfather.go:549-555 | internal/app/bots/botfather.go:569-575 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/bots/botfather.go:549` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) internal/app/bots/verifierbot.go:1227 — internal/app/bots/verifierbot.go:1227-1233 | internal/app/bots/verifybot.go:995-1001 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/bots/verifierbot.go:1227` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) internal/app/botverification/service.go:997 — internal/app/botverification/service.go:997-1003 | internal/app/botverification/service.go:1029-1035 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) internal/app/files/photos.go:469 — internal/app/files/photos.go:469-475 | internal/app/files/photos.go:556-562 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/files/photos.go:469` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) internal/app/files/sticker_admin.go:142 — internal/app/files/sticker_admin.go:142-148 | internal/app/files/sticker_admin.go:186-192 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) internal/app/files/sticker_management.go:248 — internal/app/files/sticker_management.go:248-254 | internal/app/files/sticker_management.go:262-268 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) internal/app/telegramlogin/jose.go:220 — internal/app/telegramlogin/jose.go:220-226 | internal/app/telegramlogin/jose.go:241-247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/telegramlogin/jose.go:220` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) internal/lottieraster/draw.go:327 — internal/lottieraster/draw.go:327-333 | internal/lottieraster/draw.go:349-355 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/lottieraster/draw.go:327` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) internal/rpc/account.go:299 — internal/rpc/account.go:299-305 | internal/rpc/account.go:312-318 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/account.go:299` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/rpc/account.go:306` calls `Info`, `wallpaperReferenceLogFields` and `internal/rpc/account.go:319` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) internal/rpc/aicompose.go:43 — internal/rpc/aicompose.go:43-49 | internal/rpc/aicompose.go:161-167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) internal/rpc/channel_fanout_dispatcher.go:1097 — internal/rpc/channel_fanout_dispatcher.go:1097-1103 | internal/rpc/messages_suggested_post_updates.go:90-96 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/channel_fanout_dispatcher.go:1097` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 2) internal/rpc/channels_members.go:558 — internal/rpc/channels_members.go:558-566 | internal/rpc/communities.go:443-449 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/channels_members.go:558` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 2) internal/rpc/channels_messages.go:388 — internal/rpc/channels_messages.go:388-394 | internal/rpc/channels_messages.go:423-429 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) internal/rpc/contacts.go:679 — internal/rpc/contacts.go:679-685 | internal/rpc/contacts.go:750-756 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) internal/rpc/contacts.go:729 — internal/rpc/contacts.go:729-735 | internal/rpc/contacts.go:775-781 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: `internal/rpc/contacts.go:775` is reached only past a guard at line 761 that tests `target.ID` and leaves the function early, and `internal/rpc/contacts.go:729` reads `target.ID` with no such check. What separates these copies is not which lines they run but which PRECONDITION they enforce, so one of them is operating on state the other one refuses. Decide which is intended BEFORE unifying them — extract the shared part and whichever copy is missing the check keeps running unchecked, and if the guard is the correct behaviour then that hole is already live.
  • Duplicated block (7 lines × 2) internal/rpc/messages_bot_no_state.go:341 — internal/rpc/messages_bot_no_state.go:341-347 | internal/rpc/messages_send.go:1241-1247 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_bot_no_state.go:341` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) internal/rpc/messages_edit_geolive.go:73 — internal/rpc/messages_edit_geolive.go:73-79 | internal/rpc/messages_todos.go:220-226 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_edit_geolive.go:73` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) internal/rpc/messages_polls.go:162 — internal/rpc/messages_polls.go:162-168 | internal/rpc/messages_reactions_lists.go:101-107 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_polls.go:162` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) internal/rpc/messages_read.go:107 — internal/rpc/messages_read.go:107-113 | internal/rpc/messages_read.go:144-150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_read.go:107` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • + 71 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×78
  • MethodTooLong: Router.registerMessages internal/rpc/messages_register.go:15 — MethodTooLong — registerMessages runs 691 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 591 over it, 6.91× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Server.prepareInboundLayerRPCBatch internal/mtprotoedge/inbound_layer_rpc.go:305 — MethodTooLong — prepareInboundLayerRPCBatch runs 367 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 267 over it, 3.67× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: MessageStore.sendPrivateTextOnce internal/store/postgres/message_send.go:171 — MethodTooLong — sendPrivateTextOnce runs 348 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 248 over it, 3.48× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Router.registerAccount internal/rpc/account.go:27 — MethodTooLong — registerAccount runs 312 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 212 over it, 3.12× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Router.onMessagesForwardMessages internal/rpc/messages_forward.go:13 — MethodTooLong — onMessagesForwardMessages runs 250 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 150 over it, 2.50× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ChannelStore.sendChannelMessageOnce internal/store/postgres/channel_message_send.go:51 — MethodTooLong — sendChannelMessageOnce runs 240 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 140 over it, 2.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Router.resolveInputMedia internal/rpc/send_media.go:630 — MethodTooLong — resolveInputMedia runs 212 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 112 over it, 2.12× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ChannelStore.EditChannelMessage internal/store/postgres/channel_message_edit.go:14 — MethodTooLong — EditChannelMessage runs 204 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 104 over it, 2.04× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Router.registerChannels internal/rpc/channels_register.go:12 — MethodTooLong — registerChannels runs 201 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 101 over it, 2.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ChannelStore.ListChannelHistory internal/store/postgres/channel_message_history.go:14 — MethodTooLong — ListChannelHistory runs 201 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 101 over it, 2.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: MessageStore.EditMessage internal/store/postgres/message_edit.go:13 — MethodTooLong — EditMessage runs 198 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 98 over it, 1.98× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ChannelStore.SendChannelMessage internal/store/memory/channel_message_send.go:13 — MethodTooLong — SendChannelMessage runs 193 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 93 over it, 1.93× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: DialogStore.listByUser internal/store/postgres/dialog.go:41 — MethodTooLong — listByUser runs 188 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 88 over it, 1.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ReadModelChangeListener.handlePayload internal/store/postgres/read_model_listener.go:381 — MethodTooLong — handlePayload runs 188 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 88 over it, 1.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: MessageStore.finishDeleteMessagesTx internal/store/postgres/message_delete.go:168 — MethodTooLong — finishDeleteMessagesTx runs 187 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 87 over it, 1.87× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: StarGiftUpgradeStore.UpgradeStarGift REDACTED:344 — MethodTooLong — UpgradeStarGift runs 185 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 85 over it, 1.85× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: server.routes REDACTED:70 — MethodTooLong — routes runs 176 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 76 over it, 1.76× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ChannelStore.EditChannelMessage internal/store/memory/channel_message_edit.go:11 — MethodTooLong — EditChannelMessage runs 166 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 66 over it, 1.66× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: MessageStore.ListByUser internal/store/postgres/message_history.go:80 — MethodTooLong — ListByUser runs 166 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 66 over it, 1.66× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ChannelStore.GetChannelStats internal/store/postgres/channel_stats.go:12 — MethodTooLong — GetChannelStats runs 162 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 62 over it, 1.62× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ChannelStore.ListChannelHistory internal/store/memory/channel_message_history.go:11 — MethodTooLong — ListChannelHistory runs 159 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 59 over it, 1.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Service.sweep internal/app/donations/sweep.go:57 — MethodTooLong — sweep runs 154 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 54 over it, 1.54× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Router.domainInlineResultFromTG internal/rpc/bots_inline.go:420 — MethodTooLong — domainInlineResultFromTG runs 154 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 54 over it, 1.54× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ChannelStore.listChannelDialogs REDACTED:50 — MethodTooLong — listChannelDialogs runs 154 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 54 over it, 1.54× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Router.onMessagesSendMedia internal/rpc/send_media.go:258 — MethodTooLong — onMessagesSendMedia runs 149 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 49 over it, 1.49× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 53 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×78
  • Duplicated block (6 lines × 2) REDACTED:719 — REDACTED:719-724 | REDACTED:1193-1198 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) cmd/telesrv-admin/star_gift_catalog.go:204 — cmd/telesrv-admin/star_gift_catalog.go:204-209 | internal/adminapi/server.go:1259-1264 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/telesrv-admin/star_gift_catalog.go:204` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Check import visibility before settling on that home: `internal/adminapi/server.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
  • Duplicated block (6 lines × 2) internal/app/bots/stickersbot.go:291 — internal/app/bots/stickersbot.go:291-296 | internal/app/bots/stickersbot.go:309-314 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) internal/app/channels/service.go:1972 — internal/app/channels/service.go:1972-1977 | internal/app/channels/service.go:1997-2002 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) internal/app/files/diskspace_unix.go:10 — internal/app/files/diskspace_unix.go:10-15 | internal/hoststats/disk_unix.go:14-19 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (6 lines × 2) internal/app/stories/service.go:356 — internal/app/stories/service.go:356-361 | internal/app/stories/service.go:370-375 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) internal/app/updates/service.go:777 — internal/app/updates/service.go:777-782 | internal/store/postgres/update_event.go:76-81 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/updates/service.go:777` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/store/postgres/update_event.go:83` calls `String` and `internal/app/updates/service.go:784` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) internal/botapi/inline.go:555 — internal/botapi/inline.go:555-560 | internal/botapi/inline.go:727-732 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/botapi/inline.go:555` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) internal/rpc/account.go:1826 — internal/rpc/account.go:1826-1831 | internal/rpc/account.go:1837-1842 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) internal/rpc/bot_verification_projection.go:146 — internal/rpc/bot_verification_projection.go:146-151 | internal/rpc/fragment.go:340-345 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/bot_verification_projection.go:146` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/rpc/bot_verification_projection.go:142` calls `applyBotVerificationIconsFromMap` and `internal/rpc/fragment.go:339` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) internal/rpc/channels_messages.go:332 — internal/rpc/channels_messages.go:332-337 | internal/rpc/messages_delete.go:66-71 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/channels_messages.go:332` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (6 lines × 2) internal/rpc/channels_topics.go:39 — internal/rpc/channels_topics.go:39-44 | internal/rpc/folders.go:55-60 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/channels_topics.go:39` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (6 lines × 2) internal/rpc/chatlists.go:366 — internal/rpc/chatlists.go:366-371 | internal/rpc/messages_saved_dialogs.go:346-351 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/chatlists.go:366` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) internal/rpc/convert_channels_core.go:42 — internal/rpc/convert_channels_core.go:42-47 | internal/rpc/convert_messages.go:409-414 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) internal/rpc/messages_forward.go:334 — internal/rpc/messages_forward.go:334-339 | internal/rpc/messages_quick_replies.go:219-224 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) internal/rpc/messages_monoforum.go:89 — internal/rpc/messages_monoforum.go:89-94 | internal/rpc/messages_monoforum.go:121-126 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) internal/rpc/payments_star_gifts.go:784 — internal/rpc/payments_star_gifts.go:784-789 | internal/rpc/payments_star_gifts.go:927-932 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/payments_star_gifts.go:784` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (6 lines × 2) internal/rpc/phone_group_call_updates.go:100 — internal/rpc/phone_group_call_updates.go:100-105 | internal/rpc/phone_group_call_updates.go:156-161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/phone_group_call_updates.go:100` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) internal/rpc/story_projection_cache.go:215 — internal/rpc/story_projection_cache.go:215-220 | internal/store/memory/community.go:602-607 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/story_projection_cache.go:215` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) internal/store/memory/channel_reactions.go:335 — internal/store/memory/channel_reactions.go:335-340 | internal/store/postgres/channel_reaction_messages.go:416-421 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) internal/store/memory/channel_reactions.go:514 — internal/store/memory/channel_reactions.go:514-519 | internal/store/memory/community.go:500-505 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_reactions.go:514` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) internal/store/memory/dialogs.go:50 — internal/store/memory/dialogs.go:50-55 | internal/store/memory/dialogs.go:60-65 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) internal/store/memory/message_pin.go:93 — internal/store/memory/message_pin.go:93-98 | internal/store/postgres/message_pin.go:176-181 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) internal/store/postgres/account.go:245 — internal/store/postgres/account.go:245-250 | internal/store/postgres/account.go:284-289 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/account.go:245` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) internal/store/postgres/account.go:443 — internal/store/postgres/account.go:443-448 | internal/store/postgres/account.go:487-492 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/account.go:443` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 53 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×69
  • Duplicated block (12 lines × 2) internal/app/ai/provider_http.go:105 — internal/app/ai/provider_http.go:105-116 | internal/app/ai/provider_http.go:136-147 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/ai/provider_http.go:105` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) internal/app/bots/miniapp.go:362 — internal/app/bots/miniapp.go:362-373 | internal/rpc/messages_webview.go:653-664 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 2) internal/app/bots/stickersbot.go:323 — internal/app/bots/stickersbot.go:323-334 | internal/app/bots/stickersbot.go:364-375 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/app/bots/stickersbot.go:322` calls `handleStickersEmoji` and `internal/app/bots/stickersbot.go:363` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) internal/app/donations/wallet.go:75 — internal/app/donations/wallet.go:75-86 | internal/app/donations/wallet.go:100-111 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/donations/wallet.go:75` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) internal/app/ephemeral/service.go:455 — internal/app/ephemeral/service.go:455-466 | internal/rpc/bots_callback.go:270-281 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 2) internal/app/files/retention.go:372 — internal/app/files/retention.go:372-383 | internal/app/files/retention.go:416-427 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/files/retention.go:372` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) internal/app/translation/service.go:209 — internal/app/translation/service.go:209-220 | internal/app/translation/service.go:232-243 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/translation/service.go:209` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) internal/botapi/ephemeral.go:197 — internal/botapi/ephemeral.go:197-208 | internal/botapi/ephemeral.go:307-318 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) internal/botapi/server.go:533 — internal/botapi/server.go:533-544 | internal/botapi/server.go:666-677 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) internal/botapi/server.go:1165 — internal/botapi/server.go:1165-1176 | internal/botapi/server.go:1249-1260 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/botapi/server.go:1165` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) internal/mtprotoedge/session_manager.go:365 — internal/mtprotoedge/session_manager.go:365-376 | internal/mtprotoedge/session_manager.go:1083-1094 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/mtprotoedge/session_manager.go:363` calls `RLock` and `internal/mtprotoedge/session_manager.go:1082` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) internal/mtprotoedge/session_manager.go:1739 — internal/mtprotoedge/session_manager.go:1739-1750 | internal/mtprotoedge/session_manager.go:1826-1837 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/mtprotoedge/session_manager.go:1739` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) internal/rpc/account_phone.go:12 — internal/rpc/account_phone.go:12-23 | internal/rpc/account_phone.go:35-46 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) internal/rpc/bots_longtail.go:251 — internal/rpc/bots_longtail.go:251-262 | internal/rpc/bots_longtail.go:277-288 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) internal/rpc/bots_longtail.go:309 — internal/rpc/bots_longtail.go:309-320 | internal/rpc/bots_longtail.go:337-348 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) internal/rpc/channels_members.go:227 — internal/rpc/channels_members.go:227-238 | internal/rpc/channels_members.go:521-532 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) internal/rpc/channels_settings.go:82 — internal/rpc/channels_settings.go:82-93 | internal/rpc/channels_settings.go:96-107 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 2) internal/rpc/channels_settings.go:382 — internal/rpc/channels_settings.go:382-393 | internal/rpc/channels_settings.go:444-455 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/channels_settings.go:382` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) internal/rpc/messages_forward.go:77 — internal/rpc/messages_forward.go:77-88 | internal/rpc/send_media.go:302-313 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_forward.go:77` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) internal/rpc/messages_send.go:362 — internal/rpc/messages_send.go:362-373 | internal/rpc/messages_send.go:381-392 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_send.go:362` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) internal/rpc/payments_star_gift_collections.go:14 — internal/rpc/payments_star_gift_collections.go:14-25 | internal/rpc/payments_star_gifts.go:1092-1103 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/payments_star_gift_collections.go:14` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) internal/rpc/stories.go:2318 — internal/rpc/stories.go:2318-2329 | internal/rpc/stories.go:2374-2385 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/stories.go:2318` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) internal/store/memory/bot_verification.go:1007 — internal/store/memory/bot_verification.go:1007-1018 | internal/store/postgres/bot_verification.go:1339-1350 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 2) internal/store/memory/channel_helpers.go:291 — internal/store/memory/channel_helpers.go:291-302 | internal/store/memory/channel_helpers.go:328-339 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_helpers.go:291` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) internal/store/memory/channel_helpers.go:525 — internal/store/memory/channel_helpers.go:525-536 | internal/store/postgres/channel_helpers.go:809-820 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_helpers.go:525` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 44 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×69
  • Duplicated block (11 lines × 2) cmd/telesrv-admin/readstore.go:2226 — cmd/telesrv-admin/readstore.go:2226-2236 | cmd/telesrv-admin/readstore.go:2751-2761 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/telesrv-admin/readstore.go:2226` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (11 lines × 2) REDACTED:593 — REDACTED:593-603 | REDACTED:701-711 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:700` calls `Set` and `REDACTED:592` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) REDACTED:809 — REDACTED:809-819 | REDACTED:1050-1060 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:809` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) cmd/telesrv-admin/serverstorage.go:271 — cmd/telesrv-admin/serverstorage.go:271-281 | internal/app/files/blobs3.go:40-50 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/telesrv-admin/serverstorage.go:271` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Check import visibility before settling on that home: `internal/app/files/blobs3.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
  • Duplicated block (11 lines × 2) internal/adminapi/botverification.go:546 — internal/adminapi/botverification.go:546-556 | internal/adminapi/verification.go:346-356 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (11 lines × 2) internal/app/bots/verifierbot.go:588 — internal/app/bots/verifierbot.go:588-598 | internal/app/bots/verifierbot.go:900-910 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/bots/verifierbot.go:588` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (11 lines × 2) internal/app/bots/verifierbot.go:1400 — internal/app/bots/verifierbot.go:1400-1410 | internal/app/bots/verifybot.go:1131-1141 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/bots/verifierbot.go:1400` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) internal/app/contacts/service.go:254 — internal/app/contacts/service.go:254-264 | internal/app/contacts/service.go:382-392 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/contacts/service.go:254` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) internal/app/dialogs/draft_read_model_cache.go:106 — internal/app/dialogs/draft_read_model_cache.go:106-116 | internal/rpc/story_sparse_projection_cache.go:206-216 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/dialogs/draft_read_model_cache.go:106` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) internal/app/telegramlogin/service.go:250 — internal/app/telegramlogin/service.go:250-260 | internal/app/telegramlogin/service.go:269-279 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/telegramlogin/service.go:250` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) internal/app/users/service.go:452 — internal/app/users/service.go:452-462 | internal/store/postgres/user.go:523-533 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) internal/botapi/inline.go:563 — internal/botapi/inline.go:563-573 | internal/botapi/inline.go:826-836 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) internal/botapi/server.go:354 — internal/botapi/server.go:354-364 | internal/botapi/server.go:1035-1045 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/botapi/server.go:354` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (11 lines × 2) internal/compat/tdesktop/dialogs.go:88 — internal/compat/tdesktop/dialogs.go:88-98 | internal/compat/tdesktop/dialogs.go:99-109 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) internal/compat/tdesktop/dialogs.go:121 — internal/compat/tdesktop/dialogs.go:121-131 | internal/compat/tdesktop/dialogs.go:132-142 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) REDACTED:743 — REDACTED:743-753 | internal/loadharness/seed.go:74-84 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) internal/mtprotoedge/session_manager.go:2120 — internal/mtprotoedge/session_manager.go:2120-2130 | internal/mtprotoedge/session_manager.go:2140-2150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (11 lines × 2) internal/rpc/account_deletion_notifications_worker.go:82 — internal/rpc/account_deletion_notifications_worker.go:82-92 | internal/rpc/account_freeze_worker.go:62-72 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (11 lines × 2) internal/rpc/aicompose.go:83 — internal/rpc/aicompose.go:83-93 | internal/rpc/aicompose.go:180-190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) internal/rpc/botapi_gateway.go:253 — internal/rpc/botapi_gateway.go:253-263 | internal/rpc/botapi_gateway.go:892-902 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) internal/rpc/channels_core.go:312 — internal/rpc/channels_core.go:312-322 | internal/rpc/send_media.go:287-297 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) internal/rpc/channels_members.go:396 — internal/rpc/channels_members.go:396-406 | internal/rpc/channels_state_mutation.go:12-22 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) internal/rpc/channels_messages.go:260 — internal/rpc/channels_messages.go:260-270 | internal/rpc/channels_updates.go:17-27 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) internal/rpc/channels_read_reactions.go:14 — internal/rpc/channels_read_reactions.go:14-24 | internal/rpc/channels_read_reactions.go:61-71 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) internal/rpc/channels_stubs.go:501 — internal/rpc/channels_stubs.go:501-511 | internal/rpc/premium.go:153-163 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • + 44 more in this group — see findings.md.
D3 · God Classes · TooManyMethods · ×52
  • TooManyMethods: Router internal/rpc/router.go:127 — TooManyMethods — 1671 methods, declared across 193 files: rpc/stories.go (60), rpc/account.go (57), rpc/router.go (50), rpc/presence.go (40), +189 more file(s). The bar is 30 methods; this is 1641 over it, 55.70× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ChannelStore internal/store/postgres/channel_store.go:19 — TooManyMethods — 299 methods, declared across 42 files: postgres/channel_settings.go (25), REDACTED (22), postgres/channel_topics.go (20), postgres/channel_helpers.go (15), +38 more file(s). The bar is 30 methods; this is 269 over it, 9.97× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ChannelStore internal/store/memory/channel_store.go:65 — TooManyMethods — 256 methods, declared across 26 files: memory/channel_members.go (30), memory/channel_invites.go (26), memory/channel_settings.go (26), memory/channel_reactions.go (19), +22 more file(s). The bar is 30 methods; this is 226 over it, 8.53× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: server REDACTED:36 — TooManyMethods — 224 methods, declared across 19 files: REDACTED (96), telesrv-admin/privateview.go (20), telesrv-admin/botverification.go (18), telesrv-admin/serversettings.go (16), +15 more file(s). The bar is 30 methods; this is 194 over it, 7.47× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Service internal/app/channels/service.go:16 — TooManyMethods — 203 methods, declared across 10 files: channels/service.go (170), channels/bot_policy.go (11), channels/media_count_cache.go (5), channels/active_ids_cache.go (4), +6 more file(s). The bar is 30 methods; this is 173 over it, 6.77× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. Most of these members implement rpc.ChannelsService (137 of 203 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
  • TooManyMethods: Service REDACTED:152 — TooManyMethods — 184 methods, declared across 9 files: REDACTED (39), bots/verifierbot.go (32), bots/verifybot.go (31), bots/botfather.go (26), +5 more file(s). The bar is 30 methods; this is 154 over it, 6.13× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Service internal/app/files/service.go:48 — TooManyMethods — 182 methods, declared across 34 files: files/photos.go (44), files/service.go (18), files/sticker_management.go (14), files/seed.go (13), +30 more file(s). The bar is 30 methods; this is 152 over it, 6.07× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Service internal/admin/service.go:624 — TooManyMethods — 140 methods, declared across 7 files: admin/service.go (87), admin/botverification.go (22), admin/star_gift_catalog.go (13), admin/verification.go (11), +3 more file(s). The bar is 30 methods; this is 110 over it, 4.67× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Service internal/admin/service.go:624 — TooManyMethods — 140 methods, declared across 7 files: admin/service.go (87), admin/botverification.go (22), admin/star_gift_catalog.go (13), admin/verification.go (11), +3 more file(s). The bar is 30 methods; this is 110 over it, 4.67× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. Most of these members implement adminapi.Service (119 of 140 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
  • TooManyMethods: Server internal/adminapi/server.go:202 — TooManyMethods — 120 methods, declared across 5 files: adminapi/server.go (89), adminapi/botverification.go (15), adminapi/verification.go (8), adminapi/account_rating.go (4), +1 more file(s). The bar is 30 methods; this is 90 over it, 4.00× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Conn internal/mtprotoedge/conn.go:58 — TooManyMethods — 118 methods, declared across 5 files: mtprotoedge/outbound.go (64), mtprotoedge/conn.go (28), mtprotoedge/inbound_rpc.go (13), mtprotoedge/conn_layer_profile.go (12), +1 more file(s). The bar is 30 methods; this is 88 over it, 3.93× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SessionManager internal/mtprotoedge/session_manager.go:175 — TooManyMethods — 110 methods, declared across 3 files: mtprotoedge/session_manager.go (99), mtprotoedge/logical_session.go (10), mtprotoedge/runtime_metrics.go (1). The bar is 30 methods; this is 80 over it, 3.67× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Service internal/app/account/service.go:38 — TooManyMethods — 100 methods, declared across 5 files: account/service.go (56), account/business.go (28), REDACTED (9), account/phone_change.go (5), +1 more file(s). The bar is 30 methods; this is 70 over it, 3.33× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Service internal/app/stargifts/service.go:30 — TooManyMethods — 86 methods, declared across 3 files: stargifts/service.go (82), stargifts/animation.go (2), stargifts/thumb.go (2). The bar is 30 methods; this is 56 over it, 2.87× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Server internal/mtprotoedge/server.go:508 — TooManyMethods — 84 methods, declared across 13 files: mtprotoedge/encrypted.go (31), mtprotoedge/inbound_layer_rpc.go (14), mtprotoedge/server.go (13), mtprotoedge/rpc_rewrap.go (6), +9 more file(s). The bar is 30 methods; this is 54 over it, 2.80× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: readStore cmd/telesrv-admin/readstore.go:63 — TooManyMethods — 79 methods, declared across 4 files: telesrv-admin/readstore.go (64), telesrv-admin/privateview_store.go (10), telesrv-admin/adminusers.go (4), telesrv-admin/activity.go (1). The bar is 30 methods; this is 49 over it, 2.63× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: StarGiftLifecycleStore internal/store/postgres/star_gift_lifecycle.go:21 — TooManyMethods — 73 methods, declared across 8 files: postgres/star_gift_lifecycle.go (34), postgres/star_gift_craft_auction.go (16), postgres/star_gift_purchase.go (8), postgres/star_gift_entitlements.go (5), +4 more file(s). The bar is 30 methods; this is 43 over it, 2.43× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: MessageStore internal/store/postgres/message_store.go:14 — TooManyMethods — 72 methods, declared across 19 files: postgres/scheduled_message.go (10), postgres/message_send.go (9), postgres/message_history.go (7), postgres/saved_dialog.go (6), +15 more file(s). The bar is 30 methods; this is 42 over it, 2.40× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: MediaStore internal/store/postgres/media.go:25 — TooManyMethods — 69 methods, declared across 4 files: postgres/media.go (47), postgres/media_refs.go (18), postgres/blob_migration.go (2), postgres/web_page.go (2). The bar is 30 methods; this is 39 over it, 2.30× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Service internal/app/messages/service.go:13 — TooManyMethods — 66 methods, declared across 4 files: messages/service.go (54), messages/business_automation.go (8), messages/private_media_count_cache.go (3), messages/album_group.go (1). The bar is 30 methods; this is 36 over it, 2.20× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: MessageStore internal/store/memory/message_store.go:9 — TooManyMethods — 66 methods, declared across 17 files: memory/message_send.go (9), memory/saved_dialog.go (9), memory/message_reactions.go (7), memory/message_history.go (6), +13 more file(s). The bar is 30 methods; this is 36 over it, 2.20× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Service internal/app/dialogs/service.go:22 — TooManyMethods — 55 methods, declared across 5 files: dialogs/service.go (37), dialogs/read_model_cache.go (11), dialogs/shared_list_snapshot.go (4), dialogs/list_hash_cache.go (2), +1 more file(s). The bar is 30 methods; this is 25 over it, 1.83× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: PasswordStore internal/store/postgres/account.go:21 — TooManyMethods — 54 methods, declared across 2 files: postgres/account.go (27), postgres/business.go (27). The bar is 30 methods; this is 24 over it, 1.80× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: PasswordStore internal/store/memory/password.go:12 — TooManyMethods — 53 methods, declared across 2 files: memory/business.go (27), memory/password.go (26). The bar is 30 methods; this is 23 over it, 1.77× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Service internal/app/auth/service.go:81 — TooManyMethods — 52 methods. The bar is 30 methods; this is 22 over it, 1.73× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • + 27 more in this group — see findings.md.
D3 · God Classes · ClassTooLong · ×50
  • ClassTooLong: server REDACTED:36 — ClassTooLong — 1728 significant lines (blank, comment-only and punctuation-only lines excluded), 224 methods, 97 blocks, lines 36-2962. The bar is 400 significant lines; this is 1328 over it, 4.32× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Service internal/admin/service.go:624 — ClassTooLong — 1704 significant lines (blank, comment-only and punctuation-only lines excluded), 140 methods, 86 blocks, lines 624-4071. The bar is 400 significant lines; this is 1304 over it, 4.26× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SessionManager internal/mtprotoedge/session_manager.go:175 — ClassTooLong — 1601 significant lines (blank, comment-only and punctuation-only lines excluded), 110 methods, 100 blocks, lines 175-2863. The bar is 400 significant lines; this is 1201 over it, 4.00× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Service internal/app/channels/service.go:16 — ClassTooLong — 1355 significant lines (blank, comment-only and punctuation-only lines excluded), 203 methods, 171 blocks, lines 16-2516. The bar is 400 significant lines; this is 955 over it, 3.39× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: StarGiftLifecycleStore internal/store/postgres/star_gift_lifecycle.go:21 — ClassTooLong — 1181 significant lines (blank, comment-only and punctuation-only lines excluded), 73 methods, 35 blocks, lines 21-1871. The bar is 400 significant lines; this is 781 over it, 2.95× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: readStore cmd/telesrv-admin/readstore.go:63 — ClassTooLong — 1178 significant lines (blank, comment-only and punctuation-only lines excluded), 79 methods, 64 blocks, lines 63-3502. The bar is 400 significant lines; this is 778 over it, 2.95× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Server internal/adminapi/server.go:202 — ClassTooLong — 1041 significant lines (blank, comment-only and punctuation-only lines excluded), 120 methods, 90 blocks, lines 202-1811. The bar is 400 significant lines; this is 641 over it, 2.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: StoryStore internal/store/postgres/story.go:21 — ClassTooLong — 1030 significant lines (blank, comment-only and punctuation-only lines excluded), 41 methods, 42 blocks, lines 21-2103. The bar is 400 significant lines; this is 630 over it, 2.58× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Router internal/rpc/router.go:127 — ClassTooLong — 899 significant lines (blank, comment-only and punctuation-only lines excluded), 1671 methods, 51 blocks, lines 127-1891. The bar is 400 significant lines; this is 499 over it, 2.25× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Service internal/app/auth/service.go:81 — ClassTooLong — 891 significant lines (blank, comment-only and punctuation-only lines excluded), 52 methods, 52 blocks, lines 81-1806. The bar is 400 significant lines; this is 491 over it, 2.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: StoryStore internal/store/memory/story.go:15 — ClassTooLong — 813 significant lines (blank, comment-only and punctuation-only lines excluded), 48 methods, 49 blocks, lines 15-1274. The bar is 400 significant lines; this is 413 over it, 2.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: CommunityStore internal/store/memory/community.go:16 — ClassTooLong — 783 significant lines (blank, comment-only and punctuation-only lines excluded), 33 methods, 34 blocks, lines 16-1112. The bar is 400 significant lines; this is 383 over it, 1.96× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: handler internal/botapi/server.go:128 — ClassTooLong — 780 significant lines (blank, comment-only and punctuation-only lines excluded), 29 methods, 22 blocks, lines 128-1273. The bar is 400 significant lines; this is 380 over it, 1.95× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: DialogStore internal/store/postgres/dialog.go:18 — ClassTooLong — 772 significant lines (blank, comment-only and punctuation-only lines excluded), 35 methods, 36 blocks, lines 18-1128. The bar is 400 significant lines; this is 372 over it, 1.93× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Service internal/app/telegramlogin/service.go:49 — ClassTooLong — 730 significant lines (blank, comment-only and punctuation-only lines excluded), 42 methods, 43 blocks, lines 49-1414. The bar is 400 significant lines; this is 330 over it, 1.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Service internal/app/account/service.go:38 — ClassTooLong — 727 significant lines (blank, comment-only and punctuation-only lines excluded), 100 methods, 57 blocks, lines 38-1404. The bar is 400 significant lines; this is 327 over it, 1.82× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Service internal/app/dialogs/service.go:22 — ClassTooLong — 708 significant lines (blank, comment-only and punctuation-only lines excluded), 55 methods, 38 blocks, lines 22-1305. The bar is 400 significant lines; this is 308 over it, 1.77× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ModerationReportStore internal/store/memory/moderation.go:16 — ClassTooLong — 686 significant lines (blank, comment-only and punctuation-only lines excluded), 31 methods, 32 blocks, lines 16-962. The bar is 400 significant lines; this is 286 over it, 1.72× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: GroupCallStore internal/store/postgres/groupcall.go:19 — ClassTooLong — 671 significant lines (blank, comment-only and punctuation-only lines excluded), 33 methods, 34 blocks, lines 19-1303. The bar is 400 significant lines; this is 271 over it, 1.68× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MediaStore internal/store/postgres/media.go:25 — ClassTooLong — 649 significant lines (blank, comment-only and punctuation-only lines excluded), 69 methods, 48 blocks, lines 25-1607. The bar is 400 significant lines; this is 249 over it, 1.62× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: CommunityStore internal/store/postgres/community.go:20 — ClassTooLong — 646 significant lines (blank, comment-only and punctuation-only lines excluded), 24 methods, 25 blocks, lines 20-1383. The bar is 400 significant lines; this is 246 over it, 1.62× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: StarGiftUpgradeStore REDACTED:24 — ClassTooLong — 598 significant lines (blank, comment-only and punctuation-only lines excluded), 7 methods, 8 blocks, lines 24-1249. The bar is 400 significant lines; this is 198 over it, 1.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: CachedContactStore internal/app/userprojection/contact_cache.go:175 — ClassTooLong — 597 significant lines (blank, comment-only and punctuation-only lines excluded), 42 methods, 41 blocks, lines 175-1072. The bar is 400 significant lines; this is 197 over it, 1.49× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: StarGiftStore REDACTED:14 — ClassTooLong — 582 significant lines (blank, comment-only and punctuation-only lines excluded), 40 methods, 41 blocks, lines 14-967. The bar is 400 significant lines; this is 182 over it, 1.46× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: TelegramLoginStore internal/store/postgres/telegram_login.go:18 — ClassTooLong — 579 significant lines (blank, comment-only and punctuation-only lines excluded), 29 methods, 30 blocks, lines 18-1093. The bar is 400 significant lines; this is 179 over it, 1.45× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • + 25 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (16 corresponding lines) · ×41
  • Edited copy of a member (16 corresponding lines) internal/store/postgres/star_gift_entitlements.go:195 — internal/store/postgres/star_gift_entitlements.go:195-210 | internal/store/postgres/star_gift_entitlements.go:262-282 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/store/memory/story.go:1578 — internal/store/memory/story.go:1578-1593 | internal/store/postgres/story.go:2421-2436 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/app/files/blobcache.go:130 — internal/app/files/blobcache.go:130-145 | internal/store/postgres/media.go:533-553 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/app/channels/read_model_cache.go:52 — internal/app/channels/read_model_cache.go:52-67 | internal/app/channels/resolve_cache.go:51-69 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/store/memory/telegram_login.go:59 — internal/store/memory/telegram_login.go:59-74 | internal/store/memory/telegram_login.go:76-91 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/app/bots/verifierbot.go:277 — internal/app/bots/verifierbot.go:277-292 | internal/app/bots/verifybot.go:217-232 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/store/memory/moderation.go:154 — internal/store/memory/moderation.go:154-171 | internal/store/memory/moderation.go:219-234 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/app/files/mp4faststart.go:210 — internal/app/files/mp4faststart.go:210-225 | internal/app/files/mp4faststart.go:228-243 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/rpc/webpage_resolver.go:184 — internal/rpc/webpage_resolver.go:184-199 | internal/rpc/webpage_resolver.go:201-216 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) REDACTED:289 — REDACTED:289-304 | REDACTED:343-359 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/rpc/messages_quick_replies.go:320 — internal/rpc/messages_quick_replies.go:320-335 | internal/rpc/messages_quick_replies.go:337-356 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) cmd/telesrv-admin/botverification.go:372 — cmd/telesrv-admin/botverification.go:372-388 | cmd/telesrv-admin/botverification.go:397-412 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/app/channels/service.go:1736 — internal/app/channels/service.go:1736-1751 | internal/app/channels/service.go:1792-1809 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/rpc/bots_inline.go:709 — internal/rpc/bots_inline.go:709-724 | internal/rpc/bots_inline.go:726-742 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/store/memory/ai.go:28 — internal/store/memory/ai.go:28-43 | internal/store/memory/themes.go:34-53 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/app/channels/service.go:1475 — internal/app/channels/service.go:1475-1490 | internal/app/messages/service.go:184-199 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) cmd/telesrv-admin/star_gift_catalog.go:407 — cmd/telesrv-admin/star_gift_catalog.go:407-422 | cmd/telesrv-admin/star_gift_catalog.go:434-454 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/app/botverification/service.go:1244 — internal/app/botverification/service.go:1244-1259 | internal/app/verification/service.go:1224-1239 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/rpc/messages_games.go:16 — internal/rpc/messages_games.go:16-31 | internal/rpc/messages_games.go:46-64 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/rpc/telegram_login.go:393 — internal/rpc/telegram_login.go:393-414 | internal/rpc/telegram_login.go:416-431 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/store/postgres/telegram_login.go:124 — internal/store/postgres/telegram_login.go:124-140 | internal/store/postgres/telegram_login.go:142-157 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/store/postgres/donations.go:135 — internal/store/postgres/donations.go:135-153 | internal/store/postgres/donations.go:192-207 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) REDACTED:552 — REDACTED:552-567 | internal/app/channels/bot_policy.go:69-87 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/rpc/account.go:1649 — internal/rpc/account.go:1649-1664 | internal/rpc/contacts.go:964-984 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) internal/rpc/send_media.go:1151 — internal/rpc/send_media.go:1151-1166 | internal/rpc/upload.go:369-386 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 16 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (10 corresponding lines) · ×41
  • Edited copy of a member (10 corresponding lines) REDACTED:487 — REDACTED:487-496 | REDACTED:551-560 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/store/memory/channel_stats.go:300 — internal/store/memory/channel_stats.go:300-310 | internal/store/postgres/channel_stats.go:492-501 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/rpc/messages_dialogs.go:301 — internal/rpc/messages_dialogs.go:301-310 | internal/rpc/messages_helpers.go:588-598 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/store/memory/client_telemetry.go:84 — internal/store/memory/client_telemetry.go:84-93 | internal/store/memory/moderation.go:311-320 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/store/postgres/star_gift_craft_auction.go:33 — internal/store/postgres/star_gift_craft_auction.go:33-42 | REDACTED:258-272 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/store/postgres/bot_verification.go:1112 — internal/store/postgres/bot_verification.go:1112-1121 | internal/store/postgres/bot_verification.go:1123-1135 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/app/channels/service.go:2078 — internal/app/channels/service.go:2078-2087 | internal/app/channels/service.go:2091-2100 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/store/postgres/telegram_login.go:102 — internal/store/postgres/telegram_login.go:102-111 | internal/store/postgres/telegram_login.go:113-122 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/store/postgres/telegram_login.go:828 — internal/store/postgres/telegram_login.go:828-837 | internal/store/postgres/telegram_login.go:839-848 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/app/channels/service.go:192 — internal/app/channels/service.go:192-201 | internal/app/channels/service.go:833-842 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/rpc/bot_verification_projection.go:268 — internal/rpc/bot_verification_projection.go:268-277 | internal/rpc/bot_verification_projection.go:302-311 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/app/bots/botfather.go:138 — internal/app/bots/botfather.go:138-147 | internal/app/bots/stickersbot.go:73-82 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/app/files/sticker_management.go:329 — internal/app/files/sticker_management.go:329-338 | internal/rpc/convert_media.go:710-719 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/app/files/retention_purge.go:213 — internal/app/files/retention_purge.go:213-222 | internal/app/files/retention_purge.go:227-236 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/loadharness/rich_state.go:181 — internal/loadharness/rich_state.go:181-190 | internal/loadharness/snapshot.go:494-503 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/app/moderation/appeal_links.go:44 — internal/app/moderation/appeal_links.go:44-53 | internal/app/moderation/appeal_links.go:62-71 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/store/postgres/channel_message_history.go:1042 — internal/store/postgres/channel_message_history.go:1042-1051 | internal/store/postgres/channel_suggested_post.go:645-657 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/rpc/callback_registry.go:192 — internal/rpc/callback_registry.go:192-206 | internal/rpc/messages_no_forwards.go:135-144 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) REDACTED:184 — REDACTED:184-193 | REDACTED:195-204 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/app/channels/service.go:985 — internal/app/channels/service.go:985-994 | internal/app/channels/service.go:1022-1034 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/app/dialogs/service.go:911 — internal/app/dialogs/service.go:911-923 | internal/app/dialogs/service.go:1167-1176 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/store/memory/business.go:513 — internal/store/memory/business.go:513-522 | internal/store/postgres/business.go:832-841 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/loadharness/snapshot.go:684 — internal/loadharness/snapshot.go:684-693 | REDACTED:1028-1037 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/store/memory/chatlists.go:159 — internal/store/memory/chatlists.go:159-168 | internal/store/memory/bot.go:393-402 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/store/memory/chatlists.go:180 — internal/store/memory/chatlists.go:180-189 | internal/store/memory/chatlists.go:191-203 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 16 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (12 corresponding lines) · ×40
  • Edited copy of a member (12 corresponding lines) internal/app/telegramlogin/crypto.go:49 — internal/app/telegramlogin/crypto.go:49-61 | internal/app/telegramlogin/crypto.go:63-74 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) REDACTED:982 — REDACTED:982-995 | REDACTED:998-1009 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/store/memory/telegram_login.go:194 — internal/store/memory/telegram_login.go:194-205 | internal/store/memory/telegram_login.go:263-277 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/adminapi/botverification.go:440 — internal/adminapi/botverification.go:440-451 | internal/adminapi/verification.go:267-278 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/store/memory/moderation.go:173 — internal/store/memory/moderation.go:173-186 | internal/store/memory/moderation.go:677-688 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/app/botverification/service.go:1441 — internal/app/botverification/service.go:1441-1452 | internal/app/verification/service.go:1287-1298 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/app/channels/service.go:1500 — internal/app/channels/service.go:1500-1516 | internal/app/channels/service.go:1543-1554 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) REDACTED:2190 — REDACTED:2190-2201 | cmd/telesrv-admin/star_gift_catalog.go:132-144 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/app/channels/service.go:388 — internal/app/channels/service.go:388-399 | internal/app/channels/service.go:402-413 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) REDACTED:1159 — REDACTED:1159-1170 | REDACTED:1179-1190 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/app/bots/verifierbot.go:1554 — internal/app/bots/verifierbot.go:1554-1565 | internal/app/bots/verifybot.go:1359-1370 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/store/read_model_batch.go:91 — internal/store/read_model_batch.go:91-102 | internal/store/read_model_cache.go:74-85 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) cmd/telesrv-admin/botverification.go:223 — cmd/telesrv-admin/botverification.go:223-234 | cmd/telesrv-admin/verification.go:105-116 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/rpc/messages_polls.go:231 — internal/rpc/messages_polls.go:231-242 | internal/rpc/messages_polls.go:244-255 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/app/channels/service.go:444 — internal/app/channels/service.go:444-455 | internal/app/channels/service.go:538-549 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/app/messages/service.go:338 — internal/app/messages/service.go:338-349 | internal/app/messages/service.go:554-567 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/app/messages/service.go:571 — internal/app/messages/service.go:571-582 | internal/app/messages/service.go:585-596 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/app/channels/service.go:1626 — internal/app/channels/service.go:1626-1637 | internal/app/channels/service.go:1640-1651 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/links/links.go:144 — internal/links/links.go:144-155 | internal/links/links.go:159-170 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/admin/botverification.go:861 — internal/admin/botverification.go:861-872 | internal/admin/verification.go:389-400 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/app/bots/verifierbot.go:1511 — internal/app/bots/verifierbot.go:1511-1522 | internal/app/bots/verifybot.go:1301-1312 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) cmd/telesrv-admin/activity.go:134 — cmd/telesrv-admin/activity.go:134-145 | REDACTED:2742-2753 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/store/postgres/collectible_username.go:776 — internal/store/postgres/collectible_username.go:776-791 | internal/store/postgres/collectible_username.go:793-804 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/rpc/messages_games.go:33 — internal/rpc/messages_games.go:33-44 | internal/rpc/messages_games.go:66-80 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/loadharness/mutate.go:439 — internal/loadharness/mutate.go:439-450 | internal/loadharness/mutate.go:452-463 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 15 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×40
  • Duplicated block (5 lines × 2) REDACTED:2166 — REDACTED:2166-2170 | internal/adminapi/server.go:924-928 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:2166` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Check import visibility before settling on that home: `internal/adminapi/server.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
  • Duplicated block (5 lines × 2) internal/app/ai/service.go:460 — internal/app/ai/service.go:460-464 | internal/app/ai/service.go:524-529 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/ai/service.go:460` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) internal/app/auth/service.go:1326 — internal/app/auth/service.go:1326-1330 | internal/app/auth/service.go:1343-1347 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/auth/service.go:1326` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/app/auth/service.go:1331` calls `invalidateLoginCodeDetached` and `internal/app/auth/service.go:1348` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) internal/app/files/appearance_seed.go:186 — internal/app/files/appearance_seed.go:186-190 | internal/app/files/seed.go:437-441 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/files/appearance_seed.go:186` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) internal/mtprotoedge/encrypted.go:849 — internal/mtprotoedge/encrypted.go:849-854 | internal/mtprotoedge/layer_rpc_execution.go:304-308 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/mtprotoedge/encrypted.go:849` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) internal/rpc/bots_inline.go:773 — internal/rpc/bots_inline.go:773-777 | internal/rpc/send_media.go:770-774 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/bots_inline.go:773` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) internal/rpc/channels_members.go:921 — internal/rpc/channels_members.go:921-925 | internal/store/memory/groupcall.go:723-727 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) internal/rpc/messages_dialogs.go:743 — internal/rpc/messages_dialogs.go:743-747 | internal/rpc/messages_saved_dialogs.go:221-225 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_dialogs.go:743` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) internal/rpc/messages_getmessages_trace.go:159 — internal/rpc/messages_getmessages_trace.go:159-163 | internal/rpc/messages_getmessages_trace.go:194-198 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_getmessages_trace.go:159` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) internal/rpc/messages_send.go:316 — internal/rpc/messages_send.go:316-320 | internal/rpc/phone_conference.go:445-449 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_send.go:316` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) internal/rpc/messages_webview.go:424 — internal/rpc/messages_webview.go:424-428 | internal/rpc/messages_webview.go:522-526 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_webview.go:424` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) internal/rpc/messages_webview.go:431 — internal/rpc/messages_webview.go:431-435 | internal/rpc/messages_webview.go:529-533 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_webview.go:431` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) internal/rpc/presence_last_seen_batch.go:205 — internal/rpc/presence_last_seen_batch.go:205-209 | internal/store/postgres/message_delete.go:247-251 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) internal/store/memory/channel_topics.go:582 — internal/store/memory/channel_topics.go:582-586 | internal/store/postgres/channel_message_views.go:192-196 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_topics.go:582` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) internal/store/postgres/channel_suggested_post.go:151 — internal/store/postgres/channel_suggested_post.go:151-155 | internal/store/postgres/channel_suggested_post.go:174-178 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) internal/store/postgres/message_send.go:1055 — internal/store/postgres/message_send.go:1055-1059 | internal/store/postgres/saved_dialog.go:454-458 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/message_send.go:1055` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) internal/store/postgres/telegram_login.go:215 — internal/store/postgres/telegram_login.go:215-219 | internal/store/postgres/telegram_login.go:354-358 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/telegram_login.go:215` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) internal/app/botverification/service.go:1493 — internal/app/botverification/service.go:1493-1497 | internal/app/verification/service.go:1400-1404 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) internal/app/stargifts/service.go:1023 — internal/app/stargifts/service.go:1023-1027 | internal/store/postgres/star_gift.go:546-550 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) internal/store/postgres/telegram_login.go:881 — internal/store/postgres/telegram_login.go:881-885 | internal/store/postgres/telegram_login.go:951-955 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/telegram_login.go:881` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) internal/store/postgres/channel_invite_import.go:219 — internal/store/postgres/channel_invite_import.go:219-223 | internal/store/postgres/channel_member_join.go:121-125 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_invite_import.go:219` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) internal/telegramloginhttp/handler.go:528 — internal/telegramloginhttp/handler.go:528-532 | internal/telegramloginhttp/handler.go:537-541 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) internal/app/bots/stickersbot.go:409 — internal/app/bots/stickersbot.go:409-413 | internal/app/bots/stickersbot.go:443-447 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/bots/stickersbot.go:409` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) internal/store/postgres/read_model_listener.go:428 — internal/store/postgres/read_model_listener.go:428-432 | internal/store/postgres/read_model_listener.go:451-455 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/read_model_listener.go:428` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) internal/store/postgres/telegram_login.go:829 — internal/store/postgres/telegram_login.go:829-833 | internal/store/postgres/telegram_login.go:840-844 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/telegram_login.go:829` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 15 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×39
  • Hotspot: REDACTED REDACTED:600 — REDACTED changed 37 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 136 in main.run at line 600. 14 of those changes were fix/bug commits, and the other 23 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/config/config.go internal/config/config.go:958 — internal/config/config.go changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 109 in config.Load at line 958. 10 of those changes were fix/bug commits, and the other 14 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/config/config.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/rpc/messages_register.go internal/rpc/messages_register.go:15 — internal/rpc/messages_register.go changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 105 in Router.registerMessages at line 15. 4 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/rpc/messages_register.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/admin/service.go internal/admin/service.go:662 — internal/admin/service.go changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 32 in Service.Configure at line 662. 8 of those changes were fix/bug commits, and the other 10 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/admin/service.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/rpc/messages_send.go internal/rpc/messages_send.go:394 — internal/rpc/messages_send.go changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in Router.sendSingleSendMessage at line 394. 2 of those changes were fix/bug commits, and the other 4 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/rpc/messages_send.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/rpc/convert_messages.go internal/rpc/convert_messages.go:134 — internal/rpc/convert_messages.go changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 40 in rpc.tgMessageServiceAction at line 134. 4 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/rpc/convert_messages.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: REDACTED REDACTED:310 — REDACTED changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 39 in Router.buildUserFullProjection at line 310. 2 of those changes were fix/bug commits, and the other 4 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/mtprotoedge/server.go internal/mtprotoedge/server.go:383 — internal/mtprotoedge/server.go changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in Options.setDefaults at line 383. 2 of those changes were fix/bug commits, and the other 5 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/mtprotoedge/server.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/store/postgres/message_send.go internal/store/postgres/message_send.go:171 — internal/store/postgres/message_send.go changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 96 in MessageStore.sendPrivateTextOnce at line 171. 1 of those changes was a fix/bug commit, and the other 1 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/store/postgres/message_send.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/store/postgres/message_edit.go internal/store/postgres/message_edit.go:13 — internal/store/postgres/message_edit.go changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 74 in MessageStore.EditMessage at line 13. 1 of those changes was a fix/bug commit, and the other 1 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/store/postgres/message_edit.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: REDACTED REDACTED:344 — REDACTED changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 70 in StarGiftUpgradeStore.UpgradeStarGift at line 344. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/mtprotoedge/encrypted.go internal/mtprotoedge/encrypted.go:121 — internal/mtprotoedge/encrypted.go changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in Server.handleEncrypted at line 121. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/mtprotoedge/encrypted.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/rpc/convert_channels_core.go internal/rpc/convert_channels_core.go:545 — internal/rpc/convert_channels_core.go changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in rpc.tgChannelFull at line 545. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/rpc/convert_channels_core.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/store/postgres/star_gift_lifecycle.go internal/store/postgres/star_gift_lifecycle.go:524 — internal/store/postgres/star_gift_lifecycle.go changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 64 in StarGiftLifecycleStore.PurchaseResaleStarGift at line 524. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/store/postgres/star_gift_lifecycle.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/rpc/bots_inline.go internal/rpc/bots_inline.go:46 — internal/rpc/bots_inline.go changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in Router.onMessagesGetInlineBotResults at line 46. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/rpc/bots_inline.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/rpc/messages_history.go internal/rpc/messages_history.go:834 — internal/rpc/messages_history.go changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in Router.messageFilterFromSearchRequest at line 834. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/rpc/messages_history.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/app/files/seed.go internal/app/files/seed.go:406 — internal/app/files/seed.go changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in Service.importDocument at line 406. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/app/files/seed.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/store/postgres/login_code_delivery.go internal/store/postgres/login_code_delivery.go:43 — internal/store/postgres/login_code_delivery.go changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in MessageStore.DeliverLoginCodeMessage at line 43. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/store/postgres/login_code_delivery.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/app/files/retention.go internal/app/files/retention.go:192 — internal/app/files/retention.go changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in Service.DeleteBlobBytesForMediaOlderThan at line 192. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/app/files/retention.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/rpc/layer_dispatch.go internal/rpc/layer_dispatch.go:254 — internal/rpc/layer_dispatch.go changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in Router.DispatchAdmitted at line 254. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/rpc/layer_dispatch.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/store/postgres/channel_member_admin.go internal/store/postgres/channel_member_admin.go:10 — internal/store/postgres/channel_member_admin.go changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 39 in ChannelStore.EditChannelAdmin at line 10. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/store/postgres/channel_member_admin.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/store/postgres/channel_invite_members.go internal/store/postgres/channel_invite_members.go:10 — internal/store/postgres/channel_invite_members.go changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in ChannelStore.InviteToChannel at line 10. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/store/postgres/channel_invite_members.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/store/postgres/channel_helpers.go internal/store/postgres/channel_helpers.go:808 — internal/store/postgres/channel_helpers.go changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in ChannelStore.resolveChannelReply at line 808. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/store/postgres/channel_helpers.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: internal/rpc/channels_core.go internal/rpc/channels_core.go:143 — internal/rpc/channels_core.go changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in Router.onChannelsGetFullChannel at line 143. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/rpc/channels_core.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: REDACTED REDACTED:45 — REDACTED changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in StarGiftStore.PublishCollectibleRevision at line 45. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • + 14 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×38
  • Duplicated block (13 lines × 2) cmd/telesrv-admin/publicbranding.go:52 — cmd/telesrv-admin/publicbranding.go:52-64 | cmd/telesrv-admin/serversettings.go:95-107 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/telesrv-admin/publicbranding.go:52` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) internal/app/ai/service.go:471 — internal/app/ai/service.go:471-483 | internal/app/ai/service.go:536-548 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/ai/service.go:471` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) internal/app/userprojection/contact_cache.go:409 — internal/app/userprojection/contact_cache.go:409-421 | internal/app/userprojection/contact_cache_sparse.go:69-81 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/userprojection/contact_cache.go:409` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) internal/app/userprojection/projection.go:179 — internal/app/userprojection/projection.go:179-191 | internal/app/userprojection/projection_sparse.go:104-116 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/userprojection/projection.go:179` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (13 lines × 2) internal/domain/star_gift.go:1456 — internal/domain/star_gift.go:1456-1468 | internal/domain/stars.go:269-281 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (13 lines × 2) REDACTED:1266 — REDACTED:1266-1278 | REDACTED:329-341 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1266` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) internal/mtprotoedge/rpc_rewrap.go:171 — internal/mtprotoedge/rpc_rewrap.go:171-183 | internal/mtprotoedge/rpc_rewrap.go:202-214 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/mtprotoedge/rpc_rewrap.go:171` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) internal/rpc/account_themes.go:133 — internal/rpc/account_themes.go:133-145 | internal/rpc/account_themes.go:169-181 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) internal/rpc/encrypted_files.go:68 — internal/rpc/encrypted_files.go:68-80 | internal/rpc/encrypted_messages.go:49-61 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/encrypted_files.go:68` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) internal/rpc/messages_reactions_lists.go:275 — internal/rpc/messages_reactions_lists.go:275-287 | internal/rpc/messages_read.go:115-127 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_reactions_lists.go:275` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: `internal/rpc/messages_reactions_lists.go:275` is reached only past a guard at line 263 that tests `req.AddOffset` and leaves the function early, and `internal/rpc/messages_read.go:115` reads `req.AddOffset` with no such check. What separates these copies is not which lines they run but which PRECONDITION they enforce, so one of them is operating on state the other one refuses. Decide which is intended BEFORE unifying them — extract the shared part and whichever copy is missing the check keeps running unchecked, and if the guard is the correct behaviour then that hole is already live.
  • Duplicated block (13 lines × 2) internal/rpc/messages_send.go:1139 — internal/rpc/messages_send.go:1139-1151 | internal/rpc/messages_send.go:1175-1187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_send.go:1139` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) internal/rpc/payments_star_gift_collections.go:45 — internal/rpc/payments_star_gift_collections.go:45-57 | internal/rpc/payments_star_gift_collections.go:73-85 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/payments_star_gift_collections.go:45` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) internal/rpc/phone_group_call.go:465 — internal/rpc/phone_group_call.go:465-477 | internal/rpc/phone_group_call_scheduled.go:73-85 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/phone_group_call.go:465` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/rpc/phone_group_call.go:464` calls `pushChannelStateToMembers` and `internal/rpc/phone_group_call_scheduled.go:69` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) internal/rpc/upload.go:38 — internal/rpc/upload.go:38-50 | internal/rpc/upload.go:59-71 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) internal/store/memory/channel_reactions.go:580 — internal/store/memory/channel_reactions.go:580-592 | internal/store/memory/channel_read.go:184-196 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_reactions.go:580` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (13 lines × 2) internal/store/memory/code_cas.go:33 — internal/store/memory/code_cas.go:33-45 | internal/store/memory/code_cas.go:55-67 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (13 lines × 2) internal/store/memory/message_delete.go:78 — internal/store/memory/message_delete.go:78-90 | internal/store/postgres/message_delete.go:238-250 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (13 lines × 2) internal/store/memory/message_send.go:377 — internal/store/memory/message_send.go:377-389 | internal/store/postgres/message_send.go:890-902 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/message_send.go:377` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) internal/store/memory/story.go:1291 — internal/store/memory/story.go:1291-1303 | internal/store/postgres/story.go:2213-2225 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/story.go:1291` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) internal/store/postgres/channel_member_list.go:327 — internal/store/postgres/channel_member_list.go:327-339 | internal/store/postgres/channel_member_list.go:433-445 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_member_list.go:327` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) internal/store/postgres/channel_message_edit.go:432 — internal/store/postgres/channel_message_edit.go:432-444 | internal/store/postgres/channel_message_edit.go:528-540 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (13 lines × 2) internal/store/postgres/collectible_username.go:309 — internal/store/postgres/collectible_username.go:309-321 | internal/store/postgres/collectible_username.go:400-412 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) internal/store/postgres/dispatch_outbox.go:247 — internal/store/postgres/dispatch_outbox.go:247-259 | internal/store/postgres/message_send.go:961-973 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/store/postgres/dispatch_outbox.go:260` calls `Slice` and `internal/store/postgres/message_send.go:974` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) internal/store/postgres/message_pin.go:141 — internal/store/postgres/message_pin.go:141-153 | internal/store/postgres/message_pin.go:289-301 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/message_pin.go:141` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) internal/store/postgres/moderation_cases.go:373 — internal/store/postgres/moderation_cases.go:373-385 | internal/store/postgres/moderation_cases.go:572-584 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/moderation_cases.go:373` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 13 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (17 corresponding lines) · ×36
  • Edited copy of a member (17 corresponding lines) internal/app/bots/stickersbot.go:283 — internal/app/bots/stickersbot.go:283-302 | internal/app/bots/stickersbot.go:304-320 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) internal/rpc/messages_webview.go:423 — internal/rpc/messages_webview.go:423-439 | internal/rpc/messages_webview.go:521-537 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) internal/app/stories/service.go:256 — internal/app/stories/service.go:256-273 | internal/app/stories/service.go:297-313 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) internal/adminapi/botverification.go:34 — internal/adminapi/botverification.go:34-50 | internal/adminapi/botverification.go:53-69 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) cmd/telesrv-admin/report_evidence.go:41 — cmd/telesrv-admin/report_evidence.go:41-58 | REDACTED:2835-2851 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) internal/store/postgres/channel_boosts.go:213 — internal/store/postgres/channel_boosts.go:213-229 | internal/store/postgres/channel_history_ttl.go:10-31 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) internal/rpc/dialogs_pinned.go:11 — internal/rpc/dialogs_pinned.go:11-27 | internal/rpc/dialogs_pinned.go:29-52 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) internal/rpc/communities.go:45 — internal/rpc/communities.go:45-61 | internal/rpc/communities.go:65-84 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) cmd/telesrv-admin/donations.go:49 — cmd/telesrv-admin/donations.go:49-65 | REDACTED:827-852 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) internal/app/donations/wallet.go:74 — internal/app/donations/wallet.go:74-90 | internal/app/donations/wallet.go:99-119 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) internal/store/postgres/channel_read.go:712 — internal/store/postgres/channel_read.go:712-728 | internal/store/postgres/channel_topics.go:976-992 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) internal/rpc/aicompose.go:42 — internal/rpc/aicompose.go:42-58 | internal/rpc/aicompose.go:160-177 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) internal/store/postgres/message_send.go:983 — internal/store/postgres/message_send.go:983-999 | internal/store/postgres/message_send.go:1001-1022 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) internal/adminapi/server.go:1098 — internal/adminapi/server.go:1098-1116 | internal/adminapi/server.go:1374-1390 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) cmd/telesrv-admin/publicbranding.go:44 — cmd/telesrv-admin/publicbranding.go:44-64 | cmd/telesrv-admin/serversettings.go:91-107 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) internal/rpc/bot_verification_projection.go:183 — internal/rpc/bot_verification_projection.go:183-202 | internal/rpc/fragment.go:391-407 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) internal/rpc/stats.go:50 — internal/rpc/stats.go:50-66 | internal/rpc/stats.go:68-84 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) internal/loadharness/dataset.go:430 — internal/loadharness/dataset.go:430-446 | internal/store/postgres/dialog.go:1287-1304 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) REDACTED:45 — REDACTED:45-61 | REDACTED:679-701 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) internal/app/bots/stickersbot.go:187 — internal/app/bots/stickersbot.go:187-203 | internal/app/bots/stickersbot.go:205-223 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) REDACTED:16 — REDACTED:16-37 | REDACTED:39-55 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) internal/rpc/messages_no_forwards.go:117 — internal/rpc/messages_no_forwards.go:117-133 | internal/rpc/messages_send.go:598-619 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) internal/domain/verification.go:348 — internal/domain/verification.go:348-364 | internal/rpc/messages_bot_no_state.go:52-70 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) internal/rpc/updates_delivery.go:163 — internal/rpc/updates_delivery.go:163-180 | internal/rpc/updates_delivery.go:237-253 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) internal/store/memory/bot_verification.go:465 — internal/store/memory/bot_verification.go:465-481 | internal/store/memory/collectible_username.go:141-162 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 11 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (15 corresponding lines) · ×35
  • Edited copy of a member (15 corresponding lines) internal/rpc/update_peer_refs.go:268 — internal/rpc/update_peer_refs.go:268-284 | internal/rpc/update_peer_refs.go:286-300 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/store/memory/message_helpers.go:264 — internal/store/memory/message_helpers.go:264-278 | internal/store/postgres/message_helpers.go:359-374 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/store/memory/channel_invites.go:401 — internal/store/memory/channel_invites.go:401-415 | internal/store/memory/channel_invites.go:473-493 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) REDACTED:1718 — REDACTED:1718-1732 | REDACTED:1824-1838 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) REDACTED:1921 — REDACTED:1921-1935 | REDACTED:1951-1969 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/store/postgres/business.go:380 — internal/store/postgres/business.go:380-402 | internal/store/postgres/business.go:442-456 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/rpc/messages_sticker_sets.go:233 — internal/rpc/messages_sticker_sets.go:233-247 | internal/rpc/messages_sticker_sets.go:249-263 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/adminapi/account_rating.go:121 — internal/adminapi/account_rating.go:121-135 | internal/adminapi/verification.go:234-250 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/app/telegramlogin/service.go:1027 — internal/app/telegramlogin/service.go:1027-1041 | internal/app/telegramlogin/service.go:1048-1066 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/store/memory/message_edit.go:114 — internal/store/memory/message_edit.go:114-128 | internal/store/postgres/message_edit.go:290-305 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/app/channels/service.go:1370 — internal/app/channels/service.go:1370-1386 | internal/app/channels/service.go:1557-1571 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/rpc/channels_settings.go:180 — internal/rpc/channels_settings.go:180-194 | internal/rpc/channels_settings.go:324-344 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/rpc/bots.go:256 — internal/rpc/bots.go:256-270 | internal/rpc/bots_longtail.go:21-35 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/rpc/convert_polls.go:322 — internal/rpc/convert_polls.go:322-336 | internal/store/memory/groupcall.go:609-623 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/store/memory/bot_verification.go:169 — internal/store/memory/bot_verification.go:169-183 | internal/store/memory/bot_verification.go:286-304 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/rpc/messages_dialogs.go:1159 — internal/rpc/messages_dialogs.go:1159-1173 | internal/rpc/premium.go:325-339 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/rpc/account.go:2050 — internal/rpc/account.go:2050-2064 | internal/rpc/account.go:2066-2082 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/app/auth/service.go:1931 — internal/app/auth/service.go:1931-1945 | internal/domain/emailphone.go:160-175 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/store/memory/media_search.go:49 — internal/store/memory/media_search.go:49-63 | internal/store/memory/message_history.go:371-385 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/store/postgres/channel_boosts.go:285 — internal/store/postgres/channel_boosts.go:285-299 | internal/store/postgres/channel_boosts.go:310-325 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/store/postgres/dialog.go:639 — internal/store/postgres/dialog.go:639-655 | internal/store/postgres/dialog.go:1022-1036 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/branding/branding.go:186 — internal/branding/branding.go:186-200 | internal/links/links.go:186-200 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/domain/privacy_evaluate.go:75 — internal/domain/privacy_evaluate.go:75-89 | REDACTED:990-1005 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/rpc/account_business.go:190 — internal/rpc/account_business.go:190-210 | internal/rpc/messages_quick_replies.go:38-52 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) internal/store/memory/channel_topics.go:659 — internal/store/memory/channel_topics.go:659-673 | internal/store/read_model_cache.go:335-349 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 10 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (11 corresponding lines) · ×35
  • Edited copy of a member (11 corresponding lines) internal/rpc/stories.go:3273 — internal/rpc/stories.go:3273-3284 | internal/rpc/stories.go:3286-3296 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/rpc/story_peer_projection.go:35 — internal/rpc/story_peer_projection.go:35-45 | internal/rpc/story_peer_projection.go:47-57 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/store/memory/story.go:1339 — internal/store/memory/story.go:1339-1349 | internal/store/memory/story.go:1383-1396 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/rpc/channel_fanout_dispatcher.go:1027 — internal/rpc/channel_fanout_dispatcher.go:1027-1037 | internal/rpc/channel_fanout_dispatcher.go:1131-1141 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/app/moderation/evidence.go:580 — internal/app/moderation/evidence.go:580-590 | internal/app/moderation/evidence.go:592-603 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/rpc/messages_read.go:165 — internal/rpc/messages_read.go:165-175 | internal/rpc/messages_read.go:177-187 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/sfu/cert.go:28 — internal/sfu/cert.go:28-38 | internal/sfu/sfu.go:130-140 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/store/postgres/update_event.go:138 — internal/store/postgres/update_event.go:138-150 | internal/store/postgres/update_event.go:152-162 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/store/postgres/ai.go:83 — internal/store/postgres/ai.go:83-93 | internal/store/postgres/ai.go:95-105 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/store/postgres/themes.go:78 — internal/store/postgres/themes.go:78-88 | internal/store/postgres/themes.go:90-103 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/app/donations/wallet.go:198 — internal/app/donations/wallet.go:198-208 | internal/app/telegramlogin/crypto.go:106-116 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/rpc/translation_projection.go:11 — internal/rpc/translation_projection.go:11-21 | internal/rpc/translation_projection.go:23-33 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/store/postgres/channel_read.go:730 — internal/store/postgres/channel_read.go:730-740 | internal/store/postgres/channel_topics.go:994-1004 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) REDACTED:169 — REDACTED:169-179 | REDACTED:181-191 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/mtprotoedge/rpc_execution_budget.go:57 — internal/mtprotoedge/rpc_execution_budget.go:57-67 | internal/mtprotoedge/rpc_result_subscriber_budget.go:37-49 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/rpc/bots_inline_message_id.go:42 — internal/rpc/bots_inline_message_id.go:42-52 | internal/rpc/bots_inline_message_id.go:54-64 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) cmd/telesrv/log_encoder.go:155 — cmd/telesrv/log_encoder.go:155-165 | cmd/telesrv/log_encoder.go:167-177 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/app/botverification/service.go:740 — internal/app/botverification/service.go:740-750 | internal/app/botverification/service.go:873-888 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/store/memory/channel_updates.go:165 — internal/store/memory/channel_updates.go:165-175 | internal/store/memory/password.go:163-173 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/store/postgres/channel_helpers.go:912 — internal/store/postgres/channel_helpers.go:912-927 | internal/store/postgres/donations.go:26-36 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/app/userprojection/contact_cache.go:253 — internal/app/userprojection/contact_cache.go:253-263 | internal/app/userprojection/durable_user_facts.go:85-95 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/store/postgres/channel_read.go:349 — internal/store/postgres/channel_read.go:349-359 | internal/store/postgres/message_history.go:290-300 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/mtprotoedge/rpc_rewrap.go:119 — internal/mtprotoedge/rpc_rewrap.go:119-129 | internal/mtprotoedge/rpc_rewrap.go:189-199 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/store/postgres/bot_miniapp.go:502 — internal/store/postgres/bot_miniapp.go:502-512 | internal/store/postgres/user.go:487-501 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) internal/rpc/account.go:691 — internal/rpc/account.go:691-701 | REDACTED:794-804 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 10 more in this group — see findings.md.
X3 · Exception handling · Discarded error (assigned to `_`, then its result used) · ×35
  • Discarded error (assigned to `_`, then its result used) REDACTED:229 — `zw, _ := gzip.NewWriterLevel(&buf, gzip.DefaultCompression)` writes the call's error to `_` and then uses `zw` as if the call succeeded. When `gzip.NewWriterLevel` fails, `zw` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `zw` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/webauthn/webauthntest/authenticator.go:66 — `out, _ := json.Marshal(clientData{Type: typ, Challenge: b64.EncodeToString(challenge), Origin: origin})` writes the call's error to `_` and then uses `out` as if the call succeeded. When `json.Marshal` fails, `out` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `out` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/webauthn/webauthntest/authenticator.go:82 — `out, _ := cbor.Marshal(key)` writes the call's error to `_` and then uses `out` as if the call succeeded. When `cbor.Marshal` fails, `out` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `out` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/storetest/groupcall.go:579 — `_, found, _ := st.GetParticipantOverride(ctx, call.ID, 101, 102)` writes the call's error to `_` and then uses `found` as if the call succeeded. When `st.GetParticipantOverride` fails, `found` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `found` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_groupcall.go:69 — `recipients, _ := s.ListActiveChannelMemberIDs(ctx, 0, channelID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_helpers.go:97 — `recipients, _ := s.ListActiveChannelMemberIDs(ctx, req.UserID, req.ChannelID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_history_ttl.go:29 — `recipients, _ := s.ListActiveChannelMemberIDs(ctx, userID, channelID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_invite_import.go:106 — `recipients, _ := s.ListActiveChannelMemberIDs(ctx, req.UserID, result.Channel.ID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_invite_requests.go:171 — `recipients, _ := s.ListActiveChannelMemberIDs(ctx, req.UserID, req.ChannelID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_member_admin.go:147 — `msg, _ := s.getChannelMessage(ctx, tx, req.ChannelID, channel.TopMessageID)` writes the call's error to `_` and then uses `msg` as if the call succeeded. When `s.getChannelMessage` fails, `msg` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `msg` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_member_admin.go:262 — `msg, _ := s.getChannelMessage(ctx, tx, req.ChannelID, channel.TopMessageID)` writes the call's error to `_` and then uses `msg` as if the call succeeded. When `s.getChannelMessage` fails, `msg` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `msg` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_member_admin.go:458 — `msg, _ := s.getChannelMessage(ctx, tx, req.ChannelID, channel.TopMessageID)` writes the call's error to `_` and then uses `msg` as if the call succeeded. When `s.getChannelMessage` fails, `msg` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `msg` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_member_join.go:141 — `recipients, _ := s.ListActiveChannelMemberIDs(ctx, userID, channelID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_member_join_requests.go:177 — `recipients, _ := s.ListActiveChannelMemberIDs(ctx, req.UserID, req.ChannelID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_message_delete.go:57 — `recipients, _ := s.ListActiveChannelMemberIDs(ctx, req.UserID, req.ChannelID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_message_delete.go:116 — `recipients, _ := s.ListActiveChannelMemberIDs(ctx, 0, channel.ID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_message_delete.go:361 — `recipients, _ := s.ListActiveChannelMemberIDs(ctx, req.UserID, req.ChannelID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_message_delete.go:430 — `recipients, _ := s.ListActiveChannelMemberIDs(ctx, req.UserID, req.ChannelID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_message_edit.go:137 — `recipients, _ := s.ListActiveChannelMemberIDs(ctx, req.UserID, req.ChannelID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_message_edit.go:308 — `recipients, _ := s.ListActiveChannelMemberIDs(ctx, req.UserID, req.ChannelID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_message_edit.go:376 — `recipients, _ := s.ListActiveChannelMemberIDs(ctx, req.UserID, req.ChannelID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_message_edit.go:507 — `recipients, _ := s.ListActiveChannelMemberIDs(ctx, req.UserID, req.ChannelID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_message_edit.go:593 — `recipients, _ := s.ListActiveChannelMemberIDs(ctx, req.UserID, req.ChannelID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_message_history.go:1004 — `msg, _ := s.getChannelMessage(ctx, tx, req.ChannelID, channel.TopMessageID)` writes the call's error to `_` and then uses `msg` as if the call succeeded. When `s.getChannelMessage` fails, `msg` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `msg` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • Discarded error (assigned to `_`, then its result used) internal/store/postgres/channel_settings.go:80 — `recipients, _ := s.ListActiveChannelMemberIDs(ctx, req.UserID, req.ChannelID, 0)` writes the call's error to `_` and then uses `recipients` as if the call succeeded. When `s.ListActiveChannelMemberIDs` fails, `recipients` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `recipients` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
  • + 10 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (9 corresponding lines) · ×32
  • Edited copy of a member (9 corresponding lines) internal/store/memory/langpack.go:210 — internal/store/memory/langpack.go:210-218 | internal/store/postgres/langpack.go:385-393 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) cmd/walletminiapp/main.go:364 — cmd/walletminiapp/main.go:364-372 | internal/rpc/messages_webview.go:727-735 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/rpc/payments_star_gift_lifecycle.go:287 — internal/rpc/payments_star_gift_lifecycle.go:287-295 | internal/rpc/payments_star_gift_lifecycle.go:347-355 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/store/postgres/telegram_login.go:32 — internal/store/postgres/telegram_login.go:32-40 | internal/store/postgres/telegram_login.go:258-266 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/domain/botapi_update.go:64 — internal/domain/botapi_update.go:64-72 | internal/domain/botapi_update.go:74-82 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/rpc/photos.go:648 — internal/rpc/photos.go:648-656 | internal/rpc/photos.go:658-671 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/rpc/botapi_gateway.go:782 — internal/rpc/botapi_gateway.go:782-793 | internal/rpc/botapi_gateway.go:795-803 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/admin/service.go:787 — internal/admin/service.go:787-795 | internal/admin/service.go:804-812 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/app/stories/service.go:168 — internal/app/stories/service.go:168-176 | internal/app/stories/service.go:196-204 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/botapi/server.go:277 — internal/botapi/server.go:277-288 | internal/botapi/server.go:290-298 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/app/auth/service.go:1605 — internal/app/auth/service.go:1605-1613 | internal/app/auth/service.go:1615-1623 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/adminapi/botverification.go:230 — internal/adminapi/botverification.go:230-238 | internal/adminapi/verification.go:165-173 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/store/memory/chatlists.go:81 — internal/store/memory/chatlists.go:81-89 | internal/store/memory/chatlists.go:119-129 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/adminapi/server.go:664 — internal/adminapi/server.go:664-672 | internal/adminapi/server.go:1944-1953 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/app/files/blobcache.go:119 — internal/app/files/blobcache.go:119-127 | internal/app/files/blobcache.go:186-197 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/store/memory/bot_callback.go:125 — internal/store/memory/bot_callback.go:125-135 | internal/store/memory/ephemeral_push.go:17-25 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/store/memory/ai.go:84 — internal/store/memory/ai.go:84-92 | internal/store/memory/themes.go:55-63 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/rpc/convert_business.go:435 — internal/rpc/convert_business.go:435-443 | internal/rpc/convert_messages.go:356-364 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/store/memory/password.go:538 — internal/store/memory/password.go:538-549 | internal/app/files/sticker_management.go:423-431 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/store/postgres/media.go:197 — internal/store/postgres/media.go:197-205 | internal/store/postgres/media_refs.go:186-194 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/app/moderation/evidence.go:613 — internal/app/moderation/evidence.go:613-624 | internal/rpc/messages_reactions_send.go:452-460 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/store/postgres/channel_membership_batch.go:266 — internal/store/postgres/channel_membership_batch.go:266-274 | internal/store/postgres/message_send_batch_actor.go:389-401 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/app/chatlists/service.go:790 — internal/app/chatlists/service.go:790-799 | internal/app/dialogs/service.go:1476-1484 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/app/botverification/service.go:407 — internal/app/botverification/service.go:407-415 | internal/app/verification/service.go:405-413 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/domain/login_code_delivery.go:77 — internal/domain/login_code_delivery.go:77-85 | internal/domain/login_welcome_template.go:51-62 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 7 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×31
  • Duplicated block (14 lines × 2) cmd/telesrv-admin/readstore.go:1222 — cmd/telesrv-admin/readstore.go:1222-1235 | internal/store/postgres/broadcast.go:368-381 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/telesrv-admin/readstore.go:1222` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Check import visibility before settling on that home: `internal/store/postgres/broadcast.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
  • Duplicated block (14 lines × 2) internal/adminapi/server.go:346 — internal/adminapi/server.go:346-359 | internal/adminapi/server.go:606-619 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/adminapi/server.go:346` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) internal/botapi/ephemeral.go:93 — internal/botapi/ephemeral.go:93-106 | internal/botapi/ephemeral.go:136-149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) internal/mtprotoedge/inbound_layer_rpc.go:548 — internal/mtprotoedge/inbound_layer_rpc.go:548-561 | internal/mtprotoedge/inbound_preflight.go:814-827 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/mtprotoedge/inbound_layer_rpc.go:548` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) internal/rpc/botapi_gateway.go:525 — internal/rpc/botapi_gateway.go:525-538 | internal/rpc/botapi_gateway.go:762-775 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/botapi_gateway.go:525` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) internal/rpc/bots_inline.go:442 — internal/rpc/bots_inline.go:442-455 | internal/rpc/bots_inline.go:473-486 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/bots_inline.go:442` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) internal/rpc/channels_settings.go:477 — internal/rpc/channels_settings.go:477-490 | internal/rpc/channels_settings.go:493-506 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (14 lines × 2) internal/rpc/channels_updates.go:407 — internal/rpc/channels_updates.go:407-420 | internal/rpc/messages_forum_read.go:80-93 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/channels_updates.go:407` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) internal/rpc/messages_dialogs.go:335 — internal/rpc/messages_dialogs.go:335-348 | internal/rpc/messages_send.go:1205-1218 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_dialogs.go:335` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (14 lines × 2) internal/rpc/messages_forward.go:761 — internal/rpc/messages_forward.go:761-774 | internal/rpc/stories.go:1351-1364 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (14 lines × 2) internal/rpc/messages_history.go:14 — internal/rpc/messages_history.go:14-27 | internal/rpc/messages_history.go:33-46 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (14 lines × 2) REDACTED:218 — REDACTED:218-231 | REDACTED:232-245 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) internal/rpc/messages_read.go:196 — internal/rpc/messages_read.go:196-209 | internal/rpc/messages_read.go:219-232 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) internal/rpc/payments_star_gift_lifecycle.go:566 — internal/rpc/payments_star_gift_lifecycle.go:566-579 | internal/rpc/payments_star_gift_lifecycle.go:608-621 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) internal/rpc/phone_group_call.go:200 — internal/rpc/phone_group_call.go:200-213 | internal/rpc/phone_group_call_rtmp.go:122-135 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) internal/rpc/router.go:1365 — internal/rpc/router.go:1365-1378 | internal/rpc/router.go:1396-1409 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (14 lines × 2) internal/store/memory/bot_verification.go:965 — internal/store/memory/bot_verification.go:965-978 | internal/store/postgres/bot_verification.go:1295-1308 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (14 lines × 2) internal/store/memory/channel_settings.go:794 — internal/store/memory/channel_settings.go:794-807 | internal/store/postgres/channel_settings.go:1243-1256 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_settings.go:794` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) internal/store/memory/collectible_username.go:372 — internal/store/memory/collectible_username.go:372-385 | internal/store/memory/collectible_username.go:437-450 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/collectible_username.go:372` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (14 lines × 2) internal/store/memory/moderation.go:199 — internal/store/memory/moderation.go:199-212 | internal/store/memory/moderation.go:259-272 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/moderation.go:199` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) internal/store/memory/verification.go:875 — internal/store/memory/verification.go:875-888 | internal/store/postgres/verification.go:1248-1261 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (14 lines × 2) internal/store/postgres/channel_boosts.go:353 — internal/store/postgres/channel_boosts.go:353-366 | internal/store/postgres/channel_updates.go:501-514 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_boosts.go:353` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (14 lines × 2) internal/store/postgres/channel_member_list.go:350 — internal/store/postgres/channel_member_list.go:350-363 | internal/store/postgres/channel_member_list.go:464-477 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_member_list.go:350` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/store/postgres/channel_member_list.go:364` calls `Slice` and `internal/store/postgres/channel_member_list.go:478` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 2) REDACTED:300 — REDACTED:300-313 | REDACTED:396-409 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:300` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) REDACTED:1021 — REDACTED:1021-1034 | REDACTED:1054-1067 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1021` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • + 6 more in this group — see findings.md.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×30
  • Members sharing a duplicated core (4 members, 50+ identical tokens) REDACTED:854 — REDACTED:854-870 | REDACTED:1248-1264 | REDACTED:2348-2364 | REDACTED:2717-2740 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/admin/service.go:2578 — internal/admin/service.go:2578-2654 | internal/admin/service.go:2659-2716 | internal/admin/service.go:2721-2772 | internal/admin/service.go:2778-2822 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/adminapi/botverification.go:344 — internal/adminapi/botverification.go:344-363 | internal/adminapi/botverification.go:365-380 | internal/adminapi/botverification.go:382-399 | internal/adminapi/botverification.go:401-435 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/app/channels/service.go:2524 — internal/app/channels/service.go:2524-2546 | internal/app/users/service.go:977-999 | internal/config/config.go:1952-1974 | internal/domain/collectible_username.go:299-321 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/app/dialogs/shared_list_snapshot.go:150 — internal/app/dialogs/shared_list_snapshot.go:150-179 | internal/rpc/story_projection_cache.go:204-232 | internal/store/memory/community.go:590-652 | internal/store/memory/story.go:577-596 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/app/stories/service.go:487 — internal/app/stories/service.go:487-498 | internal/rpc/stories.go:3129-3143 | internal/store/memory/story.go:1094-1105 | internal/store/postgres/story.go:2303-2314 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/botapi/ephemeral.go:92 — internal/botapi/ephemeral.go:92-133 | internal/botapi/ephemeral.go:135-194 | internal/botapi/server.go:517-583 | internal/botapi/server.go:650-738 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/botapi/server.go:517 — internal/botapi/server.go:517-583 | internal/botapi/server.go:585-648 | internal/botapi/server.go:650-738 | internal/botapi/server.go:740-835 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/domain/message_entity_autodetect.go:71 — internal/domain/message_entity_autodetect.go:71-95 | internal/domain/message_entity_autodetect.go:97-130 | internal/domain/message_entity_autodetect.go:132-165 | internal/domain/message_entity_autodetect.go:167-194 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/rpc/bot_verification_projection.go:109 — internal/rpc/bot_verification_projection.go:109-143 | internal/rpc/fragment.go:309-331 | internal/rpc/messages_monoforum.go:201-220 | internal/rpc/story_peer_projection.go:585-638 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/rpc/botapi_gateway.go:178 — internal/rpc/botapi_gateway.go:178-230 | internal/rpc/botapi_gateway.go:236-290 | internal/rpc/botapi_gateway.go:294-348 | internal/rpc/botapi_gateway.go:875-935 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/rpc/bots_callback.go:30 — internal/rpc/bots_callback.go:30-135 | internal/rpc/messages_edit.go:11-184 | internal/rpc/messages_edit_geolive.go:16-118 | internal/rpc/messages_history.go:545-587 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/rpc/channels_invites.go:374 — internal/rpc/channels_invites.go:374-391 | internal/rpc/contacts.go:179-202 | internal/store/memory/channel_core.go:281-295 | internal/store/postgres/channel_core.go:628-642 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/rpc/channels_legacy_chat.go:284 — internal/rpc/channels_legacy_chat.go:284-322 | internal/rpc/messages_suggested_post.go:30-69 | internal/rpc/phone_group_call.go:183-262 | internal/rpc/phone_group_call_rtmp.go:111-146 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/rpc/chatlists.go:54 — internal/rpc/chatlists.go:54-80 | internal/rpc/chatlists.go:205-225 | internal/rpc/chatlists.go:247-267 | internal/rpc/chatlists.go:298-318 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/rpc/communities.go:235 — internal/rpc/communities.go:235-278 | internal/rpc/communities.go:349-377 | internal/rpc/communities.go:379-411 | internal/rpc/communities.go:413-457 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/rpc/convert_channels_core.go:11 — internal/rpc/convert_channels_core.go:11-39 | internal/rpc/convert_channels_core.go:393-407 | internal/rpc/convert_dialogs.go:351-385 | internal/rpc/premium_sweeper.go:204-243 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/rpc/messages_dialogs.go:728 — internal/rpc/messages_dialogs.go:728-765 | internal/rpc/messages_dialogs.go:843-900 | internal/rpc/messages_dialogs.go:934-977 | internal/rpc/messages_saved_dialogs.go:151-198 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/rpc/messages_forward.go:13 — internal/rpc/messages_forward.go:13-347 | internal/rpc/messages_quick_replies.go:156-229 | internal/store/memory/message_forward.go:9-98 | internal/store/postgres/message_forward.go:19-117 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/rpc/payments_star_gift_collections.go:13 — internal/rpc/payments_star_gift_collections.go:13-41 | internal/rpc/payments_star_gift_collections.go:43-69 | internal/rpc/payments_star_gift_collections.go:71-116 | internal/rpc/payments_star_gifts.go:1091-1149 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/store/memory/bot_verification.go:1077 — internal/store/memory/bot_verification.go:1077-1088 | internal/store/memory/verification.go:984-995 | internal/store/postgres/bot_verification.go:1405-1416 | internal/store/postgres/verification.go:1318-1329 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/store/memory/channel_boosts.go:232 — internal/store/memory/channel_boosts.go:232-242 | internal/store/memory/channel_reactions.go:334-389 | internal/store/memory/channel_reactions.go:769-839 | internal/store/postgres/message_reactions.go:351-425 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/store/memory/channel_members.go:648 — internal/store/memory/channel_members.go:648-671 | internal/store/memory/channel_members.go:673-696 | internal/store/memory/channel_members.go:698-724 | internal/store/memory/channel_members.go:726-752 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/store/postgres/account.go:349 — internal/store/postgres/account.go:349-373 | internal/store/postgres/account.go:422-474 | internal/store/postgres/account.go:476-518 | internal/store/postgres/account.go:520-570 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/store/postgres/community.go:1084 — internal/store/postgres/community.go:1084-1104 | internal/store/postgres/community.go:1106-1126 | internal/store/postgres/community.go:1177-1198 | internal/store/postgres/community.go:1200-1226 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • + 5 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (14 corresponding lines) · ×29
  • Edited copy of a member (14 corresponding lines) internal/store/postgres/groupcall.go:35 — internal/store/postgres/groupcall.go:35-48 | internal/store/postgres/groupcall.go:69-85 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/admin/star_gift_catalog.go:253 — internal/admin/star_gift_catalog.go:253-266 | internal/admin/star_gift_catalog.go:268-281 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/store/memory/channel_helpers.go:774 — internal/store/memory/channel_helpers.go:774-787 | internal/store/postgres/channel_helpers.go:929-942 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/app/auth/service.go:1118 — internal/app/auth/service.go:1118-1131 | internal/app/auth/service.go:1138-1151 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/app/bots/verifierbot.go:300 — internal/app/bots/verifierbot.go:300-313 | internal/app/bots/verifybot.go:239-252 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/store/memory/botapi_update.go:127 — internal/store/memory/botapi_update.go:127-143 | internal/store/memory/botapi_update.go:201-214 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/store/memory/stars.go:67 — internal/store/memory/stars.go:67-81 | internal/store/memory/stars.go:83-96 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/app/channels/service.go:1955 — internal/app/channels/service.go:1955-1968 | internal/app/channels/service.go:2173-2190 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/store/postgres/media_index.go:18 — internal/store/postgres/media_index.go:18-31 | internal/store/postgres/media_index.go:72-85 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/rpc/premium.go:34 — internal/rpc/premium.go:34-47 | internal/rpc/premium.go:74-87 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) REDACTED:1466 — REDACTED:1466-1479 | REDACTED:1490-1503 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/rpc/welcome_messages.go:66 — internal/rpc/welcome_messages.go:66-80 | internal/rpc/welcome_messages.go:82-95 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) cmd/telesrv-admin/privateview.go:127 — cmd/telesrv-admin/privateview.go:127-140 | cmd/telesrv-admin/privateview.go:619-632 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/app/files/appearance_seed.go:243 — internal/app/files/appearance_seed.go:243-263 | internal/compat/tdesktop/appearance_seed.go:206-219 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/app/dialogs/read_model_cache.go:450 — internal/app/dialogs/read_model_cache.go:450-463 | internal/app/dialogs/service.go:1340-1353 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/store/memory/business.go:386 — internal/store/memory/business.go:386-399 | internal/store/memory/business.go:401-415 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/rpc/account.go:1520 — internal/rpc/account.go:1520-1533 | internal/rpc/account.go:1535-1549 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/app/files/service.go:337 — internal/app/files/service.go:337-350 | internal/app/files/service.go:353-371 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/rpc/messages_ttl.go:15 — internal/rpc/messages_ttl.go:15-28 | internal/rpc/messages_ttl.go:30-44 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/store/memory/account_rating.go:107 — internal/store/memory/account_rating.go:107-123 | internal/store/memory/bot_verification.go:352-365 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/store/memory/dialogs.go:408 — internal/store/memory/dialogs.go:408-425 | internal/store/memory/dialogs.go:466-479 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/app/donations/service.go:180 — internal/app/donations/service.go:180-194 | internal/app/donations/service.go:233-246 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/store/memory/users.go:73 — internal/store/memory/users.go:73-86 | internal/store/memory/users.go:90-103 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/store/postgres/langpack.go:439 — internal/store/postgres/langpack.go:439-452 | internal/store/postgres/langpack.go:454-467 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) internal/app/updates/service.go:468 — internal/app/updates/service.go:468-481 | internal/app/updates/service.go:540-554 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 4 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×29
  • Edited copy of a member (13 corresponding lines) internal/rpc/bots_inline_message_id.go:13 — internal/rpc/bots_inline_message_id.go:13-25 | internal/rpc/bots_inline_message_id.go:27-40 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/store/memory/message_polls.go:13 — internal/store/memory/message_polls.go:13-25 | internal/store/memory/message_polls.go:27-39 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/store/memory/channel_polls.go:13 — internal/store/memory/channel_polls.go:13-25 | internal/store/memory/channel_polls.go:27-39 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/app/files/sticker_management.go:247 — internal/app/files/sticker_management.go:247-259 | internal/app/files/sticker_management.go:261-273 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/app/stories/service.go:351 — internal/app/stories/service.go:351-363 | internal/app/stories/service.go:365-377 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) REDACTED:1743 — REDACTED:1743-1755 | REDACTED:1849-1861 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/rpc/messages_forum.go:531 — internal/rpc/messages_forum.go:531-543 | internal/rpc/messages_forum.go:545-559 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/rpc/stories.go:2720 — internal/rpc/stories.go:2720-2732 | internal/rpc/stories.go:3115-3127 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/store/memory/collectible_username.go:598 — internal/store/memory/collectible_username.go:598-610 | internal/store/memory/verification.go:591-604 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/app/files/service.go:709 — internal/app/files/service.go:709-721 | internal/store/postgres/media_search.go:95-107 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) REDACTED:1443 — REDACTED:1443-1455 | REDACTED:1871-1883 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/app/channels/service.go:1721 — internal/app/channels/service.go:1721-1733 | internal/app/channels/service.go:1754-1766 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/rpc/account_business.go:384 — internal/rpc/account_business.go:384-396 | internal/rpc/account_business.go:398-410 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) cmd/telesrv-admin/donations.go:286 — cmd/telesrv-admin/donations.go:286-298 | cmd/telesrv-admin/donations.go:303-315 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/rpc/stories.go:805 — internal/rpc/stories.go:805-817 | internal/rpc/stories.go:844-859 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/app/bots/verifierbot.go:1296 — internal/app/bots/verifierbot.go:1296-1308 | internal/app/bots/verifybot.go:1058-1070 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/app/telegramlogin/url.go:102 — internal/app/telegramlogin/url.go:102-114 | internal/app/telegramlogin/url.go:116-133 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/store/memory/ai.go:94 — internal/store/memory/ai.go:94-106 | internal/store/memory/themes.go:65-80 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/app/dialogs/list_snapshot_cache.go:127 — internal/app/dialogs/list_snapshot_cache.go:127-139 | internal/store/postgres/channel_dialog_cache.go:132-144 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) REDACTED:933 — REDACTED:933-945 | internal/store/postgres/star_gift.go:1006-1021 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/store/postgres/update_event.go:996 — internal/store/postgres/update_event.go:996-1008 | internal/store/postgres/update_event.go:1033-1045 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/rpc/messages_compat.go:308 — internal/rpc/messages_compat.go:308-320 | internal/rpc/payments.go:188-200 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/mtprotoedge/session_manager.go:2307 — internal/mtprotoedge/session_manager.go:2307-2320 | internal/mtprotoedge/session_manager.go:2324-2336 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/rpc/privacy_gifts.go:13 — internal/rpc/privacy_gifts.go:13-28 | internal/rpc/privacy_voice.go:11-23 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) internal/rpc/stories.go:3042 — internal/rpc/stories.go:3042-3057 | internal/rpc/stories.go:3059-3071 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 4 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×29
  • Duplicated block (15 lines × 2) REDACTED:973 — REDACTED:973-987 | REDACTED:1637-1651 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (15 lines × 2) REDACTED:2036 — REDACTED:2036-2050 | REDACTED:2082-2096 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (15 lines × 2) cmd/walletminiapp/main.go:202 — cmd/walletminiapp/main.go:202-216 | cmd/walletminiapp/main.go:232-246 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/walletminiapp/main.go:202` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) internal/app/files/appearance_seed.go:127 — internal/app/files/appearance_seed.go:127-141 | internal/app/files/seed_state.go:148-162 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/files/appearance_seed.go:127` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) internal/app/files/retention.go:112 — internal/app/files/retention.go:112-126 | internal/app/files/retention.go:193-207 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/files/retention.go:112` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) internal/app/privacy/service.go:279 — internal/app/privacy/service.go:279-293 | internal/app/privacy/service.go:453-467 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/privacy/service.go:279` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) internal/app/rating/worker.go:55 — internal/app/rating/worker.go:55-69 | internal/app/verification/worker.go:52-66 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/rating/worker.go:55` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (15 lines × 2) internal/rpc/account.go:1276 — internal/rpc/account.go:1276-1290 | internal/rpc/convert_business.go:259-273 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/account.go:1276` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) internal/rpc/account_reports.go:20 — internal/rpc/account_reports.go:20-34 | internal/rpc/account_reports.go:55-69 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) internal/rpc/bots_longtail.go:88 — internal/rpc/bots_longtail.go:88-102 | internal/rpc/bots_longtail.go:110-124 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) internal/rpc/channels_stubs.go:519 — internal/rpc/channels_stubs.go:519-533 | internal/rpc/messages_helpers.go:518-532 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/channels_stubs.go:519` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) internal/rpc/contacts.go:278 — internal/rpc/contacts.go:278-292 | internal/rpc/contacts.go:312-326 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) internal/rpc/messages_dialogs.go:1053 — internal/rpc/messages_dialogs.go:1053-1067 | internal/rpc/messages_dialogs.go:1103-1117 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) internal/rpc/messages_webview.go:24 — internal/rpc/messages_webview.go:24-38 | internal/rpc/messages_webview.go:205-219 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) internal/store/contact_reverse_batch.go:150 — internal/store/contact_reverse_batch.go:150-164 | internal/store/read_model_batch.go:152-166 — before extracting anything, compare `internal/store/contact_reverse_batch.go` and `internal/store/read_model_batch.go` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/contact_reverse_batch.go:150` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) internal/store/memory/bot_verification.go:547 — internal/store/memory/bot_verification.go:547-561 | internal/store/postgres/bot_verification.go:796-810 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/store/postgres/bot_verification.go:794` calls `Errorf` and `internal/store/memory/bot_verification.go:546` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (15 lines × 2) internal/store/memory/bot_verification.go:608 — internal/store/memory/bot_verification.go:608-622 | internal/store/postgres/bot_verification.go:859-873 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/store/postgres/bot_verification.go:857` calls `Errorf` and `internal/store/memory/bot_verification.go:607` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (15 lines × 2) internal/store/memory/channel_invites.go:180 — internal/store/memory/channel_invites.go:180-194 | internal/store/postgres/channel_invite_exported.go:56-70 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (15 lines × 2) internal/store/memory/channel_topics.go:329 — internal/store/memory/channel_topics.go:329-343 | internal/store/postgres/channel_topics.go:349-363 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_topics.go:329` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) internal/store/memory/channel_updates.go:143 — internal/store/memory/channel_updates.go:143-157 | internal/store/postgres/channel_updates.go:470-484 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_updates.go:143` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) internal/store/postgres/channel_updates.go:254 — internal/store/postgres/channel_updates.go:254-268 | internal/store/postgres/channel_updates.go:314-328 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_updates.go:254` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) REDACTED:807 — REDACTED:807-821 | internal/store/postgres/media.go:1411-1425 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:807` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) internal/store/postgres/message_send.go:984 — internal/store/postgres/message_send.go:984-998 | internal/store/postgres/message_send.go:1002-1016 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note what the matched lines are: every one of them assigns one field to another, so the block is a hand-written mapper between two data shapes rather than behaviour with a helper inside it. Extracting one shared function only works if both sites map the SAME pair of types in the same direction — check that first, because inverse or differently-typed mappers have no single function they can both call. Where they do not, the moves that exist are a generated or reflective mapper, a common embedded/base type the fields live on once, or accepting the run and covering it with a test that fails when a field is added to one side only. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/store/postgres/message_send.go:1001` calls `applyCreateMessageBoxMetadata` and `internal/store/postgres/message_send.go:1017` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (15 lines × 2) internal/web/server.go:1106 — internal/web/server.go:1106-1120 | internal/web/server.go:1131-1145 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (15 lines × 2) internal/app/ai/service.go:402 — internal/app/ai/service.go:402-416 | internal/app/ai/service.go:427-441 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/ai/service.go:402` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • + 4 more in this group — see findings.md.
D3 · God Classes · TooManyFields · ×26
  • TooManyFields: Config internal/config/config.go:38 — TooManyFields — 309 stored fields beside 1 method. The bar is 30 stored fields; this is 279 over it, 10.30× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Conn internal/mtprotoedge/conn.go:58 — TooManyFields — 82 stored fields beside 118 methods. The bar is 30 stored fields; this is 52 over it, 2.73× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Deps internal/rpc/deps.go:1149 — TooManyFields — 57 stored fields. The bar is 30 stored fields; this is 27 over it, 1.90× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Router internal/rpc/router.go:127 — TooManyFields — 56 stored fields beside 1671 methods. The bar is 30 stored fields; this is 26 over it, 1.87× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Channel internal/domain/channel.go:417 — TooManyFields — 54 stored fields beside 1 method. The bar is 30 stored fields; this is 24 over it, 1.80× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: TelegramLoginRequest internal/domain/telegram_login.go:175 — TooManyFields — 45 stored fields beside 3 methods. The bar is 30 stored fields; this is 15 over it, 1.50× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Server internal/mtprotoedge/server.go:508 — TooManyFields — 44 stored fields beside 84 methods. The bar is 30 stored fields; this is 14 over it, 1.47× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: User internal/domain/user.go:101 — TooManyFields — 44 stored fields beside 4 methods. The bar is 30 stored fields; this is 14 over it, 1.47× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: savedDialogTopRowFields internal/store/postgres/saved_dialog.go:355 — TooManyFields — 44 stored fields. The bar is 30 stored fields; this is 14 over it, 1.47× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Options internal/mtprotoedge/server.go:245 — TooManyFields — 43 stored fields beside 1 method. The bar is 30 stored fields; this is 13 over it, 1.43× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: UniqueStarGift internal/domain/star_gift.go:207 — TooManyFields — 41 stored fields. The bar is 30 stored fields; this is 11 over it, 1.37× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: RunReport internal/loadharness/report.go:185 — TooManyFields — 40 stored fields. The bar is 30 stored fields; this is 10 over it, 1.33× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: RuntimeSnapshot internal/mtprotoedge/runtime_metrics.go:9 — TooManyFields — 40 stored fields. The bar is 30 stored fields; this is 10 over it, 1.33× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: StarGiftCatalogWrite internal/domain/star_gift.go:883 — TooManyFields — 38 stored fields beside 3 methods. The bar is 30 stored fields; this is 8 over it, 1.27× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ChannelStore internal/store/memory/channel_store.go:65 — TooManyFields — 37 stored fields beside 256 methods. The bar is 30 stored fields; this is 7 over it, 1.23× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Service internal/app/files/service.go:48 — TooManyFields — 37 stored fields beside 182 methods. The bar is 30 stored fields; this is 7 over it, 1.23× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ChannelMessage internal/domain/channel.go:699 — TooManyFields — 37 stored fields. The bar is 30 stored fields; this is 7 over it, 1.23× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: channelDialogProjectionValues REDACTED:1974 — TooManyFields — 35 stored fields beside 2 methods. The bar is 30 stored fields; this is 5 over it, 1.17× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: UpdateEvent internal/domain/update_event.go:81 — TooManyFields — 35 stored fields beside 1 method. The bar is 30 stored fields; this is 5 over it, 1.17× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: StarGift internal/domain/star_gift.go:18 — TooManyFields — 33 stored fields. The bar is 30 stored fields; this is 3 over it, 1.10× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Config internal/rpc/router.go:54 — TooManyFields — 33 stored fields. The bar is 30 stored fields; this is 3 over it, 1.10× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Service REDACTED:152 — TooManyFields — 32 stored fields beside 184 methods. The bar is 30 stored fields; this is 2 over it, 1.07× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Service internal/app/auth/service.go:81 — TooManyFields — 32 stored fields beside 52 methods. The bar is 30 stored fields; this is 2 over it, 1.07× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ChannelMessageAction internal/domain/channel.go:650 — TooManyFields — 32 stored fields. The bar is 30 stored fields; this is 2 over it, 1.07× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ChannelRow cmd/telesrv-admin/readstore.go:207 — TooManyFields — 31 stored fields. The bar is 30 stored fields; this is 1 over it, 1.03× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • + 1 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (19 corresponding lines) · ×26
  • Edited copy of a member (19 corresponding lines) internal/web/server.go:527 — internal/web/server.go:527-545 | internal/web/server.go:547-570 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/rpc/phone_group_call_updates.go:87 — internal/rpc/phone_group_call_updates.go:87-109 | internal/rpc/phone_group_call_updates.go:147-165 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/app/bots/verifierbot.go:1397 — internal/app/bots/verifierbot.go:1397-1415 | internal/app/bots/verifybot.go:1128-1146 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/rpc/inline_registry.go:257 — internal/rpc/inline_registry.go:257-275 | internal/rpc/inline_registry.go:277-295 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) cmd/telesrv-admin/readstore.go:310 — cmd/telesrv-admin/readstore.go:310-328 | cmd/telesrv-admin/readstore.go:3482-3502 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/app/moderation/actions.go:321 — internal/app/moderation/actions.go:321-339 | internal/app/moderation/actions.go:341-359 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/app/bots/verifybot.go:586 — internal/app/bots/verifybot.go:586-604 | internal/app/bots/verifybot.go:606-625 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/app/bots/verifierbot.go:1146 — internal/app/bots/verifierbot.go:1146-1164 | internal/app/bots/verifybot.go:911-929 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/store/memory/channel_read.go:9 — internal/store/memory/channel_read.go:9-30 | internal/store/memory/channel_topics.go:49-67 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/app/userprojection/contact_cache.go:686 — internal/app/userprojection/contact_cache.go:686-704 | internal/app/userprojection/contact_cache.go:774-792 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/store/memory/channel_updates.go:138 — internal/store/memory/channel_updates.go:138-157 | internal/store/postgres/channel_updates.go:466-484 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/rpc/messages_stickers_personal.go:180 — internal/rpc/messages_stickers_personal.go:180-198 | internal/rpc/messages_stickers_personal.go:200-224 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/store/postgres/star_gift.go:389 — internal/store/postgres/star_gift.go:389-407 | internal/store/postgres/star_gift.go:409-427 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/app/userprojection/contact_cache.go:666 — internal/app/userprojection/contact_cache.go:666-684 | internal/app/userprojection/contact_cache.go:754-772 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/store/postgres/star_gift_lifecycle.go:1299 — internal/store/postgres/star_gift_lifecycle.go:1299-1317 | REDACTED:629-662 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/store/postgres/authkey.go:56 — internal/store/postgres/authkey.go:56-75 | internal/store/postgres/authkey.go:81-99 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/store/memory/auth.go:493 — internal/store/memory/auth.go:493-512 | internal/store/memory/auth.go:528-546 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/rpc/channels_invites.go:191 — internal/rpc/channels_invites.go:191-212 | internal/rpc/channels_invites.go:287-305 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/app/bots/verifierbot.go:1275 — internal/app/bots/verifierbot.go:1275-1293 | internal/app/bots/verifybot.go:1037-1055 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/app/files/retention.go:499 — internal/app/files/retention.go:499-517 | internal/app/files/retention.go:521-539 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/rpc/account.go:668 — internal/rpc/account.go:668-689 | REDACTED:746-764 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/app/userprojection/contact_cache.go:265 — internal/app/userprojection/contact_cache.go:265-283 | internal/app/userprojection/contact_cache.go:577-595 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/store/memory/secretchat.go:97 — internal/store/memory/secretchat.go:97-115 | internal/store/memory/users.go:385-405 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/rpc/convert_business.go:11 — internal/rpc/convert_business.go:11-30 | internal/rpc/convert_business.go:32-50 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) internal/store/postgres/account.go:73 — internal/store/postgres/account.go:73-91 | internal/store/postgres/read_model_versions.go:24-44 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 1 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×26
  • Edited copy of a member (18 corresponding lines) internal/admin/service.go:1692 — internal/admin/service.go:1692-1720 | internal/admin/service.go:1725-1742 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/app/files/upload_receipt.go:42 — internal/app/files/upload_receipt.go:42-59 | internal/app/files/upload_receipt.go:61-78 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/store/memory/channel_boosts.go:35 — internal/store/memory/channel_boosts.go:35-59 | internal/store/memory/channel_boosts.go:108-125 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/app/account/business.go:191 — internal/app/account/business.go:191-208 | internal/app/account/business.go:210-227 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) REDACTED:1296 — REDACTED:1296-1313 | REDACTED:1346-1363 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) cmd/telesrv-admin/botverification.go:63 — cmd/telesrv-admin/botverification.go:63-80 | cmd/telesrv-admin/botverification.go:82-99 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/app/auth/service.go:416 — internal/app/auth/service.go:416-439 | internal/app/auth/service.go:443-460 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/rpc/channels_stubs.go:499 — internal/rpc/channels_stubs.go:499-516 | internal/rpc/premium.go:151-168 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/store/memory/channel_members.go:626 — internal/store/memory/channel_members.go:626-646 | internal/store/memory/channel_settings.go:102-119 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/store/memory/channel_members.go:1030 — internal/store/memory/channel_members.go:1030-1047 | internal/store/postgres/channel_member_helpers.go:28-45 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/rpc/temp_key_cache.go:44 — internal/rpc/temp_key_cache.go:44-61 | internal/rpc/temp_key_cache.go:68-85 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/rpc/channels_members.go:950 — internal/rpc/channels_members.go:950-971 | internal/rpc/messages_polls_updates.go:21-38 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/app/verification/service.go:538 — internal/app/verification/service.go:538-556 | internal/app/verification/service.go:590-607 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/store/memory/channel_message_history.go:652 — internal/store/memory/channel_message_history.go:652-669 | internal/store/memory/message_history.go:458-481 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/rpc/webpage_resolver.go:218 — internal/rpc/webpage_resolver.go:218-235 | internal/rpc/webpage_resolver.go:237-258 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/rpc/channels_messages.go:55 — internal/rpc/channels_messages.go:55-73 | internal/rpc/messages_read.go:76-93 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/rpc/bots_longtail.go:398 — internal/rpc/bots_longtail.go:398-415 | internal/rpc/bots_longtail.go:630-647 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/mtprotoedge/session_manager.go:1514 — internal/mtprotoedge/session_manager.go:1514-1536 | internal/mtprotoedge/session_manager.go:1570-1587 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/rpc/messages_history.go:132 — internal/rpc/messages_history.go:132-149 | internal/rpc/messages_reactions_helpers.go:50-67 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/store/memory/bot_verification.go:964 — internal/store/memory/bot_verification.go:964-981 | internal/store/postgres/bot_verification.go:1294-1313 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) cmd/telesrv-admin/admin_command_runner.go:236 — cmd/telesrv-admin/admin_command_runner.go:236-253 | internal/admin/service.go:4023-4043 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/rpc/convert_business.go:120 — internal/rpc/convert_business.go:120-137 | internal/rpc/convert_business.go:150-172 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/rpc/channel_interest.go:15 — internal/rpc/channel_interest.go:15-36 | internal/rpc/channel_interest.go:42-59 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/rpc/stories.go:861 — internal/rpc/stories.go:861-880 | internal/rpc/stories.go:1275-1292 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) internal/store/postgres/groupcall.go:955 — internal/store/postgres/groupcall.go:955-974 | internal/store/postgres/groupcall.go:1217-1234 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 1 more in this group — see findings.md.
AC4 · Keyboard semantics · Modal dialog does not manage focus · ×23
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/components/ActionButton.tsx:124 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/components/AddServerLinkModal.tsx:212 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/components/AvatarModal.tsx:71 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/components/CopyBotTokenModal.tsx:49 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/components/CreateBotModal.tsx:17 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/components/CreateBroadcastModal.tsx:29 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/components/MintCollectibleUsernameModal.tsx:70 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/components/chat/ChatMedia.tsx:67 — This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/pages/AdminUsersPage.tsx:278 — This <section role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/pages/AdminUsersPage.tsx:383 — This <section role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/pages/CreateStickerSetModal.tsx:50 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/pages/DonationsPage.tsx:602 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/pages/DonationsPage.tsx:700 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/pages/DonationsPage.tsx:814 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/pages/DonationsPage.tsx:908 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/pages/GifCatalogPage.tsx:300 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/pages/GiftCollectiblesModal.tsx:239 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/pages/GiftPacks.tsx:221 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/pages/ServerSettingsPage.tsx:591 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/pages/ServerSettingsPage.tsx:784 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/pages/StarGiftCatalogPage.tsx:407 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/pages/StickerSetPreviewModal.tsx:50 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus cmd/telesrv-admin/web/src/pages/StoragePage.tsx:322 — This <section role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×23
  • Duplicated block (9 lines × 3) cmd/walletminiapp/main.go:184 — cmd/walletminiapp/main.go:184-192 | cmd/walletminiapp/main.go:211-219 | cmd/walletminiapp/main.go:241-249 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 3) internal/app/channels/service.go:445 — internal/app/channels/service.go:445-453 | internal/app/channels/service.go:539-547 | internal/app/channels/service.go:585-593 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 3) internal/app/dialogs/draft_read_model_cache.go:104 — internal/app/dialogs/draft_read_model_cache.go:104-112 | internal/rpc/peer_identity_cache.go:85-93 | internal/rpc/story_sparse_projection_cache.go:204-212 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/dialogs/draft_read_model_cache.go:104` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/app/dialogs/draft_read_model_cache.go:102` calls `uniqueDialogPeers` and `internal/rpc/peer_identity_cache.go:83` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 3) internal/botapi/bot_commands.go:32 — internal/botapi/bot_commands.go:32-40 | internal/botapi/bot_commands.go:64-72 | internal/botapi/bot_commands.go:81-89 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 3) internal/rpc/ephemeral.go:433 — internal/rpc/ephemeral.go:433-441 | internal/rpc/welcome_delivery_dispatcher.go:194-202 | internal/rpc/welcome_messages.go:315-323 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (9 lines × 3) internal/store/memory/channel_settings.go:194 — internal/store/memory/channel_settings.go:194-202 | internal/store/memory/channel_settings.go:228-236 | internal/store/memory/channel_settings.go:279-287 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (9 lines × 3) internal/store/memory/collectible_username.go:297 — internal/store/memory/collectible_username.go:297-305 | internal/store/memory/collectible_username.go:370-378 | internal/store/memory/collectible_username.go:435-443 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (9 lines × 3) internal/store/memory/password.go:522 — internal/store/memory/password.go:522-530 | internal/store/memory/users.go:57-65 | REDACTED:1732-1740 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/password.go:522` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) internal/store/memory/saved_dialog.go:145 — internal/store/memory/saved_dialog.go:145-153 | internal/store/memory/saved_dialog.go:196-204 | internal/store/postgres/dialog.go:1230-1238 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/saved_dialog.go:145` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) internal/store/postgres/channel_reaction_unread.go:26 — internal/store/postgres/channel_reaction_unread.go:26-34 | internal/store/postgres/channel_read.go:290-298 | internal/store/postgres/channel_topics.go:630-638 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: `internal/store/postgres/channel_topics.go:630` is reached only past a guard at line 594 that tests `member.AvailableMinID` and leaves the function early, and `internal/store/postgres/channel_reaction_unread.go:26` reads `member.AvailableMinID` with no such check. What separates these copies is not which lines they run but which PRECONDITION they enforce, so one of them is operating on state the other one refuses. Decide which is intended BEFORE unifying them — extract the shared part and whichever copy is missing the check keeps running unchecked, and if the guard is the correct behaviour then that hole is already live.
  • Duplicated block (9 lines × 3) internal/store/postgres/channel_updates.go:61 — internal/store/postgres/channel_updates.go:61-69 | internal/store/postgres/channel_updates.go:116-124 | internal/store/postgres/channel_updates.go:189-197 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) internal/store/postgres/dialog.go:454 — internal/store/postgres/dialog.go:454-462 | internal/store/postgres/saved_dialog.go:136-144 | internal/store/postgres/saved_dialog.go:219-227 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (9 lines × 3) internal/app/ai/service.go:466 — internal/app/ai/service.go:466-474 | internal/app/ai/service.go:508-516 | internal/app/ai/service.go:531-539 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/ai/service.go:466` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) cmd/telesrv-admin/readstore.go:3199 — cmd/telesrv-admin/readstore.go:3199-3207 | internal/store/postgres/donations.go:246-254 | internal/store/postgres/donations.go:267-275 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Check import visibility before settling on that home: `internal/store/postgres/donations.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
  • Duplicated block (9 lines × 3) internal/rpc/channels_messages.go:45 — internal/rpc/channels_messages.go:45-53 | internal/store/memory/channel_read.go:541-549 | internal/store/postgres/channel_read.go:997-1005 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (9 lines × 3) internal/store/postgres/channel_message_delete.go:198 — internal/store/postgres/channel_message_delete.go:198-206 | internal/store/postgres/channel_message_delete.go:371-379 | internal/store/postgres/channel_topics.go:388-396 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_message_delete.go:198` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 3) internal/store/postgres/channel_helpers.go:716 — internal/store/postgres/channel_helpers.go:716-724 | internal/store/postgres/channel_helpers.go:744-752 | internal/store/postgres/channel_helpers.go:789-797 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_helpers.go:716` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (9 lines × 3) internal/app/files/retention.go:372 — internal/app/files/retention.go:372-380 | internal/app/files/retention.go:394-402 | internal/app/files/retention.go:416-424 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/files/retention.go:372` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) cmd/telesrv-admin/readstore.go:1227 — cmd/telesrv-admin/readstore.go:1227-1235 | cmd/telesrv-admin/readstore.go:3254-3262 | internal/store/postgres/broadcast.go:373-381 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/telesrv-admin/readstore.go:1227` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Check import visibility before settling on that home: `internal/store/postgres/broadcast.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
  • Duplicated block (9 lines × 3) internal/rpc/bot_verification_notify.go:65 — internal/rpc/bot_verification_notify.go:65-73 | internal/rpc/username_notify.go:33-41 | internal/rpc/verification_notify.go:72-80 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/bot_verification_notify.go:65` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) internal/store/postgres/verification.go:222 — internal/store/postgres/verification.go:222-230 | internal/store/postgres/verification.go:290-298 | internal/store/postgres/verification.go:354-362 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/verification.go:222` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) internal/rpc/bot_verification_notify.go:91 — internal/rpc/bot_verification_notify.go:91-99 | internal/rpc/username_notify.go:49-57 | internal/rpc/verification_notify.go:101-109 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/bot_verification_notify.go:91` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) internal/store/postgres/user.go:61 — internal/store/postgres/user.go:61-69 | internal/store/postgres/user.go:116-124 | internal/store/postgres/user.go:786-794 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/user.go:61` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Edited copy of a member (20 corresponding lines) · ×22
  • Edited copy of a member (20 corresponding lines) internal/rpc/photos.go:531 — internal/rpc/photos.go:531-550 | internal/rpc/photos.go:552-573 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/rpc/payments_star_gift_lifecycle.go:390 — internal/rpc/payments_star_gift_lifecycle.go:390-409 | internal/rpc/payments_star_gift_unique.go:124-146 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/store/postgres/moderation_cases.go:1025 — internal/store/postgres/moderation_cases.go:1025-1044 | internal/store/postgres/moderation_cases.go:1177-1204 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/store/postgres/moderation_cases.go:512 — internal/store/postgres/moderation_cases.go:512-531 | internal/store/postgres/moderation_registries.go:57-79 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/app/bots/botfather.go:684 — internal/app/bots/botfather.go:684-703 | internal/app/bots/botfather.go:966-995 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/rpc/channels_settings.go:117 — internal/rpc/channels_settings.go:117-136 | internal/rpc/channels_settings.go:138-157 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/rpc/account_deletion.go:175 — internal/rpc/account_deletion.go:175-194 | internal/rpc/errors.go:373-392 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/rpc/upload.go:37 — internal/rpc/upload.go:37-56 | internal/rpc/upload.go:58-77 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/store/memory/code_cas.go:23 — internal/store/memory/code_cas.go:23-49 | internal/store/memory/code_cas.go:51-70 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/store/postgres/channel_settings.go:272 — internal/store/postgres/channel_settings.go:272-291 | internal/store/postgres/channel_settings.go:481-501 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/store/memory/dialogs.go:253 — internal/store/memory/dialogs.go:253-272 | internal/store/memory/users.go:50-71 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/rpc/channel_interest.go:113 — internal/rpc/channel_interest.go:113-132 | internal/rpc/channel_interest.go:134-153 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/rpc/send_media.go:939 — internal/rpc/send_media.go:939-961 | internal/rpc/stories.go:2020-2039 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/store/postgres/authorization.go:489 — internal/store/postgres/authorization.go:489-508 | internal/store/postgres/authorization.go:514-542 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/rpc/account_business.go:145 — internal/rpc/account_business.go:145-164 | internal/rpc/account_business.go:166-188 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/store/memory/ai.go:45 — internal/store/memory/ai.go:45-64 | internal/store/memory/themes.go:92-112 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/store/memory/collectible_username.go:222 — internal/store/memory/collectible_username.go:222-241 | internal/store/memory/collectible_username.go:246-272 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) REDACTED:28 — REDACTED:28-47 | internal/store/postgres/postgres.go:123-146 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/rpc/contacts.go:110 — internal/rpc/contacts.go:110-129 | internal/rpc/messages_quick_replies.go:95-115 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/store/memory/auth.go:117 — internal/store/memory/auth.go:117-136 | internal/store/memory/auth.go:419-442 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/app/dialogs/list_snapshot_cache.go:423 — internal/app/dialogs/list_snapshot_cache.go:423-442 | internal/store/memory/dialogs.go:848-868 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) internal/botapi/formatted_text.go:998 — internal/botapi/formatted_text.go:998-1017 | REDACTED:429-450 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (22 corresponding lines) · ×21
  • Edited copy of a member (22 corresponding lines) internal/app/bots/verifierbot.go:445 — internal/app/bots/verifierbot.go:445-466 | internal/app/bots/verifybot.go:413-435 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/rpc/welcome_messages.go:14 — internal/rpc/welcome_messages.go:14-41 | internal/rpc/welcome_messages.go:43-64 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/rpc/channels_updates.go:405 — internal/rpc/channels_updates.go:405-426 | internal/rpc/messages_forum_read.go:78-99 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/rpc/phone_group_call_edit.go:216 — internal/rpc/phone_group_call_edit.go:216-237 | internal/rpc/phone_group_call_edit.go:239-265 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/rpc/payments_star_gifts.go:313 — internal/rpc/payments_star_gifts.go:313-334 | internal/rpc/payments_star_gifts.go:536-560 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/store/memory/story.go:477 — internal/store/memory/story.go:477-498 | internal/store/memory/story.go:521-550 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/rpc/router.go:1691 — internal/rpc/router.go:1691-1716 | internal/rpc/router.go:1797-1818 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/rpc/stickers_creator.go:305 — internal/rpc/stickers_creator.go:305-328 | internal/rpc/stickers_creator.go:352-373 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/store/postgres/langpack.go:26 — internal/store/postgres/langpack.go:26-47 | internal/store/postgres/langpack.go:49-70 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/store/postgres/bot_verification.go:685 — internal/store/postgres/bot_verification.go:685-715 | REDACTED:425-446 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/rpc/account_deletion_notifications_worker.go:51 — internal/rpc/account_deletion_notifications_worker.go:51-72 | internal/rpc/account_freeze_worker.go:36-57 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/store/postgres/channel_row_cache.go:60 — internal/store/postgres/channel_row_cache.go:60-83 | internal/store/postgres/channel_top_message_cache.go:52-73 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/app/userprojection/contact_cache.go:794 — internal/app/userprojection/contact_cache.go:794-815 | internal/app/userprojection/contact_cache.go:856-883 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/store/memory/broadcast.go:218 — internal/store/memory/broadcast.go:218-239 | internal/store/memory/broadcast.go:241-263 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/store/postgres/secretchat.go:84 — internal/store/postgres/secretchat.go:84-111 | internal/store/postgres/secretchat.go:113-134 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/store/postgres/channel_helpers.go:544 — internal/store/postgres/channel_helpers.go:544-565 | internal/store/postgres/channel_read.go:236-273 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/store/postgres/botapi_update.go:165 — internal/store/postgres/botapi_update.go:165-186 | internal/store/postgres/botapi_update.go:248-273 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/rpc/ephemeral_push.go:17 — internal/rpc/ephemeral_push.go:17-40 | internal/rpc/inline_push.go:15-36 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/mtprotoedge/bulk_rpc_scheduler.go:60 — internal/mtprotoedge/bulk_rpc_scheduler.go:60-81 | internal/mtprotoedge/outbound.go:1078-1099 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/store/memory/moderation.go:964 — internal/store/memory/moderation.go:964-985 | internal/store/postgres/moderation_cases.go:997-1019 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) internal/store/postgres/channel_reaction_unread.go:368 — internal/store/postgres/channel_reaction_unread.go:368-402 | internal/store/postgres/channel_read.go:1009-1030 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
AC6 · Visual & motion safety · Animation without a prefers-reduced-motion guard · ×20
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/01-foundation.css:309 — `.nav-section-chevron` moves (`transition: transform 140ms ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/02-pages-and-forms.css:57 — `a.stat-tile.clickable` moves (`transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/02-pages-and-forms.css:299 — `.launcher` moves (`transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:445 — `.give-gift-option` moves (`transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:472 — `.gift-bulk-import-progress-bar > div` moves (`transition: width .2s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:500 — `.official-gift-option` moves (`transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:593 — `.gift-switch-track span` moves (`transition: transform .16s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:602 — `.chain-toggle span` moves (`transition: transform .16s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:611 — `.chain-preset-card` moves (`transition: border-color .12s ease, transform .12s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:843 — `.gift-pack-cover .gift-pack-anim` moves (`transition: transform .2s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:867 — `.gift-pack-tile` moves (`transition: border-color .15s ease, transform .15s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:1208 — `.env-group-chevron` moves (`transition: transform 140ms ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/03-entities-and-actions.css:1279 — `.restart-overlay-spin` moves (`animation: spin 1.4s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/04-modal-and-login.css:299 — `.bg-orb--1` moves (`animation: loginOrbFloat1 20s ease-in-out infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/04-modal-and-login.css:308 — `.bg-orb--2` moves (`animation: loginOrbFloat2 24s ease-in-out infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/04-modal-and-login.css:317 — `.bg-orb--3` moves (`animation: loginOrbFloat3 28s ease-in-out infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/04-modal-and-login.css:568 — `.loader-bar::before` moves (`animation: load 1s infinite ease-in-out`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/04-modal-and-login.css:572 — `.spin` moves (`animation: spin 0.8s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/06-refresh.css:1332 — `.switch-track::after` moves (`transition: transform 140ms ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard cmd/telesrv-admin/web/src/styles/08-economy.css:53 — `.give-tile` moves (`transition: border-color 0.12s, background 0.12s, transform 0.12s`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
D4 · Code Duplication · Edited copy of a member (7 corresponding lines) · ×20
  • Edited copy of a member (7 corresponding lines) internal/app/stargifts/service.go:883 — internal/app/stargifts/service.go:883-889 | internal/app/stargifts/service.go:891-897 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) internal/app/files/diskspace_unix.go:9 — internal/app/files/diskspace_unix.go:9-15 | internal/hoststats/disk_unix.go:13-19 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) internal/store/postgres/channel_core.go:710 — internal/store/postgres/channel_core.go:710-716 | internal/store/memory/channel_helpers.go:766-772 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) cmd/otpwebhook-example/main.go:267 — cmd/otpwebhook-example/main.go:267-273 | internal/otpdelivery/webhook/sender.go:195-201 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) internal/botapi/server.go:412 — internal/botapi/server.go:412-418 | internal/rpc/welcome_delivery_dispatcher.go:282-288 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) internal/store/postgres/message_polls.go:127 — internal/store/postgres/message_polls.go:127-137 | internal/store/postgres/channel_polls.go:232-238 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) internal/app/bots/verifierbot.go:1590 — internal/app/bots/verifierbot.go:1590-1596 | internal/app/bots/verifybot.go:1419-1425 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) cmd/bots/aiogramecho/echo.py:31 — cmd/bots/aiogramecho/echo.py:31-37 | cmd/bots/ptbecho/echo.py:66-72 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) cmd/telegramloginkeygen/main.go:285 — cmd/telegramloginkeygen/main.go:285-291 | internal/app/auth/service.go:1923-1929 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) internal/store/postgres/bot_verification.go:124 — internal/store/postgres/bot_verification.go:124-130 | internal/store/postgres/verification.go:86-92 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) internal/rpc/phone_conference.go:411 — internal/rpc/phone_conference.go:411-417 | internal/store/memory/poll.go:266-275 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) internal/app/userprojection/contact_cache.go:1088 — internal/app/userprojection/contact_cache.go:1088-1094 | internal/store/memory/story.go:1697-1706 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) internal/rpc/convert_users.go:411 — internal/rpc/convert_users.go:411-417 | internal/rpc/send_media.go:1185-1191 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) internal/rpc/messages_polls.go:17 — internal/rpc/messages_polls.go:17-23 | internal/store/postgres/privacy.go:108-114 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) internal/store/postgres/bot_verification.go:1178 — internal/store/postgres/bot_verification.go:1178-1184 | internal/store/postgres/verification.go:1071-1077 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) cmd/catalogfetch/main.go:82 — cmd/catalogfetch/main.go:82-88 | internal/loadharness/report.go:228-234 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) cmd/telesrv-admin/readstore.go:1596 — cmd/telesrv-admin/readstore.go:1596-1602 | internal/store/postgres/media_search.go:87-93 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) internal/app/account/business.go:505 — internal/app/account/business.go:505-511 | internal/app/bots/stickersbot.go:816-822 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) internal/app/telegramlogin/service.go:950 — internal/app/telegramlogin/service.go:950-956 | internal/telegramloginhttp/handler.go:710-719 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) cmd/telesrv-admin/privateview_store.go:342 — cmd/telesrv-admin/privateview_store.go:342-349 | internal/store/postgres/channel_message_history.go:1034-1040 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (21 corresponding lines) · ×19
  • Edited copy of a member (21 corresponding lines) internal/admin/botverification.go:808 — internal/admin/botverification.go:808-832 | internal/admin/verification.go:346-366 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) internal/rpc/presence_last_seen_batch.go:195 — internal/rpc/presence_last_seen_batch.go:195-215 | internal/store/postgres/user.go:521-564 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) internal/store/memory/channel_message_helpers.go:55 — internal/store/memory/channel_message_helpers.go:55-79 | internal/store/postgres/message_helpers.go:18-38 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) internal/rpc/channels_stubs.go:635 — internal/rpc/channels_stubs.go:635-655 | internal/rpc/channels_stubs.go:657-677 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) REDACTED:48 — REDACTED:48-68 | REDACTED:361-388 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) cmd/telesrv-admin/readstore.go:1291 — cmd/telesrv-admin/readstore.go:1291-1311 | internal/store/postgres/authorization.go:354-380 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) internal/rpc/stories.go:476 — internal/rpc/stories.go:476-496 | internal/rpc/stories.go:508-528 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) cmd/telesrv-admin/donations.go:113 — cmd/telesrv-admin/donations.go:113-133 | cmd/telesrv-admin/donations.go:155-179 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) internal/rpc/login_token.go:97 — internal/rpc/login_token.go:97-117 | internal/rpc/login_token.go:119-143 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) internal/rpc/stories.go:387 — internal/rpc/stories.go:387-407 | internal/rpc/stories.go:1147-1170 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) internal/rpc/messages_read.go:189 — internal/rpc/messages_read.go:189-216 | internal/rpc/messages_read.go:218-238 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) internal/rpc/media_count.go:59 — internal/rpc/media_count.go:59-80 | internal/rpc/media_count.go:82-102 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) internal/store/postgres/bot_verification.go:655 — internal/store/postgres/bot_verification.go:655-676 | internal/store/postgres/bot_verification.go:963-983 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) internal/store/memory/community.go:184 — internal/store/memory/community.go:184-204 | internal/store/postgres/community.go:310-331 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) cmd/telesrv-admin/premium.go:27 — cmd/telesrv-admin/premium.go:27-47 | REDACTED:1071-1091 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) internal/store/postgres/themes.go:173 — internal/store/postgres/themes.go:173-193 | internal/store/postgres/themes.go:195-215 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) internal/loadharness/mutate.go:691 — internal/loadharness/mutate.go:691-711 | internal/loadharness/mutate.go:713-734 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) internal/app/rating/worker.go:49 — internal/app/rating/worker.go:49-69 | internal/app/verification/worker.go:46-66 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) internal/store/memory/channel_invites.go:871 — internal/store/memory/channel_invites.go:871-891 | internal/store/postgres/channel_invite_exported.go:555-575 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×19
  • Duplicated block (16 lines × 2) internal/botapi/server.go:431 — internal/botapi/server.go:431-446 | internal/botapi/server.go:1049-1064 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (16 lines × 2) internal/botapi/server.go:545 — internal/botapi/server.go:545-560 | internal/botapi/server.go:699-714 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/botapi/server.go:545` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) internal/mtprotoedge/session_manager.go:2369 — internal/mtprotoedge/session_manager.go:2369-2384 | internal/mtprotoedge/session_manager.go:2458-2473 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/mtprotoedge/session_manager.go:2369` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) internal/rpc/channel_interest.go:114 — internal/rpc/channel_interest.go:114-129 | internal/rpc/channel_interest.go:135-150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/channel_interest.go:114` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `int64` to `r *Router) addOnlineChannelMemberships(channelID` in one and `r *Router) removeOnlineChannelMemberships(channelID` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (16 lines × 2) internal/rpc/channels_legacy_chat.go:504 — internal/rpc/channels_legacy_chat.go:504-519 | internal/rpc/messages_no_forwards.go:100-115 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/channels_legacy_chat.go:504` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) internal/rpc/media_count.go:65 — internal/rpc/media_count.go:65-80 | internal/rpc/media_count.go:87-102 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/media_count.go:65` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) internal/rpc/messages_edit_geolive.go:84 — internal/rpc/messages_edit_geolive.go:84-99 | internal/rpc/messages_todos.go:233-248 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_edit_geolive.go:84` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (16 lines × 2) internal/store/memory/channel_helpers.go:642 — internal/store/memory/channel_helpers.go:642-657 | internal/store/postgres/channel_helpers.go:960-975 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (16 lines × 2) internal/store/memory/channel_invites.go:365 — internal/store/memory/channel_invites.go:365-380 | internal/store/memory/channel_invites.go:608-623 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_invites.go:365` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (16 lines × 2) internal/store/memory/channel_read.go:256 — internal/store/memory/channel_read.go:256-271 | internal/store/postgres/channel_message_history.go:918-933 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) internal/store/memory/community.go:1097 — internal/store/memory/community.go:1097-1112 | internal/store/postgres/community.go:1368-1383 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (16 lines × 2) internal/store/memory/moderation.go:442 — internal/store/memory/moderation.go:442-457 | internal/store/memory/moderation.go:510-525 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/moderation.go:442` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (16 lines × 2) internal/store/postgres/channel_reaction_catalog.go:29 — internal/store/postgres/channel_reaction_catalog.go:29-44 | internal/store/postgres/channel_reaction_catalog.go:65-80 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_reaction_catalog.go:29` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (16 lines × 2) internal/store/postgres/moderation_registries.go:114 — internal/store/postgres/moderation_registries.go:114-129 | internal/store/postgres/moderation_registries.go:236-251 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/moderation_registries.go:114` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) internal/store/postgres/star_gift_lifecycle.go:451 — internal/store/postgres/star_gift_lifecycle.go:451-466 | internal/store/postgres/star_gift_lifecycle.go:1204-1219 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) internal/store/postgres/story.go:1673 — internal/store/postgres/story.go:1673-1688 | internal/store/postgres/story.go:1728-1743 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/story.go:1673` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) internal/store/memory/channel_invites.go:452 — internal/store/memory/channel_invites.go:452-467 | internal/store/postgres/channel_invite_exported.go:313-328 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (16 lines × 2) internal/store/memory/channel_message_helpers.go:56 — internal/store/memory/channel_message_helpers.go:56-71 | internal/store/postgres/message_helpers.go:19-34 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (16 lines × 2) internal/store/postgres/star_gift_lifecycle.go:758 — internal/store/postgres/star_gift_lifecycle.go:758-773 | internal/store/postgres/star_gift_lifecycle.go:1182-1197 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/star_gift_lifecycle.go:758` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Edited copy of a member (24 corresponding lines) · ×16
  • Edited copy of a member (24 corresponding lines) internal/app/ai/service.go:400 — internal/app/ai/service.go:400-423 | internal/app/ai/service.go:425-448 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) internal/app/moderation/evidence.go:424 — internal/app/moderation/evidence.go:424-447 | internal/app/moderation/legacy.go:48-81 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) internal/store/postgres/peer_username.go:176 — internal/store/postgres/peer_username.go:176-201 | internal/store/postgres/peer_username.go:254-277 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) internal/app/dialogs/read_model_cache.go:509 — internal/app/dialogs/read_model_cache.go:509-538 | internal/store/memory/message_helpers.go:142-165 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) internal/rpc/botapi_update_queue.go:433 — internal/rpc/botapi_update_queue.go:433-456 | internal/rpc/botapi_update_queue.go:478-505 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) internal/store/postgres/channel_updates.go:532 — internal/store/postgres/channel_updates.go:532-555 | internal/store/postgres/message_allocators.go:15-38 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) internal/domain/moderation_registry.go:62 — internal/domain/moderation_registry.go:62-86 | internal/domain/moderation_registry.go:133-156 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) internal/rpc/encrypted_messages.go:22 — internal/rpc/encrypted_messages.go:22-45 | internal/rpc/encrypted_read_typing.go:33-58 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) internal/rpc/bot_verification_projection.go:145 — internal/rpc/bot_verification_projection.go:145-168 | internal/rpc/messages_monoforum.go:257-285 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) internal/rpc/router.go:1395 — internal/rpc/router.go:1395-1418 | internal/rpc/router.go:1420-1451 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) internal/app/bots/verifierbot.go:1172 — internal/app/bots/verifierbot.go:1172-1195 | internal/app/bots/verifybot.go:937-964 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) internal/rpc/messages_reactions_helpers.go:69 — internal/rpc/messages_reactions_helpers.go:69-92 | internal/rpc/reactions_android_compat.go:60-87 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) internal/store/postgres/channel_listener.go:67 — internal/store/postgres/channel_listener.go:67-95 | internal/store/postgres/read_model_listener.go:228-251 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) internal/compat/tdesktop/appearance_seed.go:148 — internal/compat/tdesktop/appearance_seed.go:148-171 | internal/rpc/wallpaper.go:190-216 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) internal/store/postgres/channel_listener.go:40 — internal/store/postgres/channel_listener.go:40-63 | internal/store/postgres/read_model_listener.go:203-226 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) internal/app/moderation/legacy.go:83 — internal/app/moderation/legacy.go:83-106 | internal/rpc/messages_helpers.go:38-61 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×16
  • Duplicated block (8 lines × 3) internal/app/channels/service.go:2241 — internal/app/channels/service.go:2241-2248 | internal/store/memory/channel_message_history.go:415-422 | internal/store/postgres/channel_message_history.go:585-592 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/channels/service.go:2241` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 3) internal/app/files/seed.go:255 — internal/app/files/seed.go:255-262 | internal/app/files/seed.go:276-283 | internal/app/files/seed.go:295-302 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/files/seed.go:255` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) internal/app/usernames/service.go:328 — internal/app/usernames/service.go:328-335 | internal/app/usernames/service.go:358-365 | internal/app/usernames/service.go:382-389 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 3) internal/domain/story.go:92 — internal/domain/story.go:92-99 | internal/store/memory/story.go:1518-1525 | internal/store/postgres/story.go:2361-2368 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (8 lines × 3) internal/rpc/channels_legacy_chat.go:177 — internal/rpc/channels_legacy_chat.go:177-184 | internal/rpc/channels_members.go:451-458 | internal/rpc/messages_bot_no_state.go:23-30 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: `internal/rpc/channels_legacy_chat.go:177` is reached only past a guard at line 174 that tests `req.UserID` and leaves the function early, and `internal/rpc/channels_members.go:451` reads `req.UserID` with no such check. What separates these copies is not which lines they run but which PRECONDITION they enforce, so one of them is operating on state the other one refuses. Decide which is intended BEFORE unifying them — extract the shared part and whichever copy is missing the check keeps running unchecked, and if the guard is the correct behaviour then that hole is already live.
  • Duplicated block (8 lines × 3) internal/rpc/channels_read_reactions.go:17 — internal/rpc/channels_read_reactions.go:17-24 | internal/rpc/channels_read_reactions.go:64-71 | internal/rpc/channels_settings.go:39-46 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 3) internal/rpc/messages_edit.go:177 — internal/rpc/messages_edit.go:177-184 | internal/rpc/messages_edit_geolive.go:111-118 | internal/rpc/messages_todos.go:268-275 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_edit.go:177` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/rpc/messages_edit.go:176` calls `enqueueBotAPIPrivateEditUpdatesAsync` and `internal/rpc/messages_edit_geolive.go:110` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 3) internal/rpc/messages_reactions_helpers.go:51 — internal/rpc/messages_reactions_helpers.go:51-58 | internal/rpc/payments.go:329-336 | internal/rpc/stories.go:3091-3098 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 3) internal/store/postgres/channel_member_admin.go:73 — internal/store/postgres/channel_member_admin.go:73-80 | internal/store/postgres/channel_member_admin.go:238-245 | internal/store/postgres/channel_member_admin.go:248-255 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_member_admin.go:73` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) internal/store/postgres/moderation.go:121 — internal/store/postgres/moderation.go:121-128 | internal/store/postgres/moderation_registries.go:86-93 | internal/store/postgres/moderation_registries.go:211-218 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/moderation.go:121` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) internal/store/postgres/verification.go:1080 — internal/store/postgres/verification.go:1080-1087 | internal/store/postgres/verification.go:1097-1105 | internal/store/postgres/verification.go:1131-1139 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/verification.go:1080` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) internal/store/postgres/authkey.go:436 — internal/store/postgres/authkey.go:436-443 | internal/store/postgres/collectible_username.go:688-695 | internal/store/postgres/dispatch_outbox.go:310-317 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/authkey.go:436` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) internal/app/groupcalls/service.go:266 — internal/app/groupcalls/service.go:266-273 | internal/app/phone/registry.go:117-124 | internal/app/secretchat/service.go:311-318 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/groupcalls/service.go:266` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 3) internal/store/postgres/user.go:47 — internal/store/postgres/user.go:47-54 | internal/store/postgres/user.go:77-84 | internal/store/postgres/user.go:95-102 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/user.go:47` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 3) REDACTED:272 — REDACTED:272-279 | internal/adminapi/server.go:190-197 | internal/web/server.go:120-127 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:272` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Check import visibility before settling on that home: `internal/adminapi/server.go`, `internal/web/server.go` sit under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
  • Duplicated block (8 lines × 3) internal/store/postgres/channel_stats.go:36 — internal/store/postgres/channel_stats.go:36-43 | internal/store/postgres/channel_stats.go:183-190 | internal/store/postgres/channel_stats.go:253-260 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_stats.go:36` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D3 · God Classes · FunctionTooLong · ×15
  • FunctionTooLong: main.run REDACTED:600 — FunctionTooLong — run runs 1117 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1017 over it, 11.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: config.Load internal/config/config.go:958 — FunctionTooLong — Load runs 485 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 385 over it, 4.85× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: main.doFetch cmd/appearancefetch/main.go:92 — FunctionTooLong — doFetch runs 225 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 125 over it, 2.25× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: loadharness.StartupRun REDACTED:138 — FunctionTooLong — StartupRun runs 216 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 116 over it, 2.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rpc.tgOtherUpdateFromEvent internal/rpc/convert_updates.go:253 — FunctionTooLong — tgOtherUpdateFromEvent runs 206 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 106 over it, 2.06× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: loadharness.Run REDACTED:738 — FunctionTooLong — Run runs 203 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 103 over it, 2.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: botapi.parseBotAPIMarkdownV2 internal/botapi/formatted_text.go:645 — FunctionTooLong — parseBotAPIMarkdownV2 runs 157 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 57 over it, 1.57× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rpc.cloneEntityWithBounds internal/rpc/messages_send.go:177 — FunctionTooLong — cloneEntityWithBounds runs 129 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 29 over it, 1.29× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: main.main REDACTED:86 — FunctionTooLong — main runs 115 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 15 over it, 1.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: postgres.persistPlainPrivateSendProjectionBatch internal/store/postgres/message_send_batch_sql.go:146 — FunctionTooLong — persistPlainPrivateSendProjectionBatch runs 114 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 14 over it, 1.14× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rpc.tgMessageMedia internal/rpc/convert_media.go:17 — FunctionTooLong — tgMessageMedia runs 112 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 12 over it, 1.12× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rpc.botAPIRichBlock REDACTED:41 — FunctionTooLong — botAPIRichBlock runs 108 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 8 over it, 1.08× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: rpc.tgMessageServiceAction internal/rpc/convert_messages.go:134 — FunctionTooLong — tgMessageServiceAction runs 106 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 6 over it, 1.06× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: loadharness.MutateOffline internal/loadharness/mutate.go:95 — FunctionTooLong — MutateOffline runs 102 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2 over it, 1.02× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: loadharness.runStartupAccount REDACTED:422 — FunctionTooLong — runStartupAccount runs 102 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2 over it, 1.02× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D4 · Code Duplication · Edited copy of a member (26 corresponding lines) · ×15
  • Edited copy of a member (26 corresponding lines) internal/store/postgres/channel_message_send.go:505 — internal/store/postgres/channel_message_send.go:505-544 | internal/store/postgres/channel_suggested_post.go:237-262 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) internal/admin/verification.go:137 — internal/admin/verification.go:137-162 | internal/admin/verification.go:171-208 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) internal/store/postgres/channel_reaction_unread.go:11 — internal/store/postgres/channel_reaction_unread.go:11-36 | internal/store/postgres/channel_read.go:275-300 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) internal/store/postgres/telegram_login.go:202 — internal/store/postgres/telegram_login.go:202-230 | internal/store/postgres/telegram_login.go:344-369 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) REDACTED:169 — REDACTED:169-198 | REDACTED:200-225 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) internal/app/bots/verifierbot.go:577 — internal/app/bots/verifierbot.go:577-602 | internal/app/bots/verifierbot.go:888-915 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) internal/rpc/stories.go:3412 — internal/rpc/stories.go:3412-3437 | internal/rpc/welcome_messages.go:334-359 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) internal/app/usernames/service.go:186 — internal/app/usernames/service.go:186-218 | internal/store/memory/id_allocator.go:185-210 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) cmd/telesrv-admin/privateview_store.go:515 — cmd/telesrv-admin/privateview_store.go:515-543 | cmd/telesrv-admin/privateview_store.go:545-570 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) REDACTED:770 — REDACTED:770-795 | REDACTED:797-825 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) cmd/telesrv-admin/readstore.go:2209 — cmd/telesrv-admin/readstore.go:2209-2236 | cmd/telesrv-admin/readstore.go:2736-2761 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) internal/store/contact_reverse_batch.go:143 — internal/store/contact_reverse_batch.go:143-169 | internal/store/read_model_batch.go:146-171 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) internal/mtprotoedge/outbound.go:1869 — internal/mtprotoedge/outbound.go:1869-1904 | internal/mtprotoedge/outbound.go:1907-1932 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) internal/store/postgres/ai.go:26 — internal/store/postgres/ai.go:26-51 | internal/store/postgres/themes.go:29-55 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) internal/store/postgres/botapi_update.go:134 — internal/store/postgres/botapi_update.go:134-163 | internal/store/postgres/encrypted_queue.go:137-162 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (25 corresponding lines) · ×14
  • Edited copy of a member (25 corresponding lines) internal/rpc/messages_getmessages_trace.go:145 — internal/rpc/messages_getmessages_trace.go:145-169 | internal/rpc/messages_getmessages_trace.go:171-204 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) internal/app/files/sticker_management.go:49 — internal/app/files/sticker_management.go:49-83 | internal/app/files/sticker_management.go:85-109 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) internal/rpc/ephemeral.go:384 — internal/rpc/ephemeral.go:384-408 | internal/rpc/welcome_messages.go:269-300 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) internal/rpc/expiry_dispatcher.go:50 — internal/rpc/expiry_dispatcher.go:50-79 | internal/rpc/expiry_dispatcher.go:81-105 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) internal/rpc/account_business.go:325 — internal/rpc/account_business.go:325-356 | internal/rpc/account_business.go:358-382 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) internal/app/botverification/service.go:996 — internal/app/botverification/service.go:996-1020 | internal/app/botverification/service.go:1028-1060 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) internal/rpc/bots_longtail.go:250 — internal/rpc/bots_longtail.go:250-274 | internal/rpc/bots_longtail.go:276-306 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) cmd/telesrv-admin/readstore.go:1604 — cmd/telesrv-admin/readstore.go:1604-1628 | cmd/telesrv-admin/readstore.go:1630-1654 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) internal/store/postgres/telegram_login.go:42 — internal/store/postgres/telegram_login.go:42-66 | internal/store/postgres/telegram_login.go:68-100 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) internal/store/postgres/dispatch_outbox.go:244 — internal/store/postgres/dispatch_outbox.go:244-268 | internal/store/postgres/message_send.go:955-981 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) internal/store/postgres/channel_message_delete.go:127 — internal/store/postgres/channel_message_delete.go:127-151 | internal/store/postgres/channel_topics.go:817-857 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) internal/hoststats/cpu_unix.go:24 — internal/hoststats/cpu_unix.go:24-48 | REDACTED:24-48 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) cmd/telesrv-admin/readstore.go:895 — cmd/telesrv-admin/readstore.go:895-933 | cmd/telesrv-admin/readstore.go:1754-1778 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) internal/app/messages/business_automation.go:324 — internal/app/messages/business_automation.go:324-348 | internal/domain/business.go:269-302 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (27 corresponding lines) · ×14
  • Edited copy of a member (27 corresponding lines) REDACTED:685 — REDACTED:685-716 | REDACTED:718-744 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) cmd/telesrv-admin/readstore.go:1535 — cmd/telesrv-admin/readstore.go:1535-1566 | cmd/telesrv-admin/readstore.go:1568-1594 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) internal/rpc/messages_dialogs.go:485 — internal/rpc/messages_dialogs.go:485-515 | internal/rpc/messages_dialogs.go:517-543 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) internal/rpc/presence.go:971 — internal/rpc/presence.go:971-997 | internal/rpc/presence.go:999-1025 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) internal/rpc/bots_longtail.go:308 — internal/rpc/bots_longtail.go:308-334 | internal/rpc/bots_longtail.go:336-369 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) internal/compat/tdesktop/dialogs.go:85 — internal/compat/tdesktop/dialogs.go:85-111 | internal/compat/tdesktop/dialogs.go:118-144 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) internal/adminapi/account_rating.go:62 — internal/adminapi/account_rating.go:62-88 | internal/adminapi/server.go:1785-1811 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) internal/store/postgres/channel_helpers.go:606 — internal/store/postgres/channel_helpers.go:606-637 | internal/store/postgres/premium.go:34-60 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) internal/store/memory/channel_core.go:162 — internal/store/memory/channel_core.go:162-188 | internal/store/postgres/channel_core.go:289-316 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) REDACTED:766 — REDACTED:766-792 | REDACTED:806-833 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) internal/store/postgres/message_delete.go:532 — internal/store/postgres/message_delete.go:532-562 | internal/store/postgres/message_send.go:920-946 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) internal/rpc/phone_calls.go:148 — internal/rpc/phone_calls.go:148-174 | internal/rpc/phone_calls.go:176-204 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) internal/rpc/botapi_gateway.go:937 — internal/rpc/botapi_gateway.go:937-971 | internal/rpc/botapi_gateway.go:973-999 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) internal/rpc/router.go:1517 — internal/rpc/router.go:1517-1549 | internal/rpc/router.go:1551-1577 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×14
  • Duplicated block (17 lines × 2) cmd/telesrv-admin/botverification.go:106 — cmd/telesrv-admin/botverification.go:106-122 | cmd/telesrv-admin/botverification.go:153-169 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/telesrv-admin/botverification.go:106` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) internal/adminapi/server.go:840 — internal/adminapi/server.go:840-856 | internal/adminapi/server.go:874-890 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (17 lines × 2) internal/app/account/phone_change.go:295 — internal/app/account/phone_change.go:295-311 | internal/app/auth/service.go:1885-1901 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (17 lines × 2) internal/app/files/sticker_admin.go:210 — internal/app/files/sticker_admin.go:210-226 | internal/app/files/sticker_management.go:67-83 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/files/sticker_admin.go:210` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) internal/app/moderation/legacy.go:84 — internal/app/moderation/legacy.go:84-100 | internal/rpc/messages_helpers.go:39-55 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/moderation/legacy.go:84` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) internal/rpc/messages_bot_no_state.go:153 — internal/rpc/messages_bot_no_state.go:153-169 | internal/rpc/messages_bot_no_state.go:245-261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) internal/rpc/messages_bot_no_state.go:316 — internal/rpc/messages_bot_no_state.go:316-332 | internal/rpc/messages_send.go:771-787 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_bot_no_state.go:316` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) internal/rpc/payments_star_gifts.go:445 — internal/rpc/payments_star_gifts.go:445-461 | internal/rpc/payments_star_gifts.go:641-657 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) internal/store/memory/channel_invites.go:748 — internal/store/memory/channel_invites.go:748-764 | internal/store/postgres/channel_invite_import.go:129-145 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/store/postgres/channel_invite_import.go:126` calls `Is` and `internal/store/memory/channel_invites.go:746` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (17 lines × 2) internal/store/memory/channel_message_edit.go:28 — internal/store/memory/channel_message_edit.go:28-44 | internal/store/postgres/channel_message_edit.go:84-100 — `internal/store/memory/channel_message_edit.go` and `internal/store/postgres/channel_message_edit.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 56 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_message_edit.go:28` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) internal/store/memory/langpack.go:221 — internal/store/memory/langpack.go:221-237 | internal/store/postgres/langpack.go:396-412 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (17 lines × 2) internal/store/memory/verification.go:329 — internal/store/memory/verification.go:329-345 | internal/store/postgres/verification.go:483-499 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/store/postgres/verification.go:481` calls `Errorf` and `internal/store/memory/verification.go:328` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (17 lines × 2) internal/store/memory/channel_reactions.go:482 — internal/store/memory/channel_reactions.go:482-498 | internal/store/memory/channel_reactions.go:517-533 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_reactions.go:482` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (17 lines × 2) internal/store/postgres/moderation_cases.go:151 — internal/store/postgres/moderation_cases.go:151-167 | internal/store/postgres/moderation_cases.go:241-257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Edited copy of a member (8 corresponding lines) · ×13
  • Edited copy of a member (8 corresponding lines) cmd/telesrv-load/main.go:278 — cmd/telesrv-load/main.go:278-286 | cmd/telesrv-load/main.go:460-467 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) REDACTED:622 — REDACTED:622-629 | REDACTED:631-638 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) internal/store/memory/verification.go:780 — internal/store/memory/verification.go:780-787 | internal/store/postgres/channel_core.go:614-626 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) cmd/walletminiapp/main.go:500 — cmd/walletminiapp/main.go:500-507 | cmd/walletminiapp/main.go:509-522 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) internal/store/memory/business.go:494 — internal/store/memory/business.go:494-501 | internal/store/memory/story.go:1398-1405 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) internal/rpc/channel_full_bot_cache.go:152 — internal/rpc/channel_full_bot_cache.go:152-162 | internal/domain/moderation.go:479-486 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) internal/app/files/blobcache.go:149 — internal/app/files/blobcache.go:149-156 | internal/store/postgres/media.go:557-567 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) internal/store/postgres/star_gift_lifecycle.go:1873 — internal/store/postgres/star_gift_lifecycle.go:1873-1880 | REDACTED:1106-1113 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) internal/store/postgres/business.go:16 — internal/store/postgres/business.go:16-33 | internal/store/postgres/telegram_login.go:249-256 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) internal/app/bots/miniapp.go:174 — internal/app/bots/miniapp.go:174-181 | REDACTED:971-978 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) internal/store/memory/ai.go:184 — internal/store/memory/ai.go:184-191 | internal/store/memory/themes.go:146-153 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) internal/app/langpack/seed.go:220 — internal/app/langpack/seed.go:220-227 | internal/loadharness/mutate.go:538-545 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) internal/rpc/fragment.go:234 — internal/rpc/fragment.go:234-242 | internal/rpc/payments_star_gifts.go:1445-1452 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×13
  • Duplicated block (5 lines × 3) REDACTED:2043 — REDACTED:2043-2047 | REDACTED:2089-2093 | cmd/telesrv-admin/star_gift_catalog.go:101-105 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:2043` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (5 lines × 3) internal/admin/botverification.go:626 — internal/admin/botverification.go:626-630 | internal/admin/botverification.go:666-670 | internal/admin/botverification.go:710-714 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/admin/botverification.go:626` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) internal/app/updates/service.go:778 — internal/app/updates/service.go:778-782 | internal/store/postgres/update_event.go:77-81 | internal/store/postgres/update_event.go:139-143 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/updates/service.go:778` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/store/postgres/update_event.go:83` calls `String` and `internal/app/updates/service.go:784` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 3) internal/rpc/messages_dialogs.go:635 — internal/rpc/messages_dialogs.go:635-639 | internal/rpc/messages_dialogs.go:696-700 | internal/rpc/messages_dialogs.go:743-747 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_dialogs.go:635` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) internal/rpc/messages_quick_replies.go:223 — internal/rpc/messages_quick_replies.go:223-227 | internal/store/memory/message_forward.go:92-96 | internal/store/postgres/message_forward.go:111-115 — `internal/store/memory/message_forward.go` and `internal/store/postgres/message_forward.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 51 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_quick_replies.go:223` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) internal/store/memory/groupcall.go:723 — internal/store/memory/groupcall.go:723-727 | internal/store/memory/message_delete.go:87-91 | internal/store/postgres/message_delete.go:247-251 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (5 lines × 3) internal/store/memory/message_read.go:61 — internal/store/memory/message_read.go:61-65 | REDACTED:716-720 | internal/store/postgres/channel_message_delete.go:171-175 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (5 lines × 3) internal/store/storetest/groupcall.go:259 — internal/store/storetest/groupcall.go:259-263 | internal/store/storetest/groupcall.go:288-292 | internal/store/storetest/groupcall.go:548-552 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (5 lines × 3) internal/store/postgres/telegram_login.go:491 — internal/store/postgres/telegram_login.go:491-495 | internal/store/postgres/telegram_login.go:502-506 | internal/store/postgres/telegram_login.go:513-517 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/telegram_login.go:491` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) cmd/telesrv-admin/botverification.go:263 — cmd/telesrv-admin/botverification.go:263-267 | cmd/telesrv-admin/botverification.go:282-286 | cmd/telesrv-admin/botverification.go:301-305 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (5 lines × 3) cmd/telesrv-admin/verification.go:141 — cmd/telesrv-admin/verification.go:141-145 | cmd/telesrv-admin/verification.go:160-164 | cmd/telesrv-admin/verification.go:179-183 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (5 lines × 3) internal/app/bots/stickersbot.go:275 — internal/app/bots/stickersbot.go:275-279 | internal/app/bots/stickersbot.go:352-356 | internal/app/bots/stickersbot.go:458-462 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 3) internal/rpc/presence.go:778 — internal/rpc/presence.go:778-782 | internal/rpc/update_peer_refs.go:280-284 | internal/rpc/update_peer_refs.go:296-300 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/presence.go:778` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/rpc/update_peer_refs.go:279` calls `removeKnownChannelRefs` and `internal/rpc/presence.go:777` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×12
  • Duplicated block (18 lines × 2) cmd/walletminiapp/main.go:375 — cmd/walletminiapp/main.go:375-392 | internal/rpc/messages_webview.go:738-755 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `string` to `botToken` in one and `startParam` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. Check import visibility before settling on that home: `internal/rpc/messages_webview.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
  • Duplicated block (18 lines × 2) internal/admin/service.go:3376 — internal/admin/service.go:3376-3393 | internal/web/server.go:1041-1058 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/admin/service.go:3376` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) REDACTED:194 — REDACTED:194-211 | internal/app/account/phone_change.go:49-66 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:212` calls `TrimSpace`, `Errorf` and `internal/app/account/phone_change.go:67` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (18 lines × 2) internal/app/bots/premiumbot.go:78 — internal/app/bots/premiumbot.go:78-95 | internal/app/donations/service.go:506-523 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (18 lines × 2) internal/rpc/messages_bot_no_state.go:342 — internal/rpc/messages_bot_no_state.go:342-359 | internal/rpc/messages_send.go:805-822 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_bot_no_state.go:342` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) internal/store/memory/auth.go:118 — internal/store/memory/auth.go:118-135 | internal/store/memory/auth.go:420-437 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) internal/store/memory/botapi_update.go:419 — internal/store/memory/botapi_update.go:419-436 | internal/store/postgres/botapi_update.go:685-702 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) internal/store/memory/channel_members.go:1154 — internal/store/memory/channel_members.go:1154-1171 | internal/store/postgres/channel_member_helpers.go:490-507 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (18 lines × 2) internal/store/memory/message_helpers.go:73 — internal/store/memory/message_helpers.go:73-90 | internal/store/postgres/message_helpers.go:41-58 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (18 lines × 2) internal/store/memory/telegram_login.go:327 — internal/store/memory/telegram_login.go:327-344 | internal/store/postgres/telegram_login.go:666-683 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (18 lines × 2) internal/store/postgres/moderation_cases.go:130 — internal/store/postgres/moderation_cases.go:130-147 | internal/store/postgres/moderation_cases.go:220-237 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/moderation_cases.go:130` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (18 lines × 2) internal/store/memory/channel_reactions.go:871 — internal/store/memory/channel_reactions.go:871-888 | internal/store/postgres/channel_reaction_helpers.go:250-267 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×12
  • Duplicated block (10 lines × 3) internal/rpc/messages_pin.go:29 — internal/rpc/messages_pin.go:29-38 | internal/rpc/messages_pin.go:121-130 | internal/rpc/messages_read.go:30-39 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_pin.go:29` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 3) internal/rpc/stories.go:2417 — internal/rpc/stories.go:2417-2426 | internal/rpc/stories.go:2501-2510 | internal/rpc/stories.go:2736-2745 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/stories.go:2417` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 3) internal/store/memory/channel_members.go:627 — internal/store/memory/channel_members.go:627-636 | internal/store/memory/channel_settings.go:103-112 | internal/store/memory/channel_settings.go:146-155 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (10 lines × 3) REDACTED:50 — REDACTED:50-59 | REDACTED:72-81 | REDACTED:363-372 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 3) internal/store/postgres/channel_message_delete.go:211 — internal/store/postgres/channel_message_delete.go:211-220 | internal/store/postgres/channel_message_delete.go:384-393 | internal/store/postgres/channel_topics.go:401-410 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (10 lines × 3) internal/store/postgres/story.go:619 — internal/store/postgres/story.go:619-628 | internal/store/postgres/story.go:679-688 | internal/store/postgres/story.go:747-756 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 3) internal/app/channels/media_count_cache.go:125 — internal/app/channels/media_count_cache.go:125-134 | internal/app/messages/private_media_count_cache.go:154-163 | internal/rpc/media_count.go:48-57 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (10 lines × 3) internal/app/verification/service.go:1345 — internal/app/verification/service.go:1345-1354 | internal/store/memory/verification.go:892-901 | internal/store/postgres/verification.go:1265-1274 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (10 lines × 3) internal/rpc/aicompose.go:237 — internal/rpc/aicompose.go:237-246 | internal/rpc/encrypted_chats.go:42-51 | internal/rpc/phone_calls.go:41-50 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (10 lines × 3) internal/app/stories/service.go:476 — internal/app/stories/service.go:476-485 | internal/store/memory/story.go:1076-1085 | internal/store/postgres/story.go:2292-2301 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (10 lines × 3) internal/store/postgres/authorization.go:565 — internal/store/postgres/authorization.go:565-574 | internal/store/postgres/bot_miniapp.go:540-549 | internal/store/postgres/bot_miniapp.go:569-578 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (10 lines × 3) internal/store/postgres/user.go:266 — internal/store/postgres/user.go:266-275 | internal/store/postgres/user.go:572-581 | internal/store/postgres/user.go:666-675 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×12
  • Duplicated block (7 lines × 3) internal/admin/service.go:2680 — internal/admin/service.go:2680-2686 | internal/admin/service.go:2734-2740 | internal/admin/service.go:2788-2794 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (7 lines × 3) internal/adminapi/botverification.go:357 — internal/adminapi/botverification.go:357-363 | internal/adminapi/botverification.go:374-380 | internal/adminapi/botverification.go:393-399 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/adminapi/botverification.go:357` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/adminapi/botverification.go:354` calls `FormatInt` and `internal/adminapi/botverification.go:371` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 3) internal/rpc/channel_fanout_dispatcher.go:1067 — internal/rpc/channel_fanout_dispatcher.go:1067-1073 | internal/rpc/channel_fanout_dispatcher.go:1177-1183 | internal/rpc/channel_fanout_dispatcher.go:1200-1206 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/channel_fanout_dispatcher.go:1067` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note first that the copies are not typed on the same thing: the declarations holding them bind `int64` to `originUserID` in one and `channelID` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7 lines × 3) internal/rpc/channels_legacy_chat.go:305 — internal/rpc/channels_legacy_chat.go:305-311 | internal/rpc/messages_suggested_post.go:42-48 | internal/rpc/phone_group_call.go:200-206 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 3) internal/rpc/channels_legacy_chat.go:431 — internal/rpc/channels_legacy_chat.go:431-437 | internal/rpc/channels_members.go:232-238 | internal/rpc/channels_members.go:526-532 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 3) internal/rpc/messages_saved_dialogs.go:71 — internal/rpc/messages_saved_dialogs.go:71-77 | internal/rpc/messages_saved_dialogs.go:94-100 | internal/rpc/messages_saved_dialogs.go:137-143 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_saved_dialogs.go:71` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 3) internal/store/postgres/channel_message_edit.go:123 — internal/store/postgres/channel_message_edit.go:123-129 | internal/store/postgres/channel_message_edit.go:219-225 | internal/store/postgres/channel_message_edit.go:353-359 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_message_edit.go:123` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 3) REDACTED:237 — REDACTED:237-243 | internal/app/account/phone_change.go:88-94 | internal/app/account/phone_change.go:154-160 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:237` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (7 lines × 3) internal/app/botverification/service.go:652 — internal/app/botverification/service.go:652-658 | internal/store/memory/bot_verification.go:244-250 | internal/store/postgres/bot_verification.go:287-293 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/store/postgres/bot_verification.go:285` calls `Errorf` and `internal/store/memory/bot_verification.go:243` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 3) internal/app/bots/verifierbot.go:1578 — internal/app/bots/verifierbot.go:1578-1584 | internal/app/bots/verifybot.go:1407-1413 | internal/app/verification/service.go:1416-1422 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (7 lines × 3) internal/store/postgres/channel_helpers.go:716 — internal/store/postgres/channel_helpers.go:716-722 | internal/store/postgres/channel_helpers.go:789-795 | internal/store/postgres/story.go:1992-1998 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_helpers.go:716` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (7 lines × 3) REDACTED:2026 — REDACTED:2026-2032 | REDACTED:2072-2078 | cmd/telesrv-admin/star_gift_catalog.go:188-194 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Edited copies of one member (3 members, 12+ corresponding lines) · ×11
  • Edited copies of one member (3 members, 12+ corresponding lines) internal/rpc/story_pinned_stories_cache.go:123 — internal/rpc/story_pinned_stories_cache.go:123-140 | internal/store/memory/story.go:1407-1418 | internal/store/postgres/story.go:2534-2545 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) internal/app/messages/service.go:468 — internal/app/messages/service.go:468-479 | internal/app/messages/service.go:482-493 | internal/app/messages/service.go:496-507 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) REDACTED:2211 — REDACTED:2211-2222 | REDACTED:2480-2491 | cmd/telesrv-admin/star_gift_catalog.go:154-166 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) cmd/telesrv-admin/account_rating.go:18 — cmd/telesrv-admin/account_rating.go:18-29 | cmd/telesrv-admin/account_rating.go:39-51 | REDACTED:2604-2617 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) internal/app/users/service.go:638 — internal/app/users/service.go:638-649 | internal/app/users/service.go:720-731 | internal/app/users/service.go:734-745 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) internal/rpc/channels_topics.go:102 — internal/rpc/channels_topics.go:102-114 | internal/rpc/channels_updates.go:354-365 | internal/rpc/channels_updates.go:367-381 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) internal/app/channels/service.go:1389 — internal/app/channels/service.go:1389-1400 | internal/app/channels/service.go:1598-1609 | internal/app/channels/service.go:1612-1623 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) internal/loadharness/mutate.go:78 — internal/loadharness/mutate.go:78-89 | internal/loadharness/seed.go:44-55 | internal/loadharness/snapshot.go:88-99 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) internal/store/memory/verification.go:452 — internal/store/memory/verification.go:452-463 | internal/store/memory/verification.go:467-478 | internal/store/memory/verification.go:481-492 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) internal/store/postgres/dialog.go:677 — internal/store/postgres/dialog.go:677-691 | internal/store/postgres/dialog.go:812-823 | internal/store/postgres/dialog.go:916-929 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) internal/rpc/account.go:2235 — internal/rpc/account.go:2235-2246 | internal/rpc/bots_errors.go:94-107 | internal/rpc/channels_settings.go:572-583 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×11
  • Duplicated block (12 lines × 3) internal/app/channels/media_count_cache.go:110 — internal/app/channels/media_count_cache.go:110-121 | internal/app/channels/read_model_cache.go:70-85 | internal/app/channels/resolve_cache.go:72-83 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 3) internal/mtprotoedge/transport_ownership.go:134 — internal/mtprotoedge/transport_ownership.go:134-145 | internal/mtprotoedge/transport_ownership.go:154-165 | internal/mtprotoedge/transport_ownership.go:178-189 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/mtprotoedge/transport_ownership.go:134` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (12 lines × 3) internal/rpc/botapi_gateway.go:180 — internal/rpc/botapi_gateway.go:180-191 | internal/rpc/botapi_gateway.go:238-249 | internal/rpc/botapi_gateway.go:296-307 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/botapi_gateway.go:180` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/rpc/botapi_gateway.go:193` calls `New` and `internal/rpc/botapi_gateway.go:308` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 3) internal/rpc/channels_invites.go:380 — internal/rpc/channels_invites.go:380-391 | internal/store/memory/channel_core.go:284-295 | internal/store/postgres/channel_core.go:631-642 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/channels_invites.go:380` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 3) internal/rpc/messages_scheduled.go:10 — internal/rpc/messages_scheduled.go:10-21 | internal/rpc/messages_scheduled.go:73-84 | internal/rpc/messages_scheduled.go:106-117 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (12 lines × 3) internal/rpc/messages_webview.go:72 — internal/rpc/messages_webview.go:72-83 | internal/rpc/messages_webview.go:191-202 | internal/rpc/messages_webview.go:262-273 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_webview.go:72` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 3) internal/rpc/stories.go:2303 — internal/rpc/stories.go:2303-2314 | internal/rpc/stories.go:2359-2370 | internal/rpc/stories.go:2765-2776 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/stories.go:2303` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) internal/store/memory/channel_dialogs.go:571 — internal/store/memory/channel_dialogs.go:571-582 | internal/store/memory/dialogs.go:850-861 | REDACTED:2179-2190 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_dialogs.go:571` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 3) internal/store/memory/channel_message_delete.go:133 — internal/store/memory/channel_message_delete.go:133-144 | internal/store/memory/channel_message_delete.go:177-188 | internal/store/memory/channel_topics.go:394-405 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_message_delete.go:133` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) internal/rpc/stories.go:3376 — internal/rpc/stories.go:3376-3387 | internal/store/memory/story.go:1541-1552 | internal/store/postgres/story.go:2384-2395 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (12 lines × 3) internal/store/memory/login_code_delivery.go:69 — internal/store/memory/login_code_delivery.go:69-80 | internal/store/postgres/login_code_delivery.go:98-109 | internal/store/postgres/login_code_delivery.go:269-280 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/login_code_delivery.go:69` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Edited copy of a member (32 corresponding lines) · ×10
  • Edited copy of a member (32 corresponding lines) internal/store/memory/message_reactions.go:236 — internal/store/memory/message_reactions.go:236-267 | internal/store/postgres/message_reactions.go:427-458 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) internal/rpc/channels_members.go:643 — internal/rpc/channels_members.go:643-674 | internal/rpc/channels_members.go:676-712 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) internal/store/postgres/media_search.go:224 — internal/store/postgres/media_search.go:224-255 | internal/store/postgres/media_search.go:286-321 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) internal/mtprotoedge/session_manager.go:318 — internal/mtprotoedge/session_manager.go:318-349 | internal/mtprotoedge/session_manager.go:394-438 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) internal/store/postgres/active_channel_ids_batch.go:219 — internal/store/postgres/active_channel_ids_batch.go:219-254 | internal/store/postgres/bootstrap_update_job_batch.go:249-280 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) internal/store/postgres/account_rating.go:73 — internal/store/postgres/account_rating.go:73-104 | internal/store/postgres/bot_verification.go:447-486 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) internal/store/postgres/story.go:401 — internal/store/postgres/story.go:401-436 | internal/store/postgres/story.go:565-596 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) internal/admin/service.go:3362 — internal/admin/service.go:3362-3393 | internal/web/server.go:1027-1058 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) internal/store/postgres/auth_identity_lock.go:80 — internal/store/postgres/auth_identity_lock.go:80-111 | internal/store/postgres/channel_reaction_unread.go:404-435 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) internal/store/postgres/authkey_session_layer.go:20 — internal/store/postgres/authkey_session_layer.go:20-51 | internal/store/postgres/authkey_session_layer.go:119-179 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) · ×10
  • Edited copies of one member (3 members, 18+ corresponding lines) internal/store/postgres/channel_member_helpers.go:333 — internal/store/postgres/channel_member_helpers.go:333-354 | internal/store/postgres/channel_member_helpers.go:371-388 | internal/store/postgres/channel_member_helpers.go:390-409 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) internal/store/postgres/active_channel_ids_batch.go:200 — internal/store/postgres/active_channel_ids_batch.go:200-217 | internal/store/postgres/authkey_session_layer_batch.go:219-237 | internal/store/postgres/bootstrap_update_job_batch.go:229-247 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) internal/observability/metrics/registry.go:158 — internal/observability/metrics/registry.go:158-175 | internal/observability/metrics/registry.go:177-194 | internal/observability/metrics/registry.go:196-213 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) internal/rpc/bot_verification_notify.go:85 — internal/rpc/bot_verification_notify.go:85-107 | internal/rpc/username_notify.go:47-64 | internal/rpc/verification_notify.go:99-117 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) internal/app/account/business.go:469 — internal/app/account/business.go:469-486 | REDACTED:583-600 | internal/rpc/phone_group_call_updates.go:218-235 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) internal/rpc/aicompose.go:122 — internal/rpc/aicompose.go:122-139 | internal/rpc/aicompose.go:141-158 | internal/rpc/aicompose.go:179-199 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) internal/app/moderation/evidence.go:647 — internal/app/moderation/evidence.go:647-664 | internal/rpc/messages_send.go:356-373 | internal/rpc/messages_send.go:375-392 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) internal/store/memory/auth_delivery_report.go:66 — internal/store/memory/auth_delivery_report.go:66-83 | internal/store/memory/moderation.go:279-296 | internal/store/memory/moderation.go:752-769 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) internal/adminapi/server.go:1540 — internal/adminapi/server.go:1540-1557 | internal/adminapi/server.go:1559-1578 | internal/adminapi/server.go:1580-1599 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) internal/store/memory/bot_verification.go:215 — internal/store/memory/bot_verification.go:215-232 | internal/store/memory/bot_verification.go:368-385 | internal/store/memory/bot_verification.go:750-767 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (23 corresponding lines) · ×10
  • Edited copy of a member (23 corresponding lines) internal/store/memory/channel_invites.go:834 — internal/store/memory/channel_invites.go:834-859 | internal/store/memory/channel_members.go:847-869 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) internal/app/files/photos.go:936 — internal/app/files/photos.go:936-959 | internal/app/files/photos.go:961-983 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) cmd/stickerseeddeploy/main.go:111 — cmd/stickerseeddeploy/main.go:111-136 | cmd/stickerseeddeploy/main.go:138-160 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) internal/rpc/botapi_update_queue.go:373 — internal/rpc/botapi_update_queue.go:373-395 | internal/rpc/botapi_update_queue.go:397-420 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) internal/store/postgres/channel_member_list.go:405 — internal/store/postgres/channel_member_list.go:405-430 | REDACTED:425-447 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) internal/store/postgres/channel_member_list.go:368 — internal/store/postgres/channel_member_list.go:368-403 | internal/store/postgres/channel_updates.go:492-514 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) internal/rpc/account_business.go:121 — internal/rpc/account_business.go:121-143 | internal/rpc/messages_quick_replies.go:12-36 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) internal/adminapi/botverification.go:539 — internal/adminapi/botverification.go:539-561 | internal/adminapi/verification.go:339-361 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) internal/mtprotoedge/bulk_rpc_scheduler.go:168 — internal/mtprotoedge/bulk_rpc_scheduler.go:168-190 | internal/mtprotoedge/outbound.go:1137-1159 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) internal/mtprotoedge/logical_session.go:19 — internal/mtprotoedge/logical_session.go:19-41 | internal/mtprotoedge/logical_session.go:46-76 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 14+ corresponding lines) · ×10
  • Edited copies of one member (3 members, 14+ corresponding lines) internal/app/channels/service.go:2021 — internal/app/channels/service.go:2021-2035 | internal/app/channels/service.go:2111-2124 | internal/app/channels/service.go:2142-2155 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) internal/store/postgres/channel_reaction_unread.go:164 — internal/store/postgres/channel_reaction_unread.go:164-177 | internal/store/postgres/channel_read.go:641-654 | internal/store/postgres/channel_topics.go:918-931 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) internal/app/contacts/service.go:460 — internal/app/contacts/service.go:460-473 | internal/app/contacts/service.go:475-488 | internal/app/contacts/service.go:490-503 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) internal/store/postgres/star_gift.go:91 — internal/store/postgres/star_gift.go:91-104 | internal/store/postgres/star_gift.go:109-122 | internal/store/postgres/star_gift.go:124-155 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) internal/rpc/messages_forum.go:259 — internal/rpc/messages_forum.go:259-272 | internal/rpc/payments.go:328-341 | internal/rpc/welcome_messages.go:123-136 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) internal/rpc/account.go:1007 — internal/rpc/account.go:1007-1023 | internal/rpc/account.go:1066-1082 | internal/rpc/account.go:1096-1109 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) internal/rpc/bot_verification_notify.go:61 — internal/rpc/bot_verification_notify.go:61-80 | internal/rpc/username_notify.go:32-45 | internal/rpc/verification_notify.go:68-87 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) internal/store/postgres/user.go:71 — internal/store/postgres/user.go:71-84 | internal/store/postgres/user.go:89-102 | internal/store/postgres/user.go:126-143 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) internal/store/memory/groupcall.go:458 — internal/store/memory/groupcall.go:458-471 | internal/store/memory/groupcall.go:473-486 | internal/store/memory/groupcall.go:811-827 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) internal/app/files/sticker_management.go:140 — internal/app/files/sticker_management.go:140-157 | internal/app/files/sticker_management.go:161-178 | internal/app/files/sticker_management.go:209-222 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 10+ corresponding lines) · ×10
  • Edited copies of one member (3 members, 10+ corresponding lines) internal/store/postgres/telegram_login.go:490 — internal/store/postgres/telegram_login.go:490-499 | internal/store/postgres/telegram_login.go:501-510 | internal/store/postgres/telegram_login.go:512-521 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) internal/rpc/messages_helpers.go:603 — internal/rpc/messages_helpers.go:603-612 | internal/rpc/payments_star_gift_lifecycle.go:1148-1157 | internal/rpc/payments_star_gifts.go:1336-1348 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) internal/app/messages/service.go:352 — internal/app/messages/service.go:352-361 | internal/app/messages/service.go:400-409 | internal/app/messages/service.go:854-863 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) internal/rpc/story_peer_projection.go:69 — internal/rpc/story_peer_projection.go:69-79 | internal/rpc/story_peer_projection.go:214-223 | internal/rpc/story_peer_projection.go:225-234 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) internal/rpc/contacts.go:1178 — internal/rpc/contacts.go:1178-1187 | internal/rpc/contacts.go:1195-1206 | internal/rpc/contacts.go:1208-1217 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) internal/rpc/account.go:718 — internal/rpc/account.go:718-727 | REDACTED:835-844 | internal/rpc/chatlists.go:269-281 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) internal/store/postgres/media_codec.go:111 — internal/store/postgres/media_codec.go:111-120 | REDACTED:410-419 | internal/store/postgres/story.go:2477-2486 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) internal/store/postgres/story.go:2466 — internal/store/postgres/story.go:2466-2475 | internal/store/postgres/themes.go:225-234 | internal/store/postgres/update_event.go:897-906 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) internal/store/postgres/business.go:799 — internal/store/postgres/business.go:799-808 | internal/store/postgres/story.go:2488-2497 | internal/store/postgres/update_event.go:919-928 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) internal/rpc/messages_helpers.go:394 — internal/rpc/messages_helpers.go:394-403 | internal/rpc/messages_reactions_helpers.go:167-176 | internal/rpc/stats.go:535-544 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×10
  • Duplicated block (19 lines × 2) cmd/telesrv-admin/botverification.go:566 — cmd/telesrv-admin/botverification.go:566-584 | cmd/telesrv-admin/verification.go:244-262 — before extracting anything, compare `cmd/telesrv-admin/botverification.go` and `cmd/telesrv-admin/verification.go` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (19 lines × 2) internal/app/files/appearance_seed.go:142 — internal/app/files/appearance_seed.go:142-160 | internal/app/files/seed_state.go:169-187 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/files/appearance_seed.go:142` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 2) internal/app/messages/business_automation.go:325 — internal/app/messages/business_automation.go:325-343 | internal/domain/business.go:270-288 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (19 lines × 2) internal/rpc/channel_fanout_dispatcher.go:1236 — internal/rpc/channel_fanout_dispatcher.go:1236-1254 | internal/rpc/channel_fanout_dispatcher.go:1319-1337 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/channel_fanout_dispatcher.go:1236` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 2) internal/rpc/photos.go:38 — internal/rpc/photos.go:38-56 | internal/rpc/photos.go:86-104 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 2) internal/store/memory/channel_monoforum.go:86 — internal/store/memory/channel_monoforum.go:86-104 | internal/store/postgres/channel_monoforum.go:136-154 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: `internal/store/postgres/channel_monoforum.go:136` is reached only past a guard at line 96 that tests `domain.ErrChannelPrivate` and leaves the function early, and `internal/store/memory/channel_monoforum.go:86` reads `domain.ErrChannelPrivate` with no such check. What separates these copies is not which lines they run but which PRECONDITION they enforce, so one of them is operating on state the other one refuses. Decide which is intended BEFORE unifying them — extract the shared part and whichever copy is missing the check keeps running unchecked, and if the guard is the correct behaviour then that hole is already live.
  • Duplicated block (19 lines × 2) internal/rpc/update_peer_refs.go:335 — internal/rpc/update_peer_refs.go:335-353 | internal/rpc/update_peer_refs.go:425-443 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) internal/store/memory/botapi_update.go:448 — internal/store/memory/botapi_update.go:448-466 | internal/store/postgres/botapi_update.go:706-724 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/botapi_update.go:448` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (19 lines × 2) cmd/telesrv-admin/star_gift_catalog.go:212 — cmd/telesrv-admin/star_gift_catalog.go:212-230 | internal/adminapi/server.go:1267-1285 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/telesrv-admin/star_gift_catalog.go:212` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Check import visibility before settling on that home: `internal/adminapi/server.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
  • Duplicated block (19 lines × 2) internal/store/postgres/dialog.go:79 — internal/store/postgres/dialog.go:79-97 | internal/store/postgres/dialog.go:295-313 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/dialog.go:79` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×10
  • Duplicated block (11 lines × 3) internal/admin/service.go:3396 — internal/admin/service.go:3396-3406 | internal/web/server.go:1015-1025 | internal/web/server.go:1061-1071 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 3) internal/rpc/communities.go:296 — internal/rpc/communities.go:296-306 | internal/rpc/communities.go:323-333 | internal/rpc/communities.go:460-470 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 3) internal/rpc/communities.go:350 — internal/rpc/communities.go:350-360 | internal/rpc/communities.go:380-390 | internal/rpc/communities.go:414-424 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 3) internal/store/contact_reverse_batch.go:305 — internal/store/contact_reverse_batch.go:305-315 | internal/store/postgres/community.go:1390-1400 | internal/store/postgres/user_lane_actor.go:77-87 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/contact_reverse_batch.go:305` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 3) internal/store/postgres/channel_boosts.go:354 — internal/store/postgres/channel_boosts.go:354-364 | internal/store/postgres/channel_updates.go:502-512 | internal/store/postgres/message_helpers.go:242-252 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/store/postgres/message_helpers.go:254` calls `Errorf` and `internal/store/postgres/channel_boosts.go:365` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 3) internal/store/postgres/channel_reaction_unread.go:135 — internal/store/postgres/channel_reaction_unread.go:135-145 | internal/store/postgres/channel_read.go:612-622 | internal/store/postgres/channel_topics.go:889-899 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (11 lines × 3) internal/store/postgres/star_gift_craft_auction.go:149 — internal/store/postgres/star_gift_craft_auction.go:149-159 | internal/store/postgres/star_gift_craft_auction.go:185-195 | internal/store/postgres/star_gift_craft_auction.go:772-782 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/star_gift_craft_auction.go:149` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 3) internal/rpc/bots_inline.go:497 — internal/rpc/bots_inline.go:497-507 | internal/rpc/bots_inline.go:516-526 | internal/rpc/bots_inline.go:534-545 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 3) internal/app/stories/service.go:443 — internal/app/stories/service.go:443-453 | internal/store/memory/story.go:1050-1060 | internal/store/postgres/story.go:2259-2269 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (11 lines × 3) internal/store/memory/channel_message_helpers.go:16 — internal/store/memory/channel_message_helpers.go:16-26 | internal/store/memory/message_helpers.go:243-253 | internal/store/postgres/message_helpers.go:347-357 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
D4 · Code Duplication · Edited copy of a member (29 corresponding lines) · ×9
  • Edited copy of a member (29 corresponding lines) cmd/walletminiapp/main.go:201 — cmd/walletminiapp/main.go:201-229 | cmd/walletminiapp/main.go:231-263 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) REDACTED:2853 — REDACTED:2853-2881 | REDACTED:2889-2917 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) internal/store/postgres/premium.go:485 — internal/store/postgres/premium.go:485-513 | internal/store/postgres/premium.go:515-548 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) internal/store/memory/channel_members.go:880 — internal/store/memory/channel_members.go:880-908 | internal/store/memory/channel_members.go:949-983 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) internal/rpc/messages_scheduled.go:9 — internal/rpc/messages_scheduled.go:9-37 | internal/rpc/messages_scheduled.go:39-70 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) REDACTED:1266 — REDACTED:1266-1294 | REDACTED:1315-1344 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) internal/store/postgres/account_deletion_notifications.go:56 — internal/store/postgres/account_deletion_notifications.go:56-84 | internal/store/postgres/admin.go:363-391 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) internal/store/postgres/channel_invite_import.go:235 — internal/store/postgres/channel_invite_import.go:235-270 | internal/store/postgres/channel_member_join_requests.go:93-121 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) internal/app/ai/provider_http.go:88 — internal/app/ai/provider_http.go:88-116 | internal/app/ai/provider_http.go:118-147 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (28 corresponding lines) · ×8
  • Edited copy of a member (28 corresponding lines) internal/admin/service.go:1660 — internal/admin/service.go:1660-1688 | internal/admin/service.go:1747-1774 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) internal/rpc/channels_invites.go:461 — internal/rpc/channels_invites.go:461-488 | internal/rpc/channels_stubs.go:712-742 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) internal/store/postgres/dialog.go:837 — internal/store/postgres/dialog.go:837-864 | internal/store/postgres/dialog.go:1068-1097 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) internal/store/memory/ephemeral.go:242 — internal/store/memory/ephemeral.go:242-270 | internal/store/memory/ephemeral.go:272-299 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) internal/store/postgres/media.go:783 — internal/store/postgres/media.go:783-810 | internal/store/postgres/media.go:812-842 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) internal/store/postgres/channel_helpers.go:322 — internal/store/postgres/channel_helpers.go:322-366 | internal/store/postgres/channel_member_list.go:297-324 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) internal/app/usernames/service.go:222 — internal/app/usernames/service.go:222-249 | internal/app/usernames/service.go:253-280 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) cmd/telesrv-admin/readstore.go:935 — cmd/telesrv-admin/readstore.go:935-973 | cmd/telesrv-admin/readstore.go:1724-1751 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 11+ corresponding lines) · ×8
  • Edited copies of one member (3 members, 11+ corresponding lines) internal/adminapi/server.go:575 — internal/adminapi/server.go:575-585 | internal/adminapi/server.go:587-597 | internal/adminapi/server.go:621-631 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) internal/loadharness/seed.go:611 — internal/loadharness/seed.go:611-621 | internal/loadharness/seed.go:623-633 | internal/loadharness/seed.go:635-648 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) internal/app/groupcalls/service.go:263 — internal/app/groupcalls/service.go:263-273 | internal/app/phone/registry.go:114-124 | internal/app/secretchat/service.go:308-318 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) internal/app/stargifts/service.go:1070 — internal/app/stargifts/service.go:1070-1080 | internal/app/telegramlogin/service.go:987-997 | internal/store/postgres/premium.go:206-216 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) internal/app/channels/bot_member_ids_cache.go:85 — internal/app/channels/bot_member_ids_cache.go:85-95 | internal/app/readmodel/hash.go:24-36 | internal/rpc/callback_registry.go:213-224 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) internal/app/bots/botfather.go:1049 — internal/app/bots/botfather.go:1049-1061 | REDACTED:682-692 | internal/app/donations/watcher.go:130-142 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) internal/store/memory/community.go:902 — internal/store/memory/community.go:902-912 | internal/store/memory/community.go:913-923 | internal/store/memory/community.go:924-934 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) internal/store/postgres/dialog.go:959 — internal/store/postgres/dialog.go:959-973 | internal/store/postgres/star_gift_craft_auction.go:1258-1268 | internal/store/postgres/verification.go:1209-1221 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×8
  • Duplicated block (20 lines × 2) internal/loadharness/mutate.go:119 — internal/loadharness/mutate.go:119-138 | REDACTED:159-178 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) REDACTED:697 — REDACTED:697-716 | REDACTED:735-754 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:697` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) internal/store/memory/channel_topics.go:125 — internal/store/memory/channel_topics.go:125-144 | internal/store/postgres/channel_topics.go:151-170 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) internal/store/memory/story.go:1511 — internal/store/memory/story.go:1511-1530 | internal/store/postgres/story.go:2354-2373 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (20 lines × 2) internal/store/postgres/collectible_username.go:361 — internal/store/postgres/collectible_username.go:361-380 | internal/store/postgres/collectible_username.go:442-461 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/collectible_username.go:361` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (20 lines × 2) internal/store/postgres/media.go:913 — internal/store/postgres/media.go:913-932 | internal/store/postgres/media.go:957-976 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (20 lines × 2) internal/store/postgres/moderation_cases.go:775 — internal/store/postgres/moderation_cases.go:775-794 | internal/store/postgres/moderation_cases.go:823-842 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/moderation_cases.go:775` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (20 lines × 2) REDACTED:278 — REDACTED:278-297 | REDACTED:372-393 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:278` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×8
  • Duplicated block (14 lines × 3) internal/app/botverification/service.go:372 — internal/app/botverification/service.go:372-385 | internal/app/rating/service.go:129-142 | internal/app/verification/service.go:365-378 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/botverification/service.go:372` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 3) internal/app/files/photos.go:266 — internal/app/files/photos.go:266-279 | internal/app/files/photos.go:770-783 | internal/app/files/photos.go:791-804 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/files/photos.go:266` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 3) internal/botapi/server.go:518 — internal/botapi/server.go:518-531 | internal/botapi/server.go:586-599 | internal/botapi/server.go:838-851 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 3) internal/mtprotoedge/session_manager.go:1620 — internal/mtprotoedge/session_manager.go:1620-1633 | internal/mtprotoedge/session_manager.go:1764-1777 | internal/mtprotoedge/session_manager.go:1782-1795 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/mtprotoedge/session_manager.go:1620` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 3) internal/rpc/payments_star_gift_lifecycle.go:1095 — internal/rpc/payments_star_gift_lifecycle.go:1095-1108 | internal/rpc/phone_group_call_updates.go:222-235 | REDACTED:1259-1272 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/phone_group_call_updates.go:222` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `int64` to `originUserID` in one and `userID` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (14 lines × 3) internal/store/postgres/channel_reaction_unread.go:197 — internal/store/postgres/channel_reaction_unread.go:197-210 | internal/store/postgres/channel_read.go:674-687 | internal/store/postgres/channel_topics.go:943-956 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_reaction_unread.go:197` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (14 lines × 3) internal/store/postgres/moderation_cases.go:1081 — internal/store/postgres/moderation_cases.go:1081-1094 | internal/store/postgres/moderation_cases.go:1121-1135 | internal/store/postgres/moderation_cases.go:1146-1160 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/moderation_cases.go:1081` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 3) internal/store/postgres/media_search.go:266 — internal/store/postgres/media_search.go:266-279 | internal/store/postgres/media_search.go:351-364 | internal/store/postgres/media_search.go:375-388 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/media_search.go:266` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (11 lines × 4) · ×8
  • Duplicated block (11 lines × 4) internal/app/dialogs/service.go:1460 — internal/app/dialogs/service.go:1460-1470 | internal/store/memory/channel_dialogs.go:76-86 | REDACTED:422-432 | REDACTED:566-576 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/dialogs/service.go:1460` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 4) internal/app/stories/service.go:488 — internal/app/stories/service.go:488-498 | internal/rpc/stories.go:3133-3143 | internal/store/memory/story.go:1095-1105 | internal/store/postgres/story.go:2304-2314 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/stories.go:3133` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 4) internal/rpc/bot_verification_projection.go:115 — internal/rpc/bot_verification_projection.go:115-125 | internal/rpc/fragment.go:310-320 | internal/rpc/messages_monoforum.go:204-214 | internal/rpc/story_peer_projection.go:591-601 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/bot_verification_projection.go:115` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 4) internal/rpc/bots_callback.go:31 — internal/rpc/bots_callback.go:31-41 | internal/rpc/messages_edit.go:55-65 | internal/rpc/messages_edit_geolive.go:20-30 | internal/rpc/messages_history.go:549-559 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 4) internal/rpc/channels_members.go:45 — internal/rpc/channels_members.go:45-55 | internal/rpc/channels_members.go:518-528 | internal/rpc/channels_messages.go:317-327 | internal/rpc/channels_topics.go:16-26 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 4) internal/store/memory/bot_verification.go:1078 — internal/store/memory/bot_verification.go:1078-1088 | internal/store/memory/verification.go:985-995 | internal/store/postgres/bot_verification.go:1406-1416 | internal/store/postgres/verification.go:1319-1329 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 4) internal/store/postgres/channel_helpers.go:356 — internal/store/postgres/channel_helpers.go:356-366 | internal/store/postgres/channel_invite_requests.go:201-211 | internal/store/postgres/channel_member_join.go:308-318 | internal/store/postgres/channel_member_list.go:204-214 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_helpers.go:356` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Note first that the copies are not typed on the same thing: the declarations holding them bind `int64` to `afterChannelID` in one and `channelID` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (11 lines × 4) internal/store/postgres/channel_settings.go:610 — internal/store/postgres/channel_settings.go:610-620 | internal/store/postgres/channel_settings.go:747-757 | internal/store/postgres/channel_settings.go:832-842 | internal/store/postgres/channel_topics.go:68-78 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_settings.go:610` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×8
  • Duplicated block (6 lines × 3) internal/app/usernames/service.go:416 — internal/app/usernames/service.go:416-421 | internal/store/memory/collectible_username.go:496-501 | internal/store/postgres/collectible_username.go:476-481 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 3) internal/rpc/messages_sticker_sets.go:242 — internal/rpc/messages_sticker_sets.go:242-247 | internal/rpc/messages_sticker_sets.go:258-263 | internal/rpc/messages_stickers_personal.go:306-311 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_sticker_sets.go:242` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) internal/store/memory/channel_invites.go:594 — internal/store/memory/channel_invites.go:594-599 | internal/store/memory/poll.go:168-173 | internal/store/memory/poll.go:211-216 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_invites.go:594` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) internal/store/memory/channel_reactions.go:357 — internal/store/memory/channel_reactions.go:357-362 | internal/store/memory/channel_reactions.go:826-831 | internal/store/postgres/message_reactions.go:412-417 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 3) internal/store/memory/story.go:722 — internal/store/memory/story.go:722-727 | internal/store/memory/story.go:780-785 | internal/store/memory/story.go:824-829 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/story.go:722` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) internal/rpc/channel_full_bot_cache.go:59 — internal/rpc/channel_full_bot_cache.go:59-64 | internal/rpc/rpc_projection_cache.go:43-48 | internal/rpc/rpc_projection_cache.go:154-159 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Note first that the copies are not typed on the same thing: the declarations holding them bind `int64` to `channelID` in one and `targetUserID` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (6 lines × 3) internal/store/memory/auth.go:381 — internal/store/memory/auth.go:381-386 | internal/store/memory/password.go:156-161 | internal/store/memory/users.go:43-48 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (6 lines × 3) internal/app/telegramlogin/service.go:1092 — internal/app/telegramlogin/service.go:1092-1097 | internal/app/telegramlogin/service.go:1176-1181 | internal/app/telegramlogin/service.go:1234-1239 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/telegramlogin/service.go:1092` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Edited copy of a member (34 corresponding lines) · ×7
  • Edited copy of a member (34 corresponding lines) internal/app/files/sticker_admin.go:141 — internal/app/files/sticker_admin.go:141-181 | internal/app/files/sticker_management.go:10-47 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) internal/rpc/payments_star_gift_lifecycle.go:27 — internal/rpc/payments_star_gift_lifecycle.go:27-60 | internal/rpc/payments_star_gift_lifecycle.go:98-134 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) internal/store/memory/channel_reactions.go:462 — internal/store/memory/channel_reactions.go:462-498 | internal/store/memory/channel_reactions.go:500-533 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) internal/rpc/phone_group_call.go:479 — internal/rpc/phone_group_call.go:479-512 | internal/rpc/phone_group_call.go:514-547 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) internal/rpc/channels_legacy_chat.go:419 — internal/rpc/channels_legacy_chat.go:419-454 | internal/rpc/channels_members.go:44-77 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) internal/rpc/account_themes.go:132 — internal/rpc/account_themes.go:132-165 | internal/rpc/account_themes.go:168-209 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (34 corresponding lines) internal/app/langpack/service.go:205 — internal/app/langpack/service.go:205-238 | internal/app/langpack/service.go:245-279 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (33 corresponding lines) · ×7
  • Edited copy of a member (33 corresponding lines) internal/store/memory/channel_topic_read.go:106 — internal/store/memory/channel_topic_read.go:106-138 | internal/store/postgres/channel_topic_read.go:107-151 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) internal/rpc/contacts.go:277 — internal/rpc/contacts.go:277-309 | internal/rpc/contacts.go:311-343 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) internal/mtprotoedge/rpc_rewrap.go:77 — internal/mtprotoedge/rpc_rewrap.go:77-110 | internal/mtprotoedge/rpc_rewrap.go:131-163 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) internal/app/bots/verifierbot.go:1219 — internal/app/bots/verifierbot.go:1219-1251 | internal/app/bots/verifybot.go:987-1019 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) internal/admin/botverification.go:468 — internal/admin/botverification.go:468-500 | internal/admin/botverification.go:503-535 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) internal/store/memory/channel_message_history.go:601 — internal/store/memory/channel_message_history.go:601-633 | internal/store/memory/message_history.go:387-421 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) internal/mtprotoedge/rpc_execution_budget.go:132 — internal/mtprotoedge/rpc_execution_budget.go:132-170 | internal/mtprotoedge/rpc_result_subscriber_budget.go:77-109 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (31 corresponding lines) · ×7
  • Edited copy of a member (31 corresponding lines) internal/app/moderation/registry_reports.go:27 — internal/app/moderation/registry_reports.go:27-57 | internal/app/moderation/registry_reports.go:59-102 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) internal/store/postgres/postgres_connection_admission.go:179 — internal/store/postgres/postgres_connection_admission.go:179-219 | internal/store/postgres/postgres_connection_admission.go:272-302 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) internal/rpc/messages_forum.go:121 — internal/rpc/messages_forum.go:121-151 | internal/rpc/messages_forum.go:153-183 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) internal/app/files/external_media.go:70 — internal/app/files/external_media.go:70-100 | internal/app/files/webpage.go:100-140 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) internal/rpc/ephemeral.go:420 — internal/rpc/ephemeral.go:420-452 | internal/rpc/welcome_messages.go:302-332 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) cmd/langpackfetch/main.go:263 — cmd/langpackfetch/main.go:263-293 | cmd/telegramloginkeygen/main.go:307-341 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) internal/app/botverification/service.go:366 — internal/app/botverification/service.go:366-396 | internal/app/verification/service.go:358-392 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 16+ corresponding lines) · ×7
  • Edited copies of one member (3 members, 16+ corresponding lines) internal/store/postgres/account.go:231 — internal/store/postgres/account.go:231-257 | internal/store/postgres/authorization.go:192-207 | internal/store/postgres/authorization.go:264-282 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) internal/app/channels/service.go:1679 — internal/app/channels/service.go:1679-1695 | internal/app/channels/service.go:1821-1836 | internal/app/channels/service.go:1839-1856 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) internal/rpc/stickers_creator.go:167 — internal/rpc/stickers_creator.go:167-182 | internal/rpc/stickers_creator.go:184-202 | internal/rpc/stickers_creator.go:204-222 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) internal/store/postgres/story.go:1828 — internal/store/postgres/story.go:1828-1845 | internal/store/postgres/story.go:1847-1862 | internal/store/postgres/story.go:1864-1880 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) internal/rpc/bot_verification_notify.go:40 — internal/rpc/bot_verification_notify.go:40-55 | internal/rpc/username_notify.go:15-30 | internal/rpc/verification_notify.go:47-62 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) internal/rpc/channels_stubs.go:518 — internal/rpc/channels_stubs.go:518-542 | internal/rpc/messages_helpers.go:517-536 | internal/rpc/premium.go:170-185 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) internal/store/postgres/scheduled_message.go:596 — internal/store/postgres/scheduled_message.go:596-614 | internal/store/postgres/scheduled_message.go:616-631 | internal/store/postgres/scheduled_message.go:633-651 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (6 corresponding lines) · ×7
  • Edited copy of a member (6 corresponding lines) internal/app/channels/read_model_cache.go:102 — internal/app/channels/read_model_cache.go:102-107 | internal/app/dialogs/read_model_cache.go:566-571 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) internal/app/botverification/service.go:476 — internal/app/botverification/service.go:476-481 | internal/app/stargifts/service.go:499-504 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) internal/app/channels/service.go:648 — internal/app/channels/service.go:648-653 | internal/app/channels/service_groupcall.go:10-15 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) internal/app/botverification/service.go:456 — internal/app/botverification/service.go:456-461 | internal/app/stargifts/service.go:527-532 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) internal/app/files/blobfs.go:217 — internal/app/files/blobfs.go:217-222 | internal/identity/identity.go:218-223 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) internal/app/broadcast/service.go:173 — internal/app/broadcast/service.go:173-178 | internal/app/stargifts/service.go:506-511 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) internal/app/dialogs/list_snapshot_cache.go:101 — internal/app/dialogs/list_snapshot_cache.go:101-106 | internal/rpc/story_pinned_stories_cache.go:52-57 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×7
  • Duplicated block (13 lines × 3) cmd/telesrv-admin/botverification.go:117 — cmd/telesrv-admin/botverification.go:117-129 | cmd/telesrv-admin/botverification.go:164-176 | cmd/telesrv-admin/verification.go:44-56 — before extracting anything, compare `cmd/telesrv-admin/botverification.go` and `cmd/telesrv-admin/verification.go` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 3) internal/loadharness/mutate.go:96 — internal/loadharness/mutate.go:96-108 | internal/loadharness/seed.go:62-74 | internal/loadharness/snapshot.go:106-118 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/loadharness/mutate.go:96` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 3) internal/rpc/payments_star_gift_collections.go:120 — internal/rpc/payments_star_gift_collections.go:120-132 | internal/rpc/payments_star_gift_collections.go:146-158 | internal/rpc/payments_star_gift_collections.go:167-179 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/payments_star_gift_collections.go:120` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 3) internal/store/memory/channel_members.go:912 — internal/store/memory/channel_members.go:912-924 | internal/store/postgres/channel_member_list.go:408-420 | REDACTED:428-440 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_members.go:912` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/store/postgres/channel_member_list.go:422` calls `Errorf` and `REDACTED:441` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 3) internal/store/postgres/collectible_username.go:183 — internal/store/postgres/collectible_username.go:183-195 | internal/store/postgres/collectible_username.go:295-307 | internal/store/postgres/collectible_username.go:386-398 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (13 lines × 3) internal/store/contact_reverse_batch.go:171 — internal/store/contact_reverse_batch.go:171-183 | internal/store/postgres/active_channel_ids_batch.go:147-159 | internal/store/read_model_batch.go:173-185 — before extracting anything, compare `internal/store/contact_reverse_batch.go` and `internal/store/read_model_batch.go` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (13 lines × 3) internal/store/contact_reverse_batch.go:286 — internal/store/contact_reverse_batch.go:286-298 | internal/store/postgres/authkey_session_layer_batch.go:265-277 | internal/store/read_model_batch.go:287-299 — before extracting anything, compare `internal/store/contact_reverse_batch.go` and `internal/store/read_model_batch.go` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `error` to `s *BatchedReverseContactStore) failQueued(err` in one and `s *BatchedAuthKeySessionLayerStore) failQueued(err` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×7
  • Duplicated block (8 lines × 4) internal/app/dialogs/list_snapshot_cache.go:198 — internal/app/dialogs/list_snapshot_cache.go:198-205 | internal/rpc/channel_interest.go:188-195 | internal/rpc/messages_dialogs.go:320-327 | REDACTED:2227-2234 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/dialogs/list_snapshot_cache.go:198` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) internal/botapi/ephemeral.go:116 — internal/botapi/ephemeral.go:116-123 | internal/botapi/ephemeral.go:179-186 | internal/botapi/server.go:555-562 | internal/botapi/server.go:709-716 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/botapi/ephemeral.go:116` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8 lines × 4) internal/rpc/messages_dialogs.go:749 — internal/rpc/messages_dialogs.go:749-756 | internal/rpc/messages_dialogs.go:883-890 | internal/rpc/messages_dialogs.go:961-968 | internal/rpc/messages_saved_dialogs.go:181-188 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_dialogs.go:749` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) internal/store/memory/channel_members.go:649 — internal/store/memory/channel_members.go:649-656 | internal/store/memory/channel_members.go:674-681 | internal/store/memory/channel_members.go:699-706 | internal/store/memory/channel_members.go:727-734 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_members.go:649` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (8 lines × 4) internal/store/postgres/community.go:1085 — internal/store/postgres/community.go:1085-1092 | internal/store/postgres/community.go:1107-1114 | internal/store/postgres/community.go:1178-1185 | internal/store/postgres/community.go:1201-1208 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/community.go:1085` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 4) internal/store/postgres/media_refs.go:234 — internal/store/postgres/media_refs.go:234-241 | internal/store/postgres/media_refs.go:359-366 | internal/store/postgres/media_refs.go:404-411 | internal/store/postgres/media_refs.go:462-469 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/store/postgres/media_refs.go:242` calls `DeleteDocumentRow`, `Errorf` and `internal/store/postgres/media_refs.go:412` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 4) internal/store/postgres/account.go:885 — internal/store/postgres/account.go:885-892 | internal/store/postgres/account_rating.go:451-458 | internal/store/postgres/account_rating.go:495-502 | internal/store/postgres/channel_update_retention.go:109-116 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Note first that the copies are not typed on the same thing: the declarations holding them bind `int64` to `userID` in one and `olderThanUnix` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
X28 · Index access outside its own emptiness guard · Index access outside its own emptiness guard · ×7
  • Index access outside its own emptiness guard internal/rpc/stories.go:269 — `parts` holds what `Split` returns, and `parts[2]` takes element 2 of it without checking its length — while this file tests that same result elsewhere before indexing it, because it can be nil or shorter. Here a short result panics with `index out of range`. Test `len(parts)` (or nil) first, as the other call site does.
  • Index access outside its own emptiness guard internal/rpc/stories.go:273 — `parts` holds what `Split` returns, and `parts[3]` takes element 3 of it without checking its length — while this file tests that same result elsewhere before indexing it, because it can be nil or shorter. Here a short result panics with `index out of range`. Test `len(parts)` (or nil) first, as the other call site does.
  • Index access outside its own emptiness guard internal/loadharness/dataset.go:127 — `i%len(groupMembers)` divides by the length of `groupMembers`, and nothing before it checks that `groupMembers` is non-empty. An empty `groupMembers` makes this an integer division by zero, which panics. Test `len(groupMembers) == 0` first and return early.
  • Index access outside its own emptiness guard internal/loadharness/mutate.go:289 — `message%len(group.MemberAccounts)` divides by the length of `group.MemberAccounts`, and nothing before it checks that `group.MemberAccounts` is non-empty. An empty `group.MemberAccounts` makes this an integer division by zero, which panics. Test `len(group.MemberAccounts) == 0` first and return early.
  • Index access outside its own emptiness guard REDACTED:796 — `%len(targets)` divides by the length of `targets`, and nothing before it checks that `targets` is non-empty. An empty `targets` makes this an integer division by zero, which panics. Test `len(targets) == 0` first and return early.
  • Index access outside its own emptiness guard internal/domain/login_code_delivery.go:144 — `idx` is the result of a search that answers -1 when nothing is found, and `rendered[:idx]` uses it as a bound with no test of `idx` in between. When the search misses, the bound is -1 and the access panics with `slice bounds out of range`. Test `idx < 0` (or use `strings.Cut`) before using it.
  • Index access outside its own emptiness guard internal/domain/login_code_delivery.go:152 — `idx` is the result of a search that answers -1 when nothing is found, and `rendered[:idx]` uses it as a bound with no test of `idx` in between. When the search misses, the bound is -1 and the access panics with `slice bounds out of range`. Test `idx < 0` (or use `strings.Cut`) before using it.
D30 · Dependency Vulnerabilities · Medium CVE · ×6
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D32 · Data Compliance (PII/GDPR) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (45 corresponding lines) · ×6
  • Edited copy of a member (45 corresponding lines) internal/app/stargifts/service.go:206 — internal/app/stargifts/service.go:206-254 | internal/app/stargifts/service.go:382-426 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (45 corresponding lines) internal/admin/botverification.go:355 — internal/admin/botverification.go:355-405 | internal/admin/botverification.go:412-456 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (45 corresponding lines) internal/rpc/messages_bot_no_state.go:315 — internal/rpc/messages_bot_no_state.go:315-359 | internal/rpc/messages_send.go:770-822 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (45 corresponding lines) REDACTED:1551 — REDACTED:1551-1619 | internal/store/postgres/story.go:1508-1552 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (45 corresponding lines) internal/app/bots/verifierbot.go:322 — internal/app/bots/verifierbot.go:322-366 | internal/app/bots/verifybot.go:261-313 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (45 corresponding lines) internal/store/memory/channel_dialogs.go:517 — internal/store/memory/channel_dialogs.go:517-564 | REDACTED:2128-2172 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (35 corresponding lines) · ×6
  • Edited copy of a member (35 corresponding lines) internal/rpc/messages_send.go:1113 — internal/rpc/messages_send.go:1113-1151 | internal/rpc/messages_send.go:1153-1187 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) cmd/telesrv-admin/privateview_store.go:250 — cmd/telesrv-admin/privateview_store.go:250-284 | cmd/telesrv-admin/privateview_store.go:288-338 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) internal/store/postgres/channel_settings.go:164 — internal/store/postgres/channel_settings.go:164-198 | internal/store/postgres/channel_settings.go:974-1012 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) internal/store/postgres/channel_reaction_catalog.go:10 — internal/store/postgres/channel_reaction_catalog.go:10-44 | internal/store/postgres/channel_reaction_catalog.go:46-80 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) internal/rpc/account_themes.go:212 — internal/rpc/account_themes.go:212-246 | internal/rpc/account_themes.go:250-284 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) internal/store/postgres/channel_read.go:54 — internal/store/postgres/channel_read.go:54-108 | internal/store/postgres/channel_topics.go:80-114 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (30 corresponding lines) · ×6
  • Edited copy of a member (30 corresponding lines) internal/store/memory/moderation.go:188 — internal/store/memory/moderation.go:188-217 | internal/store/memory/moderation.go:248-277 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) internal/rpc/channels_stubs.go:20 — internal/rpc/channels_stubs.go:20-60 | internal/rpc/messages_reports.go:98-127 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) internal/store/memory/story.go:918 — internal/store/memory/story.go:918-947 | internal/store/memory/story.go:949-979 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) cmd/telesrv-admin/readstore.go:1205 — cmd/telesrv-admin/readstore.go:1205-1235 | internal/store/postgres/broadcast.go:352-381 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) internal/store/postgres/account.go:613 — internal/store/postgres/account.go:613-642 | internal/store/postgres/account.go:868-897 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (30 corresponding lines) internal/store/private_send_idempotency.go:89 — internal/store/private_send_idempotency.go:89-118 | internal/store/private_send_idempotency.go:122-152 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 24+ corresponding lines) · ×6
  • Edited copies of one member (3 members, 24+ corresponding lines) internal/rpc/bots_longtail.go:175 — internal/rpc/bots_longtail.go:175-200 | internal/rpc/messages_pin.go:78-101 | internal/rpc/photos.go:371-401 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 24+ corresponding lines) internal/store/postgres/channel_reaction_unread.go:179 — internal/store/postgres/channel_reaction_unread.go:179-210 | internal/store/postgres/channel_read.go:656-687 | internal/store/postgres/channel_topics.go:933-956 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 24+ corresponding lines) cmd/telesrv-admin/readstore.go:1932 — cmd/telesrv-admin/readstore.go:1932-1966 | cmd/telesrv-admin/readstore.go:2180-2203 | cmd/telesrv-admin/readstore.go:2473-2505 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 24+ corresponding lines) cmd/telesrv-admin/account_rating.go:98 — cmd/telesrv-admin/account_rating.go:98-121 | cmd/telesrv-admin/botverification.go:195-221 | cmd/telesrv-admin/verification.go:75-103 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 24+ corresponding lines) internal/store/postgres/channel_member_admin.go:568 — internal/store/postgres/channel_member_admin.go:568-600 | internal/store/postgres/channel_read.go:110-138 | internal/store/postgres/secretchat.go:136-159 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 24+ corresponding lines) internal/mtprotoedge/outbound.go:1936 — internal/mtprotoedge/outbound.go:1936-1961 | internal/mtprotoedge/outbound.go:1964-1989 | internal/mtprotoedge/outbound.go:1992-2015 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 19+ corresponding lines) · ×6
  • Edited copies of one member (3 members, 19+ corresponding lines) internal/rpc/channel_fanout_dispatcher.go:1057 — internal/rpc/channel_fanout_dispatcher.go:1057-1084 | internal/rpc/channel_fanout_dispatcher.go:1167-1186 | internal/rpc/channel_fanout_dispatcher.go:1191-1209 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 19+ corresponding lines) internal/store/postgres/channel_invite_requests.go:177 — internal/store/postgres/channel_invite_requests.go:177-211 | internal/store/postgres/channel_member_join.go:300-318 | internal/store/postgres/channel_member_list.go:193-214 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 19+ corresponding lines) internal/store/postgres/bot_verification.go:179 — internal/store/postgres/bot_verification.go:179-198 | internal/store/postgres/bot_verification.go:201-219 | internal/store/postgres/bot_verification.go:223-241 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 19+ corresponding lines) internal/store/memory/login_code.go:130 — internal/store/memory/login_code.go:130-148 | internal/store/memory/login_code.go:150-171 | internal/store/memory/login_code.go:173-191 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 19+ corresponding lines) internal/store/postgres/welcome_message_delivery.go:224 — internal/store/postgres/welcome_message_delivery.go:224-242 | internal/store/postgres/welcome_message_delivery.go:244-262 | internal/store/postgres/welcome_message_delivery.go:264-290 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 19+ corresponding lines) internal/store/postgres/broadcast.go:276 — internal/store/postgres/broadcast.go:276-297 | internal/store/postgres/media.go:844-863 | internal/store/postgres/media.go:865-883 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×6
  • Duplicated block (24 lines × 2) internal/rpc/bots_inline.go:1127 — internal/rpc/bots_inline.go:1127-1150 | internal/rpc/bots_inline.go:1153-1176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/bots_inline.go:1127` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (24 lines × 2) internal/store/memory/channel_helpers.go:230 — internal/store/memory/channel_helpers.go:230-253 | internal/store/memory/channel_helpers.go:256-279 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (24 lines × 2) internal/store/memory/channel_topics.go:218 — internal/store/memory/channel_topics.go:218-241 | internal/store/postgres/channel_topics.go:229-252 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_topics.go:218` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (24 lines × 2) internal/store/memory/login_code.go:31 — internal/store/memory/login_code.go:31-54 | internal/store/memory/login_code.go:101-124 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/login_code.go:31` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24 lines × 2) internal/mtprotoedge/session_manager.go:320 — internal/mtprotoedge/session_manager.go:320-343 | internal/mtprotoedge/session_manager.go:400-423 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/mtprotoedge/session_manager.go:320` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (24 lines × 2) internal/store/memory/message_reactions.go:244 — internal/store/memory/message_reactions.go:244-267 | internal/store/postgres/message_reactions.go:435-458 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/message_reactions.go:244` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×6
  • Duplicated block (9 lines × 4) REDACTED:855 — REDACTED:855-863 | REDACTED:1249-1257 | REDACTED:2349-2357 | REDACTED:2718-2726 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 4) internal/app/users/service.go:451 — internal/app/users/service.go:451-459 | internal/rpc/presence_last_seen_batch.go:196-204 | internal/store/memory/users.go:459-467 | internal/store/postgres/user.go:522-530 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
  • Duplicated block (9 lines × 4) internal/rpc/convert_channels_core.go:16 — internal/rpc/convert_channels_core.go:16-24 | internal/rpc/convert_channels_core.go:395-403 | internal/rpc/convert_dialogs.go:359-367 | internal/rpc/premium_sweeper.go:211-219 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/convert_channels_core.go:16` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 4) internal/store/postgres/story.go:379 — internal/store/postgres/story.go:379-387 | internal/store/postgres/story.go:620-628 | internal/store/postgres/story.go:680-688 | internal/store/postgres/story.go:748-756 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 4) internal/store/postgres/story.go:796 — internal/store/postgres/story.go:796-804 | internal/store/postgres/story.go:851-859 | internal/store/postgres/story.go:904-912 | internal/store/postgres/story.go:965-973 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 4) cmd/telesrv-admin/account_rating.go:109 — cmd/telesrv-admin/account_rating.go:109-117 | cmd/telesrv-admin/botverification.go:205-213 | REDACTED:2728-2736 | cmd/telesrv-admin/verification.go:86-94 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/telesrv-admin/account_rating.go:109` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D6 · Cohesion (LCOM4) · Low cohesion · ×6
  • Low cohesion: Service (LCOM4 8) internal/app/account/service.go:38 — Service's methods fall into 8 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 8 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: appServer (LCOM4 4) cmd/walletminiapp/main.go:48 — appServer's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Service (LCOM4 4) internal/app/files/service.go:48 — Service's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: layerRPCResultEncoder (LCOM4 4) internal/mtprotoedge/layer_rpc_execution.go:23 — layerRPCResultEncoder's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Router (LCOM4 4) internal/rpc/router.go:127 — Router's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: CommunityStore (LCOM4 4) internal/store/postgres/community.go:20 — CommunityStore's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
D15 · Churn × Complexity Hotspots · Repeated repair · ×5
  • Repeated repair: internal/store/postgres/media_refs.go internal/store/postgres/media_refs.go:66 — internal/store/postgres/media_refs.go changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is postgres.removeMediaReferencesByKeyTx at line 66), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix for deleted file metadata”; “fixes and ui improvements”; “fixes for storage managament”; “fix for retention logic”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/store/postgres/media_refs.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: internal/domain/system.go internal/domain/system.go:440 — internal/domain/system.go changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is domain.SystemUserByID at line 440), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fixes”; “fix”; “merged with fixes”; “fix”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/domain/system.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: internal/app/donations/service.go internal/app/donations/service.go:410 — internal/app/donations/service.go changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is Service.validateToken at line 410), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix”; “fixed crypto donations”; “fix”; “fixes”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/app/donations/service.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: internal/app/files/gif_admin.go internal/app/files/gif_admin.go:44 — internal/app/files/gif_admin.go changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is Service.AdminUploadGifMaterial at line 44), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix”; “fix”; “fix for gifs auto-catigorisation”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- internal/app/files/gif_admin.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: cmd/telesrv-admin/donations.go cmd/telesrv-admin/donations.go:69 — cmd/telesrv-admin/donations.go changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is server.handleDonationDepositsAPI at line 69), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fixed donations disable logic”; “fixed crypto donations”; “fixes”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-07..2026-11-05, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-07 12:40:50 +02:00' --until='2026-11-05 12:40:50 +02:00' --full-history --no-merges -- cmd/telesrv-admin/donations.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×5
  • Members sharing a duplicated core (6 members, 50+ identical tokens) cmd/telesrv-admin/account_rating.go:56 — cmd/telesrv-admin/account_rating.go:56-96 | cmd/telesrv-admin/botverification.go:104-144 | cmd/telesrv-admin/botverification.go:146-193 | cmd/telesrv-admin/donations.go:69-95 | REDACTED:2671-2715 | cmd/telesrv-admin/verification.go:31-73 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) internal/app/files/botfather_avatar_seed.go:27 — internal/app/files/botfather_avatar_seed.go:27-54 | internal/app/files/chatbot_avatar_seed.go:26-53 | internal/app/files/gifbot_avatar_seed.go:26-53 | internal/app/files/premiumbot_avatar_seed.go:26-53 | internal/app/files/stickers_bot_avatar_seed.go:26-53 | internal/app/files/verifybot_avatar_seed.go:26-53 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) internal/app/usernames/service.go:327 — internal/app/usernames/service.go:327-353 | internal/app/usernames/service.go:357-378 | internal/app/usernames/service.go:381-402 | internal/store/postgres/collectible_username.go:182-289 | internal/store/postgres/collectible_username.go:294-380 | internal/store/postgres/collectible_username.go:385-461 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) internal/mtprotoedge/session_manager.go:1617 — internal/mtprotoedge/session_manager.go:1617-1633 | internal/mtprotoedge/session_manager.go:1635-1679 | internal/mtprotoedge/session_manager.go:1738-1754 | internal/mtprotoedge/session_manager.go:1761-1777 | internal/mtprotoedge/session_manager.go:1779-1795 | internal/mtprotoedge/session_manager.go:1801-1848 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) internal/store/memory/channel_invites.go:334 — internal/store/memory/channel_invites.go:334-382 | internal/store/memory/channel_invites.go:562-625 | internal/store/memory/channel_invites.go:627-664 | internal/store/memory/poll.go:52-94 | internal/store/memory/poll.go:148-184 | internal/store/memory/poll.go:190-239 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×5
  • Members sharing a duplicated core (5 members, 50+ identical tokens) internal/app/dialogs/list_snapshot_cache.go:193 — internal/app/dialogs/list_snapshot_cache.go:193-217 | internal/rpc/channel_interest.go:180-207 | internal/rpc/messages_dialogs.go:312-348 | REDACTED:957-1046 | REDACTED:2214-2241 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) internal/app/dialogs/service.go:301 — internal/app/dialogs/service.go:301-331 | internal/app/dialogs/service.go:1458-1474 | internal/store/memory/channel_dialogs.go:10-105 | REDACTED:293-441 | REDACTED:446-581 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) internal/app/privacy/service.go:569 — internal/app/privacy/service.go:569-577 | internal/rpc/stories.go:2893-2904 | internal/rpc/story_pinned_stories_cache.go:142-153 | internal/store/memory/story.go:1460-1471 | internal/store/postgres/story.go:2587-2598 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) internal/loadharness/mutate.go:95 — internal/loadharness/mutate.go:95-239 | REDACTED:738-994 | internal/loadharness/seed.go:61-150 | internal/loadharness/snapshot.go:105-201 | REDACTED:138-420 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) internal/store/postgres/message_delete.go:564 — internal/store/postgres/message_delete.go:564-576 | internal/store/postgres/message_delete.go:578-590 | internal/store/postgres/message_delete.go:592-604 | internal/store/postgres/message_delete.go:606-618 | internal/store/postgres/saved_dialog.go:253-352 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Edited copy of a member (37 corresponding lines) · ×5
  • Edited copy of a member (37 corresponding lines) internal/store/memory/dialogs.go:978 — internal/store/memory/dialogs.go:978-1014 | internal/store/postgres/dialog.go:1245-1281 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (37 corresponding lines) internal/app/files/external_media.go:135 — internal/app/files/external_media.go:135-171 | internal/app/files/webpage.go:161-201 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (37 corresponding lines) internal/store/postgres/moderation_registries.go:14 — internal/store/postgres/moderation_registries.go:14-55 | internal/store/postgres/moderation_registries.go:146-182 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (37 corresponding lines) internal/store/postgres/welcome_message.go:221 — internal/store/postgres/welcome_message.go:221-260 | internal/store/postgres/welcome_message.go:262-298 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (37 corresponding lines) internal/app/channels/service.go:1430 — internal/app/channels/service.go:1430-1471 | internal/app/channels/service.go:2039-2075 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 17+ corresponding lines) · ×5
  • Edited copies of one member (3 members, 17+ corresponding lines) cmd/telesrv-admin/readstore.go:3193 — cmd/telesrv-admin/readstore.go:3193-3209 | internal/store/postgres/donations.go:240-259 | internal/store/postgres/donations.go:261-277 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 17+ corresponding lines) internal/store/postgres/bot_verification.go:1364 — internal/store/postgres/bot_verification.go:1364-1380 | internal/store/postgres/dialog.go:1164-1181 | internal/store/postgres/dialog.go:1227-1243 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 17+ corresponding lines) internal/store/postgres/channel_reaction_unread.go:212 — internal/store/postgres/channel_reaction_unread.go:212-232 | internal/store/postgres/channel_read.go:689-710 | internal/store/postgres/channel_topics.go:958-974 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 17+ corresponding lines) internal/store/postgres/ai.go:182 — internal/store/postgres/ai.go:182-198 | internal/store/postgres/ai.go:200-217 | internal/store/postgres/themes.go:57-76 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 17+ corresponding lines) internal/app/files/external_media.go:116 — internal/app/files/external_media.go:116-132 | internal/app/files/maptile_proxy.go:290-306 | internal/app/files/webpage.go:142-158 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (5 corresponding lines) · ×5
  • Edited copy of a member (5 corresponding lines) internal/app/account/service.go:1029 — internal/app/account/service.go:1029-1033 | internal/app/auth/service.go:593-597 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) internal/app/ai/service.go:799 — internal/app/ai/service.go:799-808 | internal/app/themes/service.go:222-226 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) internal/telegramloginhttp/handler.go:105 — internal/telegramloginhttp/handler.go:105-110 | internal/updatecdn/server.go:34-38 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) cmd/telesrv-admin/readstore.go:57 — cmd/telesrv-admin/readstore.go:57-61 | internal/store/postgres/channel_helpers.go:1039-1044 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) REDACTED:3011 — REDACTED:3011-3016 | internal/adminapi/server.go:1970-1974 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×5
  • Duplicated block (21 lines × 2) internal/mtprotoedge/outbound.go:1941 — internal/mtprotoedge/outbound.go:1941-1961 | internal/mtprotoedge/outbound.go:1969-1989 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/mtprotoedge/outbound.go:1941` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) internal/mtprotoedge/rpc_rewrap.go:90 — internal/mtprotoedge/rpc_rewrap.go:90-110 | internal/mtprotoedge/rpc_rewrap.go:143-163 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/mtprotoedge/rpc_rewrap.go:90` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) internal/mtprotoedge/session_manager.go:1659 — internal/mtprotoedge/session_manager.go:1659-1679 | internal/mtprotoedge/session_manager.go:1828-1848 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/mtprotoedge/session_manager.go:1659` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (21 lines × 2) internal/store/memory/channel_members.go:1131 — internal/store/memory/channel_members.go:1131-1151 | internal/store/postgres/channel_member_helpers.go:450-470 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (21 lines × 2) internal/store/postgres/media.go:1457 — internal/store/postgres/media.go:1457-1477 | internal/store/postgres/media.go:1525-1545 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/media.go:1457` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (15 lines × 3) · ×5
  • Duplicated block (15 lines × 3) internal/app/dialogs/service.go:842 — internal/app/dialogs/service.go:842-856 | internal/store/memory/channel_dialogs.go:474-488 | REDACTED:2077-2091 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:2092` calls `clonePeer` and `internal/store/memory/channel_dialogs.go:489` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (15 lines × 3) internal/loadharness/mutate.go:100 — internal/loadharness/mutate.go:100-114 | internal/loadharness/snapshot.go:110-124 | REDACTED:144-158 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:142` calls `resolveStartupProfile` and `internal/loadharness/mutate.go:98` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (15 lines × 3) internal/rpc/bot_verification_projection.go:116 — internal/rpc/bot_verification_projection.go:116-130 | internal/rpc/fragment.go:311-325 | internal/rpc/story_peer_projection.go:592-606 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/bot_verification_projection.go:116` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (15 lines × 3) internal/rpc/story_pinned_stories_cache.go:166 — internal/rpc/story_pinned_stories_cache.go:166-180 | internal/store/memory/story.go:1436-1450 | internal/store/postgres/story.go:2563-2577 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/story_pinned_stories_cache.go:166` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (15 lines × 3) internal/rpc/groupcall_sweep_dispatcher.go:41 — internal/rpc/groupcall_sweep_dispatcher.go:41-55 | internal/rpc/phone_expiry_dispatcher.go:31-45 | internal/rpc/suggested_post_dispatcher.go:37-51 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×5
  • Duplicated block (10 lines × 4) internal/botapi/server.go:574 — internal/botapi/server.go:574-583 | internal/botapi/server.go:639-648 | internal/botapi/server.go:729-738 | internal/botapi/server.go:826-835 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/botapi/server.go:574` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 4) internal/rpc/communities.go:250 — internal/rpc/communities.go:250-259 | internal/rpc/communities.go:351-360 | internal/rpc/communities.go:381-390 | internal/rpc/communities.go:415-424 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/communities.go:250` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 4) internal/rpc/payments_star_gift_collections.go:15 — internal/rpc/payments_star_gift_collections.go:15-24 | internal/rpc/payments_star_gift_collections.go:45-54 | internal/rpc/payments_star_gift_collections.go:73-82 | internal/rpc/payments_star_gifts.go:1093-1102 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/payments_star_gift_collections.go:15` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 4) internal/rpc/stories.go:586 — internal/rpc/stories.go:586-595 | internal/rpc/stories.go:2303-2312 | internal/rpc/stories.go:2359-2368 | internal/rpc/stories.go:2765-2774 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/stories.go:586` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 4) internal/store/postgres/channel_invite_import.go:71 — internal/store/postgres/channel_invite_import.go:71-80 | internal/store/postgres/channel_invite_members.go:18-27 | internal/store/postgres/channel_member_join.go:167-176 | internal/store/postgres/channel_member_join_requests.go:134-143 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×5
  • Duplicated block (9–10 lines × 2) internal/admin/service.go:2904 — internal/admin/service.go:2904-2913 | internal/admin/service.go:2949-2957 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/admin/service.go:2904` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–10 lines × 2) internal/app/userprojection/projection.go:150 — internal/app/userprojection/projection.go:150-159 | internal/app/userprojection/projection_sparse.go:87-95 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/userprojection/projection.go:150` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9–10 lines × 2) internal/compat/tdesktop/defaults.go:188 — internal/compat/tdesktop/defaults.go:188-196 | internal/rpc/convert_misc.go:155-164 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/compat/tdesktop/defaults.go:188` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: `internal/compat/tdesktop/defaults.go:188` is reached only past a guard at line 184 that tests `list.Hash` and leaves the function early, and `internal/rpc/convert_misc.go:155` reads `list.Hash` with no such check. What separates these copies is not which lines they run but which PRECONDITION they enforce, so one of them is operating on state the other one refuses. Decide which is intended BEFORE unifying them — extract the shared part and whichever copy is missing the check keeps running unchecked, and if the guard is the correct behaviour then that hole is already live.
  • Duplicated block (9–10 lines × 2) internal/rpc/outbox_dispatcher.go:251 — internal/rpc/outbox_dispatcher.go:251-259 | internal/rpc/outbox_dispatcher.go:308-317 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–10 lines × 2) internal/rpc/welcome_messages.go:22 — internal/rpc/welcome_messages.go:22-31 | internal/rpc/welcome_messages.go:46-54 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/welcome_messages.go:46` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×5
  • Duplicated block (6 lines × 4) internal/adminapi/botverification.go:356 — internal/adminapi/botverification.go:356-361 | internal/adminapi/botverification.go:373-378 | internal/adminapi/botverification.go:392-397 | internal/adminapi/botverification.go:422-427 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/adminapi/botverification.go:354` calls `FormatInt` and `internal/adminapi/botverification.go:371` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 4) internal/store/postgres/moderation.go:29 — internal/store/postgres/moderation.go:29-34 | internal/store/postgres/moderation.go:123-128 | internal/store/postgres/moderation_registries.go:88-93 | internal/store/postgres/moderation_registries.go:213-218 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/moderation.go:29` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 4) internal/store/postgres/message_history.go:829 — internal/store/postgres/message_history.go:829-834 | internal/store/postgres/message_history.go:901-906 | internal/store/postgres/message_history.go:973-978 | internal/store/postgres/saved_dialog.go:446-451 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/message_history.go:829` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 4) internal/rpc/botapi_gateway.go:186 — internal/rpc/botapi_gateway.go:186-191 | internal/rpc/botapi_gateway.go:244-249 | internal/rpc/botapi_gateway.go:302-307 | internal/rpc/botapi_gateway.go:886-891 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/rpc/botapi_gateway.go:193` calls `New` and `internal/rpc/botapi_gateway.go:308` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 4) internal/store/postgres/channel_message_history.go:74 — internal/store/postgres/channel_message_history.go:74-79 | internal/store/postgres/channel_reaction_unread.go:223-228 | internal/store/postgres/channel_read.go:701-706 | internal/store/postgres/channel_topics.go:965-970 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_message_history.go:74` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×5
  • Swallowed exception (caught, then discarded) REDACTED:208 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) internal/updatecdn/catalog.go:422 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) internal/updatecdn/server.go:81 — `if err := json.NewEncoder(w).Encode(catalog.DesktopMap()); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) internal/store/postgres/channel_core.go:700 — `if err := json.Unmarshal([]byte(raw), &out); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) internal/store/postgres/channel_message_history.go:727 — `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
D4 · Code Duplication · Edited copy of a member (52 corresponding lines) · ×4
  • Edited copy of a member (52 corresponding lines) REDACTED:94 — REDACTED:94-155 | REDACTED:157-208 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (52 corresponding lines) internal/rpc/account_deletion_notifications_worker.go:74 — internal/rpc/account_deletion_notifications_worker.go:74-137 | internal/rpc/account_freeze_worker.go:59-110 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (52 corresponding lines) internal/store/postgres/channel_history_ttl.go:33 — internal/store/postgres/channel_history_ttl.go:33-84 | internal/store/postgres/history_ttl.go:84-143 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (52 corresponding lines) internal/store/postgres/channel_reaction_unread.go:253 — internal/store/postgres/channel_reaction_unread.go:253-321 | internal/store/postgres/channel_read.go:806-857 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (41 corresponding lines) · ×4
  • Edited copy of a member (41 corresponding lines) internal/store/memory/botapi_update.go:418 — internal/store/memory/botapi_update.go:418-466 | internal/store/postgres/botapi_update.go:684-724 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (41 corresponding lines) internal/rpc/messages_history.go:308 — internal/rpc/messages_history.go:308-350 | internal/rpc/messages_read.go:95-135 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (41 corresponding lines) internal/store/postgres/channel_member_list.go:326 — internal/store/postgres/channel_member_list.go:326-366 | internal/store/postgres/channel_member_list.go:432-479 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (41 corresponding lines) internal/app/ai/provider_http.go:149 — internal/app/ai/provider_http.go:149-189 | internal/app/ai/provider_http.go:341-384 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (47 corresponding lines) · ×4
  • Edited copy of a member (47 corresponding lines) internal/store/postgres/user.go:259 — internal/store/postgres/user.go:259-305 | internal/store/postgres/user.go:658-717 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (47 corresponding lines) internal/store/memory/collectible_username.go:369 — internal/store/memory/collectible_username.go:369-426 | internal/store/memory/collectible_username.go:434-480 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (47 corresponding lines) internal/app/userprojection/contact_cache.go:423 — internal/app/userprojection/contact_cache.go:423-470 | internal/app/userprojection/contact_cache_sparse.go:113-159 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (47 corresponding lines) internal/store/postgres/message_read.go:422 — internal/store/postgres/message_read.go:422-476 | internal/store/postgres/scheduled_message.go:224-270 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 20+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 20+ corresponding lines) internal/rpc/payments_star_gift_collections.go:118 — internal/rpc/payments_star_gift_collections.go:118-142 | internal/rpc/payments_star_gift_collections.go:144-163 | internal/rpc/payments_star_gift_collections.go:165-189 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 20+ corresponding lines) internal/rpc/stories.go:2414 — internal/rpc/stories.go:2414-2435 | internal/rpc/stories.go:2499-2523 | internal/rpc/stories.go:2734-2753 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 20+ corresponding lines) internal/app/files/photos.go:282 — internal/app/files/photos.go:282-305 | internal/app/files/photos.go:764-783 | internal/app/files/photos.go:785-804 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 20+ corresponding lines) internal/compat/tdesktop/dialogs.go:54 — internal/compat/tdesktop/dialogs.go:54-78 | internal/rpc/stories.go:2906-2930 | internal/rpc/update_peer_refs.go:549-568 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 9+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 9+ corresponding lines) internal/rpc/payments_star_gift_lifecycle.go:17 — internal/rpc/payments_star_gift_lifecycle.go:17-25 | internal/rpc/payments_star_gift_lifecycle.go:161-171 | internal/rpc/payments_star_gift_unique.go:14-26 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) internal/app/channels/service.go:341 — internal/app/channels/service.go:341-349 | internal/app/channels/service.go:904-912 | internal/app/channels/service.go:2255-2263 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) internal/store/postgres/channel_reaction_unread.go:154 — internal/store/postgres/channel_reaction_unread.go:154-162 | internal/store/postgres/channel_read.go:631-639 | internal/store/postgres/channel_topics.go:908-916 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) internal/app/stories/service.go:95 — internal/app/stories/service.go:95-103 | internal/app/stories/service.go:112-121 | internal/app/stories/service.go:123-131 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 12+ corresponding lines) · ×4
  • Edited copies of one member (4 members, 12+ corresponding lines) REDACTED:1102 — REDACTED:1102-1115 | REDACTED:1535-1547 | REDACTED:1799-1811 | REDACTED:2655-2666 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 12+ corresponding lines) cmd/telesrv-admin/premium.go:12 — cmd/telesrv-admin/premium.go:12-23 | REDACTED:2126-2137 | REDACTED:2335-2346 | cmd/telesrv-admin/star_gift_catalog.go:19-30 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 12+ corresponding lines) internal/app/channels/service.go:2127 — internal/app/channels/service.go:2127-2139 | internal/app/channels/service.go:2158-2170 | internal/app/channels/service.go:2266-2277 | internal/app/channels/service.go:2280-2291 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 12+ corresponding lines) internal/app/files/upload_gc.go:19 — internal/app/files/upload_gc.go:19-39 | internal/app/rating/worker.go:33-44 | internal/app/verification/worker.go:30-41 | internal/rpc/groupcall_sweep_dispatcher.go:28-39 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 11+ corresponding lines) · ×4
  • Edited copies of one member (5 members, 11+ corresponding lines) internal/store/memory/users.go:269 — internal/store/memory/users.go:269-279 | internal/store/memory/users.go:281-291 | internal/store/memory/users.go:342-352 | internal/store/memory/users.go:355-365 | internal/store/memory/users.go:368-382 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 11+ corresponding lines) internal/store/postgres/bot.go:364 — internal/store/postgres/bot.go:364-376 | internal/store/postgres/bot.go:378-388 | internal/store/postgres/bot.go:390-400 | internal/store/postgres/bot.go:402-412 | internal/store/postgres/bot.go:414-424 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 11+ corresponding lines) internal/store/postgres/broadcast.go:153 — internal/store/postgres/broadcast.go:153-209 | internal/store/postgres/donations.go:63-73 | internal/store/postgres/donations.go:308-318 | internal/store/postgres/encrypted_queue.go:164-175 | internal/store/postgres/history_ttl.go:44-60 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 11+ corresponding lines) internal/app/ephemeral/service.go:595 — internal/app/ephemeral/service.go:595-605 | internal/app/ephemeral/service.go:607-617 | REDACTED:711-721 | internal/rpc/send_media.go:963-973 | internal/rpc/send_media.go:976-986 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (3 corresponding lines) · ×4
  • Edited copy of a member (3 corresponding lines) internal/rpc/payments_star_gifts.go:1857 — internal/rpc/payments_star_gifts.go:1857-1864 | internal/rpc/payments_star_gift_lifecycle.go:1055-1057 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) internal/store/memory/channel_reactions.go:863 — internal/store/memory/channel_reactions.go:863-865 | internal/store/postgres/channel_reaction_helpers.go:246-248 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) internal/store/memory/business.go:534 — internal/store/memory/business.go:534-541 | internal/store/postgres/business.go:853-855 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) REDACTED:620 — REDACTED:620-622 | internal/rpc/convert_updates.go:8-10 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (29 lines × 2) · ×4
  • Duplicated block (29 lines × 2) internal/rpc/botapi_update_queue.go:269 — internal/rpc/botapi_update_queue.go:269-297 | internal/rpc/botapi_update_queue.go:304-332 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/rpc/botapi_update_queue.go:303` calls `botAPIMessageFromChannel` and `internal/rpc/botapi_update_queue.go:268` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (29 lines × 2) internal/store/memory/channel_dialogs.go:567 — internal/store/memory/channel_dialogs.go:567-595 | REDACTED:2175-2203 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (29 lines × 2) internal/store/memory/channel_invites.go:35 — internal/store/memory/channel_invites.go:35-63 | internal/store/postgres/channel_invite_members.go:54-82 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_invites.go:35` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (29 lines × 2) REDACTED:520 — REDACTED:520-548 | REDACTED:1275-1303 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×4
  • Duplicated block (23 lines × 2) internal/compat/tdesktop/dialogs.go:148 — internal/compat/tdesktop/dialogs.go:148-170 | internal/compat/tdesktop/dialogs.go:174-196 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/compat/tdesktop/dialogs.go:148` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23 lines × 2) internal/store/memory/channel_members.go:558 — internal/store/memory/channel_members.go:558-580 | internal/store/postgres/channel_member_admin.go:416-438 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (23 lines × 2) internal/store/memory/channel_message_delete.go:133 — internal/store/memory/channel_message_delete.go:133-155 | internal/store/memory/channel_message_delete.go:177-199 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_message_delete.go:133` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (23 lines × 2) internal/store/memory/channel_message_edit.go:227 — internal/store/memory/channel_message_edit.go:227-249 | internal/store/postgres/channel_message_edit.go:381-403 — `internal/store/memory/channel_message_edit.go` and `internal/store/postgres/channel_message_edit.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 56 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (12 lines × 4) · ×4
  • Duplicated block (12 lines × 4) internal/loadharness/mutate.go:99 — internal/loadharness/mutate.go:99-110 | internal/loadharness/seed.go:65-76 | internal/loadharness/snapshot.go:109-120 | REDACTED:143-154 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:142` calls `resolveStartupProfile` and `internal/loadharness/mutate.go:98` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 4) internal/store/postgres/channel_member_admin.go:544 — internal/store/postgres/channel_member_admin.go:544-555 | internal/store/postgres/channel_member_admin.go:630-641 | internal/store/postgres/channel_member_admin.go:678-689 | internal/store/postgres/channel_settings.go:1097-1108 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_member_admin.go:544` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 4) internal/store/postgres/message_delete.go:565 — internal/store/postgres/message_delete.go:565-576 | internal/store/postgres/message_delete.go:579-590 | internal/store/postgres/message_delete.go:593-604 | internal/store/postgres/message_delete.go:607-618 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 4) internal/app/channels/media_count_cache.go:28 — internal/app/channels/media_count_cache.go:28-39 | internal/app/channels/participants_cache.go:36-47 | internal/app/channels/read_model_cache.go:32-43 | internal/app/channels/resolve_cache.go:31-42 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (8 lines × 5) · ×4
  • Duplicated block (8 lines × 5) internal/adminapi/server.go:838 — internal/adminapi/server.go:838-845 | internal/adminapi/server.go:872-879 | internal/adminapi/server.go:915-922 | internal/adminapi/server.go:967-974 | internal/adminapi/server.go:1319-1326 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/adminapi/server.go:838` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 5) internal/app/dialogs/service.go:315 — internal/app/dialogs/service.go:315-322 | internal/app/dialogs/service.go:1466-1473 | internal/store/memory/channel_dialogs.go:82-89 | REDACTED:428-435 | REDACTED:572-579 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/dialogs/service.go:315` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 5) internal/store/postgres/message_history.go:693 — internal/store/postgres/message_history.go:693-700 | internal/store/postgres/message_history.go:765-772 | internal/store/postgres/message_history.go:837-844 | internal/store/postgres/message_history.go:909-916 | internal/store/postgres/message_history.go:981-988 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/message_history.go:693` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 5) internal/app/privacy/service.go:570 — internal/app/privacy/service.go:570-577 | internal/rpc/stories.go:2897-2904 | internal/rpc/story_pinned_stories_cache.go:146-153 | internal/store/memory/story.go:1464-1471 | internal/store/postgres/story.go:2591-2598 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/stories.go:2897` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×4
  • Duplicated block (5 lines × 4) internal/app/dialogs/shared_list_snapshot.go:172 — internal/app/dialogs/shared_list_snapshot.go:172-176 | internal/rpc/story_projection_cache.go:217-221 | internal/store/memory/community.go:604-608 | internal/store/memory/story.go:589-593 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/dialogs/shared_list_snapshot.go:172` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) internal/domain/message_entity_autodetect.go:72 — internal/domain/message_entity_autodetect.go:72-76 | internal/domain/message_entity_autodetect.go:98-102 | internal/domain/message_entity_autodetect.go:133-137 | internal/domain/message_entity_autodetect.go:168-172 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/domain/message_entity_autodetect.go:72` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 4) internal/store/memory/channel_boosts.go:233 — internal/store/memory/channel_boosts.go:233-237 | internal/store/memory/channel_reactions.go:356-360 | internal/store/memory/channel_reactions.go:825-829 | internal/store/postgres/message_reactions.go:411-415 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_boosts.go:233` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) cmd/otpwebhook-example/main.go:393 — cmd/otpwebhook-example/main.go:393-397 | cmd/walletminiapp/main.go:597-601 | internal/botapi/server.go:1428-1432 | internal/telegramloginhttp/handler.go:811-815 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Note first that the copies are not typed on the same thing: the declarations holding them bind `any` to `body` in one and `value` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. Check import visibility before settling on that home: `internal/botapi/server.go`, `internal/telegramloginhttp/handler.go` sit under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
D4 · Code Duplication · Edited copy of a member (36 corresponding lines) · ×3
  • Edited copy of a member (36 corresponding lines) internal/store/memory/telegram_login.go:530 — internal/store/memory/telegram_login.go:530-565 | internal/store/memory/telegram_login.go:567-603 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (36 corresponding lines) internal/adminapi/server.go:1748 — internal/adminapi/server.go:1748-1783 | internal/adminapi/verification.go:21-66 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (36 corresponding lines) internal/store/memory/bot_verification.go:499 — internal/store/memory/bot_verification.go:499-534 | internal/store/memory/bot_verification.go:705-746 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (46 corresponding lines) · ×3
  • Edited copy of a member (46 corresponding lines) cmd/telesrv-admin/adminusers_api.go:191 — cmd/telesrv-admin/adminusers_api.go:191-242 | cmd/telesrv-admin/adminusers_api.go:245-290 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (46 corresponding lines) internal/store/postgres/channel_settings.go:214 — internal/store/postgres/channel_settings.go:214-270 | internal/store/postgres/channel_settings.go:405-450 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (46 corresponding lines) internal/store/postgres/channel_reaction_unread.go:38 — internal/store/postgres/channel_reaction_unread.go:38-83 | internal/store/postgres/channel_read.go:302-347 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (43 corresponding lines) · ×3
  • Edited copy of a member (43 corresponding lines) internal/admin/service.go:3492 — internal/admin/service.go:3492-3540 | internal/admin/service.go:3542-3584 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (43 corresponding lines) internal/store/postgres/bot_verification.go:737 — internal/store/postgres/bot_verification.go:737-779 | internal/store/postgres/bot_verification.go:992-1044 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (43 corresponding lines) internal/store/postgres/media.go:912 — internal/store/postgres/media.go:912-954 | internal/store/postgres/media.go:956-1019 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (39 corresponding lines) · ×3
  • Edited copy of a member (39 corresponding lines) internal/rpc/messages_reactions_lists.go:11 — internal/rpc/messages_reactions_lists.go:11-49 | internal/rpc/messages_reactions_lists.go:51-97 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (39 corresponding lines) internal/app/bots/verifierbot.go:404 — internal/app/bots/verifierbot.go:404-442 | internal/app/bots/verifybot.go:371-410 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (39 corresponding lines) internal/store/postgres/collectible_username.go:609 — internal/store/postgres/collectible_username.go:609-651 | internal/store/postgres/verification.go:831-869 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 35+ corresponding lines) · ×3
  • Edited copies of one member (4 members, 35+ corresponding lines) internal/admin/botverification.go:598 — internal/admin/botverification.go:598-637 | internal/admin/botverification.go:642-677 | internal/admin/botverification.go:681-721 | internal/admin/verification.go:213-247 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 35 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 35+ corresponding lines) internal/store/postgres/active_channel_ids_batch.go:161 — internal/store/postgres/active_channel_ids_batch.go:161-195 | internal/store/postgres/authkey_get_batch.go:162-206 | internal/store/postgres/authkey_session_layer_batch.go:168-214 | internal/store/postgres/bootstrap_update_job_batch.go:179-215 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 35 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 35+ corresponding lines) internal/store/postgres/account_rating.go:337 — internal/store/postgres/account_rating.go:337-385 | internal/store/postgres/account_rating.go:389-424 | internal/store/postgres/account_rating.go:429-463 | internal/store/postgres/account_rating.go:473-507 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 35 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 23+ corresponding lines) · ×3
  • Edited copies of one member (4 members, 23+ corresponding lines) internal/admin/service.go:2344 — internal/admin/service.go:2344-2366 | internal/admin/service.go:2369-2391 | internal/admin/service.go:3043-3066 | internal/admin/service.go:3069-3092 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 23+ corresponding lines) internal/rpc/messages_compat.go:414 — internal/rpc/messages_compat.go:414-436 | internal/rpc/messages_compat.go:438-466 | internal/rpc/story_peer_projection.go:504-526 | internal/rpc/story_peer_projection.go:528-550 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 23+ corresponding lines) internal/store/postgres/auth_delivery_report.go:130 — internal/store/postgres/auth_delivery_report.go:130-152 | internal/store/postgres/client_telemetry.go:88-110 | internal/store/postgres/moderation_cases.go:648-670 | internal/store/postgres/moderation_registries.go:268-290 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 28+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 28+ corresponding lines) internal/store/postgres/bot_verification.go:245 — internal/store/postgres/bot_verification.go:245-272 | internal/store/postgres/bot_verification.go:490-517 | internal/store/postgres/bot_verification.go:1048-1078 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 28 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 28+ corresponding lines) internal/store/postgres/moderation_cases.go:1244 — internal/store/postgres/moderation_cases.go:1244-1273 | internal/store/postgres/moderation_registries.go:292-324 | internal/store/postgres/moderation_registries.go:326-353 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 28 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 28+ corresponding lines) internal/store/postgres/channel_member_helpers.go:109 — internal/store/postgres/channel_member_helpers.go:109-163 | internal/store/postgres/peer_username.go:80-107 | internal/store/postgres/user.go:732-775 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 28 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 14+ corresponding lines) · ×3
  • Edited copies of one member (4 members, 14+ corresponding lines) internal/admin/service.go:3654 — internal/admin/service.go:3654-3667 | internal/admin/service.go:3669-3682 | internal/admin/service.go:3684-3700 | internal/admin/service.go:3829-3842 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 14+ corresponding lines) internal/mtprotoedge/transport_ownership.go:132 — internal/mtprotoedge/transport_ownership.go:132-145 | internal/mtprotoedge/transport_ownership.go:149-165 | internal/mtprotoedge/transport_ownership.go:173-189 | internal/mtprotoedge/transport_ownership.go:376-392 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 14+ corresponding lines) internal/rpc/messages_edit.go:260 — internal/rpc/messages_edit.go:260-273 | internal/rpc/messages_edit.go:275-288 | internal/rpc/messages_forward.go:776-791 | internal/rpc/messages_reactions_helpers.go:178-193 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 17+ corresponding lines) · ×3
  • Edited copies of one member (4 members, 17+ corresponding lines) internal/app/channels/service.go:458 — internal/app/channels/service.go:458-475 | internal/app/channels/service.go:478-495 | internal/app/channels/service.go:499-515 | internal/app/channels/service.go:518-535 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 17+ corresponding lines) internal/app/channels/service.go:1051 — internal/app/channels/service.go:1051-1070 | internal/app/channels/service.go:1115-1131 | internal/app/channels/service.go:1268-1287 | internal/app/messages/service.go:510-526 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 17+ corresponding lines) internal/store/postgres/channel_read.go:881 — internal/store/postgres/channel_read.go:881-905 | internal/store/postgres/groupcall.go:1034-1071 | internal/store/postgres/groupcall.go:1236-1252 | internal/store/postgres/star_gift.go:47-67 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 13+ corresponding lines) · ×3
  • Edited copies of one member (5 members, 13+ corresponding lines) cmd/telesrv-admin/serversettings.go:117 — cmd/telesrv-admin/serversettings.go:117-130 | cmd/telesrv-admin/serversettings.go:279-291 | cmd/telesrv-admin/serversettings.go:308-320 | cmd/telesrv-admin/serversettings.go:340-353 | cmd/telesrv-admin/serversettings.go:392-408 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 13+ corresponding lines) internal/store/postgres/user.go:613 — internal/store/postgres/user.go:613-625 | internal/store/postgres/user.go:628-640 | internal/store/postgres/user.go:643-655 | internal/store/postgres/user.go:887-901 | internal/store/postgres/user.go:904-916 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 13+ corresponding lines) internal/store/postgres/verification.go:1079 — internal/store/postgres/verification.go:1079-1091 | internal/store/postgres/verification.go:1096-1109 | internal/store/postgres/verification.go:1114-1128 | internal/store/postgres/verification.go:1130-1143 | internal/store/postgres/verification.go:1145-1160 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 8+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 8+ corresponding lines) internal/rpc/channels_settings.go:303 — internal/rpc/channels_settings.go:303-313 | internal/rpc/channels_settings.go:315-322 | internal/rpc/channels_settings.go:357-364 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) internal/rpc/stories.go:3402 — internal/rpc/stories.go:3402-3410 | internal/store/memory/story.go:1532-1539 | internal/store/postgres/story.go:2375-2382 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) internal/store/postgres/channel_reaction_unread.go:101 — internal/store/postgres/channel_reaction_unread.go:101-112 | internal/store/postgres/channel_read.go:578-589 | internal/store/postgres/channel_topics.go:859-866 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 7+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 7+ corresponding lines) internal/store/memory/bot.go:781 — internal/store/memory/bot.go:781-787 | internal/store/memory/bot.go:789-795 | internal/store/memory/bot.go:809-815 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) internal/mtprotoedge/rpc_execution_budget.go:200 — internal/mtprotoedge/rpc_execution_budget.go:200-206 | internal/mtprotoedge/rpc_execution_ledger.go:189-195 | internal/mtprotoedge/rpc_result_subscriber_budget.go:143-149 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) internal/rpc/convert_communities.go:47 — internal/rpc/convert_communities.go:47-53 | internal/rpc/rpc_projection_cache.go:247-256 | internal/rpc/send_media.go:1193-1199 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 13+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 13+ corresponding lines) internal/app/langpack/cache.go:63 — internal/app/langpack/cache.go:63-75 | internal/app/langpack/cache.go:176-188 | internal/store/postgres/media.go:519-531 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) internal/mtprotoedge/session_manager.go:1424 — internal/mtprotoedge/session_manager.go:1424-1436 | internal/mtprotoedge/session_manager.go:1463-1478 | internal/mtprotoedge/session_manager.go:2139-2151 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) internal/branding/branding.go:202 — internal/branding/branding.go:202-215 | internal/domain/bot.go:236-248 | internal/rpc/messages_webview.go:578-590 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (4 corresponding lines) · ×3
  • Edited copy of a member (4 corresponding lines) internal/app/botverification/service.go:1507 — internal/app/botverification/service.go:1507-1510 | internal/app/verification/service.go:1363-1366 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) internal/mtprotoedge/rpc_execution_budget.go:195 — internal/mtprotoedge/rpc_execution_budget.go:195-198 | internal/mtprotoedge/rpc_result_subscriber_budget.go:136-139 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) internal/store/postgres/account.go:148 — internal/store/postgres/account.go:148-153 | internal/store/postgres/peer_username.go:321-324 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (35 lines × 2) · ×3
  • Duplicated block (35 lines × 2) REDACTED:877 — REDACTED:877-911 | REDACTED:917-951 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (35 lines × 2) internal/mtprotoedge/bulk_rpc_scheduler.go:83 — internal/mtprotoedge/bulk_rpc_scheduler.go:83-117 | internal/mtprotoedge/outbound.go:1101-1135 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (35 lines × 2) REDACTED:64 — REDACTED:64-98 | REDACTED:116-150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:64` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×3
  • Duplicated block (27 lines × 2) internal/app/dialogs/service.go:436 — internal/app/dialogs/service.go:436-462 | internal/app/dialogs/service.go:631-657 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/dialogs/service.go:436` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (27 lines × 2) internal/store/memory/groupcall.go:581 — internal/store/memory/groupcall.go:581-607 | internal/store/postgres/groupcall.go:887-913 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (27 lines × 2) internal/store/postgres/channel_helpers.go:258 — internal/store/postgres/channel_helpers.go:258-284 | internal/store/postgres/channel_message_history.go:418-444 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_helpers.go:258` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×3
  • Duplicated block (26 lines × 2) internal/store/contact_reverse_batch.go:217 — internal/store/contact_reverse_batch.go:217-242 | internal/store/read_model_batch.go:219-244 — before extracting anything, compare `internal/store/contact_reverse_batch.go` and `internal/store/read_model_batch.go` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/contact_reverse_batch.go:217` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (26 lines × 2) internal/store/memory/channel_helpers.go:667 — internal/store/memory/channel_helpers.go:667-692 | internal/store/postgres/channel_helpers.go:985-1010 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (26 lines × 2) REDACTED:1517 — REDACTED:1517-1542 | internal/store/postgres/dialog.go:774-803 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1517` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19 lines × 3) · ×3
  • Duplicated block (19 lines × 3) REDACTED:2863 — REDACTED:2863-2881 | REDACTED:2944-2962 | cmd/telesrv-admin/star_gift_catalog.go:294-312 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:2863` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Note first that the copies are not typed on the same thing: the declarations holding them bind `string` to `apiPath` in one and `fileName` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (19 lines × 3) internal/app/privacy/service.go:218 — internal/app/privacy/service.go:218-236 | internal/app/privacy/service.go:366-384 | internal/app/privacy/service_sparse.go:67-85 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (19 lines × 3) REDACTED:540 — REDACTED:540-558 | REDACTED:2370-2388 | REDACTED:2415-2433 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:540` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×3
  • Duplicated block (13–14 lines × 2) internal/app/userprojection/contact_cache.go:457 — internal/app/userprojection/contact_cache.go:457-470 | internal/app/userprojection/contact_cache_sparse.go:147-159 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/userprojection/contact_cache.go:457` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13–14 lines × 2) REDACTED:779 — REDACTED:779-792 | REDACTED:821-833 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:779` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13–14 lines × 2) internal/store/memory/channel_message_edit.go:85 — internal/store/memory/channel_message_edit.go:85-97 | internal/store/memory/message_edit.go:75-88 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×3
  • Duplicated block (11–12 lines × 2) REDACTED:104 — REDACTED:104-115 | cmd/bots/botdemo/main.go:156-166 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (11–12 lines × 2) internal/rpc/payments_star_gift_lifecycle.go:37 — internal/rpc/payments_star_gift_lifecycle.go:37-48 | internal/rpc/payments_star_gift_lifecycle.go:113-123 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/payments_star_gift_lifecycle.go:113` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11–12 lines × 2) internal/rpc/phone_group_call.go:492 — internal/rpc/phone_group_call.go:492-502 | internal/rpc/phone_group_call.go:527-538 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×3
  • Duplicated block (7–8 lines × 2) internal/app/ephemeral/service.go:107 — internal/app/ephemeral/service.go:107-113 | internal/app/ephemeral/service.go:244-251 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/ephemeral/service.go:107` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (7–8 lines × 2) internal/store/memory/community.go:939 — internal/store/memory/community.go:939-946 | internal/store/postgres/community.go:1209-1215 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/community.go:939` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: the declarations holding them bind `int64` to `id` in one and `communityID` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (7–8 lines × 2) internal/store/postgres/channel_member_join.go:256 — internal/store/postgres/channel_member_join.go:256-263 | internal/store/postgres/community.go:896-902 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_member_join.go:256` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: `internal/store/postgres/community.go:896` is reached only past a guard at line 867 that tests `domain.ChannelMemberActive` and leaves the function early, and `internal/store/postgres/channel_member_join.go:256` reads `domain.ChannelMemberActive` with no such check. What separates these copies is not which lines they run but which PRECONDITION they enforce, so one of them is operating on state the other one refuses. Decide which is intended BEFORE unifying them — extract the shared part and whichever copy is missing the check keeps running unchecked, and if the guard is the correct behaviour then that hole is already live.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×3
  • Duplicated block (7 lines × 4) internal/admin/service.go:2579 — internal/admin/service.go:2579-2585 | internal/admin/service.go:2660-2666 | internal/admin/service.go:2722-2728 | internal/admin/service.go:2779-2785 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 4) internal/store/postgres/saved_dialog.go:42 — internal/store/postgres/saved_dialog.go:42-48 | internal/store/postgres/saved_dialog.go:73-79 | internal/store/postgres/saved_dialog.go:111-117 | internal/store/postgres/saved_dialog.go:157-163 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/saved_dialog.go:42` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 4) internal/store/postgres/channel_member_join_requests.go:13 — internal/store/postgres/channel_member_join_requests.go:13-19 | internal/store/postgres/channel_member_join_requests.go:39-45 | internal/store/postgres/channel_member_join_requests.go:65-71 | internal/store/postgres/channel_message_settings.go:13-19 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_member_join_requests.go:13` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
X2 · Cancellation propagation · Function without context.Context · ×3
  • Function without context.Context: listening internal/procctl/supervisor.go:221 — `listening` calls `net.DialTimeout(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
  • Function without context.Context: fetch internal/app/files/maptile_proxy.go:167 — `fetch` calls `http.NewRequestWithContext(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
  • Function without context.Context: serverListening cmd/telesrv-admin/serverstorage.go:300 — `serverListening` calls `net.DialTimeout(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
X26 · Unsynchronised callback handoff · Collection crosses a callback boundary unsynchronised · ×3
  • Collection crosses a callback boundary unsynchronised internal/app/userprojection/projection.go:392 — `projectBatch` starts two goroutines that both write `profileRefs`, a map — `profileRefs = …` on line 392, and again on line 409 — and waits on `g` only after both have started, so the two run at the same time with nothing ordering one write against the other. A Go map is not safe for concurrent use: a write concurrent with any other access is a data race, and the runtime aborts the whole process with `fatal error: concurrent map writes` when it catches one. `g` is an `errgroup.Group`, which orders the handoff's signal and takes no exclusion over the map's own state. Guard every write to `profileRefs` with one `sync.Mutex`, or have each goroutine send its result on a channel that this body alone receives from and writes into `profileRefs`.
  • Collection crosses a callback boundary unsynchronised cmd/telesrv-admin/activity.go:68 — `DashboardActivity` starts two goroutines that both write `err`, a variable — `err = …` on line 68, and again on line 79 — and waits on `g` only after both have started, so the two run at the same time with nothing ordering one write against the other. A goroutine's closure captures `err` by reference, so every goroutine and the body use ONE variable, and a plain variable has no synchronisation of its own: by the Go memory model a write concurrent with any other access to it is a data race (the race detector reports it), a racing `++` loses updates, and a racing read sees a stale or torn value. `g` is an `errgroup.Group`, which orders the handoff's signal and takes no exclusion over the variable's own state. Guard every write to `err` with one `sync.Mutex`, or have each goroutine send its result on a channel that this body alone receives from and writes into `err`.
  • Collection crosses a callback boundary unsynchronised cmd/telesrv-admin/activity.go:79 — `DashboardActivity` starts two goroutines that both write `err`, a variable — `err = …` on line 79, and again on line 90 — and waits on `g` only after both have started, so the two run at the same time with nothing ordering one write against the other. A goroutine's closure captures `err` by reference, so every goroutine and the body use ONE variable, and a plain variable has no synchronisation of its own: by the Go memory model a write concurrent with any other access to it is a data race (the race detector reports it), a racing `++` loses updates, and a racing read sees a stale or torn value. `g` is an `errgroup.Group`, which orders the handoff's signal and takes no exclusion over the variable's own state. Guard every write to `err` with one `sync.Mutex`, or have each goroutine send its result on a channel that this body alone receives from and writes into `err`.
AC1 · Text alternatives · <video> without a captions track · ×2
  • <video> without a captions track cmd/telesrv-admin/web/src/components/chat/ChatMedia.tsx:69 — Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation).
  • <video> without a captions track cmd/telesrv-admin/web/src/components/chat/ChatMedia.tsx:191 — Video with no captions <track> offers no captions. This player's source is set at runtime, so there is no caption file to author here: give the player a way to carry captions — accept a track/captions URL alongside the media and render a <track kind="captions"> when one is supplied — and capture that asset wherever the media enters the product (upload, import or generation).
D1 · Cyclomatic Complexity · ChannelStore.ListChannelMessagePublicForwards (cyclomatic 20) · ×2
  • ChannelStore.ListChannelMessagePublicForwards (cyclomatic 20) internal/store/memory/channel_stats.go:241 — ChannelStore.ListChannelMessagePublicForwards 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.
  • ChannelStore.ListChannelMessagePublicForwards (cyclomatic 20) internal/store/postgres/channel_stats.go:412 — ChannelStore.ListChannelMessagePublicForwards has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CommunityStore.DecideAllCommunityPeerLinkRequests (cyclomatic 16) · ×2
  • CommunityStore.DecideAllCommunityPeerLinkRequests (cyclomatic 16) internal/store/memory/community.go:590 — CommunityStore.DecideAllCommunityPeerLinkRequests has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • CommunityStore.DecideAllCommunityPeerLinkRequests (cyclomatic 16) internal/store/postgres/community.go:748 — CommunityStore.DecideAllCommunityPeerLinkRequests has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to one function literal inside it that branches (line 749). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · main.main (cognitive 40) · ×2
  • main.main (cognitive 40) REDACTED:86 — main.main has cognitive complexity 40 (threshold 15). Drivers by points: if/else 24 (30 pts), loops 2 (5 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 10). Most of this is not in the body itself: 5 of the 40 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 142, 122). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
  • main.main (cognitive 40) cmd/catalogfetch/main.go:90 — main.main has cognitive complexity 40 (threshold 15). Drivers by points: if/else 20 (29 pts), loops 5 (11 pts) (nesting depth added 15). Most of this is not in the body itself: 4 of the 40 points are its own statements and the rest belongs to one function literal inside it that branches (line 111). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · TelegramLoginStore.UpsertTelegramLoginNativeApp (cognitive 22) · ×2
  • TelegramLoginStore.UpsertTelegramLoginNativeApp (cognitive 22) internal/store/memory/telegram_login.go:214 — TelegramLoginStore.UpsertTelegramLoginNativeApp has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • TelegramLoginStore.UpsertTelegramLoginNativeApp (cognitive 22) internal/store/postgres/telegram_login.go:270 — TelegramLoginStore.UpsertTelegramLoginNativeApp has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15 (22 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Medium vulnerability · ×2
  • REDACTED
  • REDACTED
D4 · Code Duplication · Near-duplicate member pair (31 shared lines) · ×2
  • Near-duplicate member pair (31 shared lines) REDACTED:193 — REDACTED:193-250 | internal/app/account/phone_change.go:23-101 — These two members are variants of one another: 31 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (31 shared lines) internal/rpc/messages_edit_geolive.go:16 — internal/rpc/messages_edit_geolive.go:16-118 | internal/rpc/messages_todos.go:197-275 — These two members are variants of one another: 31 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (28 shared lines) · ×2
  • Near-duplicate member pair (28 shared lines) internal/store/postgres/channel_member_admin.go:10 — internal/store/postgres/channel_member_admin.go:10-163 | internal/store/postgres/channel_member_admin.go:305-367 — These two members are variants of one another: 28 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (28 shared lines) internal/store/postgres/channel_message_edit.go:417 — internal/store/postgres/channel_message_edit.go:417-509 | internal/store/postgres/channel_message_edit.go:513-595 — These two members are variants of one another: 28 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (68 corresponding lines) · ×2
  • Edited copy of a member (68 corresponding lines) internal/store/postgres/channel_settings.go:15 — internal/store/postgres/channel_settings.go:15-82 | internal/store/postgres/channel_settings.go:84-162 — These two members are one piece of code written twice and then edited apart: 68 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (68 corresponding lines) cmd/telesrv-admin/readstore.go:626 — cmd/telesrv-admin/readstore.go:626-693 | cmd/telesrv-admin/readstore.go:2872-2978 — These two members are one piece of code written twice and then edited apart: 68 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (50 corresponding lines) · ×2
  • Edited copy of a member (50 corresponding lines) internal/store/postgres/channel_message_delete.go:13 — internal/store/postgres/channel_message_delete.go:13-62 | internal/store/postgres/channel_message_delete.go:64-124 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (50 corresponding lines) internal/store/postgres/channel_invite_import.go:60 — internal/store/postgres/channel_invite_import.go:60-109 | internal/store/postgres/channel_member_join_requests.go:123-180 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (44 corresponding lines) · ×2
  • Edited copy of a member (44 corresponding lines) REDACTED:2919 — REDACTED:2919-2962 | cmd/telesrv-admin/star_gift_catalog.go:258-312 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (44 corresponding lines) internal/store/memory/channel_topics.go:318 — internal/store/memory/channel_topics.go:318-364 | internal/store/postgres/channel_topics.go:341-384 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (48 corresponding lines) · ×2
  • Edited copy of a member (48 corresponding lines) internal/store/memory/channel_reactions.go:545 — internal/store/memory/channel_reactions.go:545-592 | internal/store/memory/channel_read.go:148-196 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (48 corresponding lines) REDACTED:1149 — REDACTED:1149-1216 | REDACTED:1218-1265 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (40 corresponding lines) · ×2
  • Edited copy of a member (40 corresponding lines) internal/rpc/update_peer_refs.go:332 — internal/rpc/update_peer_refs.go:332-371 | internal/rpc/update_peer_refs.go:416-468 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (40 corresponding lines) internal/store/contact_reverse_batch.go:244 — internal/store/contact_reverse_batch.go:244-284 | internal/store/read_model_batch.go:246-285 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 37+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 37+ corresponding lines) internal/store/postgres/star_gift_lifecycle.go:1713 — internal/store/postgres/star_gift_lifecycle.go:1713-1754 | internal/store/postgres/star_gift_lifecycle.go:1778-1814 | internal/store/postgres/star_gift_lifecycle.go:1835-1871 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 37 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 37+ corresponding lines) REDACTED:786 — REDACTED:786-830 | internal/store/postgres/media.go:1387-1433 | internal/store/postgres/privacy.go:70-106 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 37 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 39+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 39+ corresponding lines) internal/admin/service.go:2277 — internal/admin/service.go:2277-2318 | internal/admin/service.go:2895-2933 | internal/admin/service.go:2937-2976 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 39 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 39+ corresponding lines) internal/store/postgres/channel_reaction_unread.go:114 — internal/store/postgres/channel_reaction_unread.go:114-152 | internal/store/postgres/channel_read.go:591-629 | internal/store/postgres/channel_topics.go:868-906 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 39 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (58 corresponding lines) · ×2
  • Edited copy of a member (58 corresponding lines) internal/store/contact_reverse_batch.go:185 — internal/store/contact_reverse_batch.go:185-242 | internal/store/read_model_batch.go:187-244 — These two members are one piece of code written twice and then edited apart: 58 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (58 corresponding lines) REDACTED:1492 — REDACTED:1492-1549 | internal/store/postgres/dialog.go:750-810 — These two members are one piece of code written twice and then edited apart: 58 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (38 corresponding lines) · ×2
  • Edited copy of a member (38 corresponding lines) REDACTED:458 — REDACTED:458-495 | REDACTED:497-536 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (38 corresponding lines) internal/store/postgres/channel_read.go:907 — internal/store/postgres/channel_read.go:907-957 | internal/store/postgres/channel_membership_batch.go:227-264 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 31+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 31+ corresponding lines) internal/rpc/messages_edit_geolive.go:128 — internal/rpc/messages_edit_geolive.go:128-158 | internal/rpc/messages_polls_updates.go:41-71 | internal/rpc/messages_todos.go:284-314 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 31 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 31+ corresponding lines) internal/store/postgres/star_gift_craft_auction.go:754 — internal/store/postgres/star_gift_craft_auction.go:754-795 | internal/store/postgres/star_gift_lifecycle.go:745-776 | internal/store/postgres/star_gift_lifecycle.go:1169-1199 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 31 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 27+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 27+ corresponding lines) REDACTED:538 — REDACTED:538-570 | REDACTED:586-612 | REDACTED:2368-2408 | REDACTED:2413-2449 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 27 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 27+ corresponding lines) internal/store/postgres/channel_boosts.go:336 — internal/store/postgres/channel_boosts.go:336-366 | internal/store/postgres/channel_polls.go:169-195 | internal/store/postgres/channel_polls.go:200-228 | REDACTED:207-233 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 27 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 26+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 26+ corresponding lines) cmd/telesrv-admin/botverification.go:330 — cmd/telesrv-admin/botverification.go:330-362 | cmd/telesrv-admin/botverification.go:425-450 | cmd/telesrv-admin/botverification.go:490-516 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 26+ corresponding lines) internal/mtprotoedge/session_manager.go:2089 — internal/mtprotoedge/session_manager.go:2089-2114 | internal/mtprotoedge/session_manager.go:2352-2384 | internal/mtprotoedge/session_manager.go:2444-2473 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 23+ corresponding lines) · ×2
  • Edited copies of one member (5 members, 23+ corresponding lines) cmd/telesrv-admin/readstore.go:1313 — cmd/telesrv-admin/readstore.go:1313-1335 | cmd/telesrv-admin/readstore.go:1342-1373 | cmd/telesrv-admin/readstore.go:1375-1397 | cmd/telesrv-admin/readstore.go:1431-1458 | cmd/telesrv-admin/readstore.go:1460-1488 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 23+ corresponding lines) internal/store/postgres/bot_verification.go:1083 — internal/store/postgres/bot_verification.go:1083-1108 | internal/store/postgres/media.go:304-326 | internal/store/postgres/media_search.go:258-283 | internal/store/postgres/media_search.go:370-392 | internal/store/postgres/verification.go:803-828 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 27+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 27+ corresponding lines) internal/botapi/server.go:837 — internal/botapi/server.go:837-863 | internal/botapi/server.go:1214-1244 | internal/botapi/server.go:1246-1273 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 27 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 27+ corresponding lines) internal/store/postgres/channel_helpers.go:701 — internal/store/postgres/channel_helpers.go:701-733 | internal/store/postgres/channel_helpers.go:735-761 | internal/store/postgres/channel_helpers.go:763-806 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 27 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 14+ corresponding lines) · ×2
  • Edited copies of one member (5 members, 14+ corresponding lines) internal/admin/service.go:3426 — internal/admin/service.go:3426-3439 | internal/admin/service.go:3441-3454 | internal/admin/service.go:3456-3472 | internal/admin/service.go:3474-3490 | internal/admin/service.go:3586-3602 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 14+ corresponding lines) internal/store/memory/channel_settings.go:193 — internal/store/memory/channel_settings.go:193-206 | internal/store/memory/channel_settings.go:208-225 | internal/store/memory/channel_settings.go:262-276 | internal/store/memory/channel_settings.go:278-295 | internal/store/memory/channel_settings.go:297-313 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 22+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 22+ corresponding lines) internal/rpc/account.go:1266 — internal/rpc/account.go:1266-1290 | internal/rpc/channels_stubs.go:553-578 | internal/rpc/convert_business.go:252-273 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 22+ corresponding lines) internal/app/dialogs/service.go:837 — internal/app/dialogs/service.go:837-859 | internal/store/memory/channel_dialogs.go:469-491 | REDACTED:2074-2095 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 18+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 18+ corresponding lines) internal/app/peerview/cache.go:147 — internal/app/peerview/cache.go:147-164 | internal/app/users/service.go:942-962 | internal/rpc/channels_stubs.go:407-424 | internal/rpc/peer_projection_cache.go:261-278 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 18+ corresponding lines) internal/rpc/account_deletion_notifications_worker.go:19 — internal/rpc/account_deletion_notifications_worker.go:19-37 | internal/rpc/account_freeze_worker.go:16-34 | internal/rpc/account_lifecycle_worker.go:19-37 | internal/rpc/premium_sweeper.go:20-37 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 16+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 16+ corresponding lines) internal/rpc/account.go:1673 — internal/rpc/account.go:1673-1691 | internal/rpc/account.go:1697-1712 | internal/rpc/bots_longtail.go:87-107 | internal/rpc/bots_longtail.go:109-129 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 16+ corresponding lines) internal/loadharness/dataset.go:335 — internal/loadharness/dataset.go:335-353 | internal/loadharness/dataset.go:365-380 | internal/loadharness/file_fixture.go:85-100 | internal/loadharness/snapshot.go:695-710 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 12+ corresponding lines) · ×2
  • Edited copies of one member (6 members, 12+ corresponding lines) internal/app/channels/service.go:1073 — internal/app/channels/service.go:1073-1084 | internal/app/channels/service.go:1087-1098 | internal/app/channels/service.go:1101-1112 | internal/app/channels/service.go:1134-1146 | internal/app/channels/service.go:1193-1208 | internal/app/channels/service.go:2302-2314 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
  • Edited copies of one member (6 members, 12+ corresponding lines) internal/store/postgres/business.go:199 — internal/store/postgres/business.go:199-224 | internal/store/postgres/chatlist.go:79-92 | internal/store/postgres/chatlist.go:94-107 | internal/store/postgres/chatlist.go:208-221 | internal/store/postgres/chatlist.go:223-236 | internal/store/postgres/community.go:152-163 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 10+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 10+ corresponding lines) internal/loadharness/dataset.go:251 — internal/loadharness/dataset.go:251-260 | internal/loadharness/dataset.go:323-333 | internal/loadharness/file_fixture.go:102-112 | internal/loadharness/types.go:126-136 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 10+ corresponding lines) REDACTED:1176 — REDACTED:1176-1191 | internal/store/postgres/gif_catalog.go:47-56 | internal/store/postgres/scheduled_message.go:412-430 | internal/store/postgres/themes.go:105-114 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 4+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 4+ corresponding lines) internal/rpc/channels_members.go:714 — internal/rpc/channels_members.go:714-717 | internal/store/memory/channel_invites.go:991-994 | internal/store/postgres/channel_invite_helpers.go:7-10 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) internal/app/files/sticker_creator.go:694 — internal/app/files/sticker_creator.go:694-697 | internal/store/memory/business.go:543-546 | internal/store/postgres/business.go:857-860 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (32 lines × 2) · ×2
  • Duplicated block (32 lines × 2) internal/rpc/stories.go:2124 — internal/rpc/stories.go:2124-2155 | internal/rpc/stories.go:2219-2250 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/rpc/stories.go:2121` calls `addCandidateIDs` and `internal/rpc/stories.go:2217` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (32 lines × 2) internal/store/memory/channel_helpers.go:196 — internal/store/memory/channel_helpers.go:196-227 | internal/store/memory/channel_message_history.go:297-328 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_helpers.go:196` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×2
  • Duplicated block (22 lines × 2) internal/rpc/stories.go:2100 — internal/rpc/stories.go:2100-2121 | internal/rpc/stories.go:2197-2218 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/stories.go:2100` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/rpc/stories.go:2123` calls `addCandidateIDs` and `internal/rpc/stories.go:2220` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (22 lines × 2) internal/store/memory/channel_dialogs.go:494 — internal/store/memory/channel_dialogs.go:494-515 | REDACTED:2244-2265 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (18 lines × 3) · ×2
  • Duplicated block (18 lines × 3) internal/rpc/messages_compat.go:419 — internal/rpc/messages_compat.go:419-436 | internal/rpc/story_peer_projection.go:509-526 | internal/rpc/story_peer_projection.go:533-550 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_compat.go:419` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 3) internal/store/postgres/channel_message_delete.go:339 — internal/store/postgres/channel_message_delete.go:339-356 | internal/store/postgres/channel_message_delete.go:408-425 | internal/store/postgres/channel_topics.go:430-447 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×2
  • Duplicated block (16–18 lines × 2) internal/app/bots/verifierbot.go:953 — internal/app/bots/verifierbot.go:953-968 | internal/app/bots/verifierbot.go:1004-1021 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/bots/verifierbot.go:953` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16–18 lines × 2) internal/app/userprojection/projection.go:196 — internal/app/userprojection/projection.go:196-211 | internal/app/userprojection/projection.go:455-472 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/userprojection/projection.go:196` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/app/userprojection/projection.go:195` calls `cloneUsers` and `internal/app/userprojection/projection.go:454` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×2
  • Duplicated block (14–15 lines × 2) internal/app/channels/bot_member_ids_cache.go:68 — internal/app/channels/bot_member_ids_cache.go:68-81 | internal/app/channels/participants_cache.go:103-117 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14–15 lines × 2) internal/loadharness/mutate.go:141 — internal/loadharness/mutate.go:141-154 | internal/loadharness/snapshot.go:139-153 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/loadharness/mutate.go:141` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–15 lines × 2) · ×2
  • Duplicated block (12–15 lines × 2) REDACTED:316 — REDACTED:316-330 | REDACTED:412-423 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:316` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12–15 lines × 2) internal/store/postgres/star_gift_private_projection.go:30 — internal/store/postgres/star_gift_private_projection.go:30-41 | internal/store/postgres/star_gift_private_projection.go:105-119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/star_gift_private_projection.go:105` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/store/postgres/star_gift_private_projection.go:44` calls `privateStarGiftAction` and `internal/store/postgres/star_gift_private_projection.go:121` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12 lines × 8) · ×2
  • Duplicated block (12 lines × 8) internal/admin/service.go:1412 — internal/admin/service.go:1412-1423 | internal/app/channels/service.go:2452-2463 | internal/app/peerview/cache.go:153-164 | internal/app/userprojection/durable_user_facts.go:131-142 | internal/domain/media.go:1038-1049 | internal/domain/media.go:1055-1066 | internal/rpc/channels_stubs.go:413-424 | internal/rpc/peer_projection_cache.go:267-278 — there are 8 copies across 7 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 8 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/admin/service.go:1412` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 8) internal/store/postgres/message_delete.go:41 — internal/store/postgres/message_delete.go:41-52 | internal/store/postgres/message_edit.go:33-44 | internal/store/postgres/message_history.go:317-328 | internal/store/postgres/message_history.go:512-523 | internal/store/postgres/message_pin.go:40-51 | internal/store/postgres/message_pin.go:186-197 | internal/store/postgres/message_read.go:44-55 | internal/store/postgres/saved_dialog.go:265-276 — there are 8 copies across 6 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 8 sites; resolving a subset leaves the remainder to drift apart. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (11 lines × 5) · ×2
  • Duplicated block (11 lines × 5) cmd/telesrv-admin/privateview.go:573 — cmd/telesrv-admin/privateview.go:573-583 | REDACTED:546-556 | REDACTED:588-598 | REDACTED:2376-2386 | REDACTED:2421-2431 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (11 lines × 5) internal/rpc/stories.go:1209 — internal/rpc/stories.go:1209-1219 | internal/rpc/stories.go:2302-2312 | internal/rpc/stories.go:2358-2368 | internal/rpc/stories.go:2648-2658 | internal/rpc/stories.go:2764-2774 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9–11 lines × 2) · ×2
  • Duplicated block (9–11 lines × 2) internal/admin/botverification.go:643 — internal/admin/botverification.go:643-653 | internal/admin/botverification.go:682-690 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9–11 lines × 2) internal/store/storetest/groupcall.go:438 — internal/store/storetest/groupcall.go:438-446 | internal/store/storetest/groupcall.go:487-497 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/storetest/groupcall.go:438` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (10 lines × 9) · ×2
  • Duplicated block (10 lines × 9) internal/store/memory/channel_reactions.go:16 — internal/store/memory/channel_reactions.go:16-25 | internal/store/memory/channel_settings.go:423-432 | internal/store/memory/channel_settings.go:453-462 | internal/store/memory/channel_settings.go:483-492 | internal/store/memory/channel_settings.go:532-541 | internal/store/memory/channel_settings.go:562-571 | internal/store/memory/channel_settings.go:581-590 | internal/store/memory/channel_settings.go:600-609 | internal/store/memory/channel_settings.go:623-632 — there are 9 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 9 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (10 lines × 9) internal/store/postgres/channel_settings.go:585 — internal/store/postgres/channel_settings.go:585-594 | internal/store/postgres/channel_settings.go:722-731 | internal/store/postgres/channel_settings.go:771-780 | internal/store/postgres/channel_settings.go:807-816 | internal/store/postgres/channel_settings.go:856-865 | internal/store/postgres/channel_settings.go:905-914 | internal/store/postgres/channel_settings.go:941-950 | internal/store/postgres/channel_settings.go:989-998 | internal/store/postgres/channel_topics.go:26-35 — there are 9 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 9 sites; resolving a subset leaves the remainder to drift apart. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (10 lines × 7) · ×2
  • Duplicated block (10 lines × 7) internal/rpc/stories.go:411 — internal/rpc/stories.go:411-420 | internal/rpc/stories.go:552-561 | internal/rpc/stories.go:1210-1219 | internal/rpc/stories.go:2458-2467 | internal/rpc/stories.go:2540-2549 | internal/rpc/stories.go:2576-2585 | internal/rpc/stories.go:2649-2658 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/stories.go:411` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 7) internal/rpc/stories.go:411 — internal/rpc/stories.go:411-420 | internal/rpc/stories.go:552-561 | internal/rpc/stories.go:586-595 | internal/rpc/stories.go:1368-1377 | internal/rpc/stories.go:2458-2467 | internal/rpc/stories.go:2540-2549 | internal/rpc/stories.go:2576-2585 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/stories.go:411` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10 lines × 6) · ×2
  • Duplicated block (10 lines × 6) cmd/telesrv-admin/account_rating.go:72 — cmd/telesrv-admin/account_rating.go:72-81 | cmd/telesrv-admin/botverification.go:116-125 | cmd/telesrv-admin/botverification.go:163-172 | cmd/telesrv-admin/donations.go:75-84 | REDACTED:2691-2700 | cmd/telesrv-admin/verification.go:43-52 — there are 6 copies across 5 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `cmd/telesrv-admin/donations.go:74` calls `Query` and `cmd/telesrv-admin/account_rating.go:71` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 6) cmd/telesrv-admin/botverification.go:135 — cmd/telesrv-admin/botverification.go:135-144 | cmd/telesrv-admin/botverification.go:184-193 | REDACTED:2706-2715 | cmd/telesrv-admin/verification.go:64-73 | internal/adminapi/botverification.go:108-117 | internal/adminapi/botverification.go:169-178 — there are 6 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/telesrv-admin/botverification.go:135` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Check import visibility before settling on that home: `internal/adminapi/botverification.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
D4 · Code Duplication · Duplicated block (10 lines × 5) · ×2
  • Duplicated block (10 lines × 5) internal/store/postgres/message_delete.go:565 — internal/store/postgres/message_delete.go:565-574 | internal/store/postgres/message_delete.go:579-588 | internal/store/postgres/message_delete.go:593-602 | internal/store/postgres/message_delete.go:607-616 | internal/store/postgres/saved_dialog.go:292-301 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (10 lines × 5) internal/store/postgres/message_edit.go:37 — internal/store/postgres/message_edit.go:37-47 | internal/store/postgres/message_history.go:321-331 | internal/store/postgres/message_history.go:516-526 | internal/store/postgres/message_pin.go:44-53 | internal/store/postgres/message_pin.go:190-199 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/message_edit.go:37` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (9 lines × 6) · ×2
  • Duplicated block (9 lines × 6) internal/app/files/botfather_avatar_seed.go:36 — internal/app/files/botfather_avatar_seed.go:36-44 | internal/app/files/chatbot_avatar_seed.go:35-43 | internal/app/files/gifbot_avatar_seed.go:35-43 | internal/app/files/premiumbot_avatar_seed.go:35-43 | internal/app/files/stickers_bot_avatar_seed.go:35-43 | internal/app/files/verifybot_avatar_seed.go:35-43 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/files/botfather_avatar_seed.go:36` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 6) internal/rpc/stats.go:204 — internal/rpc/stats.go:204-212 | internal/rpc/stories.go:413-421 | internal/rpc/stories.go:1212-1220 | internal/rpc/stories.go:2460-2468 | internal/rpc/stories.go:2542-2550 | internal/rpc/stories.go:2578-2586 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/stats.go:204` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×2
  • Duplicated block (8–9 lines × 2) internal/app/telegramlogin/service.go:1028 — internal/app/telegramlogin/service.go:1028-1035 | internal/app/telegramlogin/service.go:1049-1057 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8–9 lines × 2) internal/store/postgres/channel_message_send.go:262 — internal/store/postgres/channel_message_send.go:262-270 | internal/store/postgres/channel_monoforum.go:164-171 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_message_send.go:262` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 9) · ×2
  • Duplicated block (8 lines × 9) REDACTED:971 — REDACTED:971-978 | REDACTED:1635-1642 | REDACTED:1680-1687 | REDACTED:2034-2041 | REDACTED:2080-2087 | REDACTED:2157-2164 | cmd/telesrv-admin/serversettings.go:241-248 | cmd/telesrv-admin/star_gift_catalog.go:92-99 | cmd/telesrv-admin/star_gift_catalog.go:375-382 — there are 9 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 9 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:971` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 9) internal/store/postgres/channel_settings.go:166 — internal/store/postgres/channel_settings.go:166-173 | internal/store/postgres/channel_settings.go:575-582 | internal/store/postgres/channel_settings.go:712-719 | internal/store/postgres/channel_settings.go:761-768 | internal/store/postgres/channel_settings.go:797-804 | internal/store/postgres/channel_settings.go:846-853 | internal/store/postgres/channel_settings.go:895-902 | internal/store/postgres/channel_settings.go:931-938 | internal/store/postgres/channel_topics.go:16-23 — there are 9 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 9 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_settings.go:166` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 5) · ×2
  • Duplicated block (7 lines × 5) internal/adminapi/server.go:830 — internal/adminapi/server.go:830-836 | internal/adminapi/server.go:864-870 | internal/adminapi/server.go:907-913 | internal/adminapi/server.go:959-965 | internal/adminapi/server.go:1311-1317 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (7 lines × 5) internal/app/dialogs/list_snapshot_cache.go:197 — internal/app/dialogs/list_snapshot_cache.go:197-203 | internal/rpc/channel_interest.go:187-193 | internal/rpc/messages_dialogs.go:319-325 | REDACTED:965-971 | REDACTED:2226-2232 — there are 5 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×2
  • Duplicated block (5 lines × 5) internal/rpc/presence_last_seen_batch.go:205 — internal/rpc/presence_last_seen_batch.go:205-209 | internal/store/memory/channel_read.go:333-337 | REDACTED:716-720 | internal/store/postgres/channel_message_delete.go:171-175 | internal/store/postgres/user.go:534-538 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times.
  • Duplicated block (5 lines × 5) internal/store/memory/channel_invites.go:596 — internal/store/memory/channel_invites.go:596-600 | internal/store/memory/channel_invites.go:643-647 | internal/store/memory/poll.go:68-72 | internal/store/memory/poll.go:170-174 | internal/store/memory/poll.go:213-217 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_invites.go:596` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D1 · Cyclomatic Complexity · ReadModelChangeListener.handlePayload (cyclomatic 144) · ×1
  • ReadModelChangeListener.handlePayload (cyclomatic 144) internal/store/postgres/read_model_listener.go:381 — ReadModelChangeListener.handlePayload has cyclomatic complexity 144 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · main.run (cyclomatic 136) · ×1
  • main.run (cyclomatic 136) REDACTED:600 — main.run has cyclomatic complexity 136 (threshold 15). Of this number, 134 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · config.Load (cyclomatic 109) · ×1
  • config.Load (cyclomatic 109) internal/config/config.go:958 — config.Load has cyclomatic complexity 109 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Server.prepareInboundLayerRPCBatch (cyclomatic 109) · ×1
  • Server.prepareInboundLayerRPCBatch (cyclomatic 109) internal/mtprotoedge/inbound_layer_rpc.go:305 — Server.prepareInboundLayerRPCBatch has cyclomatic complexity 109 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Router.registerMessages (cyclomatic 105) · ×1
  • Router.registerMessages (cyclomatic 105) internal/rpc/messages_register.go:15 — Router.registerMessages has cyclomatic complexity 105 (threshold 15). Most of this is not in the body itself: 1 of the 105 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 713, 493, 416, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · TelegramLoginRequest.Validate (cyclomatic 100) · ×1
  • TelegramLoginRequest.Validate (cyclomatic 100) internal/domain/telegram_login.go:236 — TelegramLoginRequest.Validate has cyclomatic complexity 100 (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.
D1 · Cyclomatic Complexity · rpc.tgOtherUpdateFromEvent (cyclomatic 98) · ×1
  • rpc.tgOtherUpdateFromEvent (cyclomatic 98) internal/rpc/convert_updates.go:253 — rpc.tgOtherUpdateFromEvent has cyclomatic complexity 98 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MessageStore.sendPrivateTextOnce (cyclomatic 96) · ×1
  • MessageStore.sendPrivateTextOnce (cyclomatic 96) internal/store/postgres/message_send.go:171 — MessageStore.sendPrivateTextOnce has cyclomatic complexity 96 (threshold 15). Of this number, 95 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Router.onMessagesForwardMessages (cyclomatic 82) · ×1
  • Router.onMessagesForwardMessages (cyclomatic 82) internal/rpc/messages_forward.go:13 — Router.onMessagesForwardMessages has cyclomatic complexity 82 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.CraftStarGift (cyclomatic 80) · ×1
  • StarGiftLifecycleStore.CraftStarGift (cyclomatic 80) internal/store/postgres/star_gift_craft_auction.go:276 — StarGiftLifecycleStore.CraftStarGift has cyclomatic complexity 80 (threshold 15). Of this number, 28 points are the body's own statements and 52 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.ListChannelHistory (cyclomatic 78) · ×1
  • ChannelStore.ListChannelHistory (cyclomatic 78) internal/store/memory/channel_message_history.go:11 — ChannelStore.ListChannelHistory has cyclomatic complexity 78 (threshold 15). Of this number, 63 points are the body's own statements and 15 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.sendChannelMessageOnce (cyclomatic 78) · ×1
  • ChannelStore.sendChannelMessageOnce (cyclomatic 78) internal/store/postgres/channel_message_send.go:51 — ChannelStore.sendChannelMessageOnce has cyclomatic complexity 78 (threshold 15). Of this number, 77 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Router.resolveInputMedia (cyclomatic 76) · ×1
  • Router.resolveInputMedia (cyclomatic 76) internal/rpc/send_media.go:630 — Router.resolveInputMedia has cyclomatic complexity 76 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.EditChannelMessage (cyclomatic 76) · ×1
  • ChannelStore.EditChannelMessage (cyclomatic 76) internal/store/postgres/channel_message_edit.go:14 — ChannelStore.EditChannelMessage has cyclomatic complexity 76 (threshold 15). Of this number, 75 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MessageStore.EditMessage (cyclomatic 74) · ×1
  • MessageStore.EditMessage (cyclomatic 74) internal/store/postgres/message_edit.go:13 — MessageStore.EditMessage has cyclomatic complexity 74 (threshold 15). Of this number, 73 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · botapi.parseBotAPIMarkdownV2 (cyclomatic 70) · ×1
  • botapi.parseBotAPIMarkdownV2 (cyclomatic 70) internal/botapi/formatted_text.go:645 — botapi.parseBotAPIMarkdownV2 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.
D1 · Cyclomatic Complexity · StarGiftUpgradeStore.UpgradeStarGift (cyclomatic 70) · ×1
  • StarGiftUpgradeStore.UpgradeStarGift (cyclomatic 70) REDACTED:344 — StarGiftUpgradeStore.UpgradeStarGift has cyclomatic complexity 70 (threshold 15). Of this number, 28 points are the body's own statements and 42 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.ListChannelHistory (cyclomatic 67) · ×1
  • ChannelStore.ListChannelHistory (cyclomatic 67) internal/store/postgres/channel_message_history.go:14 — ChannelStore.ListChannelHistory has cyclomatic complexity 67 (threshold 15). Of this number, 51 points are the body's own statements and 16 belong to 6 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · domain.validateMarkupButton (cyclomatic 65) · ×1
  • domain.validateMarkupButton (cyclomatic 65) internal/domain/message_markup.go:298 — domain.validateMarkupButton has cyclomatic complexity 65 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.SetDiscussionGroup (cyclomatic 64) · ×1
  • ChannelStore.SetDiscussionGroup (cyclomatic 64) internal/store/postgres/channel_settings.go:1121 — ChannelStore.SetDiscussionGroup has cyclomatic complexity 64 (threshold 15). Of this number, 58 points are the body's own statements and 6 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.ToggleSuggestedPostApproval (cyclomatic 64) · ×1
  • ChannelStore.ToggleSuggestedPostApproval (cyclomatic 64) internal/store/postgres/channel_suggested_post.go:29 — ChannelStore.ToggleSuggestedPostApproval has cyclomatic complexity 64 (threshold 15). Of this number, 63 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.PurchaseResaleStarGift (cyclomatic 64) · ×1
  • StarGiftLifecycleStore.PurchaseResaleStarGift (cyclomatic 64) internal/store/postgres/star_gift_lifecycle.go:524 — StarGiftLifecycleStore.PurchaseResaleStarGift has cyclomatic complexity 64 (threshold 15). Of this number, 25 points are the body's own statements and 39 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · main.doFetch (cyclomatic 63) · ×1
  • main.doFetch (cyclomatic 63) cmd/appearancefetch/main.go:92 — main.doFetch has cyclomatic complexity 63 (threshold 15). Of this number, 25 points are the body's own statements and 38 belong to 7 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Service.sendFromBot (cyclomatic 61) · ×1
  • Service.sendFromBot (cyclomatic 61) internal/app/ephemeral/service.go:159 — Service.sendFromBot has cyclomatic complexity 61 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · loadharness.StartupRun (cyclomatic 61) · ×1
  • loadharness.StartupRun (cyclomatic 61) REDACTED:138 — loadharness.StartupRun has cyclomatic complexity 61 (threshold 15). Of this number, 55 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.EditChannelMessage (cyclomatic 60) · ×1
  • ChannelStore.EditChannelMessage (cyclomatic 60) internal/store/memory/channel_message_edit.go:11 — ChannelStore.EditChannelMessage has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MessageStore.finishDeleteMessagesTx (cyclomatic 59) · ×1
  • MessageStore.finishDeleteMessagesTx (cyclomatic 59) internal/store/postgres/message_delete.go:168 — MessageStore.finishDeleteMessagesTx has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.GetChannelStats (cyclomatic 57) · ×1
  • ChannelStore.GetChannelStats (cyclomatic 57) internal/store/memory/channel_stats.go:12 — ChannelStore.GetChannelStats has cyclomatic complexity 57 (threshold 15). Of this number, 55 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Service.CreateAuthorization (cyclomatic 55) · ×1
  • Service.CreateAuthorization (cyclomatic 55) internal/app/telegramlogin/service.go:573 — Service.CreateAuthorization 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.
D1 · Cyclomatic Complexity · ChannelStore.SendMonoforumMessage (cyclomatic 55) · ×1
  • ChannelStore.SendMonoforumMessage (cyclomatic 55) internal/store/postgres/channel_monoforum.go:20 — ChannelStore.SendMonoforumMessage has cyclomatic complexity 55 (threshold 15). Of this number, 54 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · loadharness.Run (cyclomatic 54) · ×1
  • loadharness.Run (cyclomatic 54) REDACTED:738 — loadharness.Run has cyclomatic complexity 54 (threshold 15). Of this number, 52 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · UserStore.claimOfficialUsernameOnce (cyclomatic 54) · ×1
  • UserStore.claimOfficialUsernameOnce (cyclomatic 54) internal/store/postgres/user.go:332 — UserStore.claimOfficialUsernameOnce has cyclomatic complexity 54 (threshold 15). Of this number, 51 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.domainPollFromInputMedia (cyclomatic 53) · ×1
  • Router.domainPollFromInputMedia (cyclomatic 53) internal/rpc/convert_polls.go:37 — Router.domainPollFromInputMedia has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.SendChannelMessage (cyclomatic 53) · ×1
  • ChannelStore.SendChannelMessage (cyclomatic 53) internal/store/memory/channel_message_send.go:13 — ChannelStore.SendChannelMessage has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.listChannelDialogs (cyclomatic 52) · ×1
  • ChannelStore.listChannelDialogs (cyclomatic 52) REDACTED:50 — ChannelStore.listChannelDialogs has cyclomatic complexity 52 (threshold 15). Of this number, 48 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.GetChannelStats (cyclomatic 52) · ×1
  • ChannelStore.GetChannelStats (cyclomatic 52) internal/store/postgres/channel_stats.go:12 — ChannelStore.GetChannelStats has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StarGiftUpgradeStore.GrantUniqueStarGift (cyclomatic 52) · ×1
  • StarGiftUpgradeStore.GrantUniqueStarGift (cyclomatic 52) REDACTED:53 — StarGiftUpgradeStore.GrantUniqueStarGift has cyclomatic complexity 52 (threshold 15). Of this number, 25 points are the body's own statements and 27 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StarGiftUpgradeStore.markPrivateStarGiftSourceUpgradedTx (cyclomatic 52) · ×1
  • StarGiftUpgradeStore.markPrivateStarGiftSourceUpgradedTx (cyclomatic 52) REDACTED:703 — StarGiftUpgradeStore.markPrivateStarGiftSourceUpgradedTx has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · botapi.scanBotAPIHTMLTag (cyclomatic 50) · ×1
  • botapi.scanBotAPIHTMLTag (cyclomatic 50) internal/botapi/formatted_text.go:285 — botapi.scanBotAPIHTMLTag 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.
D1 · Cyclomatic Complexity · rpc.collectRichMessageBlockMetrics (cyclomatic 50) · ×1
  • rpc.collectRichMessageBlockMetrics (cyclomatic 50) internal/rpc/rich_message_limits.go:38 — rpc.collectRichMessageBlockMetrics has cyclomatic complexity 50 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function taking that case's concrete type, so the dispatch reads one line per case. These arms are selected by TYPE rather than by value, so there is no key a lookup table could be built on; where you own the matched types, giving them one shared interface method and calling that is the form a table would have taken, and where you do not, keep the cases — they stay explicit and reviewable.
D1 · Cyclomatic Complexity · Router.onMessagesEditMessage (cyclomatic 50) · ×1
  • Router.onMessagesEditMessage (cyclomatic 50) internal/rpc/messages_edit.go:11 — Router.onMessagesEditMessage 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.
D1 · Cyclomatic Complexity · ChannelStore.SearchJoinedMessages (cyclomatic 50) · ×1
  • ChannelStore.SearchJoinedMessages (cyclomatic 50) internal/store/memory/channel_message_history.go:227 — ChannelStore.SearchJoinedMessages has cyclomatic complexity 50 (threshold 15). Of this number, 48 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MessageStore.ReadMessageContents (cyclomatic 50) · ×1
  • MessageStore.ReadMessageContents (cyclomatic 50) internal/store/postgres/message_read.go:14 — MessageStore.ReadMessageContents has cyclomatic complexity 50 (threshold 15). Of this number, 49 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Service.SignUp (cyclomatic 49) · ×1
  • Service.SignUp (cyclomatic 49) internal/app/auth/service.go:1281 — Service.SignUp has cyclomatic complexity 49 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onMessagesSendMedia (cyclomatic 49) · ×1
  • Router.onMessagesSendMedia (cyclomatic 49) internal/rpc/send_media.go:258 — Router.onMessagesSendMedia has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.SetChannelMessageReactions (cyclomatic 49) · ×1
  • ChannelStore.SetChannelMessageReactions (cyclomatic 49) internal/store/postgres/channel_reaction_messages.go:11 — ChannelStore.SetChannelMessageReactions has cyclomatic complexity 49 (threshold 15). Of this number, 48 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.retireUserStarGiftMessagesTx (cyclomatic 49) · ×1
  • StarGiftLifecycleStore.retireUserStarGiftMessagesTx (cyclomatic 49) internal/store/postgres/star_gift_lifecycle_projection.go:20 — StarGiftLifecycleStore.retireUserStarGiftMessagesTx has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Service.VerifyLoginEmail (cyclomatic 48) · ×1
  • Service.VerifyLoginEmail (cyclomatic 48) internal/app/account/service.go:870 — Service.VerifyLoginEmail has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ActionExecutor.Execute (cyclomatic 48) · ×1
  • ActionExecutor.Execute (cyclomatic 48) internal/app/moderation/actions.go:112 — ActionExecutor.Execute has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · loadharness.evaluateReport (cyclomatic 48) · ×1
  • loadharness.evaluateReport (cyclomatic 48) REDACTED:1201 — loadharness.evaluateReport has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Router.sendSingleSendMessage (cyclomatic 48) · ×1
  • Router.sendSingleSendMessage (cyclomatic 48) internal/rpc/messages_send.go:394 — Router.sendSingleSendMessage has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rpc.tgChannelMessage (cyclomatic 47) · ×1
  • rpc.tgChannelMessage (cyclomatic 47) internal/rpc/convert_channels_core.go:80 — rpc.tgChannelMessage has cyclomatic complexity 47 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.PublishAdmittedLayerProfileEvidence (cyclomatic 47) · ×1
  • Router.PublishAdmittedLayerProfileEvidence (cyclomatic 47) internal/rpc/layer_inheritance.go:41 — Router.PublishAdmittedLayerProfileEvidence has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModerationReport.Validate (cyclomatic 46) · ×1
  • ModerationReport.Validate (cyclomatic 46) internal/domain/moderation.go:312 — ModerationReport.Validate has cyclomatic complexity 46 (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.
D1 · Cyclomatic Complexity · Server.handleEncrypted (cyclomatic 46) · ×1
  • Server.handleEncrypted (cyclomatic 46) internal/mtprotoedge/encrypted.go:121 — Server.handleEncrypted has cyclomatic complexity 46 (threshold 15). Of this number, 45 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.listChannelDifferenceAttempt (cyclomatic 46) · ×1
  • ChannelStore.listChannelDifferenceAttempt (cyclomatic 46) internal/store/postgres/channel_updates.go:34 — ChannelStore.listChannelDifferenceAttempt 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.
D1 · Cyclomatic Complexity · Service.sweep (cyclomatic 45) · ×1
  • Service.sweep (cyclomatic 45) internal/app/donations/sweep.go:57 — Service.sweep has cyclomatic complexity 45 (threshold 15). Of this number, 38 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rpc.botAPIRichBlock (cyclomatic 45) · ×1
  • rpc.botAPIRichBlock (cyclomatic 45) REDACTED:41 — rpc.botAPIRichBlock has cyclomatic complexity 45 (threshold 15). Of this number, 43 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Router.onMessagesSendMultiMedia (cyclomatic 44) · ×1
  • Router.onMessagesSendMultiMedia (cyclomatic 44) internal/rpc/send_media.go:464 — Router.onMessagesSendMultiMedia has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Service.CanSeeForViewerUserIDs (cyclomatic 43) · ×1
  • Service.CanSeeForViewerUserIDs (cyclomatic 43) internal/app/privacy/service_sparse.go:15 — Service.CanSeeForViewerUserIDs has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionManager.pushToUserWithSender (cyclomatic 43) · ×1
  • SessionManager.pushToUserWithSender (cyclomatic 43) internal/mtprotoedge/session_manager.go:1874 — SessionManager.pushToUserWithSender has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Router.claimAuthLayerDefaultEvidenceLocked (cyclomatic 43) · ×1
  • Router.claimAuthLayerDefaultEvidenceLocked (cyclomatic 43) internal/rpc/layer_inheritance.go:196 — Router.claimAuthLayerDefaultEvidenceLocked has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Router.onPaymentsSendStarsForm (cyclomatic 43) · ×1
  • Router.onPaymentsSendStarsForm (cyclomatic 43) internal/rpc/payments_star_gifts.go:568 — Router.onPaymentsSendStarsForm has cyclomatic complexity 43 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.GetChannelDialogs (cyclomatic 43) · ×1
  • ChannelStore.GetChannelDialogs (cyclomatic 43) REDACTED:755 — ChannelStore.GetChannelDialogs has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Server.walkInbound (cyclomatic 42) · ×1
  • Server.walkInbound (cyclomatic 42) internal/mtprotoedge/inbound_preflight.go:337 — Server.walkInbound 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.
D1 · Cyclomatic Complexity · Router.peerIdentityMaps (cyclomatic 42) · ×1
  • Router.peerIdentityMaps (cyclomatic 42) internal/rpc/peer_identity_cache.go:114 — Router.peerIdentityMaps 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.
D1 · Cyclomatic Complexity · Router.dispatch (cyclomatic 42) · ×1
  • Router.dispatch (cyclomatic 42) internal/rpc/router.go:675 — Router.dispatch 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.
D1 · Cyclomatic Complexity · memory.validateBotAPIUpdateRequest (cyclomatic 42) · ×1
  • memory.validateBotAPIUpdateRequest (cyclomatic 42) internal/store/memory/botapi_update.go:418 — memory.validateBotAPIUpdateRequest has cyclomatic complexity 42 (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.
D1 · Cyclomatic Complexity · StarGiftStore.ListByOwnerFiltered (cyclomatic 42) · ×1
  • StarGiftStore.ListByOwnerFiltered (cyclomatic 42) REDACTED:410 — StarGiftStore.ListByOwnerFiltered has cyclomatic complexity 42 (threshold 15). Of this number, 38 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · postgres.reconcileSeedWith (cyclomatic 42) · ×1
  • postgres.reconcileSeedWith (cyclomatic 42) internal/store/postgres/langpack.go:172 — postgres.reconcileSeedWith 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.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.PrepayStarGiftUpgrade (cyclomatic 42) · ×1
  • StarGiftLifecycleStore.PrepayStarGiftUpgrade (cyclomatic 42) internal/store/postgres/star_gift_entitlements.go:60 — StarGiftLifecycleStore.PrepayStarGiftUpgrade has cyclomatic complexity 42 (threshold 15). Of this number, 23 points are the body's own statements and 19 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.ListResaleStarGifts (cyclomatic 42) · ×1
  • StarGiftLifecycleStore.ListResaleStarGifts (cyclomatic 42) internal/store/postgres/star_gift_lifecycle.go:155 — StarGiftLifecycleStore.ListResaleStarGifts has cyclomatic complexity 42 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.ResolveStarGiftOffer (cyclomatic 42) · ×1
  • StarGiftLifecycleStore.ResolveStarGiftOffer (cyclomatic 42) internal/store/postgres/star_gift_lifecycle.go:916 — StarGiftLifecycleStore.ResolveStarGiftOffer has cyclomatic complexity 42 (threshold 15). Of this number, 16 points are the body's own statements and 26 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Server.executeInboundPlan (cyclomatic 41) · ×1
  • Server.executeInboundPlan (cyclomatic 41) internal/mtprotoedge/inbound_preflight.go:935 — Server.executeInboundPlan has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.SetChannelMessageReactions (cyclomatic 41) · ×1
  • ChannelStore.SetChannelMessageReactions (cyclomatic 41) internal/store/memory/channel_reactions.go:31 — ChannelStore.SetChannelMessageReactions has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MessageStore.EditMessage (cyclomatic 41) · ×1
  • MessageStore.EditMessage (cyclomatic 41) internal/store/memory/message_edit.go:10 — MessageStore.EditMessage has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PremiumStore.settlePremiumPayment (cyclomatic 41) · ×1
  • PremiumStore.settlePremiumPayment (cyclomatic 41) internal/store/postgres/premium.go:253 — PremiumStore.settlePremiumPayment has cyclomatic complexity 41 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · RunConfig.validate (cyclomatic 40) · ×1
  • RunConfig.validate (cyclomatic 40) REDACTED:73 — RunConfig.validate has cyclomatic complexity 40 (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.
D1 · Cyclomatic Complexity · rpc.tgMessageServiceAction (cyclomatic 40) · ×1
  • rpc.tgMessageServiceAction (cyclomatic 40) internal/rpc/convert_messages.go:134 — rpc.tgMessageServiceAction 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.
D1 · Cyclomatic Complexity · Router.onMessagesToggleNoForwards (cyclomatic 40) · ×1
  • Router.onMessagesToggleNoForwards (cyclomatic 40) internal/rpc/messages_no_forwards.go:17 — Router.onMessagesToggleNoForwards has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.domainInlineResultFromTG (cyclomatic 39) · ×1
  • Router.domainInlineResultFromTG (cyclomatic 39) internal/rpc/bots_inline.go:420 — Router.domainInlineResultFromTG 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.
D1 · Cyclomatic Complexity · Router.buildUserFullProjection (cyclomatic 39) · ×1
  • Router.buildUserFullProjection (cyclomatic 39) REDACTED:310 — Router.buildUserFullProjection 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.
D1 · Cyclomatic Complexity · ChannelStore.SetDiscussionGroup (cyclomatic 39) · ×1
  • ChannelStore.SetDiscussionGroup (cyclomatic 39) internal/store/memory/channel_settings.go:708 — ChannelStore.SetDiscussionGroup has cyclomatic complexity 39 (threshold 15). Of this number, 35 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.EditChannelAdmin (cyclomatic 39) · ×1
  • ChannelStore.EditChannelAdmin (cyclomatic 39) internal/store/postgres/channel_member_admin.go:10 — ChannelStore.EditChannelAdmin has cyclomatic complexity 39 (threshold 15). Of this number, 38 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.DeleteChannelHistory (cyclomatic 39) · ×1
  • ChannelStore.DeleteChannelHistory (cyclomatic 39) internal/store/postgres/channel_message_delete.go:196 — ChannelStore.DeleteChannelHistory has cyclomatic complexity 39 (threshold 15). Of this number, 38 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MessageStore.DeleteHistory (cyclomatic 39) · ×1
  • MessageStore.DeleteHistory (cyclomatic 39) internal/store/postgres/message_history.go:497 — MessageStore.DeleteHistory has cyclomatic complexity 39 (threshold 15). Of this number, 38 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.settleStarGiftAuction (cyclomatic 39) · ×1
  • StarGiftLifecycleStore.settleStarGiftAuction (cyclomatic 39) internal/store/postgres/star_gift_craft_auction.go:613 — StarGiftLifecycleStore.settleStarGiftAuction has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 3 of the 39 points are its own statements and the rest belongs to one function literal inside it that branches (line 617). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · TelegramLoginStore.ApproveTelegramLoginRequest (cyclomatic 39) · ×1
  • TelegramLoginStore.ApproveTelegramLoginRequest (cyclomatic 39) internal/store/postgres/telegram_login.go:523 — TelegramLoginStore.ApproveTelegramLoginRequest has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.ImportContacts (cyclomatic 38) · ×1
  • Service.ImportContacts (cyclomatic 38) internal/app/contacts/service.go:220 — Service.ImportContacts 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.
D1 · Cyclomatic Complexity · Service.CanSeeMatrix (cyclomatic 38) · ×1
  • Service.CanSeeMatrix (cyclomatic 38) internal/app/privacy/service.go:351 — Service.CanSeeMatrix 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.
D1 · Cyclomatic Complexity · domain.validateStarGiftAttributes (cyclomatic 38) · ×1
  • domain.validateStarGiftAttributes (cyclomatic 38) internal/domain/star_gift.go:1285 — domain.validateStarGiftAttributes has cyclomatic complexity 38 (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.
D1 · Cyclomatic Complexity · Server.publishRPCResult (cyclomatic 38) · ×1
  • Server.publishRPCResult (cyclomatic 38) internal/mtprotoedge/encrypted.go:880 — Server.publishRPCResult has cyclomatic complexity 38 (threshold 15). Of this number, 17 points are the body's own statements and 21 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Server.prepareInboundRPCBatch (cyclomatic 38) · ×1
  • Server.prepareInboundRPCBatch (cyclomatic 38) internal/mtprotoedge/inbound_preflight.go:737 — Server.prepareInboundRPCBatch 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.
D1 · Cyclomatic Complexity · rpc.botAPIRichText (cyclomatic 38) · ×1
  • rpc.botAPIRichText (cyclomatic 38) REDACTED:320 — rpc.botAPIRichText has cyclomatic complexity 38 (threshold 15). Of this number, 36 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function taking that case's concrete type, so the dispatch reads one line per case. These arms are selected by TYPE rather than by value, so there is no key a lookup table could be built on; where you own the matched types, giving them one shared interface method and calling that is the form a table would have taken, and where you do not, keep the cases — they stay explicit and reviewable.
D1 · Cyclomatic Complexity · rpc.tgChannelMessageAction (cyclomatic 38) · ×1
  • rpc.tgChannelMessageAction (cyclomatic 38) internal/rpc/convert_channels_core.go:221 — rpc.tgChannelMessageAction 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.
D1 · Cyclomatic Complexity · rpc.tgMessageMedia (cyclomatic 38) · ×1
  • rpc.tgMessageMedia (cyclomatic 38) internal/rpc/convert_media.go:17 — rpc.tgMessageMedia 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.
D1 · Cyclomatic Complexity · Router.onMessagesSearchGlobal (cyclomatic 38) · ×1
  • Router.onMessagesSearchGlobal (cyclomatic 38) internal/rpc/messages_history.go:589 — Router.onMessagesSearchGlobal 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.
D1 · Cyclomatic Complexity · ChannelStore.InviteToChannel (cyclomatic 38) · ×1
  • ChannelStore.InviteToChannel (cyclomatic 38) internal/store/postgres/channel_invite_members.go:10 — ChannelStore.InviteToChannel has cyclomatic complexity 38 (threshold 15). Of this number, 37 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MessageStore.readHistoryOnce (cyclomatic 38) · ×1
  • MessageStore.readHistoryOnce (cyclomatic 38) internal/store/postgres/message_history.go:302 — MessageStore.readHistoryOnce has cyclomatic complexity 38 (threshold 15). Of this number, 37 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.SendStarGiftOffer (cyclomatic 38) · ×1
  • StarGiftLifecycleStore.SendStarGiftOffer (cyclomatic 38) internal/store/postgres/star_gift_lifecycle.go:778 — StarGiftLifecycleStore.SendStarGiftOffer has cyclomatic complexity 38 (threshold 15). Of this number, 21 points are the body's own statements and 17 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · apiKeyboardButton.UnmarshalJSON (cyclomatic 37) · ×1
  • apiKeyboardButton.UnmarshalJSON (cyclomatic 37) internal/botapi/inline.go:549 — apiKeyboardButton.UnmarshalJSON 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.
D1 · Cyclomatic Complexity · config.validateLoginEmailConfig (cyclomatic 37) · ×1
  • config.validateLoginEmailConfig (cyclomatic 37) internal/config/config.go:2023 — config.validateLoginEmailConfig has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · EphemeralMessage.ValidateStored (cyclomatic 37) · ×1
  • EphemeralMessage.ValidateStored (cyclomatic 37) internal/domain/ephemeral.go:269 — EphemeralMessage.ValidateStored has cyclomatic complexity 37 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: domain.validEphemeralMedia (cyclomatic 39) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · rpcRewrapAlias.activate (cyclomatic 37) · ×1
  • rpcRewrapAlias.activate (cyclomatic 37) internal/mtprotoedge/rpc_rewrap.go:855 — rpcRewrapAlias.activate has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 13 of the 37 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 872, 865). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Router.resolveBotCallbackQuery (cyclomatic 37) · ×1
  • Router.resolveBotCallbackQuery (cyclomatic 37) internal/rpc/bots_callback.go:164 — Router.resolveBotCallbackQuery 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.
D1 · Cyclomatic Complexity · ChannelStore.SendMonoforumMessage (cyclomatic 37) · ×1
  • ChannelStore.SendMonoforumMessage (cyclomatic 37) internal/store/memory/channel_monoforum.go:18 — ChannelStore.SendMonoforumMessage 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.
D1 · Cyclomatic Complexity · MessageStore.ReadHistory (cyclomatic 37) · ×1
  • MessageStore.ReadHistory (cyclomatic 37) internal/store/memory/message_history.go:80 — MessageStore.ReadHistory 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.
D1 · Cyclomatic Complexity · ChannelStore.resolveChannelReply (cyclomatic 37) · ×1
  • ChannelStore.resolveChannelReply (cyclomatic 37) internal/store/postgres/channel_helpers.go:808 — ChannelStore.resolveChannelReply 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.
D1 · Cyclomatic Complexity · ChannelStore.populateChannelMessagesReactionsWhere (cyclomatic 37) · ×1
  • ChannelStore.populateChannelMessagesReactionsWhere (cyclomatic 37) internal/store/postgres/channel_reaction_helpers.go:52 — ChannelStore.populateChannelMessagesReactionsWhere 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.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.SweepStarGiftLifecycle (cyclomatic 37) · ×1
  • StarGiftLifecycleStore.SweepStarGiftLifecycle (cyclomatic 37) internal/store/postgres/star_gift_craft_auction.go:78 — StarGiftLifecycleStore.SweepStarGiftLifecycle 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.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.BidStarGiftAuction (cyclomatic 37) · ×1
  • StarGiftLifecycleStore.BidStarGiftAuction (cyclomatic 37) internal/store/postgres/star_gift_craft_auction.go:994 — StarGiftLifecycleStore.BidStarGiftAuction has cyclomatic complexity 37 (threshold 15). Of this number, 21 points are the body's own statements and 16 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Service.SendFromClient (cyclomatic 36) · ×1
  • Service.SendFromClient (cyclomatic 36) internal/app/ephemeral/service.go:76 — Service.SendFromClient has cyclomatic complexity 36 (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.
D1 · Cyclomatic Complexity · RetentionWorker.runRetentionOnce (cyclomatic 36) · ×1
  • RetentionWorker.runRetentionOnce (cyclomatic 36) internal/app/maintenance/retention.go:424 — RetentionWorker.runRetentionOnce 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.
D1 · Cyclomatic Complexity · Conn.handleOutboundSend (cyclomatic 36) · ×1
  • Conn.handleOutboundSend (cyclomatic 36) internal/mtprotoedge/outbound.go:2260 — Conn.handleOutboundSend 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.
D1 · Cyclomatic Complexity · rpc.tgSavedStarGifts (cyclomatic 36) · ×1
  • rpc.tgSavedStarGifts (cyclomatic 36) internal/rpc/payments_star_gifts.go:1721 — rpc.tgSavedStarGifts 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.
D1 · Cyclomatic Complexity · richMessageMediaRefs.collectBlocks (cyclomatic 36) · ×1
  • richMessageMediaRefs.collectBlocks (cyclomatic 36) internal/rpc/convert_rich_message.go:87 — richMessageMediaRefs.collectBlocks 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.
D1 · Cyclomatic Complexity · ChannelStore.ListChannelDifference (cyclomatic 36) · ×1
  • ChannelStore.ListChannelDifference (cyclomatic 36) internal/store/memory/channel_updates.go:13 — ChannelStore.ListChannelDifference 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.
D1 · Cyclomatic Complexity · ChannelStore.GetChannels (cyclomatic 36) · ×1
  • ChannelStore.GetChannels (cyclomatic 36) internal/store/postgres/channel_core.go:342 — ChannelStore.GetChannels 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.
D1 · Cyclomatic Complexity · ChannelStore.EditChannelBanned (cyclomatic 36) · ×1
  • ChannelStore.EditChannelBanned (cyclomatic 36) internal/store/postgres/channel_member_admin.go:369 — ChannelStore.EditChannelBanned has cyclomatic complexity 36 (threshold 15). Of this number, 35 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.GiveStarGift (cyclomatic 35) · ×1
  • Service.GiveStarGift (cyclomatic 35) internal/admin/star_gift_catalog.go:456 — Service.GiveStarGift has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 15 of the 35 points are its own statements and the rest belongs to one function literal inside it that branches (line 489). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Service.applyTelegramLoginConfiguration (cyclomatic 35) · ×1
  • Service.applyTelegramLoginConfiguration (cyclomatic 35) internal/app/bots/botfather.go:883 — Service.applyTelegramLoginConfiguration has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Projector.ForViewerUserIDs (cyclomatic 35) · ×1
  • Projector.ForViewerUserIDs (cyclomatic 35) internal/app/userprojection/projection_sparse.go:34 — Projector.ForViewerUserIDs has cyclomatic complexity 35 (threshold 15). Of this number, 34 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Router.messageReplyFromInput (cyclomatic 35) · ×1
  • Router.messageReplyFromInput (cyclomatic 35) internal/rpc/messages_send.go:632 — Router.messageReplyFromInput has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · postgres.persistPlainPrivateSendProjectionBatch (cyclomatic 35) · ×1
  • postgres.persistPlainPrivateSendProjectionBatch (cyclomatic 35) internal/store/postgres/message_send_batch_sql.go:146 — postgres.persistPlainPrivateSendProjectionBatch has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.EditExportedInvite (cyclomatic 35) · ×1
  • ChannelStore.EditExportedInvite (cyclomatic 35) internal/store/postgres/channel_invite_exported.go:255 — ChannelStore.EditExportedInvite has cyclomatic complexity 35 (threshold 15). Of this number, 34 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GroupCallStore.RemoveConferenceCallParticipants (cyclomatic 35) · ×1
  • GroupCallStore.RemoveConferenceCallParticipants (cyclomatic 35) internal/store/postgres/groupcall.go:407 — GroupCallStore.RemoveConferenceCallParticipants has cyclomatic complexity 35 (threshold 15). Of this number, 34 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.SetStarGiftListing (cyclomatic 35) · ×1
  • StarGiftLifecycleStore.SetStarGiftListing (cyclomatic 35) internal/store/postgres/star_gift_lifecycle.go:320 — StarGiftLifecycleStore.SetStarGiftListing has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 9 of the 35 points are its own statements and the rest belongs to one function literal inside it that branches (line 325). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · domain.ValidateReplyMarkup (cyclomatic 34) · ×1
  • domain.ValidateReplyMarkup (cyclomatic 34) internal/domain/message_markup.go:236 — domain.ValidateReplyMarkup has cyclomatic complexity 34 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · serverExchangeCompat.run (cyclomatic 34) · ×1
  • serverExchangeCompat.run (cyclomatic 34) internal/mtprotoedge/exchange_compat.go:88 — serverExchangeCompat.run has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Server.seedInitialLayerProfile (cyclomatic 34) · ×1
  • Server.seedInitialLayerProfile (cyclomatic 34) internal/mtprotoedge/conn_layer_profile.go:306 — Server.seedInitialLayerProfile 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.
D1 · Cyclomatic Complexity · Server.serveConn (cyclomatic 34) · ×1
  • Server.serveConn (cyclomatic 34) internal/mtprotoedge/server.go:997 — Server.serveConn has cyclomatic complexity 34 (threshold 15). Of this number, 32 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rpc.domainMessageEntitiesForViewer (cyclomatic 34) · ×1
  • rpc.domainMessageEntitiesForViewer (cyclomatic 34) internal/rpc/convert_messages.go:673 — rpc.domainMessageEntitiesForViewer has cyclomatic complexity 34 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function taking that case's concrete type, so the dispatch reads one line per case. These arms are selected by TYPE rather than by value, so there is no key a lookup table could be built on; where you own the matched types, giving them one shared interface method and calling that is the form a table would have taken, and where you do not, keep the cases — they stay explicit and reviewable.
D1 · Cyclomatic Complexity · rpc.channelMemberHasRequestRights (cyclomatic 34) · ×1
  • rpc.channelMemberHasRequestRights (cyclomatic 34) internal/rpc/messages_bot_longtail.go:392 — rpc.channelMemberHasRequestRights has cyclomatic complexity 34 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Router.prepareTelegramLoginMarkup (cyclomatic 34) · ×1
  • Router.prepareTelegramLoginMarkup (cyclomatic 34) internal/rpc/convert_markup.go:41 — Router.prepareTelegramLoginMarkup 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.
D1 · Cyclomatic Complexity · Router.validateStarsGiveawayPurpose (cyclomatic 34) · ×1
  • Router.validateStarsGiveawayPurpose (cyclomatic 34) internal/rpc/payments_star_gifts.go:225 — Router.validateStarsGiveawayPurpose 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.
D1 · Cyclomatic Complexity · Router.domainStoryMediaAreasFromTL (cyclomatic 34) · ×1
  • Router.domainStoryMediaAreasFromTL (cyclomatic 34) internal/rpc/stories.go:1671 — Router.domainStoryMediaAreasFromTL 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.
D1 · Cyclomatic Complexity · MessageStore.finishMemoryDeleteLocked (cyclomatic 34) · ×1
  • MessageStore.finishMemoryDeleteLocked (cyclomatic 34) internal/store/memory/message_delete.go:53 — MessageStore.finishMemoryDeleteLocked 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.
D1 · Cyclomatic Complexity · MessageStore.PinPrivateMessage (cyclomatic 34) · ×1
  • MessageStore.PinPrivateMessage (cyclomatic 34) internal/store/postgres/message_pin.go:25 — MessageStore.PinPrivateMessage has cyclomatic complexity 34 (threshold 15). Of this number, 33 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.loadCraftReplay (cyclomatic 34) · ×1
  • StarGiftLifecycleStore.loadCraftReplay (cyclomatic 34) internal/store/postgres/star_gift_craft_auction.go:514 — StarGiftLifecycleStore.loadCraftReplay 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.
D1 · Cyclomatic Complexity · Service.CanSeeBatch (cyclomatic 33) · ×1
  • Service.CanSeeBatch (cyclomatic 33) internal/app/privacy/service.go:183 — Service.CanSeeBatch 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.
D1 · Cyclomatic Complexity · ModerationDecisionRequest.Validate (cyclomatic 33) · ×1
  • ModerationDecisionRequest.Validate (cyclomatic 33) internal/domain/moderation_case.go:317 — ModerationDecisionRequest.Validate has cyclomatic complexity 33 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Options.setDefaults (cyclomatic 33) · ×1
  • Options.setDefaults (cyclomatic 33) internal/mtprotoedge/server.go:383 — Options.setDefaults has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Server.commitLayerProfileEvidence (cyclomatic 33) · ×1
  • Server.commitLayerProfileEvidence (cyclomatic 33) internal/mtprotoedge/inbound_layer_rpc.go:1097 — Server.commitLayerProfileEvidence 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.
D1 · Cyclomatic Complexity · rpc.tgChannelFull (cyclomatic 33) · ×1
  • rpc.tgChannelFull (cyclomatic 33) internal/rpc/convert_channels_core.go:545 — rpc.tgChannelFull has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MessageStore.sendPrivateTextLocked (cyclomatic 33) · ×1
  • MessageStore.sendPrivateTextLocked (cyclomatic 33) internal/store/memory/message_send.go:74 — MessageStore.sendPrivateTextLocked has cyclomatic complexity 33 (threshold 15). Of this number, 30 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TelegramLoginStore.ApproveTelegramLoginRequest (cyclomatic 33) · ×1
  • TelegramLoginStore.ApproveTelegramLoginRequest (cyclomatic 33) internal/store/memory/telegram_login.go:346 — TelegramLoginStore.ApproveTelegramLoginRequest has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.JoinChannel (cyclomatic 33) · ×1
  • ChannelStore.JoinChannel (cyclomatic 33) internal/store/postgres/channel_member_join.go:14 — ChannelStore.JoinChannel has cyclomatic complexity 33 (threshold 15). Of this number, 32 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.SetPaidMessagesPrice (cyclomatic 33) · ×1
  • ChannelStore.SetPaidMessagesPrice (cyclomatic 33) internal/store/postgres/channel_message_settings.go:78 — ChannelStore.SetPaidMessagesPrice has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 6 of the 33 points are its own statements and the rest belongs to one function literal inside it that branches (line 84). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · MessageStore.DeliverLoginCodeMessage (cyclomatic 33) · ×1
  • MessageStore.DeliverLoginCodeMessage (cyclomatic 33) internal/store/postgres/login_code_delivery.go:43 — MessageStore.DeliverLoginCodeMessage has cyclomatic complexity 33 (threshold 15). Of this number, 32 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TelegramLoginStore.ConsumeTelegramLoginAuthorizationCode (cyclomatic 33) · ×1
  • TelegramLoginStore.ConsumeTelegramLoginAuthorizationCode (cyclomatic 33) internal/store/postgres/telegram_login.go:866 — TelegramLoginStore.ConsumeTelegramLoginAuthorizationCode has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.Configure (cyclomatic 32) · ×1
  • Service.Configure (cyclomatic 32) internal/admin/service.go:662 — Service.Configure has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.verifyLoginCode (cyclomatic 32) · ×1
  • Service.verifyLoginCode (cyclomatic 32) internal/app/auth/service.go:1157 — Service.verifyLoginCode has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · stargifts.normalizeAndValidateLottie (cyclomatic 32) · ×1
  • stargifts.normalizeAndValidateLottie (cyclomatic 32) internal/app/stargifts/animation.go:94 — stargifts.normalizeAndValidateLottie has cyclomatic complexity 32 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · domain.publicVerificationIP (cyclomatic 32) · ×1
  • domain.publicVerificationIP (cyclomatic 32) internal/domain/verification.go:502 — domain.publicVerificationIP has cyclomatic complexity 32 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Router.domainRichMessageFromInput (cyclomatic 32) · ×1
  • Router.domainRichMessageFromInput (cyclomatic 32) internal/rpc/convert_rich_message.go:305 — Router.domainRichMessageFromInput 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.
D1 · Cyclomatic Complexity · Router.requestedPeerMatches (cyclomatic 32) · ×1
  • Router.requestedPeerMatches (cyclomatic 32) internal/rpc/messages_bot_longtail.go:327 — Router.requestedPeerMatches 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.
D1 · Cyclomatic Complexity · Router.onMessagesToggleDialogPin (cyclomatic 32) · ×1
  • Router.onMessagesToggleDialogPin (cyclomatic 32) internal/rpc/messages_dialogs.go:600 — Router.onMessagesToggleDialogPin 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.
D1 · Cyclomatic Complexity · Router.forwardMessagesToMonoforum (cyclomatic 32) · ×1
  • Router.forwardMessagesToMonoforum (cyclomatic 32) internal/rpc/messages_forward.go:349 — Router.forwardMessagesToMonoforum 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.
D1 · Cyclomatic Complexity · Router.fanoutStoryPrivacyChange (cyclomatic 32) · ×1
  • Router.fanoutStoryPrivacyChange (cyclomatic 32) internal/rpc/stories.go:2089 — Router.fanoutStoryPrivacyChange has cyclomatic complexity 32 (threshold 15). Of this number, 23 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · Router.fanoutDeletedUserStory (cyclomatic 32) · ×1
  • Router.fanoutDeletedUserStory (cyclomatic 32) internal/rpc/stories.go:2178 — Router.fanoutDeletedUserStory has cyclomatic complexity 32 (threshold 15). Of this number, 24 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onUsersGetRequirementsToContact (cyclomatic 32) · ×1
  • Router.onUsersGetRequirementsToContact (cyclomatic 32) REDACTED:600 — Router.onUsersGetRequirementsToContact 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.
D1 · Cyclomatic Complexity · CommunityStore.viewLocked (cyclomatic 32) · ×1
  • CommunityStore.viewLocked (cyclomatic 32) internal/store/memory/community.go:95 — CommunityStore.viewLocked has cyclomatic complexity 32 (threshold 15). Of this number, 30 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · postgres.validateBotAPIUpdateRequest (cyclomatic 32) · ×1
  • postgres.validateBotAPIUpdateRequest (cyclomatic 32) internal/store/postgres/botapi_update.go:684 — postgres.validateBotAPIUpdateRequest has cyclomatic complexity 32 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ChannelStore.TransferChannelOwnership (cyclomatic 32) · ×1
  • ChannelStore.TransferChannelOwnership (cyclomatic 32) internal/store/postgres/channel_member_admin.go:165 — ChannelStore.TransferChannelOwnership has cyclomatic complexity 32 (threshold 15). Of this number, 31 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MessageStore.SetMessageReactions (cyclomatic 32) · ×1
  • MessageStore.SetMessageReactions (cyclomatic 32) internal/store/postgres/message_reactions.go:16 — MessageStore.SetMessageReactions has cyclomatic complexity 32 (threshold 15). Of this number, 31 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModerationReportStore.ReviewModerationAppeal (cyclomatic 32) · ×1
  • ModerationReportStore.ReviewModerationAppeal (cyclomatic 32) internal/store/postgres/moderation_cases.go:200 — ModerationReportStore.ReviewModerationAppeal has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.prepareStarGiftPurchase (cyclomatic 32) · ×1
  • StarGiftLifecycleStore.prepareStarGiftPurchase (cyclomatic 32) internal/store/postgres/star_gift_purchase.go:255 — StarGiftLifecycleStore.prepareStarGiftPurchase 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.
D1 · Cyclomatic Complexity · Service.createStickerSet (cyclomatic 31) · ×1
  • Service.createStickerSet (cyclomatic 31) internal/app/files/sticker_creator.go:81 — Service.createStickerSet 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.
D1 · Cyclomatic Complexity · apiInlineKeyboardButton.UnmarshalJSON (cyclomatic 31) · ×1
  • apiInlineKeyboardButton.UnmarshalJSON (cyclomatic 31) internal/botapi/inline.go:726 — apiInlineKeyboardButton.UnmarshalJSON 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.
D1 · Cyclomatic Complexity · loadharness.MutateOffline (cyclomatic 31) · ×1
  • loadharness.MutateOffline (cyclomatic 31) internal/loadharness/mutate.go:95 — loadharness.MutateOffline has cyclomatic complexity 31 (threshold 15). Of this number, 23 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · loadharness.mergeDialogPageKnownOverlap (cyclomatic 31) · ×1
  • loadharness.mergeDialogPageKnownOverlap (cyclomatic 31) internal/loadharness/snapshot.go:401 — loadharness.mergeDialogPageKnownOverlap 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.
D1 · Cyclomatic Complexity · Server.decodeInboundLayerRPCWithOptions (cyclomatic 31) · ×1
  • Server.decodeInboundLayerRPCWithOptions (cyclomatic 31) internal/mtprotoedge/inbound_layer_rpc.go:994 — Server.decodeInboundLayerRPCWithOptions 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.
D1 · Cyclomatic Complexity · Router.requestedPeerDetails (cyclomatic 31) · ×1
  • Router.requestedPeerDetails (cyclomatic 31) internal/rpc/messages_bot_longtail.go:198 — Router.requestedPeerDetails 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.
D1 · Cyclomatic Complexity · Router.onMessagesGetMessageReactionsList (cyclomatic 31) · ×1
  • Router.onMessagesGetMessageReactionsList (cyclomatic 31) internal/rpc/messages_reactions_lists.go:152 — Router.onMessagesGetMessageReactionsList 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.
D1 · Cyclomatic Complexity · Router.onPaymentsGetPaymentForm (cyclomatic 31) · ×1
  • Router.onPaymentsGetPaymentForm (cyclomatic 31) internal/rpc/payments_star_gifts.go:369 — Router.onPaymentsGetPaymentForm 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.
D1 · Cyclomatic Complexity · Router.sendOutgoing (cyclomatic 31) · ×1
  • Router.sendOutgoing (cyclomatic 31) internal/rpc/send_media.go:56 — Router.sendOutgoing 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.
D1 · Cyclomatic Complexity · memory.filterMessageList (cyclomatic 31) · ×1
  • memory.filterMessageList (cyclomatic 31) internal/store/memory/message_history.go:295 — memory.filterMessageList 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.
D1 · Cyclomatic Complexity · MessageStore.DeleteHistory (cyclomatic 31) · ×1
  • MessageStore.DeleteHistory (cyclomatic 31) internal/store/memory/message_history.go:216 — MessageStore.DeleteHistory has cyclomatic complexity 31 (threshold 15). Of this number, 19 points are the body's own statements and 12 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TelegramLoginStore.PutTelegramLoginAuthorizationCode (cyclomatic 31) · ×1
  • TelegramLoginStore.PutTelegramLoginAuthorizationCode (cyclomatic 31) internal/store/postgres/telegram_login.go:742 — TelegramLoginStore.PutTelegramLoginAuthorizationCode has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · main.main (cyclomatic 30) · ×1
  • main.main (cyclomatic 30) REDACTED:86 — main.main has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 6 of the 30 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 142, 122). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Service.ChangePhone (cyclomatic 30) · ×1
  • Service.ChangePhone (cyclomatic 30) internal/app/account/phone_change.go:170 — Service.ChangePhone has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.handleChooseBot (cyclomatic 30) · ×1
  • Service.handleChooseBot (cyclomatic 30) internal/app/bots/botfather.go:466 — Service.handleChooseBot 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.
D1 · Cyclomatic Complexity · Service.validateDecisionActions (cyclomatic 30) · ×1
  • Service.validateDecisionActions (cyclomatic 30) internal/app/moderation/actions.go:248 — Service.validateDecisionActions 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.
D1 · Cyclomatic Complexity · Service.CreateCatalogBundle (cyclomatic 30) · ×1
  • Service.CreateCatalogBundle (cyclomatic 30) internal/app/stargifts/service.go:259 — Service.CreateCatalogBundle 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.
D1 · Cyclomatic Complexity · CachedContactStore.ContactProjectionForViewers (cyclomatic 30) · ×1
  • CachedContactStore.ContactProjectionForViewers (cyclomatic 30) internal/app/userprojection/contact_cache.go:329 — CachedContactStore.ContactProjectionForViewers 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.
D1 · Cyclomatic Complexity · config.validateTelegramLoginConfig (cyclomatic 30) · ×1
  • config.validateTelegramLoginConfig (cyclomatic 30) internal/config/config.go:1680 — config.validateTelegramLoginConfig has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · rpc.botAPIQueuedUpdateKind (cyclomatic 30) · ×1
  • rpc.botAPIQueuedUpdateKind (cyclomatic 30) internal/rpc/botapi_update_queue.go:169 — rpc.botAPIQueuedUpdateKind 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.
D1 · Cyclomatic Complexity · Router.onMessagesGetInlineBotResults (cyclomatic 30) · ×1
  • Router.onMessagesGetInlineBotResults (cyclomatic 30) internal/rpc/bots_inline.go:46 — Router.onMessagesGetInlineBotResults 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.
D1 · Cyclomatic Complexity · Router.onMessagesSendReaction (cyclomatic 30) · ×1
  • Router.onMessagesSendReaction (cyclomatic 30) internal/rpc/messages_reactions_send.go:11 — Router.onMessagesSendReaction 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.
D1 · Cyclomatic Complexity · memory.adminRightsSubset (cyclomatic 30) · ×1
  • memory.adminRightsSubset (cyclomatic 30) internal/store/memory/channel_helpers.go:641 — memory.adminRightsSubset has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ChannelStore.ListChannelDialogs (cyclomatic 30) · ×1
  • ChannelStore.ListChannelDialogs (cyclomatic 30) internal/store/memory/channel_dialogs.go:10 — ChannelStore.ListChannelDialogs has cyclomatic complexity 30 (threshold 15). Of this number, 26 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.GetChannelMessageViews (cyclomatic 30) · ×1
  • ChannelStore.GetChannelMessageViews (cyclomatic 30) internal/store/memory/channel_message_views.go:9 — ChannelStore.GetChannelMessageViews 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.
D1 · Cyclomatic Complexity · ChannelStore.toggleSuggestedPostApprovalLocked (cyclomatic 30) · ×1
  • ChannelStore.toggleSuggestedPostApprovalLocked (cyclomatic 30) internal/store/memory/channel_suggested_post.go:43 — ChannelStore.toggleSuggestedPostApprovalLocked has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MessageStore.TogglePrivateNoForwards (cyclomatic 30) · ×1
  • MessageStore.TogglePrivateNoForwards (cyclomatic 30) internal/store/memory/message_no_forwards.go:45 — MessageStore.TogglePrivateNoForwards 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.
D1 · Cyclomatic Complexity · postgres.adminRightsSubset (cyclomatic 30) · ×1
  • postgres.adminRightsSubset (cyclomatic 30) internal/store/postgres/channel_helpers.go:959 — postgres.adminRightsSubset has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Service.SendLoginEmailCode (cyclomatic 29) · ×1
  • Service.SendLoginEmailCode (cyclomatic 29) internal/app/account/service.go:765 — Service.SendLoginEmailCode 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.
D1 · Cyclomatic Complexity · files.parsePremiumPromoSeed (cyclomatic 29) · ×1
  • files.parsePremiumPromoSeed (cyclomatic 29) internal/app/files/premium_promo_seed.go:219 — files.parsePremiumPromoSeed 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.
D1 · Cyclomatic Complexity · files.parseWebPageMeta (cyclomatic 29) · ×1
  • files.parseWebPageMeta (cyclomatic 29) internal/app/files/webpage.go:390 — files.parseWebPageMeta 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.
D1 · Cyclomatic Complexity · botapi.parseBotAPIHTML (cyclomatic 29) · ×1
  • botapi.parseBotAPIHTML (cyclomatic 29) internal/botapi/formatted_text.go:191 — botapi.parseBotAPIHTML 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.
D1 · Cyclomatic Complexity · botapi.apiUpdate (cyclomatic 29) · ×1
  • botapi.apiUpdate (cyclomatic 29) internal/botapi/projection.go:87 — botapi.apiUpdate 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.
D1 · Cyclomatic Complexity · botapi.apiRequestedPeer (cyclomatic 29) · ×1
  • botapi.apiRequestedPeer (cyclomatic 29) internal/botapi/projection.go:856 — botapi.apiRequestedPeer 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.
D1 · Cyclomatic Complexity · MessageStore.ReadMessageContents (cyclomatic 29) · ×1
  • MessageStore.ReadMessageContents (cyclomatic 29) internal/store/memory/message_read.go:11 — MessageStore.ReadMessageContents 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.
D1 · Cyclomatic Complexity · postgres.executePlainPrivateSendBatch (cyclomatic 29) · ×1
  • postgres.executePlainPrivateSendBatch (cyclomatic 29) internal/store/postgres/message_send_batch_actor.go:282 — postgres.executePlainPrivateSendBatch has cyclomatic complexity 29 (threshold 15). Of this number, 28 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.GetParticipants (cyclomatic 29) · ×1
  • ChannelStore.GetParticipants (cyclomatic 29) internal/store/postgres/channel_member_list.go:16 — ChannelStore.GetParticipants 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.
D1 · Cyclomatic Complexity · ChannelStore.SearchJoinedMessages (cyclomatic 29) · ×1
  • ChannelStore.SearchJoinedMessages (cyclomatic 29) internal/store/postgres/channel_message_history.go:351 — ChannelStore.SearchJoinedMessages has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MessageStore.TogglePrivateNoForwards (cyclomatic 29) · ×1
  • MessageStore.TogglePrivateNoForwards (cyclomatic 29) internal/store/postgres/message_no_forwards.go:45 — MessageStore.TogglePrivateNoForwards has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 11 of the 29 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 85, 183). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · MessageStore.CreateScheduledMessage (cyclomatic 29) · ×1
  • MessageStore.CreateScheduledMessage (cyclomatic 29) internal/store/postgres/scheduled_message.go:23 — MessageStore.CreateScheduledMessage has cyclomatic complexity 29 (threshold 15). Of this number, 28 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.markCraftInputMessageTx (cyclomatic 29) · ×1
  • StarGiftLifecycleStore.markCraftInputMessageTx (cyclomatic 29) internal/store/postgres/star_gift_craft_projection.go:52 — StarGiftLifecycleStore.markCraftInputMessageTx 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.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.CompleteStarGiftWithdrawal (cyclomatic 29) · ×1
  • StarGiftLifecycleStore.CompleteStarGiftWithdrawal (cyclomatic 29) internal/store/postgres/star_gift_lifecycle.go:1596 — StarGiftLifecycleStore.CompleteStarGiftWithdrawal has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 8 of the 29 points are its own statements and the rest belongs to one function literal inside it that branches (line 1602). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · TelegramLoginStore.ConsumeTelegramLoginDirectToken (cyclomatic 29) · ×1
  • TelegramLoginStore.ConsumeTelegramLoginDirectToken (cyclomatic 29) internal/store/postgres/telegram_login.go:936 — TelegramLoginStore.ConsumeTelegramLoginDirectToken has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.SetAccountFrozen (cyclomatic 28) · ×1
  • Service.SetAccountFrozen (cyclomatic 28) internal/admin/service.go:1473 — Service.SetAccountFrozen has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 12 of the 28 points are its own statements and the rest belongs to one function literal inside it that branches (line 1494). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · telegramlogin.NormalizeNativeCallbackURI (cyclomatic 28) · ×1
  • telegramlogin.NormalizeNativeCallbackURI (cyclomatic 28) internal/app/telegramlogin/native.go:48 — telegramlogin.NormalizeNativeCallbackURI has cyclomatic complexity 28 (threshold 15). Of this number, 23 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · userprojection.projectBatch (cyclomatic 28) · ×1
  • userprojection.projectBatch (cyclomatic 28) internal/app/userprojection/projection.go:366 — userprojection.projectBatch has cyclomatic complexity 28 (threshold 15). Of this number, 21 points are the body's own statements and 7 belong to 7 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · botapi.parseBotAPIMarkdown (cyclomatic 28) · ×1
  • botapi.parseBotAPIMarkdown (cyclomatic 28) internal/botapi/formatted_text.go:521 — botapi.parseBotAPIMarkdown 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.
D1 · Cyclomatic Complexity · botapi.apiMessageMedia (cyclomatic 28) · ×1
  • botapi.apiMessageMedia (cyclomatic 28) internal/botapi/projection.go:567 — botapi.apiMessageMedia 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.
D1 · Cyclomatic Complexity · config.validateVerificationConfig (cyclomatic 28) · ×1
  • config.validateVerificationConfig (cyclomatic 28) internal/config/config.go:1730 — config.validateVerificationConfig has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · channelFanoutDispatcher.Run (cyclomatic 28) · ×1
  • channelFanoutDispatcher.Run (cyclomatic 28) internal/rpc/channel_fanout_dispatcher.go:461 — channelFanoutDispatcher.Run has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 8 of the 28 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 512, 482). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · OutboxDispatcher.dispatchBatch (cyclomatic 28) · ×1
  • OutboxDispatcher.dispatchBatch (cyclomatic 28) internal/rpc/outbox_dispatcher.go:282 — OutboxDispatcher.dispatchBatch 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.
D1 · Cyclomatic Complexity · Router.onMessagesSendBotRequestedPeer (cyclomatic 28) · ×1
  • Router.onMessagesSendBotRequestedPeer (cyclomatic 28) internal/rpc/messages_bot_longtail.go:82 — Router.onMessagesSendBotRequestedPeer has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onEditMessageLiveLocation (cyclomatic 28) · ×1
  • Router.onEditMessageLiveLocation (cyclomatic 28) internal/rpc/messages_edit_geolive.go:16 — Router.onEditMessageLiveLocation 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.
D1 · Cyclomatic Complexity · ChannelStore.approveInviteImporterLocked (cyclomatic 28) · ×1
  • ChannelStore.approveInviteImporterLocked (cyclomatic 28) internal/store/memory/channel_invites.go:732 — ChannelStore.approveInviteImporterLocked 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.
D1 · Cyclomatic Complexity · ChannelStore.ReadChannelMessageContents (cyclomatic 28) · ×1
  • ChannelStore.ReadChannelMessageContents (cyclomatic 28) internal/store/memory/channel_read.go:52 — ChannelStore.ReadChannelMessageContents 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.
D1 · Cyclomatic Complexity · ChannelStore.ProcessSuggestedPostLifecycle (cyclomatic 28) · ×1
  • ChannelStore.ProcessSuggestedPostLifecycle (cyclomatic 28) internal/store/memory/channel_suggested_post.go:153 — ChannelStore.ProcessSuggestedPostLifecycle 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.
D1 · Cyclomatic Complexity · ChannelStore.ListChannelReplies (cyclomatic 28) · ×1
  • ChannelStore.ListChannelReplies (cyclomatic 28) internal/store/memory/channel_topics.go:499 — ChannelStore.ListChannelReplies 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.
D1 · Cyclomatic Complexity · CommunityStore.ToggleCommunityParticipantBanned (cyclomatic 28) · ×1
  • CommunityStore.ToggleCommunityParticipantBanned (cyclomatic 28) internal/store/memory/community.go:697 — CommunityStore.ToggleCommunityParticipantBanned 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.
D1 · Cyclomatic Complexity · AccountLifecycleStore.ExecuteAccountDeletion (cyclomatic 28) · ×1
  • AccountLifecycleStore.ExecuteAccountDeletion (cyclomatic 28) internal/store/postgres/account_lifecycle.go:121 — AccountLifecycleStore.ExecuteAccountDeletion has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.ListChannelDialogSnapshotHeaders (cyclomatic 28) · ×1
  • ChannelStore.ListChannelDialogSnapshotHeaders (cyclomatic 28) REDACTED:293 — ChannelStore.ListChannelDialogSnapshotHeaders has cyclomatic complexity 28 (threshold 15). Of this number, 24 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.LeaveChannel (cyclomatic 28) · ×1
  • ChannelStore.LeaveChannel (cyclomatic 28) internal/store/postgres/channel_member_join.go:159 — ChannelStore.LeaveChannel has cyclomatic complexity 28 (threshold 15). Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MessageStore.resolvePrivateSendReply (cyclomatic 28) · ×1
  • MessageStore.resolvePrivateSendReply (cyclomatic 28) internal/store/postgres/message_send.go:808 — MessageStore.resolvePrivateSendReply 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.
D1 · Cyclomatic Complexity · ModerationReportStore.SubmitModerationAppealByLink (cyclomatic 28) · ×1
  • ModerationReportStore.SubmitModerationAppealByLink (cyclomatic 28) internal/store/postgres/moderation_cases.go:533 — ModerationReportStore.SubmitModerationAppealByLink has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StarGiftStore.CreateCatalogRevision (cyclomatic 28) · ×1
  • StarGiftStore.CreateCatalogRevision (cyclomatic 28) internal/store/postgres/star_gift.go:204 — StarGiftStore.CreateCatalogRevision has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 10 of the 28 points are its own statements and the rest belongs to one function literal inside it that branches (line 211). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.ConvertStarGift (cyclomatic 28) · ×1
  • StarGiftLifecycleStore.ConvertStarGift (cyclomatic 28) internal/store/postgres/star_gift_lifecycle.go:67 — StarGiftLifecycleStore.ConvertStarGift has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 10 of the 28 points are its own statements and the rest belongs to one function literal inside it that branches (line 79). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.TransferStarGift (cyclomatic 28) · ×1
  • StarGiftLifecycleStore.TransferStarGift (cyclomatic 28) internal/store/postgres/star_gift_lifecycle.go:418 — StarGiftLifecycleStore.TransferStarGift has cyclomatic complexity 28 (threshold 15). Of this number, 16 points are the body's own statements and 12 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CachedReadModelVersionStore.ReadModelHashes (cyclomatic 28) · ×1
  • CachedReadModelVersionStore.ReadModelHashes (cyclomatic 28) internal/store/read_model_cache.go:87 — CachedReadModelVersionStore.ReadModelHashes 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.
D1 · Cyclomatic Complexity · main.pythonBytesLiteralToHex (cyclomatic 27) · ×1
  • main.pythonBytesLiteralToHex (cyclomatic 27) cmd/stickerseeddeploy/main.go:256 — main.pythonBytesLiteralToHex 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.
D1 · Cyclomatic Complexity · main.documentMedia (cyclomatic 27) · ×1
  • main.documentMedia (cyclomatic 27) cmd/telesrv-admin/privateview_store.go:781 — main.documentMedia has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · server.runOperatorCommand (cyclomatic 27) · ×1
  • server.runOperatorCommand (cyclomatic 27) cmd/telesrv-admin/admin_command_runner.go:104 — server.runOperatorCommand has cyclomatic complexity 27 (threshold 15). Of this number, 26 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · main.run (cyclomatic 27) · ×1
  • main.run (cyclomatic 27) cmd/tl-coverage/main.go:105 — main.run 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.
D1 · Cyclomatic Complexity · Service.appendMissingChannelPeerPreviews (cyclomatic 27) · ×1
  • Service.appendMissingChannelPeerPreviews (cyclomatic 27) internal/app/dialogs/service.go:727 — Service.appendMissingChannelPeerPreviews 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.
D1 · Cyclomatic Complexity · stars.validPurchaseCommand (cyclomatic 27) · ×1
  • stars.validPurchaseCommand (cyclomatic 27) internal/app/stars/service.go:260 — stars.validPurchaseCommand has cyclomatic complexity 27 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Service.deepLinkToken (cyclomatic 27) · ×1
  • Service.deepLinkToken (cyclomatic 27) internal/app/telegramlogin/service.go:914 — Service.deepLinkToken has cyclomatic complexity 27 (threshold 15). Of this number, 26 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, 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.
D1 · Cyclomatic Complexity · Projector.ForViewers (cyclomatic 27) · ×1
  • Projector.ForViewers (cyclomatic 27) internal/app/userprojection/projection.go:126 — Projector.ForViewers has cyclomatic complexity 27 (threshold 15). Of this number, 23 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · handler.getUpdates (cyclomatic 27) · ×1
  • handler.getUpdates (cyclomatic 27) internal/botapi/server.go:313 — handler.getUpdates has cyclomatic complexity 27 (threshold 15). Of this number, 26 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: handler.handle (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · loadharness.applyOfflineChannelActions (cyclomatic 27) · ×1
  • loadharness.applyOfflineChannelActions (cyclomatic 27) internal/loadharness/mutate.go:347 — loadharness.applyOfflineChannelActions 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.
D1 · Cyclomatic Complexity · DatasetSeedState.Validate (cyclomatic 27) · ×1
  • DatasetSeedState.Validate (cyclomatic 27) internal/loadharness/dataset.go:279 — DatasetSeedState.Validate 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.
D1 · Cyclomatic Complexity · loadWorker.runClient (cyclomatic 27) · ×1
  • loadWorker.runClient (cyclomatic 27) REDACTED:290 — loadWorker.runClient has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 2 of the 27 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 333, 299). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · rpcResultWaiter.subscribe (cyclomatic 27) · ×1
  • rpcResultWaiter.subscribe (cyclomatic 27) internal/mtprotoedge/rpc_flight.go:189 — rpcResultWaiter.subscribe 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.
D1 · Cyclomatic Complexity · rpc.tgChannelAdminLogEvent (cyclomatic 27) · ×1
  • rpc.tgChannelAdminLogEvent (cyclomatic 27) internal/rpc/convert_channels_core.go:785 — rpc.tgChannelAdminLogEvent has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · rpc.tgMessage (cyclomatic 27) · ×1
  • rpc.tgMessage (cyclomatic 27) internal/rpc/convert_messages.go:32 — rpc.tgMessage has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onChannelsGetSendAs (cyclomatic 27) · ×1
  • Router.onChannelsGetSendAs (cyclomatic 27) internal/rpc/channels_core.go:311 — Router.onChannelsGetSendAs 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.
D1 · Cyclomatic Complexity · Router.onChannelsGetParticipants (cyclomatic 27) · ×1
  • Router.onChannelsGetParticipants (cyclomatic 27) internal/rpc/channels_members.go:121 — Router.onChannelsGetParticipants has cyclomatic complexity 27 (threshold 15). Of this number, 25 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Router.onPaymentsGetResaleStarGifts (cyclomatic 27) · ×1
  • Router.onPaymentsGetResaleStarGifts (cyclomatic 27) internal/rpc/payments_star_gift_lifecycle.go:489 — Router.onPaymentsGetResaleStarGifts 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.
D1 · Cyclomatic Complexity · Router.rememberClientLayerAt (cyclomatic 27) · ×1
  • Router.rememberClientLayerAt (cyclomatic 27) internal/rpc/router.go:992 — Router.rememberClientLayerAt has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · LangPackStore.ReconcileSeed (cyclomatic 27) · ×1
  • LangPackStore.ReconcileSeed (cyclomatic 27) internal/store/memory/langpack.go:129 — LangPackStore.ReconcileSeed 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.
D1 · Cyclomatic Complexity · ChannelStore.approveInviteImporterTx (cyclomatic 27) · ×1
  • ChannelStore.approveInviteImporterTx (cyclomatic 27) internal/store/postgres/channel_invite_import.go:111 — ChannelStore.approveInviteImporterTx has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CommunityStore.ToggleCommunityParticipantBanned (cyclomatic 27) · ×1
  • CommunityStore.ToggleCommunityParticipantBanned (cyclomatic 27) internal/store/postgres/community.go:918 — CommunityStore.ToggleCommunityParticipantBanned has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 1 of the 27 points is its own statement and the rest belongs to one function literal inside it that branches (line 919). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · MessageStore.UnpinAllPrivateMessages (cyclomatic 27) · ×1
  • MessageStore.UnpinAllPrivateMessages (cyclomatic 27) internal/store/postgres/message_pin.go:174 — MessageStore.UnpinAllPrivateMessages has cyclomatic complexity 27 (threshold 15). Of this number, 26 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MessageStore.duplicateSendResult (cyclomatic 27) · ×1
  • MessageStore.duplicateSendResult (cyclomatic 27) internal/store/postgres/message_send.go:713 — MessageStore.duplicateSendResult 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.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.DropStarGiftOriginalDetails (cyclomatic 27) · ×1
  • StarGiftLifecycleStore.DropStarGiftOriginalDetails (cyclomatic 27) internal/store/postgres/star_gift_entitlements.go:212 — StarGiftLifecycleStore.DropStarGiftOriginalDetails has cyclomatic complexity 27 (threshold 15). Of this number, 20 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Handler.token (cyclomatic 27) · ×1
  • Handler.token (cyclomatic 27) internal/telegramloginhttp/handler.go:587 — Handler.token has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.DeleteAccount (cyclomatic 26) · ×1
  • Service.DeleteAccount (cyclomatic 26) REDACTED:42 — Service.DeleteAccount has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · HTTPProvider.composeOpenAIChatStream (cyclomatic 26) · ×1
  • HTTPProvider.composeOpenAIChatStream (cyclomatic 26) internal/app/ai/provider_http.go:217 — HTTPProvider.composeOpenAIChatStream 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.
D1 · Cyclomatic Complexity · Service.Search (cyclomatic 26) · ×1
  • Service.Search (cyclomatic 26) internal/app/contacts/service.go:349 — Service.Search has cyclomatic complexity 26 (threshold 15). Of this number, 23 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Service.importDocument (cyclomatic 26) · ×1
  • Service.importDocument (cyclomatic 26) internal/app/files/seed.go:406 — Service.importDocument 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.
D1 · Cyclomatic Complexity · Service.ensureStickerMaterialShape (cyclomatic 26) · ×1
  • Service.ensureStickerMaterialShape (cyclomatic 26) internal/app/files/sticker_creator.go:305 — Service.ensureStickerMaterialShape 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.
D1 · Cyclomatic Complexity · telegramlogin.parseWebURL (cyclomatic 26) · ×1
  • telegramlogin.parseWebURL (cyclomatic 26) internal/app/telegramlogin/url.go:49 — telegramlogin.parseWebURL 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.
D1 · Cyclomatic Complexity · Service.AuthorizeMessageButton (cyclomatic 26) · ×1
  • Service.AuthorizeMessageButton (cyclomatic 26) internal/app/telegramlogin/service.go:430 — Service.AuthorizeMessageButton has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.resolveTexts (cyclomatic 26) · ×1
  • Service.resolveTexts (cyclomatic 26) internal/app/translation/service.go:171 — Service.resolveTexts 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.
D1 · Cyclomatic Complexity · botapi.apiMessage (cyclomatic 26) · ×1
  • botapi.apiMessage (cyclomatic 26) internal/botapi/projection.go:278 — botapi.apiMessage has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · botapi.apiReplyMarkup (cyclomatic 26) · ×1
  • botapi.apiReplyMarkup (cyclomatic 26) internal/botapi/projection.go:486 — botapi.apiReplyMarkup 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.
D1 · Cyclomatic Complexity · handler.sendEphemeralLocation (cyclomatic 26) · ×1
  • handler.sendEphemeralLocation (cyclomatic 26) internal/botapi/ephemeral.go:135 — handler.sendEphemeralLocation has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · webhookDispatcher.deliver (cyclomatic 26) · ×1
  • webhookDispatcher.deliver (cyclomatic 26) internal/botapi/webhook.go:105 — webhookDispatcher.deliver has cyclomatic complexity 26 (threshold 15). Of this number, 23 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · loadharness.seedRichAccountState (cyclomatic 26) · ×1
  • loadharness.seedRichAccountState (cyclomatic 26) internal/loadharness/rich_state.go:48 — loadharness.seedRichAccountState has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 3 of the 26 points are its own statements and the rest belongs to one function literal inside it that branches (line 66). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · loadharness.SnapshotClientState (cyclomatic 26) · ×1
  • loadharness.SnapshotClientState (cyclomatic 26) internal/loadharness/snapshot.go:105 — loadharness.SnapshotClientState has cyclomatic complexity 26 (threshold 15). Of this number, 22 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · loadharness.catchUpStartupChannel (cyclomatic 26) · ×1
  • loadharness.catchUpStartupChannel (cyclomatic 26) REDACTED:745 — loadharness.catchUpStartupChannel 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.
D1 · Cyclomatic Complexity · mtprotoedge.preflightInboundItem (cyclomatic 26) · ×1
  • mtprotoedge.preflightInboundItem (cyclomatic 26) internal/mtprotoedge/inbound_preflight.go:648 — mtprotoedge.preflightInboundItem 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.
D1 · Cyclomatic Complexity · Router.cacheBoundAuthKeyLayerResolution (cyclomatic 26) · ×1
  • Router.cacheBoundAuthKeyLayerResolution (cyclomatic 26) REDACTED:278 — Router.cacheBoundAuthKeyLayerResolution 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.
D1 · Cyclomatic Complexity · Router.cacheResolvedDurableSessionLayer (cyclomatic 26) · ×1
  • Router.cacheResolvedDurableSessionLayer (cyclomatic 26) internal/rpc/durable_layer_evidence.go:153 — Router.cacheResolvedDurableSessionLayer 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.
D1 · Cyclomatic Complexity · Router.DispatchAdmitted (cyclomatic 26) · ×1
  • Router.DispatchAdmitted (cyclomatic 26) internal/rpc/layer_dispatch.go:254 — Router.DispatchAdmitted has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.messageFilterFromSearchRequest (cyclomatic 26) · ×1
  • Router.messageFilterFromSearchRequest (cyclomatic 26) internal/rpc/messages_history.go:834 — Router.messageFilterFromSearchRequest 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.
D1 · Cyclomatic Complexity · Router.onMessagesAcceptURLAuth (cyclomatic 26) · ×1
  • Router.onMessagesAcceptURLAuth (cyclomatic 26) internal/rpc/telegram_login.go:168 — Router.onMessagesAcceptURLAuth 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.
D1 · Cyclomatic Complexity · Router.onUsersGetUsers (cyclomatic 26) · ×1
  • Router.onUsersGetUsers (cyclomatic 26) REDACTED:42 — Router.onUsersGetUsers 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.
D1 · Cyclomatic Complexity · ChannelStore.ListDirtyActiveChannelsForUser (cyclomatic 26) · ×1
  • ChannelStore.ListDirtyActiveChannelsForUser (cyclomatic 26) internal/store/memory/channel_helpers.go:318 — ChannelStore.ListDirtyActiveChannelsForUser 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.
D1 · Cyclomatic Complexity · ChannelStore.resolveChannelReplyLocked (cyclomatic 26) · ×1
  • ChannelStore.resolveChannelReplyLocked (cyclomatic 26) internal/store/memory/channel_helpers.go:524 — ChannelStore.resolveChannelReplyLocked 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.
D1 · Cyclomatic Complexity · ChannelStore.DeleteChannelParticipantReactions (cyclomatic 26) · ×1
  • ChannelStore.DeleteChannelParticipantReactions (cyclomatic 26) internal/store/memory/channel_reactions.go:204 — ChannelStore.DeleteChannelParticipantReactions has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · postgres.pruneConfirmedUserPrefixTx (cyclomatic 26) · ×1
  • postgres.pruneConfirmedUserPrefixTx (cyclomatic 26) internal/store/postgres/update_event_retention.go:114 — postgres.pruneConfirmedUserPrefixTx has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.CreateChannel (cyclomatic 26) · ×1
  • ChannelStore.CreateChannel (cyclomatic 26) internal/store/postgres/channel_core.go:60 — ChannelStore.CreateChannel has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.processSuggestedPostLifecycleOne (cyclomatic 26) · ×1
  • ChannelStore.processSuggestedPostLifecycleOne (cyclomatic 26) internal/store/postgres/channel_suggested_post.go:540 — ChannelStore.processSuggestedPostLifecycleOne has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.loadChannelDifferenceBase (cyclomatic 26) · ×1
  • ChannelStore.loadChannelDifferenceBase (cyclomatic 26) internal/store/postgres/channel_updates.go:202 — ChannelStore.loadChannelDifferenceBase 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.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.PurchaseStarGift (cyclomatic 26) · ×1
  • StarGiftLifecycleStore.PurchaseStarGift (cyclomatic 26) internal/store/postgres/star_gift_purchase.go:122 — StarGiftLifecycleStore.PurchaseStarGift has cyclomatic complexity 26 (threshold 15). Of this number, 21 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · main.main (cyclomatic 25) · ×1
  • main.main (cyclomatic 25) cmd/catalogfetch/main.go:90 — main.main has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 5 of the 25 points are its own statements and the rest belongs to one function literal inside it that branches (line 111). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · bots.validStickersBotEmoji (cyclomatic 25) · ×1
  • bots.validStickersBotEmoji (cyclomatic 25) internal/app/bots/stickersbot.go:779 — bots.validStickersBotEmoji has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Service.SeedPremiumPromo (cyclomatic 25) · ×1
  • Service.SeedPremiumPromo (cyclomatic 25) internal/app/files/premium_promo_seed.go:64 — Service.SeedPremiumPromo 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.
D1 · Cyclomatic Complexity · Service.SeedMedia (cyclomatic 25) · ×1
  • Service.SeedMedia (cyclomatic 25) internal/app/files/seed.go:41 — Service.SeedMedia has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · handler.sendMedia (cyclomatic 25) · ×1
  • handler.sendMedia (cyclomatic 25) internal/botapi/server.go:650 — handler.sendMedia has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: handler.handle (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Server.handleRPC (cyclomatic 25) · ×1
  • Server.handleRPC (cyclomatic 25) internal/mtprotoedge/encrypted.go:745 — Server.handleRPC 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.
D1 · Cyclomatic Complexity · rpc.tgChannel (cyclomatic 25) · ×1
  • rpc.tgChannel (cyclomatic 25) internal/rpc/convert_channels_core.go:449 — rpc.tgChannel has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onEphemeralSendMessage (cyclomatic 25) · ×1
  • Router.onEphemeralSendMessage (cyclomatic 25) internal/rpc/ephemeral.go:44 — Router.onEphemeralSendMessage has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.BuildOutboxUpdates (cyclomatic 25) · ×1
  • Router.BuildOutboxUpdates (cyclomatic 25) internal/rpc/outbox_update_builder.go:26 — Router.BuildOutboxUpdates 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.
D1 · Cyclomatic Complexity · Router.resolvePremiumInvoice (cyclomatic 25) · ×1
  • Router.resolvePremiumInvoice (cyclomatic 25) internal/rpc/payments_premium.go:170 — Router.resolvePremiumInvoice 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.
D1 · Cyclomatic Complexity · Router.onUpdatesGetDifference (cyclomatic 25) · ×1
  • Router.onUpdatesGetDifference (cyclomatic 25) internal/rpc/updates.go:82 — Router.onUpdatesGetDifference 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.
D1 · Cyclomatic Complexity · ChannelStore.EditExportedInvite (cyclomatic 25) · ×1
  • ChannelStore.EditExportedInvite (cyclomatic 25) internal/store/memory/channel_invites.go:417 — ChannelStore.EditExportedInvite has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.channelMessageRepliesLocked (cyclomatic 25) · ×1
  • ChannelStore.channelMessageRepliesLocked (cyclomatic 25) internal/store/memory/channel_topics.go:578 — ChannelStore.channelMessageRepliesLocked 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.
D1 · Cyclomatic Complexity · VerificationStore.ListVerificationApplications (cyclomatic 25) · ×1
  • VerificationStore.ListVerificationApplications (cyclomatic 25) internal/store/memory/verification.go:501 — VerificationStore.ListVerificationApplications 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.
D1 · Cyclomatic Complexity · ChannelStore.ListChannelMessageReactions (cyclomatic 25) · ×1
  • ChannelStore.ListChannelMessageReactions (cyclomatic 25) internal/store/postgres/channel_reaction_messages.go:415 — ChannelStore.ListChannelMessageReactions has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.populateChannelMessageReplies (cyclomatic 25) · ×1
  • ChannelStore.populateChannelMessageReplies (cyclomatic 25) internal/store/postgres/channel_topics.go:722 — ChannelStore.populateChannelMessageReplies 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.
D1 · Cyclomatic Complexity · MessageStore.ForwardPrivateMessages (cyclomatic 25) · ×1
  • MessageStore.ForwardPrivateMessages (cyclomatic 25) internal/store/postgres/message_forward.go:19 — MessageStore.ForwardPrivateMessages 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.
D1 · Cyclomatic Complexity · MessageStore.mutateMessagePoll (cyclomatic 25) · ×1
  • MessageStore.mutateMessagePoll (cyclomatic 25) internal/store/postgres/message_polls.go:30 — MessageStore.mutateMessagePoll has cyclomatic complexity 25 (threshold 15). Of this number, 24 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ModerationReportStore.DecideModerationCase (cyclomatic 25) · ×1
  • ModerationReportStore.DecideModerationCase (cyclomatic 25) internal/store/postgres/moderation_cases.go:112 — ModerationReportStore.DecideModerationCase has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ReadModelChangeListener.flush (cyclomatic 25) · ×1
  • ReadModelChangeListener.flush (cyclomatic 25) internal/store/postgres/read_model_listener.go:279 — ReadModelChangeListener.flush has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StarGiftStore.ResolveSavedIDs (cyclomatic 25) · ×1
  • StarGiftStore.ResolveSavedIDs (cyclomatic 25) internal/store/postgres/star_gift.go:669 — StarGiftStore.ResolveSavedIDs 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.
D1 · Cyclomatic Complexity · main.run (cyclomatic 24) · ×1
  • main.run (cyclomatic 24) cmd/blob-migrate/main.go:55 — main.run has cyclomatic complexity 24 (threshold 15). Of this number, 21 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.verifyPasswordRecoveryCode (cyclomatic 24) · ×1
  • Service.verifyPasswordRecoveryCode (cyclomatic 24) internal/app/account/service.go:631 — Service.verifyPasswordRecoveryCode 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.
D1 · Cyclomatic Complexity · Service.WatchChain (cyclomatic 24) · ×1
  • Service.WatchChain (cyclomatic 24) internal/app/donations/watcher.go:36 — Service.WatchChain has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Service.editFieldsFromBot (cyclomatic 24) · ×1
  • Service.editFieldsFromBot (cyclomatic 24) internal/app/ephemeral/service.go:317 — Service.editFieldsFromBot 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.
D1 · Cyclomatic Complexity · telegramlogin.validateRawSigningKey (cyclomatic 24) · ×1
  • telegramlogin.validateRawSigningKey (cyclomatic 24) internal/app/telegramlogin/jose.go:143 — telegramlogin.validateRawSigningKey has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · botapi.richMessageInputFromAPI (cyclomatic 24) · ×1
  • botapi.richMessageInputFromAPI (cyclomatic 24) internal/botapi/rich_message.go:15 — botapi.richMessageInputFromAPI 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.
D1 · Cyclomatic Complexity · handler.editMessageText (cyclomatic 24) · ×1
  • handler.editMessageText (cyclomatic 24) internal/botapi/server.go:740 — handler.editMessageText has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: handler.handle (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · handler.setWebhook (cyclomatic 24) · ×1
  • handler.setWebhook (cyclomatic 24) internal/botapi/server.go:973 — handler.setWebhook has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: handler.handle (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · domain.ApplyPremiumBoostSlot (cyclomatic 24) · ×1
  • domain.ApplyPremiumBoostSlot (cyclomatic 24) internal/domain/boost.go:218 — domain.ApplyPremiumBoostSlot has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ModerationAppeal.Validate (cyclomatic 24) · ×1
  • ModerationAppeal.Validate (cyclomatic 24) internal/domain/moderation_case.go:459 — ModerationAppeal.Validate has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · loadharness.snapshotDialogsObserved (cyclomatic 24) · ×1
  • loadharness.snapshotDialogsObserved (cyclomatic 24) internal/loadharness/snapshot.go:272 — loadharness.snapshotDialogsObserved has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OfflineMutationState.Validate (cyclomatic 24) · ×1
  • OfflineMutationState.Validate (cyclomatic 24) internal/loadharness/mutate.go:584 — OfflineMutationState.Validate has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · serverMetricsClient.scrape (cyclomatic 24) · ×1
  • serverMetricsClient.scrape (cyclomatic 24) internal/loadharness/server_metrics.go:110 — serverMetricsClient.scrape 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.
D1 · Cyclomatic Complexity · SessionManager.runFlush (cyclomatic 24) · ×1
  • SessionManager.runFlush (cyclomatic 24) internal/mtprotoedge/session_manager.go:1242 — SessionManager.runFlush 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.
D1 · Cyclomatic Complexity · Cache.GetOrLoadBatch (cyclomatic 24) · ×1
  • Cache.GetOrLoadBatch (cyclomatic 24) internal/readmodelcache/cache.go:319 — Cache.GetOrLoadBatch 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.
D1 · Cyclomatic Complexity · Router.onContactsSetBlocked (cyclomatic 24) · ×1
  • Router.onContactsSetBlocked (cyclomatic 24) internal/rpc/contacts.go:345 — Router.onContactsSetBlocked 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.
D1 · Cyclomatic Complexity · Router.editChannelInlineBotMessage (cyclomatic 24) · ×1
  • Router.editChannelInlineBotMessage (cyclomatic 24) internal/rpc/messages_bot_no_state.go:190 — Router.editChannelInlineBotMessage 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.
D1 · Cyclomatic Complexity · Router.starGiftRefFromInput (cyclomatic 24) · ×1
  • Router.starGiftRefFromInput (cyclomatic 24) internal/rpc/payments_star_gifts.go:1366 — Router.starGiftRefFromInput 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.
D1 · Cyclomatic Complexity · Router.onPhoneDeleteConferenceCallParticipants (cyclomatic 24) · ×1
  • Router.onPhoneDeleteConferenceCallParticipants (cyclomatic 24) internal/rpc/phone_conference.go:232 — Router.onPhoneDeleteConferenceCallParticipants has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · memory.channelDialogMatchesFilter (cyclomatic 24) · ×1
  • memory.channelDialogMatchesFilter (cyclomatic 24) internal/store/memory/channel_dialogs.go:517 — memory.channelDialogMatchesFilter has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.EditChannelAdmin (cyclomatic 24) · ×1
  • ChannelStore.EditChannelAdmin (cyclomatic 24) internal/store/memory/channel_members.go:288 — ChannelStore.EditChannelAdmin has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.DeleteChannelHistory (cyclomatic 24) · ×1
  • ChannelStore.DeleteChannelHistory (cyclomatic 24) internal/store/memory/channel_message_delete.go:65 — ChannelStore.DeleteChannelHistory 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.
D1 · Cyclomatic Complexity · ChannelStore.ChannelPollFanoutViews (cyclomatic 24) · ×1
  • ChannelStore.ChannelPollFanoutViews (cyclomatic 24) internal/store/memory/channel_polls.go:68 — ChannelStore.ChannelPollFanoutViews has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · MessageStore.ForwardPrivateMessages (cyclomatic 24) · ×1
  • MessageStore.ForwardPrivateMessages (cyclomatic 24) internal/store/memory/message_forward.go:9 — MessageStore.ForwardPrivateMessages 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.
D1 · Cyclomatic Complexity · TelegramLoginStore.PutTelegramLoginAuthorizationCode (cyclomatic 24) · ×1
  • TelegramLoginStore.PutTelegramLoginAuthorizationCode (cyclomatic 24) internal/store/memory/telegram_login.go:469 — TelegramLoginStore.PutTelegramLoginAuthorizationCode has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ChannelStore.DeleteChannelParticipantReactions (cyclomatic 24) · ×1
  • ChannelStore.DeleteChannelParticipantReactions (cyclomatic 24) internal/store/postgres/channel_reaction_messages.go:255 — ChannelStore.DeleteChannelParticipantReactions has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.EditForumTopic (cyclomatic 24) · ×1
  • ChannelStore.EditForumTopic (cyclomatic 24) internal/store/postgres/channel_topics.go:194 — ChannelStore.EditForumTopic has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.ListChannelReplies (cyclomatic 24) · ×1
  • ChannelStore.ListChannelReplies (cyclomatic 24) internal/store/postgres/channel_topics.go:588 — ChannelStore.ListChannelReplies has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.pruneChannelUpdateEvents (cyclomatic 24) · ×1
  • ChannelStore.pruneChannelUpdateEvents (cyclomatic 24) internal/store/postgres/channel_update_retention.go:123 — ChannelStore.pruneChannelUpdateEvents has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 7 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 132). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · MessageStore.ReserveAlbumGroup (cyclomatic 24) · ×1
  • MessageStore.ReserveAlbumGroup (cyclomatic 24) internal/store/postgres/album_group.go:18 — MessageStore.ReserveAlbumGroup 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.
D1 · Cyclomatic Complexity · MessageStore.ListByUser (cyclomatic 24) · ×1
  • MessageStore.ListByUser (cyclomatic 24) internal/store/postgres/message_history.go:80 — MessageStore.ListByUser 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.
D1 · Cyclomatic Complexity · MessageStore.EditScheduledMessage (cyclomatic 24) · ×1
  • MessageStore.EditScheduledMessage (cyclomatic 24) internal/store/postgres/scheduled_message.go:138 — MessageStore.EditScheduledMessage has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.loadStarGiftPurchaseReplay (cyclomatic 24) · ×1
  • StarGiftLifecycleStore.loadStarGiftPurchaseReplay (cyclomatic 24) internal/store/postgres/star_gift_purchase.go:358 — StarGiftLifecycleStore.loadStarGiftPurchaseReplay 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.
D1 · Cyclomatic Complexity · Service.runCommand (cyclomatic 23) · ×1
  • Service.runCommand (cyclomatic 23) internal/admin/service.go:3933 — Service.runCommand has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.appearanceSeedReady (cyclomatic 23) · ×1
  • Service.appearanceSeedReady (cyclomatic 23) internal/app/files/appearance_seed.go:96 — Service.appearanceSeedReady has cyclomatic complexity 23 (threshold 15). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · giftpack.ParseManifest (cyclomatic 23) · ×1
  • giftpack.ParseManifest (cyclomatic 23) internal/app/giftpack/manifest.go:89 — giftpack.ParseManifest 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.
D1 · Cyclomatic Complexity · Service.SendPrivateText (cyclomatic 23) · ×1
  • Service.SendPrivateText (cyclomatic 23) internal/app/messages/service.go:129 — Service.SendPrivateText 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.
D1 · Cyclomatic Complexity · Service.ReportMessages (cyclomatic 23) · ×1
  • Service.ReportMessages (cyclomatic 23) internal/app/moderation/evidence.go:41 — Service.ReportMessages 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.
D1 · Cyclomatic Complexity · Service.exchangeAuthorizationCode (cyclomatic 23) · ×1
  • Service.exchangeAuthorizationCode (cyclomatic 23) internal/app/telegramlogin/service.go:1297 — Service.exchangeAuthorizationCode has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.candidateStates (cyclomatic 23) · ×1
  • Service.candidateStates (cyclomatic 23) internal/app/verification/service.go:1080 — Service.candidateStates 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.
D1 · Cyclomatic Complexity · loadharness.classifyError (cyclomatic 23) · ×1
  • loadharness.classifyError (cyclomatic 23) REDACTED:1345 — loadharness.classifyError has cyclomatic complexity 23 (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.
D1 · Cyclomatic Complexity · loadharness.runStartupAccount (cyclomatic 23) · ×1
  • loadharness.runStartupAccount (cyclomatic 23) REDACTED:422 — loadharness.runStartupAccount has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 7 of the 23 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 461, 447). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · inboundRPCBatchReservation.commit (cyclomatic 23) · ×1
  • inboundRPCBatchReservation.commit (cyclomatic 23) internal/mtprotoedge/inbound_rpc.go:677 — inboundRPCBatchReservation.commit has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 5 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 689). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · rpc.postProcessBotAPIRichText (cyclomatic 23) · ×1
  • rpc.postProcessBotAPIRichText (cyclomatic 23) internal/rpc/botapi_rich_message.go:206 — rpc.postProcessBotAPIRichText has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function taking that case's concrete type, so the dispatch reads one line per case. These arms are selected by TYPE rather than by value, so there is no key a lookup table could be built on; where you own the matched types, giving them one shared interface method and calling that is the form a table would have taken, and where you do not, keep the cases — they stay explicit and reviewable.
D1 · Cyclomatic Complexity · rpc.tgUpdatesDifference (cyclomatic 23) · ×1
  • rpc.tgUpdatesDifference (cyclomatic 23) internal/rpc/convert_updates.go:12 — rpc.tgUpdatesDifference 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.
D1 · Cyclomatic Complexity · Router.onChannelsGetFullChannel (cyclomatic 23) · ×1
  • Router.onChannelsGetFullChannel (cyclomatic 23) internal/rpc/channels_core.go:143 — Router.onChannelsGetFullChannel 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.
D1 · Cyclomatic Complexity · Router.onMessagesUnpinAllMessages (cyclomatic 23) · ×1
  • Router.onMessagesUnpinAllMessages (cyclomatic 23) internal/rpc/channels_stubs.go:145 — Router.onMessagesUnpinAllMessages 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.
D1 · Cyclomatic Complexity · Router.deliverEphemeralPushLocal (cyclomatic 23) · ×1
  • Router.deliverEphemeralPushLocal (cyclomatic 23) internal/rpc/ephemeral_push.go:58 — Router.deliverEphemeralPushLocal 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.
D1 · Cyclomatic Complexity · Router.onMessagesReorderPinnedDialogs (cyclomatic 23) · ×1
  • Router.onMessagesReorderPinnedDialogs (cyclomatic 23) internal/rpc/messages_dialogs.go:767 — Router.onMessagesReorderPinnedDialogs has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onMessagesReadDiscussion (cyclomatic 23) · ×1
  • Router.onMessagesReadDiscussion (cyclomatic 23) internal/rpc/messages_history.go:380 — Router.onMessagesReadDiscussion 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.
D1 · Cyclomatic Complexity · Router.onMessagesGetPollVotes (cyclomatic 23) · ×1
  • Router.onMessagesGetPollVotes (cyclomatic 23) internal/rpc/messages_polls.go:143 — Router.onMessagesGetPollVotes has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.savedDialogsProjection (cyclomatic 23) · ×1
  • Router.savedDialogsProjection (cyclomatic 23) internal/rpc/messages_saved_dialogs.go:288 — Router.savedDialogsProjection has cyclomatic complexity 23 (threshold 15). Of this number, 15 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Router.onPhoneJoinGroupCall (cyclomatic 23) · ×1
  • Router.onPhoneJoinGroupCall (cyclomatic 23) internal/rpc/phone_group_call.go:264 — Router.onPhoneJoinGroupCall has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.JoinChannel (cyclomatic 23) · ×1
  • ChannelStore.JoinChannel (cyclomatic 23) internal/store/memory/channel_members.go:108 — ChannelStore.JoinChannel 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.
D1 · Cyclomatic Complexity · ChannelStore.ResolveDiscussionReadTarget (cyclomatic 23) · ×1
  • ChannelStore.ResolveDiscussionReadTarget (cyclomatic 23) internal/store/memory/channel_message_history.go:529 — ChannelStore.ResolveDiscussionReadTarget 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.
D1 · Cyclomatic Complexity · GroupCallStore.RemoveConferenceCallParticipants (cyclomatic 23) · ×1
  • GroupCallStore.RemoveConferenceCallParticipants (cyclomatic 23) internal/store/memory/groupcall.go:245 — GroupCallStore.RemoveConferenceCallParticipants 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.
D1 · Cyclomatic Complexity · MessageStore.PinPrivateMessage (cyclomatic 23) · ×1
  • MessageStore.PinPrivateMessage (cyclomatic 23) internal/store/memory/message_pin.go:13 — MessageStore.PinPrivateMessage 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.
D1 · Cyclomatic Complexity · MessageStore.resolveMemoryReplyLocked (cyclomatic 23) · ×1
  • MessageStore.resolveMemoryReplyLocked (cyclomatic 23) internal/store/memory/message_send.go:329 — MessageStore.resolveMemoryReplyLocked 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.
D1 · Cyclomatic Complexity · ModerationReportStore.ReviewModerationAppeal (cyclomatic 23) · ×1
  • ModerationReportStore.ReviewModerationAppeal (cyclomatic 23) internal/store/memory/moderation.go:503 — ModerationReportStore.ReviewModerationAppeal has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TelegramLoginStore.ConsumeTelegramLoginAuthorizationCode (cyclomatic 23) · ×1
  • TelegramLoginStore.ConsumeTelegramLoginAuthorizationCode (cyclomatic 23) internal/store/memory/telegram_login.go:530 — TelegramLoginStore.ConsumeTelegramLoginAuthorizationCode has cyclomatic complexity 23 (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.
D1 · Cyclomatic Complexity · TelegramLoginStore.DeleteExpiredTelegramLoginArtifacts (cyclomatic 23) · ×1
  • TelegramLoginStore.DeleteExpiredTelegramLoginArtifacts (cyclomatic 23) internal/store/memory/telegram_login.go:670 — TelegramLoginStore.DeleteExpiredTelegramLoginArtifacts 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.
D1 · Cyclomatic Complexity · postgres.channelDialogMatchesFilter (cyclomatic 23) · ×1
  • postgres.channelDialogMatchesFilter (cyclomatic 23) REDACTED:2128 — postgres.channelDialogMatchesFilter has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · postgres.insertChannelMessageWithFingerprintTx (cyclomatic 23) · ×1
  • postgres.insertChannelMessageWithFingerprintTx (cyclomatic 23) internal/store/postgres/channel_message_send.go:554 — postgres.insertChannelMessageWithFingerprintTx has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · postgres.persistPlainPrivateSendProjection (cyclomatic 23) · ×1
  • postgres.persistPlainPrivateSendProjection (cyclomatic 23) internal/store/postgres/message_send_hotpath.go:101 — postgres.persistPlainPrivateSendProjection has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PasswordStore.SaveMusic (cyclomatic 23) · ×1
  • PasswordStore.SaveMusic (cyclomatic 23) internal/store/postgres/account.go:785 — PasswordStore.SaveMusic has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 4 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 789). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ChannelStore.mutateChannelMessagePoll (cyclomatic 23) · ×1
  • ChannelStore.mutateChannelMessagePoll (cyclomatic 23) internal/store/postgres/channel_polls.go:31 — ChannelStore.mutateChannelMessagePoll has cyclomatic complexity 23 (threshold 15). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StarGiftStore.ListByOwnerFiltered (cyclomatic 23) · ×1
  • StarGiftStore.ListByOwnerFiltered (cyclomatic 23) internal/store/postgres/star_gift.go:552 — StarGiftStore.ListByOwnerFiltered has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StarGiftStore.PublishCollectibleRevision (cyclomatic 23) · ×1
  • StarGiftStore.PublishCollectibleRevision (cyclomatic 23) REDACTED:45 — StarGiftStore.PublishCollectibleRevision has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 53). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · StarGiftUpgradeStore.loadAdminStarGiftGrantReplay (cyclomatic 23) · ×1
  • StarGiftUpgradeStore.loadAdminStarGiftGrantReplay (cyclomatic 23) REDACTED:282 — StarGiftUpgradeStore.loadAdminStarGiftGrantReplay 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.
D1 · Cyclomatic Complexity · main.classify (cyclomatic 22) · ×1
  • main.classify (cyclomatic 22) cmd/tl-coverage/main.go:389 — main.classify has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 9 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 393). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Service.ConsumeLoginEmailReset (cyclomatic 22) · ×1
  • Service.ConsumeLoginEmailReset (cyclomatic 22) internal/app/auth/service.go:999 — Service.ConsumeLoginEmailReset has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.seedEmojiGroupIcons (cyclomatic 22) · ×1
  • Service.seedEmojiGroupIcons (cyclomatic 22) internal/app/files/emoji_group_icons_seed.go:43 — Service.seedEmojiGroupIcons 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.
D1 · Cyclomatic Complexity · Service.ManualPurge (cyclomatic 22) · ×1
  • Service.ManualPurge (cyclomatic 22) internal/app/files/retention.go:354 — Service.ManualPurge 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.
D1 · Cyclomatic Complexity · Service.seedDocumentJSONsReady (cyclomatic 22) · ×1
  • Service.seedDocumentJSONsReady (cyclomatic 22) internal/app/files/seed_state.go:124 — Service.seedDocumentJSONsReady 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.
D1 · Cyclomatic Complexity · Service.loadMembershipFactsForKeys (cyclomatic 22) · ×1
  • Service.loadMembershipFactsForKeys (cyclomatic 22) internal/app/privacy/service_sparse.go:165 — Service.loadMembershipFactsForKeys has cyclomatic complexity 22 (threshold 15). Of this number, 15 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · botapi.parseEphemeralSendTarget (cyclomatic 22) · ×1
  • botapi.parseEphemeralSendTarget (cyclomatic 22) internal/botapi/ephemeral.go:20 — botapi.parseEphemeralSendTarget 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.
D1 · Cyclomatic Complexity · botapi.validateBotAPIFormattedText (cyclomatic 22) · ×1
  • botapi.validateBotAPIFormattedText (cyclomatic 22) internal/botapi/formatted_text.go:87 — botapi.validateBotAPIFormattedText 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.
D1 · Cyclomatic Complexity · config.validAdminPermission (cyclomatic 22) · ×1
  • config.validAdminPermission (cyclomatic 22) internal/config/config.go:1952 — config.validAdminPermission has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ClientTelemetryEvent.Validate (cyclomatic 22) · ×1
  • ClientTelemetryEvent.Validate (cyclomatic 22) internal/domain/client_telemetry.go:102 — ClientTelemetryEvent.Validate has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · mtprotoedge.closeConnBatch (cyclomatic 22) · ×1
  • mtprotoedge.closeConnBatch (cyclomatic 22) internal/mtprotoedge/session_manager.go:1079 — mtprotoedge.closeConnBatch has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · outboundTrackedBudget.waitReserveUntil (cyclomatic 22) · ×1
  • outboundTrackedBudget.waitReserveUntil (cyclomatic 22) internal/mtprotoedge/outbound.go:1269 — outboundTrackedBudget.waitReserveUntil has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Server.handleAdmittedLayerRPC (cyclomatic 22) · ×1
  • Server.handleAdmittedLayerRPC (cyclomatic 22) internal/mtprotoedge/layer_rpc_execution.go:237 — Server.handleAdmittedLayerRPC 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.
D1 · Cyclomatic Complexity · Manager.BootstrapEnv (cyclomatic 22) · ×1
  • Manager.BootstrapEnv (cyclomatic 22) internal/procctl/bootstrap.go:81 — Manager.BootstrapEnv 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.
D1 · Cyclomatic Complexity · rpc.checkBotDownloadFileParams (cyclomatic 22) · ×1
  • rpc.checkBotDownloadFileParams (cyclomatic 22) internal/rpc/bots_longtail.go:826 — rpc.checkBotDownloadFileParams has cyclomatic complexity 22 (threshold 15). Of this number, 18 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · rpc.storyViewUserIDs (cyclomatic 22) · ×1
  • rpc.storyViewUserIDs (cyclomatic 22) internal/rpc/story_peer_projection.go:323 — rpc.storyViewUserIDs 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.
D1 · Cyclomatic Complexity · Router.channelFanoutRecipients (cyclomatic 22) · ×1
  • Router.channelFanoutRecipients (cyclomatic 22) internal/rpc/channels_stubs.go:333 — Router.channelFanoutRecipients has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onMessagesGetMessageEditData (cyclomatic 22) · ×1
  • Router.onMessagesGetMessageEditData (cyclomatic 22) internal/rpc/messages_edit.go:195 — Router.onMessagesGetMessageEditData 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.
D1 · Cyclomatic Complexity · Router.starGiftAuctionBidTarget (cyclomatic 22) · ×1
  • Router.starGiftAuctionBidTarget (cyclomatic 22) internal/rpc/payments_star_gift_lifecycle.go:230 — Router.starGiftAuctionBidTarget 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.
D1 · Cyclomatic Complexity · Router.onPaymentsCraftStarGift (cyclomatic 22) · ×1
  • Router.onPaymentsCraftStarGift (cyclomatic 22) internal/rpc/payments_star_gift_lifecycle.go:792 — Router.onPaymentsCraftStarGift 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.
D1 · Cyclomatic Complexity · Router.groupCallScopeFrom (cyclomatic 22) · ×1
  • Router.groupCallScopeFrom (cyclomatic 22) internal/rpc/phone_group_call.go:54 — Router.groupCallScopeFrom 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.
D1 · Cyclomatic Complexity · Router.onPhoneCreateGroupCall (cyclomatic 22) · ×1
  • Router.onPhoneCreateGroupCall (cyclomatic 22) internal/rpc/phone_group_call.go:183 — Router.onPhoneCreateGroupCall has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onPhotosUploadContactProfilePhoto (cyclomatic 22) · ×1
  • Router.onPhotosUploadContactProfilePhoto (cyclomatic 22) internal/rpc/photos.go:158 — Router.onPhotosUploadContactProfilePhoto has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.rememberClientInfoAt (cyclomatic 22) · ×1
  • Router.rememberClientInfoAt (cyclomatic 22) internal/rpc/router.go:898 — Router.rememberClientInfoAt 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.
D1 · Cyclomatic Complexity · Router.onStatsGetPollStats (cyclomatic 22) · ×1
  • Router.onStatsGetPollStats (cyclomatic 22) internal/rpc/stats.go:252 — Router.onStatsGetPollStats 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.
D1 · Cyclomatic Complexity · Router.onStoriesGetAllStories (cyclomatic 22) · ×1
  • Router.onStoriesGetAllStories (cyclomatic 22) internal/rpc/stories.go:139 — Router.onStoriesGetAllStories has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: rpc.messageEntityClassNil (cyclomatic 27) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Router.applyStoryMaxIDsToPeerObjects (cyclomatic 22) · ×1
  • Router.applyStoryMaxIDsToPeerObjects (cyclomatic 22) internal/rpc/story_peer_projection.go:585 — Router.applyStoryMaxIDsToPeerObjects has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.ListInviteImporters (cyclomatic 22) · ×1
  • ChannelStore.ListInviteImporters (cyclomatic 22) internal/store/memory/channel_invites.go:562 — ChannelStore.ListInviteImporters has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.EditChannelBanned (cyclomatic 22) · ×1
  • ChannelStore.EditChannelBanned (cyclomatic 22) internal/store/memory/channel_members.go:534 — ChannelStore.EditChannelBanned has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.CreateForumTopic (cyclomatic 22) · ×1
  • ChannelStore.CreateForumTopic (cyclomatic 22) internal/store/memory/channel_topics.go:69 — ChannelStore.CreateForumTopic has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.EditForumTopic (cyclomatic 22) · ×1
  • ChannelStore.EditForumTopic (cyclomatic 22) internal/store/memory/channel_topics.go:179 — ChannelStore.EditForumTopic has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CommunityStore.validatePeerLocked (cyclomatic 22) · ×1
  • CommunityStore.validatePeerLocked (cyclomatic 22) internal/store/memory/community.go:216 — CommunityStore.validatePeerLocked 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.
D1 · Cyclomatic Complexity · CommunityStore.ListCommunityParticipants (cyclomatic 22) · ×1
  • CommunityStore.ListCommunityParticipants (cyclomatic 22) internal/store/memory/community.go:825 — CommunityStore.ListCommunityParticipants 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.
D1 · Cyclomatic Complexity · MessageStore.SetMessageReactions (cyclomatic 22) · ×1
  • MessageStore.SetMessageReactions (cyclomatic 22) internal/store/memory/message_reactions.go:12 — MessageStore.SetMessageReactions 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.
D1 · Cyclomatic Complexity · MessageStore.ListSavedDialogs (cyclomatic 22) · ×1
  • MessageStore.ListSavedDialogs (cyclomatic 22) internal/store/memory/saved_dialog.go:51 — MessageStore.ListSavedDialogs 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.
D1 · Cyclomatic Complexity · MessageStore.DeleteSavedHistory (cyclomatic 22) · ×1
  • MessageStore.DeleteSavedHistory (cyclomatic 22) internal/store/memory/saved_dialog.go:219 — MessageStore.DeleteSavedHistory has cyclomatic complexity 22 (threshold 15). Of this number, 14 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · postgres.bindAuthorization (cyclomatic 22) · ×1
  • postgres.bindAuthorization (cyclomatic 22) internal/store/postgres/authorization.go:51 — postgres.bindAuthorization has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · postgres.pollViewerAggregates (cyclomatic 22) · ×1
  • postgres.pollViewerAggregates (cyclomatic 22) REDACTED:231 — postgres.pollViewerAggregates has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.DeleteChannel (cyclomatic 22) · ×1
  • ChannelStore.DeleteChannel (cyclomatic 22) internal/store/postgres/channel_helpers.go:72 — ChannelStore.DeleteChannel has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.deleteChannelMessagesTx (cyclomatic 22) · ×1
  • ChannelStore.deleteChannelMessagesTx (cyclomatic 22) internal/store/postgres/channel_message_delete.go:438 — ChannelStore.deleteChannelMessagesTx 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.
D1 · Cyclomatic Complexity · ChannelStore.reconcileChannelEditMentionsTx (cyclomatic 22) · ×1
  • ChannelStore.reconcileChannelEditMentionsTx (cyclomatic 22) internal/store/postgres/channel_message_edit.go:639 — ChannelStore.reconcileChannelEditMentionsTx 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.
D1 · Cyclomatic Complexity · ChannelStore.channelMessageViewReplies (cyclomatic 22) · ×1
  • ChannelStore.channelMessageViewReplies (cyclomatic 22) internal/store/postgres/channel_message_views.go:169 — ChannelStore.channelMessageViewReplies has cyclomatic complexity 22 (threshold 15). Of this number, 19 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.ReadChannelMessageContents (cyclomatic 22) · ×1
  • ChannelStore.ReadChannelMessageContents (cyclomatic 22) internal/store/postgres/channel_read.go:140 — ChannelStore.ReadChannelMessageContents has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.GetChannelMessageStats (cyclomatic 22) · ×1
  • ChannelStore.GetChannelMessageStats (cyclomatic 22) internal/store/postgres/channel_stats.go:336 — ChannelStore.GetChannelMessageStats 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.
D1 · Cyclomatic Complexity · ChannelStore.DeleteForumTopicHistory (cyclomatic 22) · ×1
  • ChannelStore.DeleteForumTopicHistory (cyclomatic 22) internal/store/postgres/channel_topics.go:386 — ChannelStore.DeleteForumTopicHistory has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ModerationReportStore.CompleteModerationAction (cyclomatic 22) · ×1
  • ModerationReportStore.CompleteModerationAction (cyclomatic 22) internal/store/postgres/moderation_cases.go:816 — ModerationReportStore.CompleteModerationAction 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.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.RecordStarGiftWithdrawal (cyclomatic 22) · ×1
  • StarGiftLifecycleStore.RecordStarGiftWithdrawal (cyclomatic 22) internal/store/postgres/star_gift_lifecycle.go:1522 — StarGiftLifecycleStore.RecordStarGiftWithdrawal has cyclomatic complexity 22 (threshold 15). Of this number, 11 points are the body's own statements and 11 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · UpdateEventStore.BatchByCursor (cyclomatic 22) · ×1
  • UpdateEventStore.BatchByCursor (cyclomatic 22) internal/store/postgres/update_event.go:530 — UpdateEventStore.BatchByCursor 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.
D1 · Cyclomatic Complexity · Service.CheckTmpPassword (cyclomatic 21) · ×1
  • Service.CheckTmpPassword (cyclomatic 21) internal/app/account/tmp_password.go:93 — Service.CheckTmpPassword has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Service.resendCode (cyclomatic 21) · ×1
  • Service.resendCode (cyclomatic 21) internal/app/auth/service.go:861 — Service.resendCode has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.CreateDocumentFromUpload (cyclomatic 21) · ×1
  • Service.CreateDocumentFromUpload (cyclomatic 21) internal/app/files/photos.go:324 — Service.CreateDocumentFromUpload 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.
D1 · Cyclomatic Complexity · Service.documentsNeedSeedRepair (cyclomatic 21) · ×1
  • Service.documentsNeedSeedRepair (cyclomatic 21) internal/app/files/seed.go:1093 — Service.documentsNeedSeedRepair has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: files.seedThumbMimeType (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Service.SeedDirectory (cyclomatic 21) · ×1
  • Service.SeedDirectory (cyclomatic 21) internal/app/langpack/seed.go:27 — Service.SeedDirectory 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.
D1 · Cyclomatic Complexity · Service.Withdraw (cyclomatic 21) · ×1
  • Service.Withdraw (cyclomatic 21) internal/app/stargifts/service.go:804 — Service.Withdraw has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Service.Translate (cyclomatic 21) · ×1
  • Service.Translate (cyclomatic 21) internal/app/translation/service.go:102 — Service.Translate 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.
D1 · Cyclomatic Complexity · CachedContactStore.ContactProjectionForViewerUserIDs (cyclomatic 21) · ×1
  • CachedContactStore.ContactProjectionForViewerUserIDs (cyclomatic 21) internal/app/userprojection/contact_cache_sparse.go:16 — CachedContactStore.ContactProjectionForViewerUserIDs 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.
D1 · Cyclomatic Complexity · botapi.requestValuesWithFiles (cyclomatic 21) · ×1
  • botapi.requestValuesWithFiles (cyclomatic 21) internal/botapi/server.go:1280 — botapi.requestValuesWithFiles has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: handler.handle (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · StarGiftCatalogWrite.ValidateLifecycleAuthoring (cyclomatic 21) · ×1
  • StarGiftCatalogWrite.ValidateLifecycleAuthoring (cyclomatic 21) internal/domain/star_gift.go:931 — StarGiftCatalogWrite.ValidateLifecycleAuthoring 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.
D1 · Cyclomatic Complexity · loadharness.Seed (cyclomatic 21) · ×1
  • loadharness.Seed (cyclomatic 21) internal/loadharness/seed.go:61 — loadharness.Seed has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · prop.numbers (cyclomatic 21) · ×1
  • prop.numbers (cyclomatic 21) internal/lottieraster/lottieraster.go:219 — prop.numbers 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.
D1 · Cyclomatic Complexity · Conn.sendOutboundWithTerminalReserved (cyclomatic 21) · ×1
  • Conn.sendOutboundWithTerminalReserved (cyclomatic 21) internal/mtprotoedge/outbound.go:1779 — Conn.sendOutboundWithTerminalReserved 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.
D1 · Cyclomatic Complexity · Manager.Run (cyclomatic 21) · ×1
  • Manager.Run (cyclomatic 21) internal/procctl/supervisor.go:97 — Manager.Run has cyclomatic complexity 21 (threshold 15). Of this number, 13 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rpc.tgMessageActionStarGift (cyclomatic 21) · ×1
  • rpc.tgMessageActionStarGift (cyclomatic 21) internal/rpc/payments_star_gifts.go:1623 — rpc.tgMessageActionStarGift has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.BotAPISendEphemeral (cyclomatic 21) · ×1
  • Router.BotAPISendEphemeral (cyclomatic 21) internal/rpc/botapi_gateway.go:350 — Router.BotAPISendEphemeral has cyclomatic complexity 21 (threshold 15). Of this number, 14 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onMessagesSendInlineBotResult (cyclomatic 21) · ×1
  • Router.onMessagesSendInlineBotResult (cyclomatic 21) internal/rpc/bots_inline.go:201 — Router.onMessagesSendInlineBotResult has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onChannelsGetChannels (cyclomatic 21) · ×1
  • Router.onChannelsGetChannels (cyclomatic 21) internal/rpc/channels_core.go:85 — Router.onChannelsGetChannels 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.
D1 · Cyclomatic Complexity · Router.editPrivateInlineBotMessage (cyclomatic 21) · ×1
  • Router.editPrivateInlineBotMessage (cyclomatic 21) internal/rpc/messages_bot_no_state.go:113 — Router.editPrivateInlineBotMessage 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.
D1 · Cyclomatic Complexity · Router.forwardSources (cyclomatic 21) · ×1
  • Router.forwardSources (cyclomatic 21) internal/rpc/messages_forward.go:617 — Router.forwardSources 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.
D1 · Cyclomatic Complexity · Router.onMessagesGetSearchCounters (cyclomatic 21) · ×1
  • Router.onMessagesGetSearchCounters (cyclomatic 21) internal/rpc/messages_history.go:230 — Router.onMessagesGetSearchCounters 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.
D1 · Cyclomatic Complexity · Router.onMessagesSendQuickReplyMessages (cyclomatic 21) · ×1
  • Router.onMessagesSendQuickReplyMessages (cyclomatic 21) internal/rpc/messages_quick_replies.go:156 — Router.onMessagesSendQuickReplyMessages has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.usersForMessageUpdatesWithPreloaded (cyclomatic 21) · ×1
  • Router.usersForMessageUpdatesWithPreloaded (cyclomatic 21) internal/rpc/messages_send.go:1045 — Router.usersForMessageUpdatesWithPreloaded has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: rpc.cloneEntityWithBounds (cyclomatic 26) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Router.editSelfParticipant (cyclomatic 21) · ×1
  • Router.editSelfParticipant (cyclomatic 21) internal/rpc/phone_group_call_edit.go:54 — Router.editSelfParticipant 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.
D1 · Cyclomatic Complexity · Router.telegramLoginButtonFromMessage (cyclomatic 21) · ×1
  • Router.telegramLoginButtonFromMessage (cyclomatic 21) internal/rpc/telegram_login.go:263 — Router.telegramLoginButtonFromMessage 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.
D1 · Cyclomatic Complexity · BotVerificationStore.ListCustomVerificationRequests (cyclomatic 21) · ×1
  • BotVerificationStore.ListCustomVerificationRequests (cyclomatic 21) internal/store/memory/bot_verification.go:705 — BotVerificationStore.ListCustomVerificationRequests 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.
D1 · Cyclomatic Complexity · ChannelStore.GetChannelDialogs (cyclomatic 21) · ×1
  • ChannelStore.GetChannelDialogs (cyclomatic 21) internal/store/memory/channel_dialogs.go:107 — ChannelStore.GetChannelDialogs 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.
D1 · Cyclomatic Complexity · ChannelStore.ListCommonChannels (cyclomatic 21) · ×1
  • ChannelStore.ListCommonChannels (cyclomatic 21) internal/store/memory/channel_dialogs.go:163 — ChannelStore.ListCommonChannels has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ChannelStore.SearchPublicChannels (cyclomatic 21) · ×1
  • ChannelStore.SearchPublicChannels (cyclomatic 21) internal/store/memory/channel_helpers.go:74 — ChannelStore.SearchPublicChannels has cyclomatic complexity 21 (threshold 15). Of this number, 18 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.InviteToChannel (cyclomatic 21) · ×1
  • ChannelStore.InviteToChannel (cyclomatic 21) internal/store/memory/channel_invites.go:13 — ChannelStore.InviteToChannel 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.
D1 · Cyclomatic Complexity · ChannelStore.SetPaidMessagesPrice (cyclomatic 21) · ×1
  • ChannelStore.SetPaidMessagesPrice (cyclomatic 21) internal/store/memory/channel_message_settings.go:52 — ChannelStore.SetPaidMessagesPrice has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.ListChannelMessageReactions (cyclomatic 21) · ×1
  • ChannelStore.ListChannelMessageReactions (cyclomatic 21) internal/store/memory/channel_reactions.go:334 — ChannelStore.ListChannelMessageReactions has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.ReadChannelReactions (cyclomatic 21) · ×1
  • ChannelStore.ReadChannelReactions (cyclomatic 21) internal/store/memory/channel_reactions.go:594 — ChannelStore.ReadChannelReactions 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.
D1 · Cyclomatic Complexity · ChannelStore.ListMessageReadParticipants (cyclomatic 21) · ×1
  • ChannelStore.ListMessageReadParticipants (cyclomatic 21) internal/store/memory/channel_read.go:361 — ChannelStore.ListMessageReadParticipants has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · postgres.lockRawAuthKeyInIdentityOrder (cyclomatic 21) · ×1
  • postgres.lockRawAuthKeyInIdentityOrder (cyclomatic 21) internal/store/postgres/auth_identity_lock.go:153 — postgres.lockRawAuthKeyInIdentityOrder 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.
D1 · Cyclomatic Complexity · postgres.getModerationCase (cyclomatic 21) · ×1
  • postgres.getModerationCase (cyclomatic 21) internal/store/postgres/moderation_cases.go:1046 — postgres.getModerationCase 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.
D1 · Cyclomatic Complexity · AccountRatingStore.SaveAccountRating (cyclomatic 21) · ×1
  • AccountRatingStore.SaveAccountRating (cyclomatic 21) internal/store/postgres/account_rating.go:111 — AccountRatingStore.SaveAccountRating has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · BotStore.DeleteBotAccount (cyclomatic 21) · ×1
  • BotStore.DeleteBotAccount (cyclomatic 21) internal/store/postgres/bot.go:98 — BotStore.DeleteBotAccount has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.HydrateChannelDialogSnapshot (cyclomatic 21) · ×1
  • ChannelStore.HydrateChannelDialogSnapshot (cyclomatic 21) REDACTED:953 — ChannelStore.HydrateChannelDialogSnapshot 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.
D1 · Cyclomatic Complexity · ChannelStore.SearchPublicPosts (cyclomatic 21) · ×1
  • ChannelStore.SearchPublicPosts (cyclomatic 21) internal/store/postgres/channel_helpers.go:232 — ChannelStore.SearchPublicPosts has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.ChannelPollFanoutViews (cyclomatic 21) · ×1
  • ChannelStore.ChannelPollFanoutViews (cyclomatic 21) internal/store/postgres/channel_polls.go:104 — ChannelStore.ChannelPollFanoutViews has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.CreateForumTopic (cyclomatic 21) · ×1
  • ChannelStore.CreateForumTopic (cyclomatic 21) internal/store/postgres/channel_topics.go:116 — ChannelStore.CreateForumTopic has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CollectibleUsernameStore.MintCollectibleUsername (cyclomatic 21) · ×1
  • CollectibleUsernameStore.MintCollectibleUsername (cyclomatic 21) internal/store/postgres/collectible_username.go:182 — CollectibleUsernameStore.MintCollectibleUsername has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 5 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 196). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · MessageStore.DeleteSavedHistory (cyclomatic 21) · ×1
  • MessageStore.DeleteSavedHistory (cyclomatic 21) internal/store/postgres/saved_dialog.go:253 — MessageStore.DeleteSavedHistory has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PremiumStore.UpsertPremiumPlan (cyclomatic 21) · ×1
  • PremiumStore.UpsertPremiumPlan (cyclomatic 21) internal/store/postgres/premium.go:87 — PremiumStore.UpsertPremiumPlan has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 6 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 92). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.ListCraftStarGifts (cyclomatic 21) · ×1
  • StarGiftLifecycleStore.ListCraftStarGifts (cyclomatic 21) internal/store/postgres/star_gift_craft_auction.go:207 — StarGiftLifecycleStore.ListCraftStarGifts has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.dispatchStarGiftAuctionAwards (cyclomatic 21) · ×1
  • StarGiftLifecycleStore.dispatchStarGiftAuctionAwards (cyclomatic 21) internal/store/postgres/star_gift_craft_auction.go:804 — StarGiftLifecycleStore.dispatchStarGiftAuctionAwards has cyclomatic complexity 21 (threshold 15). Of this number, 16 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StarGiftUpgradeStore.loadUpgradeSourceReplay (cyclomatic 21) · ×1
  • StarGiftUpgradeStore.loadUpgradeSourceReplay (cyclomatic 21) REDACTED:1151 — StarGiftUpgradeStore.loadUpgradeSourceReplay 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.
D1 · Cyclomatic Complexity · UpdateEventStore.ListAfter (cyclomatic 21) · ×1
  • UpdateEventStore.ListAfter (cyclomatic 21) internal/store/postgres/update_event.go:326 — UpdateEventStore.ListAfter 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.
D1 · Cyclomatic Complexity · main.chatMediaFromJSON (cyclomatic 20) · ×1
  • main.chatMediaFromJSON (cyclomatic 20) cmd/telesrv-admin/privateview_store.go:689 — main.chatMediaFromJSON 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.
D1 · Cyclomatic Complexity · server.storageEnvValues (cyclomatic 20) · ×1
  • server.storageEnvValues (cyclomatic 20) cmd/telesrv-admin/serverstorage.go:154 — server.storageEnvValues 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.
D1 · Cyclomatic Complexity · Service.ResendConfirmPhoneCode (cyclomatic 20) · ×1
  • Service.ResendConfirmPhoneCode (cyclomatic 20) REDACTED:296 — Service.ResendConfirmPhoneCode has cyclomatic complexity 20 (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.
D1 · Cyclomatic Complexity · Service.IssueTmpPassword (cyclomatic 20) · ×1
  • Service.IssueTmpPassword (cyclomatic 20) internal/app/account/tmp_password.go:35 — Service.IssueTmpPassword has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.resolveTone (cyclomatic 20) · ×1
  • Service.resolveTone (cyclomatic 20) internal/app/ai/service.go:574 — Service.resolveTone 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.
D1 · Cyclomatic Complexity · dialogs.dialogListForPeer (cyclomatic 20) · ×1
  • dialogs.dialogListForPeer (cyclomatic 20) internal/app/dialogs/read_model_cache.go:347 — dialogs.dialogListForPeer 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.
D1 · Cyclomatic Complexity · files.inspectMP4Layout (cyclomatic 20) · ×1
  • files.inspectMP4Layout (cyclomatic 20) internal/app/files/mp4faststart.go:79 — files.inspectMP4Layout 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.
D1 · Cyclomatic Complexity · Service.CreateDocumentFromBytes (cyclomatic 20) · ×1
  • Service.CreateDocumentFromBytes (cyclomatic 20) internal/app/files/photos.go:642 — Service.CreateDocumentFromBytes 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.
D1 · Cyclomatic Complexity · Service.GetFile (cyclomatic 20) · ×1
  • Service.GetFile (cyclomatic 20) internal/app/files/service.go:498 — Service.GetFile has cyclomatic complexity 20 (threshold 15). Of this number, 13 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · langpack.scanSeedCandidates (cyclomatic 20) · ×1
  • langpack.scanSeedCandidates (cyclomatic 20) internal/app/langpack/seed.go:123 — langpack.scanSeedCandidates has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 129). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Service.deliverConnectedBusinessBotAutomation (cyclomatic 20) · ×1
  • Service.deliverConnectedBusinessBotAutomation (cyclomatic 20) internal/app/messages/business_automation.go:185 — Service.deliverConnectedBusinessBotAutomation has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.ReportReaction (cyclomatic 20) · ×1
  • Service.ReportReaction (cyclomatic 20) internal/app/moderation/evidence.go:272 — Service.ReportReaction 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.
D1 · Cyclomatic Complexity · telegramlogin.LoadSigningKeyRing (cyclomatic 20) · ×1
  • telegramlogin.LoadSigningKeyRing (cyclomatic 20) internal/app/telegramlogin/keyfiles.go:41 — telegramlogin.LoadSigningKeyRing 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.
D1 · Cyclomatic Complexity · userprojection.applyPrivacy (cyclomatic 20) · ×1
  • userprojection.applyPrivacy (cyclomatic 20) internal/app/userprojection/projection.go:634 — userprojection.applyPrivacy has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · botapi.botAPIHTMLFrame (cyclomatic 20) · ×1
  • botapi.botAPIHTMLFrame (cyclomatic 20) internal/botapi/formatted_text.go:388 — botapi.botAPIHTMLFrame 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.
D1 · Cyclomatic Complexity · domain.validateStoryInteractionOffset (cyclomatic 20) · ×1
  • domain.validateStoryInteractionOffset (cyclomatic 20) internal/domain/story.go:81 — domain.validateStoryInteractionOffset has cyclomatic complexity 20 (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.
D1 · Cyclomatic Complexity · domain.validateVerificationHost (cyclomatic 20) · ×1
  • domain.validateVerificationHost (cyclomatic 20) internal/domain/verification.go:465 — domain.validateVerificationHost has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · loadharness.validateClientAccountState (cyclomatic 20) · ×1
  • loadharness.validateClientAccountState (cyclomatic 20) internal/loadharness/snapshot.go:660 — loadharness.validateClientAccountState has cyclomatic complexity 20 (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.
D1 · Cyclomatic Complexity · Dataset.Validate (cyclomatic 20) · ×1
  • Dataset.Validate (cyclomatic 20) internal/loadharness/dataset.go:205 — Dataset.Validate 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.
D1 · Cyclomatic Complexity · Conn.enqueueEncodedDeliveryReserved (cyclomatic 20) · ×1
  • Conn.enqueueEncodedDeliveryReserved (cyclomatic 20) internal/mtprotoedge/outbound.go:1678 — Conn.enqueueEncodedDeliveryReserved 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.
D1 · Cyclomatic Complexity · rpc.postProcessBotAPIRichHTML (cyclomatic 20) · ×1
  • rpc.postProcessBotAPIRichHTML (cyclomatic 20) internal/rpc/botapi_rich_message.go:141 — rpc.postProcessBotAPIRichHTML has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to one function literal inside it that branches (line 144). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · rpc.botAPIRequestedPeerProjectable (cyclomatic 20) · ×1
  • rpc.botAPIRequestedPeerProjectable (cyclomatic 20) internal/rpc/botapi_update_queue.go:576 — rpc.botAPIRequestedPeerProjectable has cyclomatic complexity 20 (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.
D1 · Cyclomatic Complexity · rpc.tgBotInlineResult (cyclomatic 20) · ×1
  • rpc.tgBotInlineResult (cyclomatic 20) internal/rpc/bots_inline.go:1088 — rpc.tgBotInlineResult 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.
D1 · Cyclomatic Complexity · rpc.contactNote (cyclomatic 20) · ×1
  • rpc.contactNote (cyclomatic 20) internal/rpc/contacts.go:1025 — rpc.contactNote 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.
D1 · Cyclomatic Complexity · rpc.normalizeOrderedListForClients (cyclomatic 20) · ×1
  • rpc.normalizeOrderedListForClients (cyclomatic 20) internal/rpc/convert_rich_message.go:257 — rpc.normalizeOrderedListForClients 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.
D1 · Cyclomatic Complexity · rpc.tgUniqueStarGift (cyclomatic 20) · ×1
  • rpc.tgUniqueStarGift (cyclomatic 20) internal/rpc/payments_star_gift_unique.go:374 — rpc.tgUniqueStarGift has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · rpc.fileLocationKey (cyclomatic 20) · ×1
  • rpc.fileLocationKey (cyclomatic 20) internal/rpc/upload.go:228 — rpc.fileLocationKey has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: rpc.sniffImageType (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · rpc.safeExternalIP (cyclomatic 20) · ×1
  • rpc.safeExternalIP (cyclomatic 20) internal/rpc/upload_webfile.go:238 — rpc.safeExternalIP has cyclomatic complexity 20 (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.
D1 · Cyclomatic Complexity · Router.onAccountGetNotifyExceptions (cyclomatic 20) · ×1
  • Router.onAccountGetNotifyExceptions (cyclomatic 20) internal/rpc/account_notify.go:142 — Router.onAccountGetNotifyExceptions 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.
D1 · Cyclomatic Complexity · Router.BotAPISendRichMessage (cyclomatic 20) · ×1
  • Router.BotAPISendRichMessage (cyclomatic 20) internal/rpc/botapi_gateway.go:236 — Router.BotAPISendRichMessage has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.botAPIQueuedUpdates (cyclomatic 20) · ×1
  • Router.botAPIQueuedUpdates (cyclomatic 20) internal/rpc/botapi_update_queue.go:20 — Router.botAPIQueuedUpdates 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.
D1 · Cyclomatic Complexity · Router.nudgeBeyondCapChannelMessageAudience (cyclomatic 20) · ×1
  • Router.nudgeBeyondCapChannelMessageAudience (cyclomatic 20) internal/rpc/channel_fanout_dispatcher.go:1270 — Router.nudgeBeyondCapChannelMessageAudience 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.
D1 · Cyclomatic Complexity · Router.channelMessagesUpdatesWithPeerCacheAndUsernames (cyclomatic 20) · ×1
  • Router.channelMessagesUpdatesWithPeerCacheAndUsernames (cyclomatic 20) internal/rpc/channels_updates.go:244 — Router.channelMessagesUpdatesWithPeerCacheAndUsernames 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.
D1 · Cyclomatic Complexity · Router.onContactsGetStatuses (cyclomatic 20) · ×1
  • Router.onContactsGetStatuses (cyclomatic 20) internal/rpc/contacts.go:506 — Router.onContactsGetStatuses 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.
D1 · Cyclomatic Complexity · Router.dialogFolderFromTG (cyclomatic 20) · ×1
  • Router.dialogFolderFromTG (cyclomatic 20) internal/rpc/messages_dialogs.go:1047 — Router.dialogFolderFromTG 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.
D1 · Cyclomatic Complexity · Router.forumTopicsResponse (cyclomatic 20) · ×1
  • Router.forumTopicsResponse (cyclomatic 20) internal/rpc/messages_forum.go:411 — Router.forumTopicsResponse 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.
D1 · Cyclomatic Complexity · Router.channelMessagesReactionsUpdates (cyclomatic 20) · ×1
  • Router.channelMessagesReactionsUpdates (cyclomatic 20) internal/rpc/messages_reactions_send.go:391 — Router.channelMessagesReactionsUpdates 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.
D1 · Cyclomatic Complexity · Router.onMessagesReportReadMetrics (cyclomatic 20) · ×1
  • Router.onMessagesReportReadMetrics (cyclomatic 20) internal/rpc/messages_reports.go:180 — Router.onMessagesReportReadMetrics has cyclomatic complexity 20 (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.
D1 · Cyclomatic Complexity · Router.webViewBotAppFromInput (cyclomatic 20) · ×1
  • Router.webViewBotAppFromInput (cyclomatic 20) internal/rpc/messages_webview.go:441 — Router.webViewBotAppFromInput 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.
D1 · Cyclomatic Complexity · Router.FreezeNegotiatedSessionLayerAt (cyclomatic 20) · ×1
  • Router.FreezeNegotiatedSessionLayerAt (cyclomatic 20) internal/rpc/router.go:1179 — Router.FreezeNegotiatedSessionLayerAt 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.
D1 · Cyclomatic Complexity · Router.onStoriesSendReaction (cyclomatic 20) · ×1
  • Router.onStoriesSendReaction (cyclomatic 20) internal/rpc/stories.go:2762 — Router.onStoriesSendReaction has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: rpc.messageEntityClassNil (cyclomatic 27) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Router.enrichPreparedUpdateEvents (cyclomatic 20) · ×1
  • Router.enrichPreparedUpdateEvents (cyclomatic 20) internal/rpc/update_peer_refs.go:72 — Router.enrichPreparedUpdateEvents 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.
D1 · Cyclomatic Complexity · Router.onUsersGetFullUser (cyclomatic 20) · ×1
  • Router.onUsersGetFullUser (cyclomatic 20) REDACTED:130 — Router.onUsersGetFullUser has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.fillUserFullPhotos (cyclomatic 20) · ×1
  • Router.fillUserFullPhotos (cyclomatic 20) REDACTED:812 — Router.fillUserFullPhotos 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.
D1 · Cyclomatic Complexity · ChannelStore.SearchPublicPosts (cyclomatic 20) · ×1
  • ChannelStore.SearchPublicPosts (cyclomatic 20) internal/store/memory/channel_helpers.go:164 — ChannelStore.SearchPublicPosts has cyclomatic complexity 20 (threshold 15). Of this number, 18 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.channelForViewerLocked (cyclomatic 20) · ×1
  • ChannelStore.channelForViewerLocked (cyclomatic 20) internal/store/memory/channel_helpers.go:424 — ChannelStore.channelForViewerLocked has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.ListAdminLog (cyclomatic 20) · ×1
  • ChannelStore.ListAdminLog (cyclomatic 20) internal/store/memory/channel_invites.go:108 — ChannelStore.ListAdminLog 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.
D1 · Cyclomatic Complexity · ChannelStore.ListExportedInvites (cyclomatic 20) · ×1
  • ChannelStore.ListExportedInvites (cyclomatic 20) internal/store/memory/channel_invites.go:334 — ChannelStore.ListExportedInvites has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.HideAllChatJoinRequests (cyclomatic 20) · ×1
  • ChannelStore.HideAllChatJoinRequests (cyclomatic 20) internal/store/memory/channel_invites.go:666 — ChannelStore.HideAllChatJoinRequests 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.
D1 · Cyclomatic Complexity · ChannelStore.DeleteChannelMessages (cyclomatic 20) · ×1
  • ChannelStore.DeleteChannelMessages (cyclomatic 20) internal/store/memory/channel_message_delete.go:8 — ChannelStore.DeleteChannelMessages 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.
D1 · Cyclomatic Complexity · CommunityStore.ListCommunityPeerLinkRequests (cyclomatic 20) · ×1
  • CommunityStore.ListCommunityPeerLinkRequests (cyclomatic 20) internal/store/memory/community.go:484 — CommunityStore.ListCommunityPeerLinkRequests has cyclomatic complexity 20 (threshold 15). Of this number, 18 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BotVerificationStore.DecideCustomVerificationRequest (cyclomatic 20) · ×1
  • BotVerificationStore.DecideCustomVerificationRequest (cyclomatic 20) internal/store/postgres/bot_verification.go:855 — BotVerificationStore.DecideCustomVerificationRequest has cyclomatic complexity 20 (threshold 15). Of this number, 10 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.EnsurePermanentInvite (cyclomatic 20) · ×1
  • ChannelStore.EnsurePermanentInvite (cyclomatic 20) internal/store/postgres/channel_invite_exported.go:83 — ChannelStore.EnsurePermanentInvite has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.getChannelMessagesForMember (cyclomatic 20) · ×1
  • ChannelStore.getChannelMessagesForMember (cyclomatic 20) internal/store/postgres/channel_message_history.go:493 — ChannelStore.getChannelMessagesForMember 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.
D1 · Cyclomatic Complexity · ChannelStore.readChannelHistoryOnce (cyclomatic 20) · ×1
  • ChannelStore.readChannelHistoryOnce (cyclomatic 20) internal/store/postgres/channel_message_history.go:916 — ChannelStore.readChannelHistoryOnce has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.GetChannelMessageViews (cyclomatic 20) · ×1
  • ChannelStore.GetChannelMessageViews (cyclomatic 20) internal/store/postgres/channel_message_views.go:23 — ChannelStore.GetChannelMessageViews 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.
D1 · Cyclomatic Complexity · ChannelStore.ListMonoforumDialogs (cyclomatic 20) · ×1
  • ChannelStore.ListMonoforumDialogs (cyclomatic 20) internal/store/postgres/channel_monoforum.go:308 — ChannelStore.ListMonoforumDialogs 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.
D1 · Cyclomatic Complexity · ChannelStore.DeleteChannelParticipantReaction (cyclomatic 20) · ×1
  • ChannelStore.DeleteChannelParticipantReaction (cyclomatic 20) internal/store/postgres/channel_reaction_messages.go:186 — ChannelStore.DeleteChannelParticipantReaction has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · EphemeralReportStore.ListUnmigratedEphemeralReports (cyclomatic 20) · ×1
  • EphemeralReportStore.ListUnmigratedEphemeralReports (cyclomatic 20) internal/store/postgres/ephemeral_report.go:53 — EphemeralReportStore.ListUnmigratedEphemeralReports 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.
D1 · Cyclomatic Complexity · MessageStore.enrichPrivateMessageReactions (cyclomatic 20) · ×1
  • MessageStore.enrichPrivateMessageReactions (cyclomatic 20) internal/store/postgres/message_reactions.go:237 — MessageStore.enrichPrivateMessageReactions 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.
D1 · Cyclomatic Complexity · ModerationReportStore.ImportLegacyEphemeralReport (cyclomatic 20) · ×1
  • ModerationReportStore.ImportLegacyEphemeralReport (cyclomatic 20) internal/store/postgres/moderation.go:110 — ModerationReportStore.ImportLegacyEphemeralReport has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ModerationReportStore.IssueModerationAppealLink (cyclomatic 20) · ×1
  • ModerationReportStore.IssueModerationAppealLink (cyclomatic 20) internal/store/postgres/moderation_cases.go:447 — ModerationReportStore.IssueModerationAppealLink has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PremiumStore.RefundPremiumPayment (cyclomatic 20) · ×1
  • PremiumStore.RefundPremiumPayment (cyclomatic 20) internal/store/postgres/premium.go:623 — PremiumStore.RefundPremiumPayment has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 633). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.creditPeerLifecycleAmount (cyclomatic 20) · ×1
  • StarGiftLifecycleStore.creditPeerLifecycleAmount (cyclomatic 20) internal/store/postgres/star_gift_lifecycle.go:1387 — StarGiftLifecycleStore.creditPeerLifecycleAmount 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.
D1 · Cyclomatic Complexity · StoryStore.populateStoryViewState (cyclomatic 20) · ×1
  • StoryStore.populateStoryViewState (cyclomatic 20) internal/store/postgres/story.go:1906 — StoryStore.populateStoryViewState 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.
D1 · Cyclomatic Complexity · Service.DeletePrivateHistory (cyclomatic 19) · ×1
  • Service.DeletePrivateHistory (cyclomatic 19) internal/admin/service.go:3233 — Service.DeletePrivateHistory has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.composeStreamWithProviders (cyclomatic 19) · ×1
  • Service.composeStreamWithProviders (cyclomatic 19) internal/app/ai/service.go:485 — Service.composeStreamWithProviders has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Service.handleStickers (cyclomatic 19) · ×1
  • Service.handleStickers (cyclomatic 19) internal/app/bots/stickersbot.go:84 — Service.handleStickers 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.
D1 · Cyclomatic Complexity · Service.dialogDraftsReadModel (cyclomatic 19) · ×1
  • Service.dialogDraftsReadModel (cyclomatic 19) internal/app/dialogs/draft_read_model_cache.go:39 — Service.dialogDraftsReadModel has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Service.attachArchiveSummary (cyclomatic 19) · ×1
  • Service.attachArchiveSummary (cyclomatic 19) internal/app/dialogs/service.go:605 — Service.attachArchiveSummary has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.ChainBalance (cyclomatic 19) · ×1
  • Service.ChainBalance (cyclomatic 19) internal/app/donations/balance.go:20 — Service.ChainBalance 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.
D1 · Cyclomatic Complexity · FFmpegGIFTranscoder.Transcode (cyclomatic 19) · ×1
  • FFmpegGIFTranscoder.Transcode (cyclomatic 19) internal/app/files/gif_transcoder.go:64 — FFmpegGIFTranscoder.Transcode has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.DeleteBlobBytesForMediaOlderThan (cyclomatic 19) · ×1
  • Service.DeleteBlobBytesForMediaOlderThan (cyclomatic 19) internal/app/files/retention.go:192 — Service.DeleteBlobBytesForMediaOlderThan 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.
D1 · Cyclomatic Complexity · telegramlogin.importSigningKey (cyclomatic 19) · ×1
  • telegramlogin.importSigningKey (cyclomatic 19) internal/app/telegramlogin/jose.go:89 — telegramlogin.importSigningKey has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · botapi.messageEntitiesFromAPI (cyclomatic 19) · ×1
  • botapi.messageEntitiesFromAPI (cyclomatic 19) internal/botapi/inline.go:72 — botapi.messageEntitiesFromAPI has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: botapi.apiEntityType (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · botapi.apiPoll (cyclomatic 19) · ×1
  • botapi.apiPoll (cyclomatic 19) internal/botapi/projection.go:760 — botapi.apiPoll has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: botapi.botAPIEntityType (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · domain.ValidateEphemeralContent (cyclomatic 19) · ×1
  • domain.ValidateEphemeralContent (cyclomatic 19) internal/domain/ephemeral.go:296 — domain.ValidateEphemeralContent 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. This is NOT this file's highest cyclomatic complexity: domain.validEphemeralMedia (cyclomatic 39) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · domain.detectBotCommandMessageEntities (cyclomatic 19) · ×1
  • domain.detectBotCommandMessageEntities (cyclomatic 19) internal/domain/message_entity_autodetect.go:97 — domain.detectBotCommandMessageEntities has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · loadharness.prepareDownloadFixture (cyclomatic 19) · ×1
  • loadharness.prepareDownloadFixture (cyclomatic 19) REDACTED:592 — loadharness.prepareDownloadFixture has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 607). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · loadharness.seedGroup (cyclomatic 19) · ×1
  • loadharness.seedGroup (cyclomatic 19) internal/loadharness/seed.go:201 — loadharness.seedGroup 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.
D1 · Cyclomatic Complexity · Sender.send (cyclomatic 19) · ×1
  • Sender.send (cyclomatic 19) internal/otpdelivery/smtp/sender.go:71 — Sender.send has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Sender.Deliver (cyclomatic 19) · ×1
  • Sender.Deliver (cyclomatic 19) internal/otpdelivery/webhook/sender.go:91 — Sender.Deliver has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Manager.ReadEnvGroups (cyclomatic 19) · ×1
  • Manager.ReadEnvGroups (cyclomatic 19) internal/procctl/procctl.go:348 — Manager.ReadEnvGroups has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rpc.tgMessageReplyHeader (cyclomatic 19) · ×1
  • rpc.tgMessageReplyHeader (cyclomatic 19) internal/rpc/convert_messages.go:441 — rpc.tgMessageReplyHeader has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: rpc.tgMessageEntities (cyclomatic 26) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · rpc.tgStoryMediaAreas (cyclomatic 19) · ×1
  • rpc.tgStoryMediaAreas (cyclomatic 19) internal/rpc/convert_stories.go:144 — rpc.tgStoryMediaAreas 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.
D1 · Cyclomatic Complexity · rpc.collectChannelMessagePeerRefs (cyclomatic 19) · ×1
  • rpc.collectChannelMessagePeerRefs (cyclomatic 19) internal/rpc/update_peer_refs.go:416 — rpc.collectChannelMessagePeerRefs 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.
D1 · Cyclomatic Complexity · Router.registerAccount (cyclomatic 19) · ×1
  • Router.registerAccount (cyclomatic 19) internal/rpc/account.go:27 — Router.registerAccount has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 10 function literals inside it that branch (lines 281, 298, 311, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Router.onMessagesGetBotCallbackAnswer (cyclomatic 19) · ×1
  • Router.onMessagesGetBotCallbackAnswer (cyclomatic 19) internal/rpc/bots_callback.go:30 — Router.onMessagesGetBotCallbackAnswer has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onMessagesGetChatInviteImporters (cyclomatic 19) · ×1
  • Router.onMessagesGetChatInviteImporters (cyclomatic 19) internal/rpc/channels_invites.go:307 — Router.onMessagesGetChatInviteImporters 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.
D1 · Cyclomatic Complexity · Router.applyLayerRPCWrapperEffects (cyclomatic 19) · ×1
  • Router.applyLayerRPCWrapperEffects (cyclomatic 19) internal/rpc/layer_dispatch.go:406 — Router.applyLayerRPCWrapperEffects 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.
D1 · Cyclomatic Complexity · Router.checkedMessageReadPeer (cyclomatic 19) · ×1
  • Router.checkedMessageReadPeer (cyclomatic 19) internal/rpc/messages_read_filter.go:32 — Router.checkedMessageReadPeer 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.
D1 · Cyclomatic Complexity · Router.onPhoneInviteConferenceCallParticipant (cyclomatic 19) · ×1
  • Router.onPhoneInviteConferenceCallParticipant (cyclomatic 19) internal/rpc/phone_conference.go:118 — Router.onPhoneInviteConferenceCallParticipant has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onPhotosGetUserPhotos (cyclomatic 19) · ×1
  • Router.onPhotosGetUserPhotos (cyclomatic 19) internal/rpc/photos.go:426 — Router.onPhotosGetUserPhotos has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.withBotProfileFlagsForUsers (cyclomatic 19) · ×1
  • Router.withBotProfileFlagsForUsers (cyclomatic 19) internal/rpc/presence.go:819 — Router.withBotProfileFlagsForUsers 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.
D1 · Cyclomatic Complexity · Router.accountChannelDifferenceNudges (cyclomatic 19) · ×1
  • Router.accountChannelDifferenceNudges (cyclomatic 19) internal/rpc/updates.go:182 — Router.accountChannelDifferenceNudges 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.
D1 · Cyclomatic Complexity · Router.onUsersGetSavedMusicByID (cyclomatic 19) · ×1
  • Router.onUsersGetSavedMusicByID (cyclomatic 19) REDACTED:733 — Router.onUsersGetSavedMusicByID 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.
D1 · Cyclomatic Complexity · storySparseProjectionCache.activePeers (cyclomatic 19) · ×1
  • storySparseProjectionCache.activePeers (cyclomatic 19) internal/rpc/story_sparse_projection_cache.go:75 — storySparseProjectionCache.activePeers has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · endpoint.run (cyclomatic 19) · ×1
  • endpoint.run (cyclomatic 19) internal/sfu/pion.go:411 — endpoint.run has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · memory.upsertMemoryDialog (cyclomatic 19) · ×1
  • memory.upsertMemoryDialog (cyclomatic 19) internal/store/memory/dialogs.go:681 — memory.upsertMemoryDialog 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.
D1 · Cyclomatic Complexity · memory.dialogMatchesFolder (cyclomatic 19) · ×1
  • memory.dialogMatchesFolder (cyclomatic 19) internal/store/memory/dialogs.go:780 — memory.dialogMatchesFolder has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · BotStore.UpsertBotApp (cyclomatic 19) · ×1
  • BotStore.UpsertBotApp (cyclomatic 19) internal/store/memory/bot.go:323 — BotStore.UpsertBotApp has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.GetParticipants (cyclomatic 19) · ×1
  • ChannelStore.GetParticipants (cyclomatic 19) internal/store/memory/channel_members.go:15 — ChannelStore.GetParticipants has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.deleteChannelMessagesLocked (cyclomatic 19) · ×1
  • ChannelStore.deleteChannelMessagesLocked (cyclomatic 19) internal/store/memory/channel_message_delete.go:201 — ChannelStore.deleteChannelMessagesLocked 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.
D1 · Cyclomatic Complexity · ChannelStore.advanceChannelReadOutboxLocked (cyclomatic 19) · ×1
  • ChannelStore.advanceChannelReadOutboxLocked (cyclomatic 19) internal/store/memory/channel_read.go:304 — ChannelStore.advanceChannelReadOutboxLocked 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.
D1 · Cyclomatic Complexity · ChannelStore.GetChannelMessageStats (cyclomatic 19) · ×1
  • ChannelStore.GetChannelMessageStats (cyclomatic 19) internal/store/memory/channel_stats.go:202 — ChannelStore.GetChannelMessageStats has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · ChannelStore.SearchChannelMedia (cyclomatic 19) · ×1
  • ChannelStore.SearchChannelMedia (cyclomatic 19) internal/store/memory/media_search.go:163 — ChannelStore.SearchChannelMedia 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.
D1 · Cyclomatic Complexity · postgres.MigrateAndStatus (cyclomatic 19) · ×1
  • postgres.MigrateAndStatus (cyclomatic 19) internal/store/postgres/postgres.go:155 — postgres.MigrateAndStatus has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.ListAdminLog (cyclomatic 19) · ×1
  • ChannelStore.ListAdminLog (cyclomatic 19) internal/store/postgres/channel_admin_log.go:11 — ChannelStore.ListAdminLog has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.UpdatePinnedMessage (cyclomatic 19) · ×1
  • ChannelStore.UpdatePinnedMessage (cyclomatic 19) internal/store/postgres/channel_message_edit.go:417 — ChannelStore.UpdatePinnedMessage has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.channelHistoryClearAnchor (cyclomatic 19) · ×1
  • ChannelStore.channelHistoryClearAnchor (cyclomatic 19) internal/store/postgres/channel_message_history.go:309 — ChannelStore.channelHistoryClearAnchor 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.
D1 · Cyclomatic Complexity · ChannelStore.SetChannelPhoto (cyclomatic 19) · ×1
  • ChannelStore.SetChannelPhoto (cyclomatic 19) internal/store/postgres/channel_settings.go:623 — ChannelStore.SetChannelPhoto has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.SetForum (cyclomatic 19) · ×1
  • ChannelStore.SetForum (cyclomatic 19) internal/store/postgres/channel_topics.go:14 — ChannelStore.SetForum has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DialogStore.listByUser (cyclomatic 19) · ×1
  • DialogStore.listByUser (cyclomatic 19) internal/store/postgres/dialog.go:41 — DialogStore.listByUser 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.
D1 · Cyclomatic Complexity · GroupCallStore.JoinGroupCall (cyclomatic 19) · ×1
  • GroupCallStore.JoinGroupCall (cyclomatic 19) internal/store/postgres/groupcall.go:273 — GroupCallStore.JoinGroupCall has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MessageStore.ListSavedDialogs (cyclomatic 19) · ×1
  • MessageStore.ListSavedDialogs (cyclomatic 19) internal/store/postgres/saved_dialog.go:15 — MessageStore.ListSavedDialogs 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.
D1 · Cyclomatic Complexity · ModerationReportStore.CreateModerationAppeal (cyclomatic 19) · ×1
  • ModerationReportStore.CreateModerationAppeal (cyclomatic 19) internal/store/postgres/moderation_cases.go:350 — ModerationReportStore.CreateModerationAppeal has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PhoneChangeStore.ChangePhone (cyclomatic 19) · ×1
  • PhoneChangeStore.ChangePhone (cyclomatic 19) internal/store/postgres/phone_change.go:25 — PhoneChangeStore.ChangePhone has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StarGiftStore.UpdateCollection (cyclomatic 19) · ×1
  • StarGiftStore.UpdateCollection (cyclomatic 19) REDACTED:662 — StarGiftStore.UpdateCollection has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to one function literal inside it that branches (line 664). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · handler.publicUserPeer (cyclomatic 19) · ×1
  • handler.publicUserPeer (cyclomatic 19) internal/web/server.go:746 — handler.publicUserPeer 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.
D1 · Cyclomatic Complexity · main.rotateSigning (cyclomatic 18) · ×1
  • main.rotateSigning (cyclomatic 18) cmd/telegramloginkeygen/main.go:177 — main.rotateSigning 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.
D1 · Cyclomatic Complexity · main.evidenceToChat (cyclomatic 18) · ×1
  • main.evidenceToChat (cyclomatic 18) cmd/telesrv-admin/report_evidence.go:84 — main.evidenceToChat has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.RevokeSessions (cyclomatic 18) · ×1
  • Service.RevokeSessions (cyclomatic 18) internal/admin/service.go:3120 — Service.RevokeSessions has cyclomatic complexity 18 (threshold 15). Of this number, 9 points are the body's own statements and 9 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.ConfirmPhone (cyclomatic 18) · ×1
  • Service.ConfirmPhone (cyclomatic 18) REDACTED:254 — Service.ConfirmPhone 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.
D1 · Cyclomatic Complexity · Service.SendChangePhoneCode (cyclomatic 18) · ×1
  • Service.SendChangePhoneCode (cyclomatic 18) internal/app/account/phone_change.go:23 — Service.SendChangePhoneCode 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.
D1 · Cyclomatic Complexity · Service.SignInBot (cyclomatic 18) · ×1
  • Service.SignInBot (cyclomatic 18) internal/app/auth/service.go:1437 — Service.SignInBot has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.handleBotFatherCommand (cyclomatic 18) · ×1
  • Service.handleBotFatherCommand (cyclomatic 18) internal/app/bots/botfather.go:328 — Service.handleBotFatherCommand 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.
D1 · Cyclomatic Complexity · Service.chatBotPromptText (cyclomatic 18) · ×1
  • Service.chatBotPromptText (cyclomatic 18) internal/app/bots/chatbot.go:116 — Service.chatBotPromptText 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.
D1 · Cyclomatic Complexity · Service.getDialogs (cyclomatic 18) · ×1
  • Service.getDialogs (cyclomatic 18) internal/app/dialogs/service.go:148 — Service.getDialogs 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.
D1 · Cyclomatic Complexity · Service.TogglePinned (cyclomatic 18) · ×1
  • Service.TogglePinned (cyclomatic 18) internal/app/dialogs/service.go:950 — Service.TogglePinned 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.
D1 · Cyclomatic Complexity · Service.refreshConfirmationsAndCredit (cyclomatic 18) · ×1
  • Service.refreshConfirmationsAndCredit (cyclomatic 18) internal/app/donations/watcher.go:321 — Service.refreshConfirmationsAndCredit 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.
D1 · Cyclomatic Complexity · files.faststartMP4 (cyclomatic 18) · ×1
  • files.faststartMP4 (cyclomatic 18) internal/app/files/mp4faststart.go:13 — files.faststartMP4 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.
D1 · Cyclomatic Complexity · Service.SeedAppearance (cyclomatic 18) · ×1
  • Service.SeedAppearance (cyclomatic 18) internal/app/files/appearance_seed.go:24 — Service.SeedAppearance has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.maybeFaststartVideoBlob (cyclomatic 18) · ×1
  • Service.maybeFaststartVideoBlob (cyclomatic 18) internal/app/files/photos.go:551 — Service.maybeFaststartVideoBlob has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.seedStickerSets (cyclomatic 18) · ×1
  • Service.seedStickerSets (cyclomatic 18) internal/app/files/seed.go:251 — Service.seedStickerSets has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: files.seedThumbMimeType (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Service.WarmCaches (cyclomatic 18) · ×1
  • Service.WarmCaches (cyclomatic 18) internal/app/files/warm.go:19 — Service.WarmCaches has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Service.RequestEncryption (cyclomatic 18) · ×1
  • Service.RequestEncryption (cyclomatic 18) internal/app/secretchat/service.go:31 — Service.RequestEncryption has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.ExchangeInAppTokenAndIssue (cyclomatic 18) · ×1
  • Service.ExchangeInAppTokenAndIssue (cyclomatic 18) internal/app/telegramlogin/service.go:1106 — Service.ExchangeInAppTokenAndIssue has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.targetState (cyclomatic 18) · ×1
  • Service.targetState (cyclomatic 18) internal/app/verification/service.go:976 — Service.targetState 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.
D1 · Cyclomatic Complexity · botapi.markupButtonFromAPI (cyclomatic 18) · ×1
  • botapi.markupButtonFromAPI (cyclomatic 18) internal/botapi/inline.go:330 — botapi.markupButtonFromAPI has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: botapi.apiEntityType (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · botapi.apiEphemeralMessageDepth (cyclomatic 18) · ×1
  • botapi.apiEphemeralMessageDepth (cyclomatic 18) internal/botapi/projection.go:181 — botapi.apiEphemeralMessageDepth has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: botapi.botAPIEntityType (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · handler.sendMessage (cyclomatic 18) · ×1
  • handler.sendMessage (cyclomatic 18) internal/botapi/server.go:517 — handler.sendMessage has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: handler.handle (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · handler.sendRichMessage (cyclomatic 18) · ×1
  • handler.sendRichMessage (cyclomatic 18) internal/botapi/server.go:585 — handler.sendRichMessage has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: handler.handle (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · domain.ValidateExternalReplyQuote (cyclomatic 18) · ×1
  • domain.ValidateExternalReplyQuote (cyclomatic 18) internal/domain/message_reply_external.go:89 — domain.ValidateExternalReplyQuote 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.
D1 · Cyclomatic Complexity · Conn.writeFrame (cyclomatic 18) · ×1
  • Conn.writeFrame (cyclomatic 18) internal/mtprotoedge/outbound.go:2866 — Conn.writeFrame has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · rpcExecutionLedger.acquire (cyclomatic 18) · ×1
  • rpcExecutionLedger.acquire (cyclomatic 18) internal/mtprotoedge/rpc_flight.go:538 — rpcExecutionLedger.acquire 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.
D1 · Cyclomatic Complexity · rpc.tgChannelUpdate (cyclomatic 18) · ×1
  • rpc.tgChannelUpdate (cyclomatic 18) internal/rpc/convert_updates.go:176 — rpc.tgChannelUpdate 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.
D1 · Cyclomatic Complexity · rpc.augmentAutoEntities (cyclomatic 18) · ×1
  • rpc.augmentAutoEntities (cyclomatic 18) internal/rpc/message_entities_autodetect.go:30 — rpc.augmentAutoEntities has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · viewerPeerCache.channelsForIDs (cyclomatic 18) · ×1
  • viewerPeerCache.channelsForIDs (cyclomatic 18) internal/rpc/peer_projection_cache.go:195 — viewerPeerCache.channelsForIDs 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.
D1 · Cyclomatic Complexity · Router.BotAPIEditEphemeral (cyclomatic 18) · ×1
  • Router.BotAPIEditEphemeral (cyclomatic 18) internal/rpc/botapi_gateway.go:404 — Router.BotAPIEditEphemeral has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Router.fanoutCloseFriendStoryChanges (cyclomatic 18) · ×1
  • Router.fanoutCloseFriendStoryChanges (cyclomatic 18) internal/rpc/contacts.go:131 — Router.fanoutCloseFriendStoryChanges 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.
D1 · Cyclomatic Complexity · Router.prepareRPCDispatchContext (cyclomatic 18) · ×1
  • Router.prepareRPCDispatchContext (cyclomatic 18) internal/rpc/dispatch_context.go:15 — Router.prepareRPCDispatchContext 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.
D1 · Cyclomatic Complexity · Router.loadLiveLocationMessage (cyclomatic 18) · ×1
  • Router.loadLiveLocationMessage (cyclomatic 18) internal/rpc/messages_edit_geolive.go:128 — Router.loadLiveLocationMessage 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.
D1 · Cyclomatic Complexity · Router.loadMessagePoll (cyclomatic 18) · ×1
  • Router.loadMessagePoll (cyclomatic 18) internal/rpc/messages_polls_updates.go:41 — Router.loadMessagePoll 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.
D1 · Cyclomatic Complexity · Router.privateMessagesReactionsUpdates (cyclomatic 18) · ×1
  • Router.privateMessagesReactionsUpdates (cyclomatic 18) internal/rpc/messages_reactions_send.go:328 — Router.privateMessagesReactionsUpdates 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.
D1 · Cyclomatic Complexity · Router.loadTodoMessage (cyclomatic 18) · ×1
  • Router.loadTodoMessage (cyclomatic 18) internal/rpc/messages_todos.go:284 — Router.loadTodoMessage 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.
D1 · Cyclomatic Complexity · Router.onStoriesEditStory (cyclomatic 18) · ×1
  • Router.onStoriesEditStory (cyclomatic 18) internal/rpc/stories.go:1366 — Router.onStoriesEditStory has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: rpc.messageEntityClassNil (cyclomatic 27) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · BotVerificationStore.ListCustomVerifications (cyclomatic 18) · ×1
  • BotVerificationStore.ListCustomVerifications (cyclomatic 18) internal/store/memory/bot_verification.go:499 — BotVerificationStore.ListCustomVerifications 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.
D1 · Cyclomatic Complexity · ChannelStore.EnsurePermanentInvite (cyclomatic 18) · ×1
  • ChannelStore.EnsurePermanentInvite (cyclomatic 18) internal/store/memory/channel_invites.go:202 — ChannelStore.EnsurePermanentInvite has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.ListChannelUnreadMentions (cyclomatic 18) · ×1
  • ChannelStore.ListChannelUnreadMentions (cyclomatic 18) internal/store/memory/channel_read.go:148 — ChannelStore.ListChannelUnreadMentions 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.
D1 · Cyclomatic Complexity · LoginCodeDeliveryStore.DeliverLoginCodeMessage (cyclomatic 18) · ×1
  • LoginCodeDeliveryStore.DeliverLoginCodeMessage (cyclomatic 18) internal/store/memory/login_code_delivery.go:38 — LoginCodeDeliveryStore.DeliverLoginCodeMessage has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MessageStore.SearchPrivateMedia (cyclomatic 18) · ×1
  • MessageStore.SearchPrivateMedia (cyclomatic 18) internal/store/memory/media_search.go:100 — MessageStore.SearchPrivateMedia 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.
D1 · Cyclomatic Complexity · ModerationReportStore.SubmitModerationAppealByLink (cyclomatic 18) · ×1
  • ModerationReportStore.SubmitModerationAppealByLink (cyclomatic 18) internal/store/memory/moderation.go:690 — ModerationReportStore.SubmitModerationAppealByLink has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TelegramLoginStore.ConsumeTelegramLoginDirectToken (cyclomatic 18) · ×1
  • TelegramLoginStore.ConsumeTelegramLoginDirectToken (cyclomatic 18) internal/store/memory/telegram_login.go:567 — TelegramLoginStore.ConsumeTelegramLoginDirectToken has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · postgres.revokeByUserExceptTx (cyclomatic 18) · ×1
  • postgres.revokeByUserExceptTx (cyclomatic 18) internal/store/postgres/authorization.go:394 — postgres.revokeByUserExceptTx has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AccountLifecycleStore.ScheduleAccountDeletion (cyclomatic 18) · ×1
  • AccountLifecycleStore.ScheduleAccountDeletion (cyclomatic 18) internal/store/postgres/account_lifecycle.go:53 — AccountLifecycleStore.ScheduleAccountDeletion has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.listActiveChannelIDPages (cyclomatic 18) · ×1
  • ChannelStore.listActiveChannelIDPages (cyclomatic 18) internal/store/postgres/active_channel_ids_batch.go:277 — ChannelStore.listActiveChannelIDPages 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.
D1 · Cyclomatic Complexity · ChannelStore.ApplyPremiumBoost (cyclomatic 18) · ×1
  • ChannelStore.ApplyPremiumBoost (cyclomatic 18) internal/store/postgres/channel_boosts.go:63 — ChannelStore.ApplyPremiumBoost has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.ListAllBuiltinChannelDialogSnapshot (cyclomatic 18) · ×1
  • ChannelStore.ListAllBuiltinChannelDialogSnapshot (cyclomatic 18) REDACTED:446 — ChannelStore.ListAllBuiltinChannelDialogSnapshot has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.ExportInvite (cyclomatic 18) · ×1
  • ChannelStore.ExportInvite (cyclomatic 18) internal/store/postgres/channel_invite_exported.go:15 — ChannelStore.ExportInvite has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.getLinkedDiscussionGuest (cyclomatic 18) · ×1
  • ChannelStore.getLinkedDiscussionGuest (cyclomatic 18) internal/store/postgres/channel_member_helpers.go:51 — ChannelStore.getLinkedDiscussionGuest 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.
D1 · Cyclomatic Complexity · ChannelStore.UnpinAllChannelMessages (cyclomatic 18) · ×1
  • ChannelStore.UnpinAllChannelMessages (cyclomatic 18) internal/store/postgres/channel_message_edit.go:513 — ChannelStore.UnpinAllChannelMessages has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.ListMessageReadParticipants (cyclomatic 18) · ×1
  • ChannelStore.ListMessageReadParticipants (cyclomatic 18) internal/store/postgres/channel_read.go:413 — ChannelStore.ListMessageReadParticipants has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.SetChannelWallpaper (cyclomatic 18) · ×1
  • ChannelStore.SetChannelWallpaper (cyclomatic 18) internal/store/postgres/channel_settings.go:84 — ChannelStore.SetChannelWallpaper has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.SetChannelScamFake (cyclomatic 18) · ×1
  • ChannelStore.SetChannelScamFake (cyclomatic 18) internal/store/postgres/channel_settings.go:294 — ChannelStore.SetChannelScamFake has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CollectibleUsernameStore.TransferCollectibleUsername (cyclomatic 18) · ×1
  • CollectibleUsernameStore.TransferCollectibleUsername (cyclomatic 18) internal/store/postgres/collectible_username.go:294 — CollectibleUsernameStore.TransferCollectibleUsername has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 308). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · plainPrivateSendBatchActor.run (cyclomatic 18) · ×1
  • plainPrivateSendBatchActor.run (cyclomatic 18) internal/store/postgres/message_send_batch_actor.go:156 — plainPrivateSendBatchActor.run has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 171, 163). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · MessageStore.DeleteMessages (cyclomatic 18) · ×1
  • MessageStore.DeleteMessages (cyclomatic 18) internal/store/postgres/message_delete.go:14 — MessageStore.DeleteMessages has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PremiumStore.PurchasePremium (cyclomatic 18) · ×1
  • PremiumStore.PurchasePremium (cyclomatic 18) internal/store/postgres/premium.go:218 — PremiumStore.PurchasePremium has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.IssueStarGiftPurchaseForm (cyclomatic 18) · ×1
  • StarGiftLifecycleStore.IssueStarGiftPurchaseForm (cyclomatic 18) internal/store/postgres/star_gift_purchase.go:20 — StarGiftLifecycleStore.IssueStarGiftPurchaseForm has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · StarGiftUpgradeStore.loadUpgradeReplay (cyclomatic 18) · ×1
  • StarGiftUpgradeStore.loadUpgradeReplay (cyclomatic 18) REDACTED:1115 — StarGiftUpgradeStore.loadUpgradeReplay has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · VerificationStore.DecideVerificationApplication (cyclomatic 18) · ×1
  • VerificationStore.DecideVerificationApplication (cyclomatic 18) internal/store/postgres/verification.go:479 — VerificationStore.DecideVerificationApplication has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 502). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · echo.parse_args (cyclomatic 18) · ×1
  • echo.parse_args (cyclomatic 18) cmd/bots/aiogramecho/echo.py:40 — echo.parse_args has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · main.fetchSet (cyclomatic 17) · ×1
  • main.fetchSet (cyclomatic 17) cmd/stickerfetch/main.go:200 — main.fetchSet 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.
D1 · Cyclomatic Complexity · readStore.PeerProfileContent (cyclomatic 17) · ×1
  • readStore.PeerProfileContent (cyclomatic 17) cmd/telesrv-admin/privateview_store.go:389 — readStore.PeerProfileContent 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.
D1 · Cyclomatic Complexity · main.analyzeHandlers (cyclomatic 17) · ×1
  • main.analyzeHandlers (cyclomatic 17) cmd/tl-coverage/main.go:237 — main.analyzeHandlers has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 261). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Service.SetChannelAvatar (cyclomatic 17) · ×1
  • Service.SetChannelAvatar (cyclomatic 17) internal/admin/service.go:2277 — Service.SetChannelAvatar has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 2288). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Service.RevokeVerification (cyclomatic 17) · ×1
  • Service.RevokeVerification (cyclomatic 17) internal/admin/verification.go:254 — Service.RevokeVerification has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 272). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Service.controls (cyclomatic 17) · ×1
  • Service.controls (cyclomatic 17) internal/app/botverification/service.go:1376 — Service.controls 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.
D1 · Cyclomatic Complexity · Service.SearchJoinedMessages (cyclomatic 17) · ×1
  • Service.SearchJoinedMessages (cyclomatic 17) internal/app/channels/service.go:1996 — Service.SearchJoinedMessages 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.
D1 · Cyclomatic Complexity · Service.JoinInvite (cyclomatic 17) · ×1
  • Service.JoinInvite (cyclomatic 17) internal/app/chatlists/service.go:253 — Service.JoinInvite has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.AddContact (cyclomatic 17) · ×1
  • Service.AddContact (cyclomatic 17) internal/app/contacts/service.go:129 — Service.AddContact 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.
D1 · Cyclomatic Complexity · Service.AcceptContact (cyclomatic 17) · ×1
  • Service.AcceptContact (cyclomatic 17) internal/app/contacts/service.go:172 — Service.AcceptContact has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · files.stickerSetShortNameBase (cyclomatic 17) · ×1
  • files.stickerSetShortNameBase (cyclomatic 17) internal/app/files/sticker_creator.go:578 — files.stickerSetShortNameBase 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.
D1 · Cyclomatic Complexity · Service.EnsureDefaultEmojiStatusSet (cyclomatic 17) · ×1
  • Service.EnsureDefaultEmojiStatusSet (cyclomatic 17) internal/app/files/default_statuses.go:66 — Service.EnsureDefaultEmojiStatusSet 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.
D1 · Cyclomatic Complexity · Service.importStickerSetDir (cyclomatic 17) · ×1
  • Service.importStickerSetDir (cyclomatic 17) internal/app/files/seed.go:319 — Service.importStickerSetDir has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: files.seedThumbMimeType (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Service.loadBaseUsersByIDs (cyclomatic 17) · ×1
  • Service.loadBaseUsersByIDs (cyclomatic 17) internal/app/users/service.go:851 — Service.loadBaseUsersByIDs 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.
D1 · Cyclomatic Complexity · StarGiftCatalogWrite.PreserveCatalogInventory (cyclomatic 17) · ×1
  • StarGiftCatalogWrite.PreserveCatalogInventory (cyclomatic 17) internal/domain/star_gift.go:1010 — StarGiftCatalogWrite.PreserveCatalogInventory 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.
D1 · Cyclomatic Complexity · Manifest.Validate (cyclomatic 17) · ×1
  • Manifest.Validate (cyclomatic 17) internal/loadharness/types.go:70 — Manifest.Validate 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.
D1 · Cyclomatic Complexity · Conn.sendBestEffort (cyclomatic 17) · ×1
  • Conn.sendBestEffort (cyclomatic 17) internal/mtprotoedge/outbound.go:1565 — Conn.sendBestEffort has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · encodedOutboundMessage.materializeRPCResultBodyInto (cyclomatic 17) · ×1
  • encodedOutboundMessage.materializeRPCResultBodyInto (cyclomatic 17) internal/mtprotoedge/outbound.go:312 — encodedOutboundMessage.materializeRPCResultBodyInto has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Server.decodeMessageContainerViews (cyclomatic 17) · ×1
  • Server.decodeMessageContainerViews (cyclomatic 17) internal/mtprotoedge/encrypted.go:517 — Server.decodeMessageContainerViews has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rpc.parseBotAPIRichHTML (cyclomatic 17) · ×1
  • rpc.parseBotAPIRichHTML (cyclomatic 17) internal/rpc/botapi_rich_message.go:53 — rpc.parseBotAPIRichHTML has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 5 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 60). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · rpc.domainChannelReactionPolicy (cyclomatic 17) · ×1
  • rpc.domainChannelReactionPolicy (cyclomatic 17) internal/rpc/channels_read_reactions.go:92 — rpc.domainChannelReactionPolicy 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.
D1 · Cyclomatic Complexity · rpc.validChannelManagementUsername (cyclomatic 17) · ×1
  • rpc.validChannelManagementUsername (cyclomatic 17) internal/rpc/channels_settings.go:513 — rpc.validChannelManagementUsername 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.
D1 · Cyclomatic Complexity · rpc.domainRequestPeerFilter (cyclomatic 17) · ×1
  • rpc.domainRequestPeerFilter (cyclomatic 17) internal/rpc/convert_markup.go:495 — rpc.domainRequestPeerFilter 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.
D1 · Cyclomatic Complexity · rpc.tgChannelDifference (cyclomatic 17) · ×1
  • rpc.tgChannelDifference (cyclomatic 17) internal/rpc/convert_updates.go:101 — rpc.tgChannelDifference 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.
D1 · Cyclomatic Complexity · rpc.ephemeralReplyFromInput (cyclomatic 17) · ×1
  • rpc.ephemeralReplyFromInput (cyclomatic 17) internal/rpc/ephemeral.go:327 — rpc.ephemeralReplyFromInput 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.
D1 · Cyclomatic Complexity · rpc.extractMentionUsernames (cyclomatic 17) · ×1
  • rpc.extractMentionUsernames (cyclomatic 17) internal/rpc/messages_send.go:828 — rpc.extractMentionUsernames has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: rpc.cloneEntityWithBounds (cyclomatic 26) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · rpc.domainWallpaperSettings (cyclomatic 17) · ×1
  • rpc.domainWallpaperSettings (cyclomatic 17) internal/rpc/wallpaper.go:133 — rpc.domainWallpaperSettings has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · rpc.rawURLByteSpans (cyclomatic 17) · ×1
  • rpc.rawURLByteSpans (cyclomatic 17) internal/rpc/webpage_url_extract.go:37 — rpc.rawURLByteSpans has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rpc.bareDomainHostValid (cyclomatic 17) · ×1
  • rpc.bareDomainHostValid (cyclomatic 17) internal/rpc/webpage_url_extract.go:151 — rpc.bareDomainHostValid 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.
D1 · Cyclomatic Complexity · Router.domainPrivacyRulesFromInput (cyclomatic 17) · ×1
  • Router.domainPrivacyRulesFromInput (cyclomatic 17) internal/rpc/account.go:1187 — Router.domainPrivacyRulesFromInput 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 taking that case's concrete type, so the dispatch reads one line per case. These arms are selected by TYPE rather than by value, so there is no key a lookup table could be built on; where you own the matched types, giving them one shared interface method and calling that is the form a table would have taken, and where you do not, keep the cases — they stay explicit and reviewable.
D1 · Cyclomatic Complexity · Router.connectedBusinessBotPeerSettings (cyclomatic 17) · ×1
  • Router.connectedBusinessBotPeerSettings (cyclomatic 17) internal/rpc/account_business.go:431 — Router.connectedBusinessBotPeerSettings has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.BotAPISendMedia (cyclomatic 17) · ×1
  • Router.BotAPISendMedia (cyclomatic 17) internal/rpc/botapi_gateway.go:294 — Router.BotAPISendMedia has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.botAPIMedia (cyclomatic 17) · ×1
  • Router.botAPIMedia (cyclomatic 17) internal/rpc/botapi_gateway.go:721 — Router.botAPIMedia 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.
D1 · Cyclomatic Complexity · Router.BotAPIEditRichMessage (cyclomatic 17) · ×1
  • Router.BotAPIEditRichMessage (cyclomatic 17) internal/rpc/botapi_gateway.go:875 — Router.BotAPIEditRichMessage has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.runChannelFanoutJob (cyclomatic 17) · ×1
  • Router.runChannelFanoutJob (cyclomatic 17) internal/rpc/channel_fanout_dispatcher.go:877 — Router.runChannelFanoutJob 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.
D1 · Cyclomatic Complexity · Router.onMessagesSetChatTheme (cyclomatic 17) · ×1
  • Router.onMessagesSetChatTheme (cyclomatic 17) internal/rpc/channels_legacy_chat.go:456 — Router.onMessagesSetChatTheme has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onChannelsEditAdmin (cyclomatic 17) · ×1
  • Router.onChannelsEditAdmin (cyclomatic 17) internal/rpc/channels_members.go:447 — Router.onChannelsEditAdmin has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onContactsDeleteContacts (cyclomatic 17) · ×1
  • Router.onContactsDeleteContacts (cyclomatic 17) internal/rpc/contacts.go:792 — Router.onContactsDeleteContacts 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.
D1 · Cyclomatic Complexity · Router.onEphemeralGetCallbackAnswer (cyclomatic 17) · ×1
  • Router.onEphemeralGetCallbackAnswer (cyclomatic 17) internal/rpc/ephemeral.go:126 — Router.onEphemeralGetCallbackAnswer has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.ResolveInheritedAuthKeyLayer (cyclomatic 17) · ×1
  • Router.ResolveInheritedAuthKeyLayer (cyclomatic 17) internal/rpc/layer_inheritance.go:380 — Router.ResolveInheritedAuthKeyLayer 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.
D1 · Cyclomatic Complexity · Router.onMessagesSetTyping (cyclomatic 17) · ×1
  • Router.onMessagesSetTyping (cyclomatic 17) internal/rpc/messages_helpers.go:161 — Router.onMessagesSetTyping 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.
D1 · Cyclomatic Complexity · Router.validateTelemetryMessageIDs (cyclomatic 17) · ×1
  • Router.validateTelemetryMessageIDs (cyclomatic 17) internal/rpc/messages_reports.go:322 — Router.validateTelemetryMessageIDs 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.
D1 · Cyclomatic Complexity · Router.onMessagesGetSavedDialogs (cyclomatic 17) · ×1
  • Router.onMessagesGetSavedDialogs (cyclomatic 17) internal/rpc/messages_saved_dialogs.go:16 — Router.onMessagesGetSavedDialogs 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.
D1 · Cyclomatic Complexity · Router.onMessagesToggleSuggestedPostApproval (cyclomatic 17) · ×1
  • Router.onMessagesToggleSuggestedPostApproval (cyclomatic 17) internal/rpc/messages_suggested_post.go:30 — Router.onMessagesToggleSuggestedPostApproval has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onMessagesToggleTodoCompleted (cyclomatic 17) · ×1
  • Router.onMessagesToggleTodoCompleted (cyclomatic 17) internal/rpc/messages_todos.go:139 — Router.onMessagesToggleTodoCompleted has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 151). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Router.mutateTodoMedia (cyclomatic 17) · ×1
  • Router.mutateTodoMedia (cyclomatic 17) internal/rpc/messages_todos.go:197 — Router.mutateTodoMedia has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onMessagesRequestAppWebView (cyclomatic 17) · ×1
  • Router.onMessagesRequestAppWebView (cyclomatic 17) internal/rpc/messages_webview.go:138 — Router.onMessagesRequestAppWebView 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.
D1 · Cyclomatic Complexity · Router.onPaymentsUpdateStarGiftPrice (cyclomatic 17) · ×1
  • Router.onPaymentsUpdateStarGiftPrice (cyclomatic 17) internal/rpc/payments_star_gift_lifecycle.go:565 — Router.onPaymentsUpdateStarGiftPrice 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.
D1 · Cyclomatic Complexity · Router.onPaymentsConvertStarGift (cyclomatic 17) · ×1
  • Router.onPaymentsConvertStarGift (cyclomatic 17) internal/rpc/payments_star_gifts.go:1249 — Router.onPaymentsConvertStarGift 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.
D1 · Cyclomatic Complexity · Router.onPhoneRequestCall (cyclomatic 17) · ×1
  • Router.onPhoneRequestCall (cyclomatic 17) internal/rpc/phone_calls.go:63 — Router.onPhoneRequestCall has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onStatsGetStoryPublicForwards (cyclomatic 17) · ×1
  • Router.onStatsGetStoryPublicForwards (cyclomatic 17) internal/rpc/stats.go:194 — Router.onStatsGetStoryPublicForwards has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.telegramLoginRequestResult (cyclomatic 17) · ×1
  • Router.telegramLoginRequestResult (cyclomatic 17) internal/rpc/telegram_login.go:55 — Router.telegramLoginRequestResult 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.
D1 · Cyclomatic Complexity · Router.domainWelcomeEditFields (cyclomatic 17) · ×1
  • Router.domainWelcomeEditFields (cyclomatic 17) internal/rpc/welcome_messages.go:173 — Router.domainWelcomeEditFields 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.
D1 · Cyclomatic Complexity · CodeStore.VerifyLogin (cyclomatic 17) · ×1
  • CodeStore.VerifyLogin (cyclomatic 17) internal/store/memory/login_code.go:11 — CodeStore.VerifyLogin 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.
D1 · Cyclomatic Complexity · ChannelStore.GetChannelMessages (cyclomatic 17) · ×1
  • ChannelStore.GetChannelMessages (cyclomatic 17) internal/store/memory/channel_message_history.go:330 — ChannelStore.GetChannelMessages 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.
D1 · Cyclomatic Complexity · ChannelStore.ListChannelUnreadReactions (cyclomatic 17) · ×1
  • ChannelStore.ListChannelUnreadReactions (cyclomatic 17) internal/store/memory/channel_reactions.go:545 — ChannelStore.ListChannelUnreadReactions 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.
D1 · Cyclomatic Complexity · ChannelStore.channelMessageReactionsLocked (cyclomatic 17) · ×1
  • ChannelStore.channelMessageReactionsLocked (cyclomatic 17) internal/store/memory/channel_reactions.go:769 — ChannelStore.channelMessageReactionsLocked has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.DeleteForumTopicHistory (cyclomatic 17) · ×1
  • ChannelStore.DeleteForumTopicHistory (cyclomatic 17) internal/store/memory/channel_topics.go:366 — ChannelStore.DeleteForumTopicHistory has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ContactStore.ContactProjectionForViewers (cyclomatic 17) · ×1
  • ContactStore.ContactProjectionForViewers (cyclomatic 17) REDACTED:94 — ContactStore.ContactProjectionForViewers 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.
D1 · Cyclomatic Complexity · GroupCallStore.JoinGroupCall (cyclomatic 17) · ×1
  • GroupCallStore.JoinGroupCall (cyclomatic 17) internal/store/memory/groupcall.go:161 — GroupCallStore.JoinGroupCall has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · postgres.getModerationReport (cyclomatic 17) · ×1
  • postgres.getModerationReport (cyclomatic 17) internal/store/postgres/moderation.go:338 — postgres.getModerationReport 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.
D1 · Cyclomatic Complexity · postgres.canonicalizeStoredPhoneIdentitiesInTableTx (cyclomatic 17) · ×1
  • postgres.canonicalizeStoredPhoneIdentitiesInTableTx (cyclomatic 17) REDACTED:53 — postgres.canonicalizeStoredPhoneIdentitiesInTableTx 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.
D1 · Cyclomatic Complexity · postgres.validateStarGiftPurchaseForm (cyclomatic 17) · ×1
  • postgres.validateStarGiftPurchaseForm (cyclomatic 17) internal/store/postgres/star_gift_purchase.go:60 — postgres.validateStarGiftPurchaseForm 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.
D1 · Cyclomatic Complexity · BotVerificationStore.GrantCustomVerification (cyclomatic 17) · ×1
  • BotVerificationStore.GrantCustomVerification (cyclomatic 17) internal/store/postgres/bot_verification.go:537 — BotVerificationStore.GrantCustomVerification has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 553). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ChannelStore.ListDirtyActiveChannelsForUser (cyclomatic 17) · ×1
  • ChannelStore.ListDirtyActiveChannelsForUser (cyclomatic 17) internal/store/postgres/channel_helpers.go:368 — ChannelStore.ListDirtyActiveChannelsForUser has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.HideChatJoinRequest (cyclomatic 17) · ×1
  • ChannelStore.HideChatJoinRequest (cyclomatic 17) internal/store/postgres/channel_member_join_requests.go:123 — ChannelStore.HideChatJoinRequest has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.DeleteChannelParticipantHistory (cyclomatic 17) · ×1
  • ChannelStore.DeleteChannelParticipantHistory (cyclomatic 17) internal/store/postgres/channel_message_delete.go:369 — ChannelStore.DeleteChannelParticipantHistory has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.ListStoryMessageForwards (cyclomatic 17) · ×1
  • ChannelStore.ListStoryMessageForwards (cyclomatic 17) internal/store/postgres/channel_message_history.go:583 — ChannelStore.ListStoryMessageForwards 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.
D1 · Cyclomatic Complexity · ChannelStore.GetChannelMessageReactions (cyclomatic 17) · ×1
  • ChannelStore.GetChannelMessageReactions (cyclomatic 17) internal/store/postgres/channel_reaction_messages.go:353 — ChannelStore.GetChannelMessageReactions has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DialogStore.ListByPeers (cyclomatic 17) · ×1
  • DialogStore.ListByPeers (cyclomatic 17) internal/store/postgres/dialog.go:450 — DialogStore.ListByPeers 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.
D1 · Cyclomatic Complexity · MessageStore.GetMessageReactions (cyclomatic 17) · ×1
  • MessageStore.GetMessageReactions (cyclomatic 17) internal/store/postgres/message_reactions.go:178 — MessageStore.GetMessageReactions 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.
D1 · Cyclomatic Complexity · MessageStore.setSavedMessageTags (cyclomatic 17) · ×1
  • MessageStore.setSavedMessageTags (cyclomatic 17) internal/store/postgres/message_saved_reactions.go:16 — MessageStore.setSavedMessageTags has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ModerationReportStore.CreateSponsoredModerationReport (cyclomatic 17) · ×1
  • ModerationReportStore.CreateSponsoredModerationReport (cyclomatic 17) internal/store/postgres/moderation_registries.go:81 — ModerationReportStore.CreateSponsoredModerationReport has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.loadStarGiftAuction (cyclomatic 17) · ×1
  • StarGiftLifecycleStore.loadStarGiftAuction (cyclomatic 17) internal/store/postgres/star_gift_craft_auction.go:1139 — StarGiftLifecycleStore.loadStarGiftAuction 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.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.loadCraftInputMessageReplays (cyclomatic 17) · ×1
  • StarGiftLifecycleStore.loadCraftInputMessageReplays (cyclomatic 17) internal/store/postgres/star_gift_craft_projection.go:170 — StarGiftLifecycleStore.loadCraftInputMessageReplays 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.
D1 · Cyclomatic Complexity · StoryStore.CreateStory (cyclomatic 17) · ×1
  • StoryStore.CreateStory (cyclomatic 17) internal/store/postgres/story.go:184 — StoryStore.CreateStory 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.
D1 · Cyclomatic Complexity · StoryStore.ListStoryViews (cyclomatic 17) · ×1
  • StoryStore.ListStoryViews (cyclomatic 17) internal/store/postgres/story.go:1188 — StoryStore.ListStoryViews has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WelcomeMessageStore.CreateWelcomeMessage (cyclomatic 17) · ×1
  • WelcomeMessageStore.CreateWelcomeMessage (cyclomatic 17) internal/store/postgres/welcome_message.go:36 — WelcomeMessageStore.CreateWelcomeMessage has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 5 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 47). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · WelcomeMessageStore.ClaimWelcomeMessageDeliveries (cyclomatic 17) · ×1
  • WelcomeMessageStore.ClaimWelcomeMessageDeliveries (cyclomatic 17) internal/store/postgres/welcome_message_delivery.go:136 — WelcomeMessageStore.ClaimWelcomeMessageDeliveries has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Catalog.validateApps (cyclomatic 17) · ×1
  • Catalog.validateApps (cyclomatic 17) internal/updatecdn/catalog.go:214 — Catalog.validateApps 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.
D1 · Cyclomatic Complexity · main.runLoop (cyclomatic 16) · ×1
  • main.runLoop (cyclomatic 16) cmd/bots/botdemo/main.go:256 — main.runLoop has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · main.render (cyclomatic 16) · ×1
  • main.render (cyclomatic 16) cmd/tl-coverage/main.go:568 — main.render has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, 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.
D1 · Cyclomatic Complexity · Service.SetLoginEmail (cyclomatic 16) · ×1
  • Service.SetLoginEmail (cyclomatic 16) internal/admin/service.go:2133 — Service.SetLoginEmail has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 2144). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · Service.UpdatePasswordSettings (cyclomatic 16) · ×1
  • Service.UpdatePasswordSettings (cyclomatic 16) internal/app/account/service.go:360 — Service.UpdatePasswordSettings 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.
D1 · Cyclomatic Complexity · Service.RecoverPassword (cyclomatic 16) · ×1
  • Service.RecoverPassword (cyclomatic 16) internal/app/account/service.go:478 — Service.RecoverPassword has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.UpdateTone (cyclomatic 16) · ×1
  • Service.UpdateTone (cyclomatic 16) internal/app/ai/service.go:240 — Service.UpdateTone has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.SendCode (cyclomatic 16) · ×1
  • Service.SendCode (cyclomatic 16) internal/app/auth/service.go:493 — Service.SendCode 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.
D1 · Cyclomatic Complexity · Service.bind (cyclomatic 16) · ×1
  • Service.bind (cyclomatic 16) internal/app/auth/service.go:1625 — Service.bind 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.
D1 · Cyclomatic Complexity · Service.normalizeBotApp (cyclomatic 16) · ×1
  • Service.normalizeBotApp (cyclomatic 16) internal/app/bots/miniapp.go:64 — Service.normalizeBotApp 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.
D1 · Cyclomatic Complexity · Service.CreateBot (cyclomatic 16) · ×1
  • Service.CreateBot (cyclomatic 16) REDACTED:628 — Service.CreateBot has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.handleStickersCommand (cyclomatic 16) · ×1
  • Service.handleStickersCommand (cyclomatic 16) internal/app/bots/stickersbot.go:143 — Service.handleStickersCommand 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.
D1 · Cyclomatic Complexity · Service.handleVerify (cyclomatic 16) · ×1
  • Service.handleVerify (cyclomatic 16) internal/app/bots/verifybot.go:261 — Service.handleVerify has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: bots.verifyPolicyText (cyclomatic 17) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Service.SetCustomVerification (cyclomatic 16) · ×1
  • Service.SetCustomVerification (cyclomatic 16) internal/app/botverification/service.go:511 — Service.SetCustomVerification has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.cachedPeerDialogsReadModel (cyclomatic 16) · ×1
  • Service.cachedPeerDialogsReadModel (cyclomatic 16) internal/app/dialogs/read_model_cache.go:74 — Service.cachedPeerDialogsReadModel 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.
D1 · Cyclomatic Complexity · Service.PrivateDialogPeerIDs (cyclomatic 16) · ×1
  • Service.PrivateDialogPeerIDs (cyclomatic 16) internal/app/dialogs/service.go:255 — Service.PrivateDialogPeerIDs 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.
D1 · Cyclomatic Complexity · Service.hydrateDialogSnapshotPage (cyclomatic 16) · ×1
  • Service.hydrateDialogSnapshotPage (cyclomatic 16) internal/app/dialogs/service.go:472 — Service.hydrateDialogSnapshotPage 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.
D1 · Cyclomatic Complexity · Service.GetPeerDialogs (cyclomatic 16) · ×1
  • Service.GetPeerDialogs (cyclomatic 16) internal/app/dialogs/service.go:686 — Service.GetPeerDialogs has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.RefreshPrices (cyclomatic 16) · ×1
  • Service.RefreshPrices (cyclomatic 16) internal/app/donations/pricefeed.go:64 — Service.RefreshPrices 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.
D1 · Cyclomatic Complexity · Service.DocumentAnimationJSON (cyclomatic 16) · ×1
  • Service.DocumentAnimationJSON (cyclomatic 16) internal/app/files/emoji_animation.go:19 — Service.DocumentAnimationJSON has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.DeleteOrphanedOlderThan (cyclomatic 16) · ×1
  • Service.DeleteOrphanedOlderThan (cyclomatic 16) internal/app/files/retention.go:111 — Service.DeleteOrphanedOlderThan 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.
D1 · Cyclomatic Complexity · Service.cloneStickerSetDocument (cyclomatic 16) · ×1
  • Service.cloneStickerSetDocument (cyclomatic 16) internal/app/files/sticker_material.go:39 — Service.cloneStickerSetDocument 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.
D1 · Cyclomatic Complexity · FFmpegVideoThumbnailer.Extract (cyclomatic 16) · ×1
  • FFmpegVideoThumbnailer.Extract (cyclomatic 16) internal/app/files/video_thumbnail.go:44 — FFmpegVideoThumbnailer.Extract has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · giftpack.Import (cyclomatic 16) · ×1
  • giftpack.Import (cyclomatic 16) internal/app/giftpack/import.go:63 — giftpack.Import 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.
D1 · Cyclomatic Complexity · langpack.packFromFilename (cyclomatic 16) · ×1
  • langpack.packFromFilename (cyclomatic 16) internal/app/langpack/parser.go:58 — langpack.packFromFilename has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.SetChatTheme (cyclomatic 16) · ×1
  • Service.SetChatTheme (cyclomatic 16) internal/app/messages/service.go:228 — Service.SetChatTheme has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.ReviewAppeal (cyclomatic 16) · ×1
  • Service.ReviewAppeal (cyclomatic 16) internal/app/moderation/cases.go:92 — Service.ReviewAppeal has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.ReportProfilePhoto (cyclomatic 16) · ×1
  • Service.ReportProfilePhoto (cyclomatic 16) internal/app/moderation/evidence.go:186 — Service.ReportProfilePhoto has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · BatchCache.UsersForView (cyclomatic 16) · ×1
  • BatchCache.UsersForView (cyclomatic 16) internal/app/peerview/cache.go:32 — BatchCache.UsersForView 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.
D1 · Cyclomatic Complexity · telegramlogin.NewService (cyclomatic 16) · ×1
  • telegramlogin.NewService (cyclomatic 16) internal/app/telegramlogin/service.go:63 — telegramlogin.NewService has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · IDTokenIssuer.Issue (cyclomatic 16) · ×1
  • IDTokenIssuer.Issue (cyclomatic 16) internal/app/telegramlogin/jose.go:357 — IDTokenIssuer.Issue has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Service.GetDifference (cyclomatic 16) · ×1
  • Service.GetDifference (cyclomatic 16) internal/app/updates/service.go:176 — Service.GetDifference has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · botapi.replyMarkupFromAPI (cyclomatic 16) · ×1
  • botapi.replyMarkupFromAPI (cyclomatic 16) internal/botapi/inline.go:179 — botapi.replyMarkupFromAPI has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: botapi.apiEntityType (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · botapi.replyKeyboardMarkupFromAPI (cyclomatic 16) · ×1
  • botapi.replyKeyboardMarkupFromAPI (cyclomatic 16) internal/botapi/inline.go:269 — botapi.replyKeyboardMarkupFromAPI has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: botapi.apiEntityType (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · handler.editEphemeralMessage (cyclomatic 16) · ×1
  • handler.editEphemeralMessage (cyclomatic 16) internal/botapi/ephemeral.go:196 — handler.editEphemeralMessage 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.
D1 · Cyclomatic Complexity · handler.setUserEmojiStatus (cyclomatic 16) · ×1
  • handler.setUserEmojiStatus (cyclomatic 16) internal/botapi/server.go:1162 — handler.setUserEmojiStatus has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: handler.handle (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · domain.classifyDocumentCategory (cyclomatic 16) · ×1
  • domain.classifyDocumentCategory (cyclomatic 16) internal/domain/media_category.go:113 — domain.classifyDocumentCategory 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.
D1 · Cyclomatic Complexity · domain.DetectAutomaticMessageEntities (cyclomatic 16) · ×1
  • domain.DetectAutomaticMessageEntities (cyclomatic 16) internal/domain/message_entity_autodetect.go:24 — domain.DetectAutomaticMessageEntities has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · domain.cloneReplyData (cyclomatic 16) · ×1
  • domain.cloneReplyData (cyclomatic 16) internal/domain/message_reply_external.go:140 — domain.cloneReplyData 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.
D1 · Cyclomatic Complexity · domain.EvaluatePrivacy (cyclomatic 16) · ×1
  • domain.EvaluatePrivacy (cyclomatic 16) internal/domain/privacy_evaluate.go:5 — domain.EvaluatePrivacy 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.
D1 · Cyclomatic Complexity · domain.validateStarGiftUpgradePreviewPool (cyclomatic 16) · ×1
  • domain.validateStarGiftUpgradePreviewPool (cyclomatic 16) internal/domain/star_gift.go:1237 — domain.validateStarGiftUpgradePreviewPool has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · links.ValidateAppLinkBase (cyclomatic 16) · ×1
  • links.ValidateAppLinkBase (cyclomatic 16) internal/links/links.go:54 — links.ValidateAppLinkBase has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · loadharness.provisionOne (cyclomatic 16) · ×1
  • loadharness.provisionOne (cyclomatic 16) internal/loadharness/provision.go:204 — loadharness.provisionOne has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 210). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · loadharness.validateSeededRichDialogs (cyclomatic 16) · ×1
  • loadharness.validateSeededRichDialogs (cyclomatic 16) internal/loadharness/rich_state.go:192 — loadharness.validateSeededRichDialogs has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · DatasetConfig.validate (cyclomatic 16) · ×1
  • DatasetConfig.validate (cyclomatic 16) internal/loadharness/dataset.go:164 — DatasetConfig.validate has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · loadWorker.supervise (cyclomatic 16) · ×1
  • loadWorker.supervise (cyclomatic 16) REDACTED:224 — loadWorker.supervise has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: loadharness.classifyErrorReason (cyclomatic 19) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Conn.beginRPCReplayRestore (cyclomatic 16) · ×1
  • Conn.beginRPCReplayRestore (cyclomatic 16) internal/mtprotoedge/inbound_rpc.go:861 — Conn.beginRPCReplayRestore has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 882). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · connStateOverlay.validateSeq (cyclomatic 16) · ×1
  • connStateOverlay.validateSeq (cyclomatic 16) internal/mtprotoedge/inbound_preflight.go:255 — connStateOverlay.validateSeq 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.
D1 · Cyclomatic Complexity · Server.refreshActivatedInheritedLayerProfile (cyclomatic 16) · ×1
  • Server.refreshActivatedInheritedLayerProfile (cyclomatic 16) internal/mtprotoedge/conn_layer_profile.go:441 — Server.refreshActivatedInheritedLayerProfile 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.
D1 · Cyclomatic Complexity · SessionManager.ExplicitLayerEvidenceForAuthKey (cyclomatic 16) · ×1
  • SessionManager.ExplicitLayerEvidenceForAuthKey (cyclomatic 16) internal/mtprotoedge/session_manager.go:516 — SessionManager.ExplicitLayerEvidenceForAuthKey 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.
D1 · Cyclomatic Complexity · SessionManager.CloseSessionsForBusinessAuthKey (cyclomatic 16) · ×1
  • SessionManager.CloseSessionsForBusinessAuthKey (cyclomatic 16) internal/mtprotoedge/session_manager.go:947 — SessionManager.CloseSessionsForBusinessAuthKey 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.
D1 · Cyclomatic Complexity · SessionManager.pushToBusinessAuthKeyBestEffort (cyclomatic 16) · ×1
  • SessionManager.pushToBusinessAuthKeyBestEffort (cyclomatic 16) internal/mtprotoedge/session_manager.go:1635 — SessionManager.pushToBusinessAuthKeyBestEffort has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (SessionManager.pushToUserBestEffort) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · SessionManager.pushToUserBestEffort (cyclomatic 16) · ×1
  • SessionManager.pushToUserBestEffort (cyclomatic 16) internal/mtprotoedge/session_manager.go:1801 — SessionManager.pushToUserBestEffort has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (SessionManager.pushToBusinessAuthKeyBestEffort) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · SessionManager.OnlineChannelIDsSnapshot (cyclomatic 16) · ×1
  • SessionManager.OnlineChannelIDsSnapshot (cyclomatic 16) internal/mtprotoedge/session_manager.go:2392 — SessionManager.OnlineChannelIDsSnapshot 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.
D1 · Cyclomatic Complexity · rpc.botAPIRichTable (cyclomatic 16) · ×1
  • rpc.botAPIRichTable (cyclomatic 16) REDACTED:245 — rpc.botAPIRichTable has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: rpc.botAPIRichPlainText (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · rpc.botAPIQueuedUpdateEventFromMessages (cyclomatic 16) · ×1
  • rpc.botAPIQueuedUpdateEventFromMessages (cyclomatic 16) internal/rpc/botapi_update_queue.go:230 — rpc.botAPIQueuedUpdateEventFromMessages 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.
D1 · Cyclomatic Complexity · rpc.validateChannelSearchPostsRequest (cyclomatic 16) · ×1
  • rpc.validateChannelSearchPostsRequest (cyclomatic 16) internal/rpc/channels_messages.go:109 — rpc.validateChannelSearchPostsRequest 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.
D1 · Cyclomatic Complexity · rpc.domainSuggestedPost (cyclomatic 16) · ×1
  • rpc.domainSuggestedPost (cyclomatic 16) internal/rpc/messages_suggested_post.go:84 — rpc.domainSuggestedPost 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.
D1 · Cyclomatic Complexity · rpc.collectMessagePeerRefs (cyclomatic 16) · ×1
  • rpc.collectMessagePeerRefs (cyclomatic 16) internal/rpc/update_peer_refs.go:332 — rpc.collectMessagePeerRefs 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.
D1 · Cyclomatic Complexity · Router.onAccountDeleteAccount (cyclomatic 16) · ×1
  • Router.onAccountDeleteAccount (cyclomatic 16) internal/rpc/account_deletion.go:29 — Router.onAccountDeleteAccount 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.
D1 · Cyclomatic Complexity · Router.onAuthBindTempAuthKey (cyclomatic 16) · ×1
  • Router.onAuthBindTempAuthKey (cyclomatic 16) REDACTED:205 — Router.onAuthBindTempAuthKey has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.BotAPISendMessage (cyclomatic 16) · ×1
  • Router.BotAPISendMessage (cyclomatic 16) internal/rpc/botapi_gateway.go:178 — Router.BotAPISendMessage has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onMessagesCreateChat (cyclomatic 16) · ×1
  • Router.onMessagesCreateChat (cyclomatic 16) internal/rpc/channels_legacy_chat.go:13 — Router.onMessagesCreateChat has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.fanoutStoryBlocklistChange (cyclomatic 16) · ×1
  • Router.fanoutStoryBlocklistChange (cyclomatic 16) internal/rpc/contacts.go:204 — Router.fanoutStoryBlocklistChange 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.
D1 · Cyclomatic Complexity · Router.onContactsImportContacts (cyclomatic 16) · ×1
  • Router.onContactsImportContacts (cyclomatic 16) internal/rpc/contacts.go:604 — Router.onContactsImportContacts 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.
D1 · Cyclomatic Complexity · Router.onContactsAddContact (cyclomatic 16) · ×1
  • Router.onContactsAddContact (cyclomatic 16) internal/rpc/contacts.go:678 — Router.onContactsAddContact has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onMessagesRequestEncryption (cyclomatic 16) · ×1
  • Router.onMessagesRequestEncryption (cyclomatic 16) internal/rpc/encrypted_chats.go:154 — Router.onMessagesRequestEncryption has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onEphemeralReportMessage (cyclomatic 16) · ×1
  • Router.onEphemeralReportMessage (cyclomatic 16) internal/rpc/ephemeral.go:236 — Router.onEphemeralReportMessage has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.checkFrozenChannelParticipants (cyclomatic 16) · ×1
  • Router.checkFrozenChannelParticipants (cyclomatic 16) internal/rpc/frozen_gate.go:101 — Router.checkFrozenChannelParticipants 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.
D1 · Cyclomatic Complexity · Router.onMessagesToggleBotInAttachMenu (cyclomatic 16) · ×1
  • Router.onMessagesToggleBotInAttachMenu (cyclomatic 16) internal/rpc/messages_attach_menu.go:75 — Router.onMessagesToggleBotInAttachMenu has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onMessagesGetSavedHistory (cyclomatic 16) · ×1
  • Router.onMessagesGetSavedHistory (cyclomatic 16) internal/rpc/messages_compat.go:19 — Router.onMessagesGetSavedHistory 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.
D1 · Cyclomatic Complexity · Router.onMessagesDeleteSavedHistory (cyclomatic 16) · ×1
  • Router.onMessagesDeleteSavedHistory (cyclomatic 16) internal/rpc/messages_compat.go:109 — Router.onMessagesDeleteSavedHistory has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.dialogDraftFromSaveDraft (cyclomatic 16) · ×1
  • Router.dialogDraftFromSaveDraft (cyclomatic 16) internal/rpc/messages_dialogs.go:155 — Router.dialogDraftFromSaveDraft has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.updatePrivatePinnedMessage (cyclomatic 16) · ×1
  • Router.updatePrivatePinnedMessage (cyclomatic 16) internal/rpc/messages_pin.go:17 — Router.updatePrivatePinnedMessage 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.
D1 · Cyclomatic Complexity · Router.onMessagesGetUnreadMentions (cyclomatic 16) · ×1
  • Router.onMessagesGetUnreadMentions (cyclomatic 16) internal/rpc/messages_read.go:95 — Router.onMessagesGetUnreadMentions has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Router.onMessagesReport (cyclomatic 16) · ×1
  • Router.onMessagesReport (cyclomatic 16) internal/rpc/messages_reports.go:46 — Router.onMessagesReport has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.mentionedUserIDsFromMessage (cyclomatic 16) · ×1
  • Router.mentionedUserIDsFromMessage (cyclomatic 16) internal/rpc/messages_send.go:770 — Router.mentionedUserIDsFromMessage has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: rpc.cloneEntityWithBounds (cyclomatic 26) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Router.stickerCollectionDocuments (cyclomatic 16) · ×1
  • Router.stickerCollectionDocuments (cyclomatic 16) internal/rpc/messages_stickers_personal.go:244 — Router.stickerCollectionDocuments 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.
D1 · Cyclomatic Complexity · Router.onPaymentsValidateRequestedInfo (cyclomatic 16) · ×1
  • Router.onPaymentsValidateRequestedInfo (cyclomatic 16) internal/rpc/payments_star_gifts.go:486 — Router.onPaymentsValidateRequestedInfo has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onPhoneCheckGroupCall (cyclomatic 16) · ×1
  • Router.onPhoneCheckGroupCall (cyclomatic 16) internal/rpc/phone_group_call.go:552 — Router.onPhoneCheckGroupCall 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.
D1 · Cyclomatic Complexity · Router.NotifyUserModerationFlagsChanged (cyclomatic 16) · ×1
  • Router.NotifyUserModerationFlagsChanged (cyclomatic 16) internal/rpc/premium_sweeper.go:102 — Router.NotifyUserModerationFlagsChanged 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.
D1 · Cyclomatic Complexity · Router.presenceFanoutCandidates (cyclomatic 16) · ×1
  • Router.presenceFanoutCandidates (cyclomatic 16) internal/rpc/presence.go:1091 — Router.presenceFanoutCandidates has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.persistAuthKeyClientInfo (cyclomatic 16) · ×1
  • Router.persistAuthKeyClientInfo (cyclomatic 16) internal/rpc/router.go:1083 — Router.persistAuthKeyClientInfo 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.
D1 · Cyclomatic Complexity · Router.buildEmojiStickerIndex (cyclomatic 16) · ×1
  • Router.buildEmojiStickerIndex (cyclomatic 16) internal/rpc/stickers_emoji_index.go:147 — Router.buildEmojiStickerIndex 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.
D1 · Cyclomatic Complexity · Router.onUploadGetWebFile (cyclomatic 16) · ×1
  • Router.onUploadGetWebFile (cyclomatic 16) internal/rpc/upload_webfile.go:49 — Router.onUploadGetWebFile has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Router.onUsersGetSavedMusic (cyclomatic 16) · ×1
  • Router.onUsersGetSavedMusic (cyclomatic 16) REDACTED:695 — Router.onUsersGetSavedMusic has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · sfu.buildMediaPlan (cyclomatic 16) · ×1
  • sfu.buildMediaPlan (cyclomatic 16) internal/sfu/pion.go:77 — sfu.buildMediaPlan 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.
D1 · Cyclomatic Complexity · AuthKeyStore.AdvanceSessionLayer (cyclomatic 16) · ×1
  • AuthKeyStore.AdvanceSessionLayer (cyclomatic 16) internal/store/memory/authkey_session_layer.go:37 — AuthKeyStore.AdvanceSessionLayer has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CodeStore.VerifyScoped (cyclomatic 16) · ×1
  • CodeStore.VerifyScoped (cyclomatic 16) internal/store/memory/login_code.go:74 — CodeStore.VerifyScoped 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.
D1 · Cyclomatic Complexity · ChannelStore.ListLeftChannels (cyclomatic 16) · ×1
  • ChannelStore.ListLeftChannels (cyclomatic 16) internal/store/memory/channel_dialogs.go:204 — ChannelStore.ListLeftChannels has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.ListInactiveChannels (cyclomatic 16) · ×1
  • ChannelStore.ListInactiveChannels (cyclomatic 16) internal/store/memory/channel_dialogs.go:248 — ChannelStore.ListInactiveChannels has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChannelStore.ListActiveChannelIDsForUser (cyclomatic 16) · ×1
  • ChannelStore.ListActiveChannelIDsForUser (cyclomatic 16) internal/store/memory/channel_helpers.go:281 — ChannelStore.ListActiveChannelIDsForUser 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.
D1 · Cyclomatic Complexity · ChannelStore.linkedDiscussionGuestLocked (cyclomatic 16) · ×1
  • ChannelStore.linkedDiscussionGuestLocked (cyclomatic 16) internal/store/memory/channel_members.go:1052 — ChannelStore.linkedDiscussionGuestLocked has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ChannelStore.ListMonoforumDialogs (cyclomatic 16) · ×1
  • ChannelStore.ListMonoforumDialogs (cyclomatic 16) internal/store/memory/channel_monoforum.go:212 — ChannelStore.ListMonoforumDialogs 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.
D1 · Cyclomatic Complexity · ChannelStore.pollChannelMessageTarget (cyclomatic 16) · ×1
  • ChannelStore.pollChannelMessageTarget (cyclomatic 16) internal/store/memory/channel_polls.go:41 — ChannelStore.pollChannelMessageTarget has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ChannelStore.ReadChannelMentions (cyclomatic 16) · ×1
  • ChannelStore.ReadChannelMentions (cyclomatic 16) internal/store/memory/channel_read.go:198 — ChannelStore.ReadChannelMentions has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.pruneChannelUpdateEventsLocked (cyclomatic 16) · ×1
  • ChannelStore.pruneChannelUpdateEventsLocked (cyclomatic 16) internal/store/memory/channel_updates.go:269 — ChannelStore.pruneChannelUpdateEventsLocked has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: memory.adminLogEventMatchesFilter (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · EphemeralMessageStore.PruneExpiredEphemeralMessages (cyclomatic 16) · ×1
  • EphemeralMessageStore.PruneExpiredEphemeralMessages (cyclomatic 16) internal/store/memory/ephemeral.go:301 — EphemeralMessageStore.PruneExpiredEphemeralMessages 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.
D1 · Cyclomatic Complexity · MessageStore.UnpinAllPrivateMessages (cyclomatic 16) · ×1
  • MessageStore.UnpinAllPrivateMessages (cyclomatic 16) internal/store/memory/message_pin.go:91 — MessageStore.UnpinAllPrivateMessages 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.
D1 · Cyclomatic Complexity · ModerationReportStore.ListModerationCases (cyclomatic 16) · ×1
  • ModerationReportStore.ListModerationCases (cyclomatic 16) internal/store/memory/moderation.go:322 — ModerationReportStore.ListModerationCases has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ModerationReportStore.DecideModerationCase (cyclomatic 16) · ×1
  • ModerationReportStore.DecideModerationCase (cyclomatic 16) internal/store/memory/moderation.go:437 — ModerationReportStore.DecideModerationCase has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PollStore.ListPollVotes (cyclomatic 16) · ×1
  • PollStore.ListPollVotes (cyclomatic 16) internal/store/memory/poll.go:52 — PollStore.ListPollVotes has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StarsStore.ListTransactions (cyclomatic 16) · ×1
  • StarsStore.ListTransactions (cyclomatic 16) internal/store/memory/stars.go:148 — StarsStore.ListTransactions has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StoryStore.ListPinnedStories (cyclomatic 16) · ×1
  • StoryStore.ListPinnedStories (cyclomatic 16) internal/store/memory/story.go:359 — StoryStore.ListPinnedStories has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StoryStore.ListStoriesArchive (cyclomatic 16) · ×1
  • StoryStore.ListStoriesArchive (cyclomatic 16) internal/store/memory/story.go:424 — StoryStore.ListStoriesArchive has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StoryStore.ListStoryViewerIDs (cyclomatic 16) · ×1
  • StoryStore.ListStoryViewerIDs (cyclomatic 16) internal/store/memory/story.go:839 — StoryStore.ListStoryViewerIDs 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.
D1 · Cyclomatic Complexity · TelegramLoginStore.UpsertTelegramLoginNativeApp (cyclomatic 16) · ×1
  • TelegramLoginStore.UpsertTelegramLoginNativeApp (cyclomatic 16) internal/store/memory/telegram_login.go:214 — TelegramLoginStore.UpsertTelegramLoginNativeApp 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.
D1 · Cyclomatic Complexity · postgres.validateCommunityPeerForLink (cyclomatic 16) · ×1
  • postgres.validateCommunityPeerForLink (cyclomatic 16) internal/store/postgres/community.go:380 — postgres.validateCommunityPeerForLink 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.
D1 · Cyclomatic Complexity · postgres.privateMessageReactionsFromRows (cyclomatic 16) · ×1
  • postgres.privateMessageReactionsFromRows (cyclomatic 16) internal/store/postgres/message_reactions.go:351 — postgres.privateMessageReactionsFromRows has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · postgres.selectPlainPrivateSendBatch (cyclomatic 16) · ×1
  • postgres.selectPlainPrivateSendBatch (cyclomatic 16) internal/store/postgres/message_send_batch_actor.go:219 — postgres.selectPlainPrivateSendBatch 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.
D1 · Cyclomatic Complexity · postgres.appendUserUpdateEvent (cyclomatic 16) · ×1
  • postgres.appendUserUpdateEvent (cyclomatic 16) internal/store/postgres/update_event.go:164 — postgres.appendUserUpdateEvent has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.getChannelForViewer (cyclomatic 16) · ×1
  • ChannelStore.getChannelForViewer (cyclomatic 16) internal/store/postgres/channel_helpers.go:466 — ChannelStore.getChannelForViewer has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.HideAllChatJoinRequests (cyclomatic 16) · ×1
  • ChannelStore.HideAllChatJoinRequests (cyclomatic 16) internal/store/postgres/channel_invite_requests.go:109 — ChannelStore.HideAllChatJoinRequests 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.
D1 · Cyclomatic Complexity · ChannelStore.EditChannelMemberRank (cyclomatic 16) · ×1
  • ChannelStore.EditChannelMemberRank (cyclomatic 16) internal/store/postgres/channel_member_admin.go:305 — ChannelStore.EditChannelMemberRank has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.ModerationDeleteChannelMessages (cyclomatic 16) · ×1
  • ChannelStore.ModerationDeleteChannelMessages (cyclomatic 16) internal/store/postgres/channel_message_delete.go:64 — ChannelStore.ModerationDeleteChannelMessages has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.EditChannelTitle (cyclomatic 16) · ×1
  • ChannelStore.EditChannelTitle (cyclomatic 16) internal/store/postgres/channel_settings.go:15 — ChannelStore.EditChannelTitle has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChannelStore.ReorderPinnedForumTopics (cyclomatic 16) · ×1
  • ChannelStore.ReorderPinnedForumTopics (cyclomatic 16) internal/store/postgres/channel_topics.go:341 — ChannelStore.ReorderPinnedForumTopics 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.
D1 · Cyclomatic Complexity · CollectibleUsernameStore.RevokeCollectibleUsername (cyclomatic 16) · ×1
  • CollectibleUsernameStore.RevokeCollectibleUsername (cyclomatic 16) internal/store/postgres/collectible_username.go:385 — CollectibleUsernameStore.RevokeCollectibleUsername has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 399). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · CommunityStore.ReorderCommunityPinned (cyclomatic 16) · ×1
  • CommunityStore.ReorderCommunityPinned (cyclomatic 16) internal/store/postgres/community.go:1309 — CommunityStore.ReorderCommunityPinned has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to one function literal inside it that branches (line 1310). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ContactStore.ContactProjectionForViewers (cyclomatic 16) · ×1
  • ContactStore.ContactProjectionForViewers (cyclomatic 16) REDACTED:220 — ContactStore.ContactProjectionForViewers 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.
D1 · Cyclomatic Complexity · ModerationReportStore.CreateAntiSpamFalsePositiveReport (cyclomatic 16) · ×1
  • ModerationReportStore.CreateAntiSpamFalsePositiveReport (cyclomatic 16) internal/store/postgres/moderation_registries.go:206 — ModerationReportStore.CreateAntiSpamFalsePositiveReport has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StarGiftLifecycleStore.ensureStarGiftAuction (cyclomatic 16) · ×1
  • StarGiftLifecycleStore.ensureStarGiftAuction (cyclomatic 16) internal/store/postgres/star_gift_craft_auction.go:1093 — StarGiftLifecycleStore.ensureStarGiftAuction has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · VerificationStore.RevokeVerification (cyclomatic 16) · ×1
  • VerificationStore.RevokeVerification (cyclomatic 16) internal/store/postgres/verification.go:584 — VerificationStore.RevokeVerification has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 603). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · storetest.contractConferenceEmptyDiscards (cyclomatic 16) · ×1
  • storetest.contractConferenceEmptyDiscards (cyclomatic 16) internal/store/storetest/groupcall.go:481 — storetest.contractConferenceEmptyDiscards has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Handler.inApp (cyclomatic 16) · ×1
  • Handler.inApp (cyclomatic 16) internal/telegramloginhttp/handler.go:303 — Handler.inApp has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Handler.authorizationStatus (cyclomatic 16) · ×1
  • Handler.authorizationStatus (cyclomatic 16) internal/telegramloginhttp/handler.go:499 — Handler.authorizationStatus 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.
D12 · Dependency Hygiene · Dependency pinned to a stale untagged commit · ×1
  • Dependency pinned to a stale untagged commit: github.com/jackc/pgerrcode — Direct dependency `github.com/jackc/pgerrcode` is required at `v0.0.0-20220416144525-469b46aa5efa` in REDACTED — a pseudo-version, which pins an UNTAGGED commit from 2022-04-16, 4.6 years ago. The pin itself is exact, so this is not a reproducibility defect, and it is not a claim that the module is unmaintained. What it says is that this repository tracks no RELEASE of `github.com/jackc/pgerrcode` and has not moved this requirement in 4.6 years: every fix the module has published since that commit — including any security fix — is absent from this build, whether the module went quiet or moved on without you. Check whether `github.com/jackc/pgerrcode` now publishes tagged releases and move the requirement to one; if it publishes none, re-pin to a current commit.
D17 · Explicit Debt · TodoComment · ×1
  • TodoComment internal/domain/message.go:598 — // todo->todo 且正文/entities/markup 不变,避免普通消息越权编辑。 — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D2 · Cognitive Complexity · Server.prepareInboundLayerRPCBatch (cognitive 239) · ×1
  • Server.prepareInboundLayerRPCBatch (cognitive 239) internal/mtprotoedge/inbound_layer_rpc.go:305 — Server.prepareInboundLayerRPCBatch has cognitive complexity 239 (threshold 15). Drivers by points: if/else 70 (193 pts), loops 17 (27 pts), boolean chains 13, match/switch 2 (6 pts) (nesting depth added 137). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReadModelChangeListener.handlePayload (cognitive 226) · ×1
  • ReadModelChangeListener.handlePayload (cognitive 226) internal/store/postgres/read_model_listener.go:381 — ReadModelChangeListener.handlePayload has cognitive complexity 226 (threshold 15). Drivers by points: if/else 76 (193 pts), boolean chains 29, match/switch 2 (4 pts) (nesting depth added 119). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.run (cognitive 165) · ×1
  • main.run (cognitive 165) REDACTED:600 — main.run has cognitive complexity 165 (threshold 15). Drivers by points: if/else 113 (142 pts), boolean chains 13, match/switch 4 (7 pts), loops 3 (nesting depth added 32). Of this number, 162 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Router.registerMessages (cognitive 165) · ×1
  • Router.registerMessages (cognitive 165) internal/rpc/messages_register.go:15 — Router.registerMessages has cognitive complexity 165 (threshold 15). Drivers by points: if/else 87 (149 pts), boolean chains 14, loops 2 (nesting depth added 62). None of this is in the body itself: all 165 points belong to 7 function literals inside it that branch (lines 713, 493, 658, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · MessageStore.sendPrivateTextOnce (cognitive 143) · ×1
  • MessageStore.sendPrivateTextOnce (cognitive 143) internal/store/postgres/message_send.go:171 — MessageStore.sendPrivateTextOnce has cognitive complexity 143 (threshold 15). Drivers by points: if/else 90 (138 pts), boolean chains 5 (nesting depth added 48). Of this number, 142 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesForwardMessages (cognitive 133) · ×1
  • Router.onMessagesForwardMessages (cognitive 133) internal/rpc/messages_forward.go:13 — Router.onMessagesForwardMessages has cognitive complexity 133 (threshold 15). Drivers by points: if/else 57 (99 pts), loops 12 (21 pts), boolean chains 11, match/switch 1 (2 pts) (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · botapi.parseBotAPIMarkdownV2 (cognitive 124) · ×1
  • botapi.parseBotAPIMarkdownV2 (cognitive 124) internal/botapi/formatted_text.go:645 — botapi.parseBotAPIMarkdownV2 has cognitive complexity 124 (threshold 15). Drivers by points: if/else 34 (97 pts), boolean chains 16, loops 2 (6 pts), match/switch 2 (5 pts) (nesting depth added 70). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · config.Load (cognitive 116) · ×1
  • config.Load (cognitive 116) internal/config/config.go:958 — config.Load has cognitive complexity 116 (threshold 15). Drivers by points: if/else 72 (79 pts), boolean chains 36, match/switch 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · MessageStore.finishDeleteMessagesTx (cognitive 116) · ×1
  • MessageStore.finishDeleteMessagesTx (cognitive 116) internal/store/postgres/message_delete.go:168 — MessageStore.finishDeleteMessagesTx has cognitive complexity 116 (threshold 15). Drivers by points: if/else 37 (94 pts), loops 11 (15 pts), boolean chains 7 (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.
D2 · Cognitive Complexity · Router.resolveInputMedia (cognitive 111) · ×1
  • Router.resolveInputMedia (cognitive 111) internal/rpc/send_media.go:630 — Router.resolveInputMedia has cognitive complexity 111 (threshold 15). Drivers by points: if/else 44 (94 pts), boolean chains 7, loops 2 (5 pts), match/switch 2 (5 pts) (nesting depth added 56). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ChannelStore.sendChannelMessageOnce (cognitive 107) · ×1
  • ChannelStore.sendChannelMessageOnce (cognitive 107) internal/store/postgres/channel_message_send.go:51 — ChannelStore.sendChannelMessageOnce has cognitive complexity 107 (threshold 15). Drivers by points: if/else 59 (91 pts), boolean chains 13, match/switch 1 (3 pts) (nesting depth added 34). Of this number, 106 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.tgOtherUpdateFromEvent (cognitive 104) · ×1
  • rpc.tgOtherUpdateFromEvent (cognitive 104) internal/rpc/convert_updates.go:253 — rpc.tgOtherUpdateFromEvent has cognitive complexity 104 (threshold 15). Drivers by points: if/else 42 (85 pts), boolean chains 18, match/switch 1 (nesting depth added 43). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · StarGiftUpgradeStore.markPrivateStarGiftSourceUpgradedTx (cognitive 102) · ×1
  • StarGiftUpgradeStore.markPrivateStarGiftSourceUpgradedTx (cognitive 102) REDACTED:703 — StarGiftUpgradeStore.markPrivateStarGiftSourceUpgradedTx has cognitive complexity 102 (threshold 15). Drivers by points: if/else 38 (90 pts), boolean chains 9, loops 2 (3 pts) (nesting depth added 53). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ListChannelHistory (cognitive 95) · ×1
  • ChannelStore.ListChannelHistory (cognitive 95) internal/store/postgres/channel_message_history.go:14 — ChannelStore.ListChannelHistory has cognitive complexity 95 (threshold 15). Drivers by points: if/else 59 (84 pts), loops 4 (7 pts), boolean chains 3, match/switch 1 (nesting depth added 28). Of this number, 78 points are the body's own statements and 17 belong to 6 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loadharness.StartupRun (cognitive 94) · ×1
  • loadharness.StartupRun (cognitive 94) REDACTED:138 — loadharness.StartupRun has cognitive complexity 94 (threshold 15). Drivers by points: if/else 45 (72 pts), loops 10 (14 pts), match/switch 2 (5 pts), boolean chains 3 (nesting depth added 34). Of this number, 83 points are the body's own statements and 11 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ListChannelHistory (cognitive 94) · ×1
  • ChannelStore.ListChannelHistory (cognitive 94) internal/store/memory/channel_message_history.go:11 — ChannelStore.ListChannelHistory has cognitive complexity 94 (threshold 15). Drivers by points: if/else 37 (62 pts), boolean chains 26, loops 5, match/switch 1 (nesting depth added 25). Of this number, 73 points are the body's own statements and 21 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.EditMessage (cognitive 93) · ×1
  • MessageStore.EditMessage (cognitive 93) internal/store/postgres/message_edit.go:13 — MessageStore.EditMessage has cognitive complexity 93 (threshold 15). Drivers by points: if/else 50 (81 pts), boolean chains 9, loops 2 (3 pts) (nesting depth added 32). Of this number, 92 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.doFetch (cognitive 91) · ×1
  • main.doFetch (cognitive 91) cmd/appearancefetch/main.go:92 — main.doFetch has cognitive complexity 91 (threshold 15). Drivers by points: if/else 45 (74 pts), loops 6 (10 pts), match/switch 4 (5 pts), boolean chains 2 (nesting depth added 34). Of this number, 49 points are the body's own statements and 42 belong to 7 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.claimAuthLayerDefaultEvidenceLocked (cognitive 91) · ×1
  • Router.claimAuthLayerDefaultEvidenceLocked (cognitive 91) internal/rpc/layer_inheritance.go:196 — Router.claimAuthLayerDefaultEvidenceLocked has cognitive complexity 91 (threshold 15). Drivers by points: if/else 27 (69 pts), loops 8 (15 pts), boolean chains 7 (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionManager.pushToUserWithSender (cognitive 90) · ×1
  • SessionManager.pushToUserWithSender (cognitive 90) internal/mtprotoedge/session_manager.go:1874 — SessionManager.pushToUserWithSender has cognitive complexity 90 (threshold 15). Drivers by points: if/else 30 (79 pts), boolean chains 7, loops 3 (4 pts) (nesting depth added 50). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ChannelStore.GetChannelStats (cognitive 90) · ×1
  • ChannelStore.GetChannelStats (cognitive 90) internal/store/memory/channel_stats.go:12 — ChannelStore.GetChannelStats has cognitive complexity 90 (threshold 15). Drivers by points: if/else 24 (55 pts), loops 14 (20 pts), boolean chains 10, match/switch 2 (5 pts) (nesting depth added 40). Of this number, 88 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.EditChannelMessage (cognitive 90) · ×1
  • ChannelStore.EditChannelMessage (cognitive 90) internal/store/postgres/channel_message_edit.go:14 — ChannelStore.EditChannelMessage has cognitive complexity 90 (threshold 15). Drivers by points: if/else 55 (76 pts), boolean chains 14 (nesting depth added 21). Of this number, 89 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Server.serveConn (cognitive 89) · ×1
  • Server.serveConn (cognitive 89) internal/mtprotoedge/server.go:997 — Server.serveConn has cognitive complexity 89 (threshold 15). Drivers by points: if/else 32 (85 pts), boolean chains 3, loops 1 (nesting depth added 53). Of this number, 87 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · StarGiftLifecycleStore.CraftStarGift (cognitive 88) · ×1
  • StarGiftLifecycleStore.CraftStarGift (cognitive 88) internal/store/postgres/star_gift_craft_auction.go:276 — StarGiftLifecycleStore.CraftStarGift has cognitive complexity 88 (threshold 15). Drivers by points: if/else 44 (72 pts), boolean chains 11, loops 5 (nesting depth added 28). Of this number, 26 points are the body's own statements and 62 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.EditChannelMessage (cognitive 87) · ×1
  • ChannelStore.EditChannelMessage (cognitive 87) internal/store/memory/channel_message_edit.go:11 — ChannelStore.EditChannelMessage has cognitive complexity 87 (threshold 15). Drivers by points: if/else 30 (60 pts), boolean chains 16, loops 5 (11 pts) (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.
D2 · Cognitive Complexity · ChannelStore.SetDiscussionGroup (cognitive 87) · ×1
  • ChannelStore.SetDiscussionGroup (cognitive 87) internal/store/postgres/channel_settings.go:1121 — ChannelStore.SetDiscussionGroup has cognitive complexity 87 (threshold 15). Drivers by points: if/else 46 (71 pts), boolean chains 16 (nesting depth added 25). Of this number, 81 points are the body's own statements and 6 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.sweep (cognitive 85) · ×1
  • Service.sweep (cognitive 85) internal/app/donations/sweep.go:57 — Service.sweep has cognitive complexity 85 (threshold 15). Drivers by points: if/else 38 (78 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 41). Of this number, 69 points are the body's own statements and 16 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.GetChannelDialogs (cognitive 85) · ×1
  • ChannelStore.GetChannelDialogs (cognitive 85) REDACTED:755 — ChannelStore.GetChannelDialogs has cognitive complexity 85 (threshold 15). Drivers by points: if/else 34 (73 pts), loops 7 (8 pts), boolean chains 4 (nesting depth added 40). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Router.domainPollFromInputMedia (cognitive 84) · ×1
  • Router.domainPollFromInputMedia (cognitive 84) internal/rpc/convert_polls.go:37 — Router.domainPollFromInputMedia has cognitive complexity 84 (threshold 15). Drivers by points: if/else 33 (63 pts), boolean chains 12, loops 5 (7 pts), match/switch 1 (2 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CachedContactStore.ContactProjectionForViewers (cognitive 81) · ×1
  • CachedContactStore.ContactProjectionForViewers (cognitive 81) internal/app/userprojection/contact_cache.go:329 — CachedContactStore.ContactProjectionForViewers has cognitive complexity 81 (threshold 15). Drivers by points: if/else 17 (58 pts), loops 7 (18 pts), boolean chains 5 (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.ReadHistory (cognitive 81) · ×1
  • MessageStore.ReadHistory (cognitive 81) internal/store/memory/message_history.go:80 — MessageStore.ReadHistory has cognitive complexity 81 (threshold 15). Drivers by points: if/else 19 (55 pts), loops 6 (19 pts), boolean chains 7 (nesting depth added 49). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.domainInlineResultFromTG (cognitive 80) · ×1
  • Router.domainInlineResultFromTG (cognitive 80) internal/rpc/bots_inline.go:420 — Router.domainInlineResultFromTG has cognitive complexity 80 (threshold 15). Drivers by points: if/else 30 (77 pts), match/switch 2 (3 pts) (nesting depth added 48). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Router.dispatch (cognitive 80) · ×1
  • Router.dispatch (cognitive 80) internal/rpc/router.go:675 — Router.dispatch has cognitive complexity 80 (threshold 15). Drivers by points: if/else 32 (73 pts), boolean chains 4, loops 1 (2 pts), match/switch 1 (nesting depth added 42). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Service.CanSeeForViewerUserIDs (cognitive 77) · ×1
  • Service.CanSeeForViewerUserIDs (cognitive 77) internal/app/privacy/service_sparse.go:15 — Service.CanSeeForViewerUserIDs has cognitive complexity 77 (threshold 15). Drivers by points: if/else 21 (45 pts), loops 15 (27 pts), boolean chains 5 (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.
D2 · Cognitive Complexity · ChannelStore.ToggleSuggestedPostApproval (cognitive 77) · ×1
  • ChannelStore.ToggleSuggestedPostApproval (cognitive 77) internal/store/postgres/channel_suggested_post.go:29 — ChannelStore.ToggleSuggestedPostApproval has cognitive complexity 77 (threshold 15). Drivers by points: if/else 45 (65 pts), boolean chains 12 (nesting depth added 20). Of this number, 76 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StarGiftLifecycleStore.retireUserStarGiftMessagesTx (cognitive 77) · ×1
  • StarGiftLifecycleStore.retireUserStarGiftMessagesTx (cognitive 77) internal/store/postgres/star_gift_lifecycle_projection.go:20 — StarGiftLifecycleStore.retireUserStarGiftMessagesTx has cognitive complexity 77 (threshold 15). Drivers by points: if/else 29 (67 pts), boolean chains 5, loops 4 (5 pts) (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · richMessageMediaRefs.collectBlocks (cognitive 76) · ×1
  • richMessageMediaRefs.collectBlocks (cognitive 76) internal/rpc/convert_rich_message.go:87 — richMessageMediaRefs.collectBlocks has cognitive complexity 76 (threshold 15). Drivers by points: if/else 18 (64 pts), loops 4 (10 pts), match/switch 1 (2 pts) (nesting depth added 53). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · botapi.parseBotAPIHTML (cognitive 75) · ×1
  • botapi.parseBotAPIHTML (cognitive 75) internal/botapi/formatted_text.go:191 — botapi.parseBotAPIHTML has cognitive complexity 75 (threshold 15). Drivers by points: if/else 15 (59 pts), match/switch 2 (7 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 51). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ChannelStore.SearchJoinedMessages (cognitive 74) · ×1
  • ChannelStore.SearchJoinedMessages (cognitive 74) internal/store/memory/channel_message_history.go:227 — ChannelStore.SearchJoinedMessages has cognitive complexity 74 (threshold 15). Drivers by points: if/else 22 (49 pts), boolean chains 20, loops 4 (5 pts) (nesting depth added 28). Of this number, 72 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ActionExecutor.Execute (cognitive 73) · ×1
  • ActionExecutor.Execute (cognitive 73) internal/app/moderation/actions.go:112 — ActionExecutor.Execute has cognitive complexity 73 (threshold 15). Drivers by points: if/else 27 (61 pts), boolean chains 11, match/switch 1 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.listChannelDifferenceAttempt (cognitive 73) · ×1
  • ChannelStore.listChannelDifferenceAttempt (cognitive 73) internal/store/postgres/channel_updates.go:34 — ChannelStore.listChannelDifferenceAttempt has cognitive complexity 73 (threshold 15). Drivers by points: if/else 34 (54 pts), boolean chains 9, loops 5 (8 pts), match/switch 1 (2 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loadharness.Run (cognitive 70) · ×1
  • loadharness.Run (cognitive 70) REDACTED:738 — loadharness.Run has cognitive complexity 70 (threshold 15). Drivers by points: if/else 34 (44 pts), match/switch 4 (10 pts), loops 6 (8 pts), boolean chains 4, jumps 4 (nesting depth added 18). Of this number, 68 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Server.handleEncrypted (cognitive 70) · ×1
  • Server.handleEncrypted (cognitive 70) internal/mtprotoedge/encrypted.go:121 — Server.handleEncrypted has cognitive complexity 70 (threshold 15). Drivers by points: if/else 40 (66 pts), boolean chains 4 (nesting depth added 26). Of this number, 68 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StarGiftUpgradeStore.UpgradeStarGift (cognitive 70) · ×1
  • StarGiftUpgradeStore.UpgradeStarGift (cognitive 70) REDACTED:344 — StarGiftUpgradeStore.UpgradeStarGift has cognitive complexity 70 (threshold 15). Drivers by points: if/else 47 (57 pts), boolean chains 11, loops 1 (2 pts) (nesting depth added 11). Of this number, 16 points are the body's own statements and 54 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Service.VerifyLoginEmail (cognitive 69) · ×1
  • Service.VerifyLoginEmail (cognitive 69) internal/app/account/service.go:870 — Service.VerifyLoginEmail has cognitive complexity 69 (threshold 15). Drivers by points: if/else 36 (63 pts), boolean chains 6 (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.
D2 · Cognitive Complexity · Service.CanSeeMatrix (cognitive 69) · ×1
  • Service.CanSeeMatrix (cognitive 69) internal/app/privacy/service.go:351 — Service.CanSeeMatrix has cognitive complexity 69 (threshold 15). Drivers by points: if/else 21 (44 pts), loops 9 (19 pts), boolean chains 6 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loadharness.evaluateReport (cognitive 69) · ×1
  • loadharness.evaluateReport (cognitive 69) REDACTED:1201 — loadharness.evaluateReport has cognitive complexity 69 (threshold 15). Drivers by points: if/else 29 (49 pts), loops 8 (11 pts), boolean chains 9 (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.
D2 · Cognitive Complexity · ChannelStore.GetChannelStats (cognitive 69) · ×1
  • ChannelStore.GetChannelStats (cognitive 69) internal/store/postgres/channel_stats.go:12 — ChannelStore.GetChannelStats has cognitive complexity 69 (threshold 15). Drivers by points: if/else 38 (57 pts), loops 8 (9 pts), boolean chains 3 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · botapi.scanBotAPIHTMLTag (cognitive 68) · ×1
  • botapi.scanBotAPIHTMLTag (cognitive 68) internal/botapi/formatted_text.go:285 — botapi.scanBotAPIHTMLTag has cognitive complexity 68 (threshold 15). Drivers by points: if/else 19 (33 pts), loops 9 (18 pts), boolean chains 17 (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.
D2 · Cognitive Complexity · Server.prepareInboundRPCBatch (cognitive 68) · ×1
  • Server.prepareInboundRPCBatch (cognitive 68) internal/mtprotoedge/inbound_preflight.go:737 — Server.prepareInboundRPCBatch has cognitive complexity 68 (threshold 15). Drivers by points: if/else 22 (52 pts), loops 4 (7 pts), match/switch 2 (6 pts), 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.
D2 · Cognitive Complexity · ChannelStore.SetChannelMessageReactions (cognitive 68) · ×1
  • ChannelStore.SetChannelMessageReactions (cognitive 68) internal/store/postgres/channel_reaction_messages.go:11 — ChannelStore.SetChannelMessageReactions has cognitive complexity 68 (threshold 15). Drivers by points: if/else 34 (56 pts), loops 5 (7 pts), boolean chains 5 (nesting depth added 24). Of this number, 67 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StarGiftLifecycleStore.settleStarGiftAuction (cognitive 68) · ×1
  • StarGiftLifecycleStore.settleStarGiftAuction (cognitive 68) internal/store/postgres/star_gift_craft_auction.go:613 — StarGiftLifecycleStore.settleStarGiftAuction has cognitive complexity 68 (threshold 15). Drivers by points: if/else 26 (55 pts), boolean chains 7, loops 3 (6 pts) (nesting depth added 32). Most of this is not in the body itself: 2 of the 68 points are its own statements and the rest belongs to one function literal inside it that branches (line 617). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Server.seedInitialLayerProfile (cognitive 67) · ×1
  • Server.seedInitialLayerProfile (cognitive 67) internal/mtprotoedge/conn_layer_profile.go:306 — Server.seedInitialLayerProfile has cognitive complexity 67 (threshold 15). Drivers by points: if/else 31 (63 pts), boolean chains 4 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Router.onMessagesSendMultiMedia (cognitive 67) · ×1
  • Router.onMessagesSendMultiMedia (cognitive 67) internal/rpc/send_media.go:464 — Router.onMessagesSendMultiMedia has cognitive complexity 67 (threshold 15). Drivers by points: if/else 34 (56 pts), loops 6 (7 pts), boolean chains 4 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · domain.validateMarkupButton (cognitive 66) · ×1
  • domain.validateMarkupButton (cognitive 66) internal/domain/message_markup.go:298 — domain.validateMarkupButton has cognitive complexity 66 (threshold 15). Drivers by points: if/else 21 (50 pts), boolean chains 12, match/switch 3 (4 pts) (nesting depth added 30). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · StarGiftStore.ListByOwnerFiltered (cognitive 66) · ×1
  • StarGiftStore.ListByOwnerFiltered (cognitive 66) REDACTED:410 — StarGiftStore.ListByOwnerFiltered has cognitive complexity 66 (threshold 15). Drivers by points: if/else 24 (49 pts), boolean chains 15, loops 2 (nesting depth added 25). Of this number, 60 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · TelegramLoginRequest.Validate (cognitive 65) · ×1
  • TelegramLoginRequest.Validate (cognitive 65) internal/domain/telegram_login.go:236 — TelegramLoginRequest.Validate has cognitive complexity 65 (threshold 15). Drivers by points: if/else 27 (43 pts), boolean chains 19, loops 1 (2 pts), 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.
D2 · Cognitive Complexity · Router.onMessagesSendMedia (cognitive 65) · ×1
  • Router.onMessagesSendMedia (cognitive 65) internal/rpc/send_media.go:258 — Router.onMessagesSendMedia has cognitive complexity 65 (threshold 15). Drivers by points: if/else 40 (57 pts), boolean chains 5, match/switch 2 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.domainStoryMediaAreasFromTL (cognitive 65) · ×1
  • Router.domainStoryMediaAreasFromTL (cognitive 65) internal/rpc/stories.go:1671 — Router.domainStoryMediaAreasFromTL has cognitive complexity 65 (threshold 15). Drivers by points: if/else 22 (61 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (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.
D2 · Cognitive Complexity · MessageStore.finishMemoryDeleteLocked (cognitive 65) · ×1
  • MessageStore.finishMemoryDeleteLocked (cognitive 65) internal/store/memory/message_delete.go:53 — MessageStore.finishMemoryDeleteLocked has cognitive complexity 65 (threshold 15). Drivers by points: if/else 18 (46 pts), loops 9 (15 pts), boolean chains 4 (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.
D2 · Cognitive Complexity · Service.CreateAuthorization (cognitive 64) · ×1
  • Service.CreateAuthorization (cognitive 64) internal/app/telegramlogin/service.go:573 — Service.CreateAuthorization has cognitive complexity 64 (threshold 15). Drivers by points: if/else 35 (49 pts), boolean chains 15 (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.
D2 · Cognitive Complexity · Server.walkInbound (cognitive 64) · ×1
  • Server.walkInbound (cognitive 64) internal/mtprotoedge/inbound_preflight.go:337 — Server.walkInbound has cognitive complexity 64 (threshold 15). Drivers by points: if/else 33 (54 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.SendChannelMessage (cognitive 64) · ×1
  • ChannelStore.SendChannelMessage (cognitive 64) internal/store/memory/channel_message_send.go:13 — ChannelStore.SendChannelMessage has cognitive complexity 64 (threshold 15). Drivers by points: if/else 30 (44 pts), boolean chains 13, loops 2 (4 pts), match/switch 1 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.InviteToChannel (cognitive 64) · ×1
  • ChannelStore.InviteToChannel (cognitive 64) internal/store/postgres/channel_invite_members.go:10 — ChannelStore.InviteToChannel has cognitive complexity 64 (threshold 15). Drivers by points: if/else 30 (57 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 29). Of this number, 63 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.SendMonoforumMessage (cognitive 64) · ×1
  • ChannelStore.SendMonoforumMessage (cognitive 64) internal/store/postgres/channel_monoforum.go:20 — ChannelStore.SendMonoforumMessage has cognitive complexity 64 (threshold 15). Drivers by points: if/else 37 (52 pts), boolean chains 11, loops 1 (nesting depth added 15). Of this number, 63 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.ReadMessageContents (cognitive 64) · ×1
  • MessageStore.ReadMessageContents (cognitive 64) internal/store/postgres/message_read.go:14 — MessageStore.ReadMessageContents has cognitive complexity 64 (threshold 15). Drivers by points: if/else 34 (51 pts), loops 7 (8 pts), boolean chains 5 (nesting depth added 18). Of this number, 63 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.sendSingleSendMessage (cognitive 63) · ×1
  • Router.sendSingleSendMessage (cognitive 63) internal/rpc/messages_send.go:394 — Router.sendSingleSendMessage has cognitive complexity 63 (threshold 15). Drivers by points: if/else 39 (55 pts), boolean chains 6, match/switch 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.buildUserFullProjection (cognitive 63) · ×1
  • Router.buildUserFullProjection (cognitive 63) REDACTED:310 — Router.buildUserFullProjection has cognitive complexity 63 (threshold 15). Drivers by points: if/else 32 (57 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.listChannelDialogs (cognitive 63) · ×1
  • ChannelStore.listChannelDialogs (cognitive 63) REDACTED:50 — ChannelStore.listChannelDialogs has cognitive complexity 63 (threshold 15). Drivers by points: if/else 38 (52 pts), boolean chains 7, loops 3, match/switch 1 (nesting depth added 14). Of this number, 59 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.sendFromBot (cognitive 62) · ×1
  • Service.sendFromBot (cognitive 62) internal/app/ephemeral/service.go:159 — Service.sendFromBot has cognitive complexity 62 (threshold 15). Drivers by points: if/else 32 (47 pts), boolean chains 15 (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.
D2 · Cognitive Complexity · Server.executeInboundPlan (cognitive 62) · ×1
  • Server.executeInboundPlan (cognitive 62) internal/mtprotoedge/inbound_preflight.go:935 — Server.executeInboundPlan has cognitive complexity 62 (threshold 15). Drivers by points: if/else 20 (59 pts), match/switch 1 (2 pts), loops 1 (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.
D2 · Cognitive Complexity · Router.onMessagesEditMessage (cognitive 62) · ×1
  • Router.onMessagesEditMessage (cognitive 62) internal/rpc/messages_edit.go:11 — Router.onMessagesEditMessage has cognitive complexity 62 (threshold 15). Drivers by points: if/else 37 (50 pts), boolean chains 12 (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.
D2 · Cognitive Complexity · ChannelStore.populateChannelMessagesReactionsWhere (cognitive 62) · ×1
  • ChannelStore.populateChannelMessagesReactionsWhere (cognitive 62) internal/store/postgres/channel_reaction_helpers.go:52 — ChannelStore.populateChannelMessagesReactionsWhere has cognitive complexity 62 (threshold 15). Drivers by points: if/else 23 (43 pts), loops 10 (16 pts), boolean chains 3 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Server.commitLayerProfileEvidence (cognitive 61) · ×1
  • Server.commitLayerProfileEvidence (cognitive 61) internal/mtprotoedge/inbound_layer_rpc.go:1097 — Server.commitLayerProfileEvidence has cognitive complexity 61 (threshold 15). Drivers by points: if/else 24 (55 pts), boolean chains 6 (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Router.onMessagesToggleDialogPin (cognitive 61) · ×1
  • Router.onMessagesToggleDialogPin (cognitive 61) internal/rpc/messages_dialogs.go:600 — Router.onMessagesToggleDialogPin has cognitive complexity 61 (threshold 15). Drivers by points: if/else 29 (58 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · postgres.reconcileSeedWith (cognitive 61) · ×1
  • postgres.reconcileSeedWith (cognitive 61) internal/store/postgres/langpack.go:172 — postgres.reconcileSeedWith has cognitive complexity 61 (threshold 15). Drivers by points: if/else 25 (48 pts), loops 6 (8 pts), boolean chains 5 (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.
D2 · Cognitive Complexity · apiKeyboardButton.UnmarshalJSON (cognitive 60) · ×1
  • apiKeyboardButton.UnmarshalJSON (cognitive 60) internal/botapi/inline.go:549 — apiKeyboardButton.UnmarshalJSON has cognitive complexity 60 (threshold 15). Drivers by points: if/else 32 (50 pts), boolean chains 7, match/switch 1 (2 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.prepareTelegramLoginMarkup (cognitive 60) · ×1
  • Router.prepareTelegramLoginMarkup (cognitive 60) internal/rpc/convert_markup.go:41 — Router.prepareTelegramLoginMarkup has cognitive complexity 60 (threshold 15). Drivers by points: if/else 18 (48 pts), boolean chains 6, loops 4 (6 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StarGiftLifecycleStore.SweepStarGiftLifecycle (cognitive 60) · ×1
  • StarGiftLifecycleStore.SweepStarGiftLifecycle (cognitive 60) internal/store/postgres/star_gift_craft_auction.go:78 — StarGiftLifecycleStore.SweepStarGiftLifecycle has cognitive complexity 60 (threshold 15). Drivers by points: if/else 24 (47 pts), loops 6 (10 pts), boolean chains 3 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.peerIdentityMaps (cognitive 58) · ×1
  • Router.peerIdentityMaps (cognitive 58) internal/rpc/peer_identity_cache.go:114 — Router.peerIdentityMaps has cognitive complexity 58 (threshold 15). Drivers by points: if/else 20 (35 pts), boolean chains 15, loops 4 (8 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.SetChannelMessageReactions (cognitive 58) · ×1
  • ChannelStore.SetChannelMessageReactions (cognitive 58) internal/store/memory/channel_reactions.go:31 — ChannelStore.SetChannelMessageReactions has cognitive complexity 58 (threshold 15). Drivers by points: if/else 23 (37 pts), loops 8 (16 pts), boolean chains 5 (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.
D2 · Cognitive Complexity · Projector.ForViewerUserIDs (cognitive 57) · ×1
  • Projector.ForViewerUserIDs (cognitive 57) internal/app/userprojection/projection_sparse.go:34 — Projector.ForViewerUserIDs has cognitive complexity 57 (threshold 15). Drivers by points: if/else 18 (40 pts), loops 6 (9 pts), boolean chains 8 (nesting depth added 25). Of this number, 55 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Cache.GetOrLoadBatch (cognitive 57) · ×1
  • Cache.GetOrLoadBatch (cognitive 57) internal/readmodelcache/cache.go:319 — Cache.GetOrLoadBatch has cognitive complexity 57 (threshold 15). Drivers by points: if/else 14 (38 pts), loops 6 (15 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onChannelsGetSendAs (cognitive 57) · ×1
  • Router.onChannelsGetSendAs (cognitive 57) internal/rpc/channels_core.go:311 — Router.onChannelsGetSendAs has cognitive complexity 57 (threshold 15). Drivers by points: if/else 17 (44 pts), loops 2 (7 pts), boolean chains 6 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Router.requestedPeerDetails (cognitive 56) · ×1
  • Router.requestedPeerDetails (cognitive 56) internal/rpc/messages_bot_longtail.go:198 — Router.requestedPeerDetails has cognitive complexity 56 (threshold 15). Drivers by points: if/else 16 (42 pts), loops 6 (7 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CachedReadModelVersionStore.ReadModelHashes (cognitive 56) · ×1
  • CachedReadModelVersionStore.ReadModelHashes (cognitive 56) internal/store/read_model_cache.go:87 — CachedReadModelVersionStore.ReadModelHashes has cognitive complexity 56 (threshold 15). Drivers by points: if/else 16 (41 pts), loops 5 (9 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.tgSavedStarGifts (cognitive 55) · ×1
  • rpc.tgSavedStarGifts (cognitive 55) internal/rpc/payments_star_gifts.go:1721 — rpc.tgSavedStarGifts has cognitive complexity 55 (threshold 15). Drivers by points: if/else 21 (44 pts), boolean chains 10, loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.PublishAdmittedLayerProfileEvidence (cognitive 55) · ×1
  • Router.PublishAdmittedLayerProfileEvidence (cognitive 55) internal/rpc/layer_inheritance.go:41 — Router.PublishAdmittedLayerProfileEvidence has cognitive complexity 55 (threshold 15). Drivers by points: if/else 29 (43 pts), boolean chains 10, match/switch 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.DeleteChannelHistory (cognitive 55) · ×1
  • ChannelStore.DeleteChannelHistory (cognitive 55) internal/store/postgres/channel_message_delete.go:196 — ChannelStore.DeleteChannelHistory has cognitive complexity 55 (threshold 15). Drivers by points: if/else 29 (47 pts), boolean chains 4, match/switch 1 (3 pts), loops 1 (nesting depth added 20). Of this number, 54 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GroupCallStore.RemoveConferenceCallParticipants (cognitive 55) · ×1
  • GroupCallStore.RemoveConferenceCallParticipants (cognitive 55) internal/store/postgres/groupcall.go:407 — GroupCallStore.RemoveConferenceCallParticipants has cognitive complexity 55 (threshold 15). Drivers by points: if/else 28 (49 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 22). Of this number, 54 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StarGiftLifecycleStore.PurchaseResaleStarGift (cognitive 55) · ×1
  • StarGiftLifecycleStore.PurchaseResaleStarGift (cognitive 55) internal/store/postgres/star_gift_lifecycle.go:524 — StarGiftLifecycleStore.PurchaseResaleStarGift has cognitive complexity 55 (threshold 15). Drivers by points: if/else 38 (45 pts), boolean chains 10 (nesting depth added 7). Most of this is not in the body itself: 15 of the 55 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 659, 573). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Service.CanSeeBatch (cognitive 54) · ×1
  • Service.CanSeeBatch (cognitive 54) internal/app/privacy/service.go:183 — Service.CanSeeBatch has cognitive complexity 54 (threshold 15). Drivers by points: if/else 19 (37 pts), loops 8 (13 pts), boolean chains 4 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.tgChannelMessage (cognitive 53) · ×1
  • rpc.tgChannelMessage (cognitive 53) internal/rpc/convert_channels_core.go:80 — rpc.tgChannelMessage has cognitive complexity 53 (threshold 15). Drivers by points: if/else 32 (41 pts), boolean chains 8, match/switch 1 (4 pts) (nesting depth added 12). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Router.onMessagesGetMessageReactionsList (cognitive 53) · ×1
  • Router.onMessagesGetMessageReactionsList (cognitive 53) internal/rpc/messages_reactions_lists.go:152 — Router.onMessagesGetMessageReactionsList has cognitive complexity 53 (threshold 15). Drivers by points: if/else 21 (41 pts), boolean chains 8, loops 2 (4 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ListChannelDifference (cognitive 53) · ×1
  • ChannelStore.ListChannelDifference (cognitive 53) internal/store/memory/channel_updates.go:13 — ChannelStore.ListChannelDifference has cognitive complexity 53 (threshold 15). Drivers by points: if/else 19 (35 pts), boolean chains 9, loops 5 (7 pts), match/switch 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · channelFanoutDispatcher.Run (cognitive 52) · ×1
  • channelFanoutDispatcher.Run (cognitive 52) internal/rpc/channel_fanout_dispatcher.go:461 — channelFanoutDispatcher.Run has cognitive complexity 52 (threshold 15). Drivers by points: if/else 13 (31 pts), loops 6 (9 pts), match/switch 3 (9 pts), boolean chains 2, jumps 1 (nesting depth added 27). Most of this is not in the body itself: 11 of the 52 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 482, 512). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · CommunityStore.viewLocked (cognitive 52) · ×1
  • CommunityStore.viewLocked (cognitive 52) internal/store/memory/community.go:95 — CommunityStore.viewLocked has cognitive complexity 52 (threshold 15). Drivers by points: if/else 17 (35 pts), loops 5 (9 pts), boolean chains 8 (nesting depth added 22). Of this number, 50 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.readHistoryOnce (cognitive 52) · ×1
  • MessageStore.readHistoryOnce (cognitive 52) internal/store/postgres/message_history.go:302 — MessageStore.readHistoryOnce has cognitive complexity 52 (threshold 15). Drivers by points: if/else 33 (49 pts), boolean chains 3 (nesting depth added 16). Of this number, 51 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.ImportContacts (cognitive 51) · ×1
  • Service.ImportContacts (cognitive 51) internal/app/contacts/service.go:220 — Service.ImportContacts has cognitive complexity 51 (threshold 15). Drivers by points: if/else 19 (34 pts), loops 8 (11 pts), boolean chains 6 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.ManualPurge (cognitive 51) · ×1
  • Service.ManualPurge (cognitive 51) internal/app/files/retention.go:354 — Service.ManualPurge has cognitive complexity 51 (threshold 15). Drivers by points: if/else 13 (32 pts), loops 7 (18 pts), boolean chains 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UserStore.claimOfficialUsernameOnce (cognitive 51) · ×1
  • UserStore.claimOfficialUsernameOnce (cognitive 51) internal/store/postgres/user.go:332 — UserStore.claimOfficialUsernameOnce has cognitive complexity 51 (threshold 15). Drivers by points: if/else 32 (40 pts), boolean chains 9, loops 2 (nesting depth added 8). Of this number, 49 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Service.applyTelegramLoginConfiguration (cognitive 50) · ×1
  • Service.applyTelegramLoginConfiguration (cognitive 50) internal/app/bots/botfather.go:883 — Service.applyTelegramLoginConfiguration has cognitive complexity 50 (threshold 15). Drivers by points: if/else 21 (40 pts), boolean chains 8, match/switch 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RetentionWorker.runRetentionOnce (cognitive 50) · ×1
  • RetentionWorker.runRetentionOnce (cognitive 50) internal/app/maintenance/retention.go:424 — RetentionWorker.runRetentionOnce has cognitive complexity 50 (threshold 15). Drivers by points: if/else 35 (49 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CachedContactStore.ContactProjectionForViewerUserIDs (cognitive 50) · ×1
  • CachedContactStore.ContactProjectionForViewerUserIDs (cognitive 50) internal/app/userprojection/contact_cache_sparse.go:16 — CachedContactStore.ContactProjectionForViewerUserIDs has cognitive complexity 50 (threshold 15). Drivers by points: if/else 16 (44 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.collectRichMessageBlockMetrics (cognitive 50) · ×1
  • rpc.collectRichMessageBlockMetrics (cognitive 50) internal/rpc/rich_message_limits.go:38 — rpc.collectRichMessageBlockMetrics has cognitive complexity 50 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 6 (17 pts), match/switch 3 (10 pts), boolean chains 2 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.BuildOutboxUpdates (cognitive 50) · ×1
  • Router.BuildOutboxUpdates (cognitive 50) internal/rpc/outbox_update_builder.go:26 — Router.BuildOutboxUpdates has cognitive complexity 50 (threshold 15). Drivers by points: if/else 13 (31 pts), loops 10 (18 pts), boolean chains 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onPaymentsGetResaleStarGifts (cognitive 50) · ×1
  • Router.onPaymentsGetResaleStarGifts (cognitive 50) internal/rpc/payments_star_gift_lifecycle.go:489 — Router.onPaymentsGetResaleStarGifts has cognitive complexity 50 (threshold 15). Drivers by points: if/else 14 (28 pts), loops 5 (15 pts), boolean chains 4, match/switch 1 (3 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onPaymentsSendStarsForm (cognitive 50) · ×1
  • Router.onPaymentsSendStarsForm (cognitive 50) internal/rpc/payments_star_gifts.go:568 — Router.onPaymentsSendStarsForm has cognitive complexity 50 (threshold 15). Drivers by points: if/else 32 (41 pts), boolean chains 8, match/switch 1 (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · postgres.persistPlainPrivateSendProjectionBatch (cognitive 50) · ×1
  • postgres.persistPlainPrivateSendProjectionBatch (cognitive 50) internal/store/postgres/message_send_batch_sql.go:146 — postgres.persistPlainPrivateSendProjectionBatch has cognitive complexity 50 (threshold 15). Drivers by points: if/else 23 (42 pts), boolean chains 6, loops 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.SetPaidMessagesPrice (cognitive 50) · ×1
  • ChannelStore.SetPaidMessagesPrice (cognitive 50) internal/store/postgres/channel_message_settings.go:78 — ChannelStore.SetPaidMessagesPrice has cognitive complexity 50 (threshold 15). Drivers by points: if/else 22 (41 pts), boolean chains 9 (nesting depth added 19). Most of this is not in the body itself: 4 of the 50 points are its own statements and the rest belongs to one function literal inside it that branches (line 84). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · StarGiftLifecycleStore.dispatchStarGiftAuctionAwards (cognitive 50) · ×1
  • StarGiftLifecycleStore.dispatchStarGiftAuctionAwards (cognitive 50) internal/store/postgres/star_gift_craft_auction.go:804 — StarGiftLifecycleStore.dispatchStarGiftAuctionAwards has cognitive complexity 50 (threshold 15). Drivers by points: if/else 16 (44 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 30). Of this number, 34 points are the body's own statements and 16 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.importDocument (cognitive 49) · ×1
  • Service.importDocument (cognitive 49) internal/app/files/seed.go:406 — Service.importDocument has cognitive complexity 49 (threshold 15). Drivers by points: if/else 23 (47 pts), boolean chains 1, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loadharness.applyOfflineChannelActions (cognitive 49) · ×1
  • loadharness.applyOfflineChannelActions (cognitive 49) internal/loadharness/mutate.go:347 — loadharness.applyOfflineChannelActions has cognitive complexity 49 (threshold 15). Drivers by points: if/else 21 (45 pts), boolean chains 4 (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.
D2 · Cognitive Complexity · rpcRewrapAlias.activate (cognitive 49) · ×1
  • rpcRewrapAlias.activate (cognitive 49) internal/mtprotoedge/rpc_rewrap.go:855 — rpcRewrapAlias.activate has cognitive complexity 49 (threshold 15). Drivers by points: if/else 26 (42 pts), boolean chains 7 (nesting depth added 16). Most of this is not in the body itself: 10 of the 49 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 872, 865). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · rpc.tgMessageMedia (cognitive 49) · ×1
  • rpc.tgMessageMedia (cognitive 49) internal/rpc/convert_media.go:17 — rpc.tgMessageMedia has cognitive complexity 49 (threshold 15). Drivers by points: if/else 24 (47 pts), boolean chains 1, match/switch 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OutboxDispatcher.dispatchBatch (cognitive 49) · ×1
  • OutboxDispatcher.dispatchBatch (cognitive 49) internal/rpc/outbox_dispatcher.go:282 — OutboxDispatcher.dispatchBatch has cognitive complexity 49 (threshold 15). Drivers by points: if/else 18 (37 pts), loops 9 (12 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.SetDiscussionGroup (cognitive 49) · ×1
  • ChannelStore.SetDiscussionGroup (cognitive 49) internal/store/memory/channel_settings.go:708 — ChannelStore.SetDiscussionGroup has cognitive complexity 49 (threshold 15). Drivers by points: if/else 25 (37 pts), boolean chains 12 (nesting depth added 12). Of this number, 45 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.EditMessage (cognitive 49) · ×1
  • MessageStore.EditMessage (cognitive 49) internal/store/memory/message_edit.go:10 — MessageStore.EditMessage has cognitive complexity 49 (threshold 15). Drivers by points: if/else 17 (33 pts), boolean chains 10, loops 4 (6 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.GetChannels (cognitive 49) · ×1
  • ChannelStore.GetChannels (cognitive 49) internal/store/postgres/channel_core.go:342 — ChannelStore.GetChannels has cognitive complexity 49 (threshold 15). Drivers by points: if/else 23 (38 pts), loops 7, boolean chains 4 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.SignUp (cognitive 48) · ×1
  • Service.SignUp (cognitive 48) internal/app/auth/service.go:1281 — Service.SignUp has cognitive complexity 48 (threshold 15). Drivers by points: if/else 33 (38 pts), boolean chains 10 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SessionManager.runFlush (cognitive 48) · ×1
  • SessionManager.runFlush (cognitive 48) internal/mtprotoedge/session_manager.go:1242 — SessionManager.runFlush has cognitive complexity 48 (threshold 15). Drivers by points: if/else 15 (42 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.resolveChannelReply (cognitive 48) · ×1
  • ChannelStore.resolveChannelReply (cognitive 48) internal/store/postgres/channel_helpers.go:808 — ChannelStore.resolveChannelReply has cognitive complexity 48 (threshold 15). Drivers by points: if/else 21 (34 pts), boolean chains 12, match/switch 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.DeleteHistory (cognitive 48) · ×1
  • MessageStore.DeleteHistory (cognitive 48) internal/store/postgres/message_history.go:497 — MessageStore.DeleteHistory has cognitive complexity 48 (threshold 15). Drivers by points: if/else 28 (42 pts), boolean chains 6 (nesting depth added 14). Of this number, 47 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memory.upsertMemoryDialog (cognitive 47) · ×1
  • memory.upsertMemoryDialog (cognitive 47) internal/store/memory/dialogs.go:681 — memory.upsertMemoryDialog has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (44 pts), boolean chains 2, loops 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.EditChannelAdmin (cognitive 47) · ×1
  • ChannelStore.EditChannelAdmin (cognitive 47) internal/store/postgres/channel_member_admin.go:10 — ChannelStore.EditChannelAdmin has cognitive complexity 47 (threshold 15). Drivers by points: if/else 33 (43 pts), boolean chains 4 (nesting depth added 10). Of this number, 46 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Service.chatBotPromptText (cognitive 46) · ×1
  • Service.chatBotPromptText (cognitive 46) internal/app/bots/chatbot.go:116 — Service.chatBotPromptText has cognitive complexity 46 (threshold 15). Drivers by points: if/else 11 (38 pts), boolean chains 5, loops 1 (3 pts) (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · botapi.apiUpdate (cognitive 46) · ×1
  • botapi.apiUpdate (cognitive 46) internal/botapi/projection.go:87 — botapi.apiUpdate has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (39 pts), boolean chains 4, loops 1 (2 pts), match/switch 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · botapi.apiReplyMarkup (cognitive 46) · ×1
  • botapi.apiReplyMarkup (cognitive 46) internal/botapi/projection.go:486 — botapi.apiReplyMarkup has cognitive complexity 46 (threshold 15). Drivers by points: if/else 10 (25 pts), match/switch 3 (13 pts), loops 3 (8 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loadharness.mergeDialogPageKnownOverlap (cognitive 46) · ×1
  • loadharness.mergeDialogPageKnownOverlap (cognitive 46) internal/loadharness/snapshot.go:401 — loadharness.mergeDialogPageKnownOverlap has cognitive complexity 46 (threshold 15). Drivers by points: if/else 16 (35 pts), boolean chains 7, loops 4 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onUsersGetUsers (cognitive 46) · ×1
  • Router.onUsersGetUsers (cognitive 46) REDACTED:42 — Router.onUsersGetUsers has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (37 pts), loops 3 (4 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memory.filterMessageList (cognitive 46) · ×1
  • memory.filterMessageList (cognitive 46) internal/store/memory/message_history.go:295 — memory.filterMessageList has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (33 pts), boolean chains 11, loops 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.
D2 · Cognitive Complexity · ChannelStore.loadChannelDifferenceBase (cognitive 46) · ×1
  • ChannelStore.loadChannelDifferenceBase (cognitive 46) internal/store/postgres/channel_updates.go:202 — ChannelStore.loadChannelDifferenceBase has cognitive complexity 46 (threshold 15). Drivers by points: if/else 21 (41 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TelegramLoginStore.ApproveTelegramLoginRequest (cognitive 46) · ×1
  • TelegramLoginStore.ApproveTelegramLoginRequest (cognitive 46) internal/store/postgres/telegram_login.go:523 — TelegramLoginStore.ApproveTelegramLoginRequest has cognitive complexity 46 (threshold 15). Drivers by points: if/else 32 (41 pts), boolean chains 5 (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Catalog.validateApps (cognitive 46) · ×1
  • Catalog.validateApps (cognitive 46) internal/updatecdn/catalog.go:214 — Catalog.validateApps has cognitive complexity 46 (threshold 15). Drivers by points: if/else 11 (36 pts), loops 4 (9 pts), boolean chains 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.createStickerSet (cognitive 45) · ×1
  • Service.createStickerSet (cognitive 45) internal/app/files/sticker_creator.go:81 — Service.createStickerSet has cognitive complexity 45 (threshold 15). Drivers by points: if/else 24 (39 pts), boolean chains 4, 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.
D2 · Cognitive Complexity · botapi.apiRequestedPeer (cognitive 45) · ×1
  • botapi.apiRequestedPeer (cognitive 45) internal/botapi/projection.go:856 — botapi.apiRequestedPeer has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (31 pts), boolean chains 10, loops 3 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · botapi.requestValuesWithFiles (cognitive 45) · ×1
  • botapi.requestValuesWithFiles (cognitive 45) internal/botapi/server.go:1280 — botapi.requestValuesWithFiles has cognitive complexity 45 (threshold 15). Drivers by points: if/else 15 (35 pts), loops 4 (7 pts), match/switch 1 (3 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · apiInlineKeyboardButton.UnmarshalJSON (cognitive 45) · ×1
  • apiInlineKeyboardButton.UnmarshalJSON (cognitive 45) internal/botapi/inline.go:726 — apiInlineKeyboardButton.UnmarshalJSON has cognitive complexity 45 (threshold 15). Drivers by points: if/else 27 (41 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Conn.handleOutboundSend (cognitive 45) · ×1
  • Conn.handleOutboundSend (cognitive 45) internal/mtprotoedge/outbound.go:2260 — Conn.handleOutboundSend has cognitive complexity 45 (threshold 15). Drivers by points: if/else 27 (38 pts), boolean chains 7 (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.
D2 · Cognitive Complexity · Router.sendOutgoing (cognitive 45) · ×1
  • Router.sendOutgoing (cognitive 45) internal/rpc/send_media.go:56 — Router.sendOutgoing has cognitive complexity 45 (threshold 15). Drivers by points: if/else 25 (39 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.buildEmojiStickerIndex (cognitive 45) · ×1
  • Router.buildEmojiStickerIndex (cognitive 45) internal/rpc/stickers_emoji_index.go:147 — Router.buildEmojiStickerIndex has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (34 pts), loops 4 (10 pts), boolean chains 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.GetChannelMessageViews (cognitive 45) · ×1
  • ChannelStore.GetChannelMessageViews (cognitive 45) internal/store/memory/channel_message_views.go:9 — ChannelStore.GetChannelMessageViews has cognitive complexity 45 (threshold 15). Drivers by points: if/else 19 (36 pts), loops 5, 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.
D2 · Cognitive Complexity · ChannelStore.populateChannelMessageReplies (cognitive 45) · ×1
  • ChannelStore.populateChannelMessageReplies (cognitive 45) internal/store/postgres/channel_topics.go:722 — ChannelStore.populateChannelMessageReplies has cognitive complexity 45 (threshold 15). Drivers by points: if/else 13 (30 pts), loops 6 (12 pts), boolean chains 3 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · files.parsePremiumPromoSeed (cognitive 44) · ×1
  • files.parsePremiumPromoSeed (cognitive 44) internal/app/files/premium_promo_seed.go:219 — files.parsePremiumPromoSeed has cognitive complexity 44 (threshold 15). Drivers by points: if/else 21 (38 pts), boolean chains 5, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · botapi.parseBotAPIMarkdown (cognitive 44) · ×1
  • botapi.parseBotAPIMarkdown (cognitive 44) internal/botapi/formatted_text.go:521 — botapi.parseBotAPIMarkdown has cognitive complexity 44 (threshold 15). Drivers by points: if/else 12 (29 pts), loops 3 (7 pts), boolean chains 6, match/switch 1 (2 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.tgUpdatesDifference (cognitive 44) · ×1
  • rpc.tgUpdatesDifference (cognitive 44) internal/rpc/convert_updates.go:12 — rpc.tgUpdatesDifference has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (38 pts), boolean chains 2, loops 2, match/switch 1 (2 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.messageReplyFromInput (cognitive 44) · ×1
  • Router.messageReplyFromInput (cognitive 44) internal/rpc/messages_send.go:632 — Router.messageReplyFromInput has cognitive complexity 44 (threshold 15). Drivers by points: if/else 22 (33 pts), boolean chains 9, match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StarGiftUpgradeStore.GrantUniqueStarGift (cognitive 44) · ×1
  • StarGiftUpgradeStore.GrantUniqueStarGift (cognitive 44) REDACTED:53 — StarGiftUpgradeStore.GrantUniqueStarGift has cognitive complexity 44 (threshold 15). Drivers by points: if/else 33 (40 pts), boolean chains 4 (nesting depth added 7). Of this number, 16 points are the body's own statements and 28 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Service.GiveStarGift (cognitive 43) · ×1
  • Service.GiveStarGift (cognitive 43) internal/admin/star_gift_catalog.go:456 — Service.GiveStarGift has cognitive complexity 43 (threshold 15). Drivers by points: if/else 26 (35 pts), boolean chains 8 (nesting depth added 9). Most of this is not in the body itself: 14 of the 43 points are its own statements and the rest belongs to one function literal inside it that branches (line 489). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Service.validateDecisionActions (cognitive 43) · ×1
  • Service.validateDecisionActions (cognitive 43) internal/app/moderation/actions.go:248 — Service.validateDecisionActions has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (34 pts), boolean chains 6, match/switch 1 (2 pts), loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loadharness.catchUpStartupChannel (cognitive 43) · ×1
  • loadharness.catchUpStartupChannel (cognitive 43) REDACTED:745 — loadharness.catchUpStartupChannel has cognitive complexity 43 (threshold 15). Drivers by points: if/else 18 (36 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · files.parseWebPageMeta (cognitive 42) · ×1
  • files.parseWebPageMeta (cognitive 42) internal/app/files/webpage.go:390 — files.parseWebPageMeta has cognitive complexity 42 (threshold 15). Drivers by points: if/else 7 (25 pts), match/switch 4 (12 pts), jumps 3, boolean chains 1, loops 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.seedEmojiGroupIcons (cognitive 42) · ×1
  • Service.seedEmojiGroupIcons (cognitive 42) internal/app/files/emoji_group_icons_seed.go:43 — Service.seedEmojiGroupIcons has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (34 pts), loops 3 (5 pts), boolean chains 3 (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.
D2 · Cognitive Complexity · Service.resolveTexts (cognitive 42) · ×1
  • Service.resolveTexts (cognitive 42) internal/app/translation/service.go:171 — Service.resolveTexts has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (29 pts), loops 5 (9 pts), boolean chains 3, match/switch 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.forumTopicsResponse (cognitive 42) · ×1
  • Router.forumTopicsResponse (cognitive 42) internal/rpc/messages_forum.go:411 — Router.forumTopicsResponse has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (29 pts), loops 5 (11 pts), boolean chains 2 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Service.verifyPasswordRecoveryCode (cognitive 41) · ×1
  • Service.verifyPasswordRecoveryCode (cognitive 41) internal/app/account/service.go:631 — Service.verifyPasswordRecoveryCode has cognitive complexity 41 (threshold 15). Drivers by points: if/else 18 (38 pts), boolean chains 2, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · userprojection.projectBatch (cognitive 41) · ×1
  • userprojection.projectBatch (cognitive 41) internal/app/userprojection/projection.go:366 — userprojection.projectBatch has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (35 pts), boolean chains 5, loops 1 (nesting depth added 16). Of this number, 25 points are the body's own statements and 16 belong to 7 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Server.decodeInboundLayerRPCWithOptions (cognitive 41) · ×1
  • Server.decodeInboundLayerRPCWithOptions (cognitive 41) internal/mtprotoedge/inbound_layer_rpc.go:994 — Server.decodeInboundLayerRPCWithOptions has cognitive complexity 41 (threshold 15). Drivers by points: if/else 24 (34 pts), boolean chains 7 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.tgMessageServiceAction (cognitive 41) · ×1
  • rpc.tgMessageServiceAction (cognitive 41) internal/rpc/convert_messages.go:134 — rpc.tgMessageServiceAction has cognitive complexity 41 (threshold 15). Drivers by points: if/else 18 (36 pts), boolean chains 4, match/switch 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.storyViewUserIDs (cognitive 41) · ×1
  • rpc.storyViewUserIDs (cognitive 41) internal/rpc/story_peer_projection.go:323 — rpc.storyViewUserIDs has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (37 pts), boolean chains 3, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.resolveBotCallbackQuery (cognitive 41) · ×1
  • Router.resolveBotCallbackQuery (cognitive 41) internal/rpc/bots_callback.go:164 — Router.resolveBotCallbackQuery has cognitive complexity 41 (threshold 15). Drivers by points: if/else 20 (34 pts), boolean chains 7 (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.
D2 · Cognitive Complexity · Router.onEditMessageLiveLocation (cognitive 41) · ×1
  • Router.onEditMessageLiveLocation (cognitive 41) internal/rpc/messages_edit_geolive.go:16 — Router.onEditMessageLiveLocation has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21 (34 pts), boolean chains 7 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.forwardSources (cognitive 41) · ×1
  • Router.forwardSources (cognitive 41) internal/rpc/messages_forward.go:617 — Router.forwardSources has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (32 pts), boolean chains 4, loops 2 (4 pts), match/switch 1 (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Router.accountChannelDifferenceNudges (cognitive 41) · ×1
  • Router.accountChannelDifferenceNudges (cognitive 41) internal/rpc/updates.go:182 — Router.accountChannelDifferenceNudges has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (30 pts), loops 4 (9 pts), boolean chains 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onUsersGetRequirementsToContact (cognitive 41) · ×1
  • Router.onUsersGetRequirementsToContact (cognitive 41) REDACTED:600 — Router.onUsersGetRequirementsToContact has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (24 pts), loops 5 (7 pts), boolean chains 6, match/switch 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ListChannelDialogs (cognitive 41) · ×1
  • ChannelStore.ListChannelDialogs (cognitive 41) internal/store/memory/channel_dialogs.go:10 — ChannelStore.ListChannelDialogs has cognitive complexity 41 (threshold 15). Drivers by points: if/else 18 (31 pts), boolean chains 5, loops 5 (nesting depth added 13). Of this number, 37 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.sendPrivateTextLocked (cognitive 41) · ×1
  • MessageStore.sendPrivateTextLocked (cognitive 41) internal/store/memory/message_send.go:74 — MessageStore.sendPrivateTextLocked has cognitive complexity 41 (threshold 15). Drivers by points: if/else 24 (30 pts), loops 4 (6 pts), boolean chains 5 (nesting depth added 8). Of this number, 35 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Service.handleChooseBot (cognitive 40) · ×1
  • Service.handleChooseBot (cognitive 40) internal/app/bots/botfather.go:466 — Service.handleChooseBot has cognitive complexity 40 (threshold 15). Drivers by points: if/else 18 (35 pts), match/switch 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.ReportMessages (cognitive 40) · ×1
  • Service.ReportMessages (cognitive 40) internal/app/moderation/evidence.go:41 — Service.ReportMessages has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 4 (8 pts), boolean chains 4, match/switch 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Projector.ForViewers (cognitive 40) · ×1
  • Projector.ForViewers (cognitive 40) internal/app/userprojection/projection.go:126 — Projector.ForViewers has cognitive complexity 40 (threshold 15). Drivers by points: if/else 13 (27 pts), loops 4 (7 pts), boolean chains 6 (nesting depth added 17). Of this number, 37 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · botapi.apiMessageMedia (cognitive 40) · ×1
  • botapi.apiMessageMedia (cognitive 40) internal/botapi/projection.go:567 — botapi.apiMessageMedia has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (34 pts), loops 1 (3 pts), match/switch 2 (3 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.forwardMessagesToMonoforum (cognitive 40) · ×1
  • Router.forwardMessagesToMonoforum (cognitive 40) internal/rpc/messages_forward.go:349 — Router.forwardMessagesToMonoforum has cognitive complexity 40 (threshold 15). Drivers by points: if/else 20 (30 pts), loops 5 (6 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesSearchGlobal (cognitive 40) · ×1
  • Router.onMessagesSearchGlobal (cognitive 40) internal/rpc/messages_history.go:589 — Router.onMessagesSearchGlobal has cognitive complexity 40 (threshold 15). Drivers by points: if/else 21 (28 pts), boolean chains 12 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ReadChannelMessageContents (cognitive 40) · ×1
  • ChannelStore.ReadChannelMessageContents (cognitive 40) internal/store/memory/channel_read.go:52 — ChannelStore.ReadChannelMessageContents has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 7 (10 pts), boolean chains 5 (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.
D2 · Cognitive Complexity · CommunityStore.ToggleCommunityParticipantBanned (cognitive 40) · ×1
  • CommunityStore.ToggleCommunityParticipantBanned (cognitive 40) internal/store/memory/community.go:697 — CommunityStore.ToggleCommunityParticipantBanned has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (30 pts), boolean chains 9, loops 1 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ChannelStore.EditChannelBanned (cognitive 40) · ×1
  • ChannelStore.EditChannelBanned (cognitive 40) internal/store/postgres/channel_member_admin.go:369 — ChannelStore.EditChannelBanned has cognitive complexity 40 (threshold 15). Drivers by points: if/else 27 (34 pts), boolean chains 5, match/switch 1 (nesting depth added 7). Of this number, 39 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · MessageStore.PinPrivateMessage (cognitive 40) · ×1
  • MessageStore.PinPrivateMessage (cognitive 40) internal/store/postgres/message_pin.go:25 — MessageStore.PinPrivateMessage has cognitive complexity 40 (threshold 15). Drivers by points: if/else 23 (32 pts), boolean chains 7, loops 1 (nesting depth added 9). Of this number, 39 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StarGiftLifecycleStore.SetStarGiftListing (cognitive 40) · ×1
  • StarGiftLifecycleStore.SetStarGiftListing (cognitive 40) internal/store/postgres/star_gift_lifecycle.go:320 — StarGiftLifecycleStore.SetStarGiftListing has cognitive complexity 40 (threshold 15). Drivers by points: if/else 21 (33 pts), boolean chains 6, match/switch 1 (nesting depth added 12). Most of this is not in the body itself: 6 of the 40 points are its own statements and the rest belongs to one function literal inside it that branches (line 325). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Service.composeStreamWithProviders (cognitive 39) · ×1
  • Service.composeStreamWithProviders (cognitive 39) internal/app/ai/service.go:485 — Service.composeStreamWithProviders has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (34 pts), boolean chains 4, loops 1 (nesting depth added 21). Of this number, 36 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Service.ensureStickerMaterialShape (cognitive 39) · ×1
  • Service.ensureStickerMaterialShape (cognitive 39) internal/app/files/sticker_creator.go:305 — Service.ensureStickerMaterialShape has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (32 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · giftpack.ParseManifest (cognitive 39) · ×1
  • giftpack.ParseManifest (cognitive 39) internal/app/giftpack/manifest.go:89 — giftpack.ParseManifest has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (28 pts), loops 4 (8 pts), boolean chains 3 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · config.validateLoginEmailConfig (cognitive 39) · ×1
  • config.validateLoginEmailConfig (cognitive 39) internal/config/config.go:2023 — config.validateLoginEmailConfig has cognitive complexity 39 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 13, match/switch 3, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · rpcExecutionLedger.acquire (cognitive 39) · ×1
  • rpcExecutionLedger.acquire (cognitive 39) internal/mtprotoedge/rpc_flight.go:538 — rpcExecutionLedger.acquire has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (37 pts), boolean chains 1, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Server.publishRPCResult (cognitive 39) · ×1
  • Server.publishRPCResult (cognitive 39) internal/mtprotoedge/encrypted.go:880 — Server.publishRPCResult has cognitive complexity 39 (threshold 15). Drivers by points: if/else 26 (32 pts), boolean chains 7 (nesting depth added 6). Of this number, 20 points are the body's own statements and 19 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.onChannelsGetParticipants (cognitive 39) · ×1
  • Router.onChannelsGetParticipants (cognitive 39) internal/rpc/channels_members.go:121 — Router.onChannelsGetParticipants has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (27 pts), loops 5 (9 pts), boolean chains 3 (nesting depth added 12). Of this number, 37 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onPaymentsGetPaymentForm (cognitive 39) · ×1
  • Router.onPaymentsGetPaymentForm (cognitive 39) internal/rpc/payments_star_gifts.go:369 — Router.onPaymentsGetPaymentForm has cognitive complexity 39 (threshold 15). Drivers by points: if/else 26 (36 pts), boolean chains 2, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.enrichPreparedUpdateEvents (cognitive 39) · ×1
  • Router.enrichPreparedUpdateEvents (cognitive 39) internal/rpc/update_peer_refs.go:72 — Router.enrichPreparedUpdateEvents has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (25 pts), loops 7 (13 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.resolvePrivateSendReply (cognitive 39) · ×1
  • MessageStore.resolvePrivateSendReply (cognitive 39) internal/store/postgres/message_send.go:808 — MessageStore.resolvePrivateSendReply has cognitive complexity 39 (threshold 15). Drivers by points: if/else 22 (34 pts), boolean chains 5 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StarGiftLifecycleStore.markCraftInputMessageTx (cognitive 39) · ×1
  • StarGiftLifecycleStore.markCraftInputMessageTx (cognitive 39) internal/store/postgres/star_gift_craft_projection.go:52 — StarGiftLifecycleStore.markCraftInputMessageTx has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (34 pts), boolean chains 4, 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.
D2 · Cognitive Complexity · UpdateEventStore.BatchByCursor (cognitive 39) · ×1
  • UpdateEventStore.BatchByCursor (cognitive 39) internal/store/postgres/update_event.go:530 — UpdateEventStore.BatchByCursor has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (37 pts), loops 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesGetInlineBotResults (cognitive 38) · ×1
  • Router.onMessagesGetInlineBotResults (cognitive 38) internal/rpc/bots_inline.go:46 — Router.onMessagesGetInlineBotResults has cognitive complexity 38 (threshold 15). Drivers by points: if/else 24 (33 pts), boolean chains 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.
D2 · Cognitive Complexity · Router.requestedPeerMatches (cognitive 38) · ×1
  • Router.requestedPeerMatches (cognitive 38) internal/rpc/messages_bot_longtail.go:327 — Router.requestedPeerMatches has cognitive complexity 38 (threshold 15). Drivers by points: if/else 19 (26 pts), boolean chains 12 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesSendReaction (cognitive 38) · ×1
  • Router.onMessagesSendReaction (cognitive 38) internal/rpc/messages_reactions_send.go:11 — Router.onMessagesSendReaction has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (28 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ListDirtyActiveChannelsForUser (cognitive 38) · ×1
  • ChannelStore.ListDirtyActiveChannelsForUser (cognitive 38) internal/store/memory/channel_helpers.go:318 — ChannelStore.ListDirtyActiveChannelsForUser has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 7, loops 3 (5 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.SendMonoforumMessage (cognitive 38) · ×1
  • ChannelStore.SendMonoforumMessage (cognitive 38) internal/store/memory/channel_monoforum.go:18 — ChannelStore.SendMonoforumMessage has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 9, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GroupCallStore.RemoveConferenceCallParticipants (cognitive 38) · ×1
  • GroupCallStore.RemoveConferenceCallParticipants (cognitive 38) internal/store/memory/groupcall.go:245 — GroupCallStore.RemoveConferenceCallParticipants has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (30 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.EditExportedInvite (cognitive 38) · ×1
  • ChannelStore.EditExportedInvite (cognitive 38) internal/store/postgres/channel_invite_exported.go:255 — ChannelStore.EditExportedInvite has cognitive complexity 38 (threshold 15). Drivers by points: if/else 23 (31 pts), boolean chains 7 (nesting depth added 8). Of this number, 37 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StarGiftStore.ResolveSavedIDs (cognitive 38) · ×1
  • StarGiftStore.ResolveSavedIDs (cognitive 38) internal/store/postgres/star_gift.go:669 — StarGiftStore.ResolveSavedIDs has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (31 pts), boolean chains 4, loops 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.
D2 · Cognitive Complexity · UpdateEventStore.ListAfter (cognitive 38) · ×1
  • UpdateEventStore.ListAfter (cognitive 38) internal/store/postgres/update_event.go:326 — UpdateEventStore.ListAfter has cognitive complexity 38 (threshold 15). Drivers by points: if/else 19 (37 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.run (cognitive 37) · ×1
  • main.run (cognitive 37) cmd/tl-coverage/main.go:105 — main.run has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 4 (5 pts), match/switch 2 (5 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HTTPProvider.composeOpenAIChatStream (cognitive 37) · ×1
  • HTTPProvider.composeOpenAIChatStream (cognitive 37) internal/app/ai/provider_http.go:217 — HTTPProvider.composeOpenAIChatStream has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (30 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · Service.appendMissingChannelPeerPreviews (cognitive 37) · ×1
  • Service.appendMissingChannelPeerPreviews (cognitive 37) internal/app/dialogs/service.go:727 — Service.appendMissingChannelPeerPreviews has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 5, loops 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.
D2 · Cognitive Complexity · Service.DeleteBlobBytesForMediaOlderThan (cognitive 37) · ×1
  • Service.DeleteBlobBytesForMediaOlderThan (cognitive 37) internal/app/files/retention.go:192 — Service.DeleteBlobBytesForMediaOlderThan has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (29 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.seedStickerSets (cognitive 37) · ×1
  • Service.seedStickerSets (cognitive 37) internal/app/files/seed.go:251 — Service.seedStickerSets has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 6 (12 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · serverMetricsClient.scrape (cognitive 37) · ×1
  • serverMetricsClient.scrape (cognitive 37) internal/loadharness/server_metrics.go:110 — serverMetricsClient.scrape has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (33 pts), boolean chains 3, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.savedDialogsProjection (cognitive 37) · ×1
  • Router.savedDialogsProjection (cognitive 37) internal/rpc/messages_saved_dialogs.go:288 — Router.savedDialogsProjection has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (28 pts), loops 3 (5 pts), boolean chains 3, match/switch 1 (nesting depth added 16). Of this number, 25 points are the body's own statements and 12 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.InviteToChannel (cognitive 37) · ×1
  • ChannelStore.InviteToChannel (cognitive 37) internal/store/memory/channel_invites.go:13 — ChannelStore.InviteToChannel has cognitive complexity 37 (threshold 15). Drivers by points: if/else 13 (32 pts), boolean chains 3, loops 2 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · postgres.executePlainPrivateSendBatch (cognitive 37) · ×1
  • postgres.executePlainPrivateSendBatch (cognitive 37) internal/store/postgres/message_send_batch_actor.go:282 — postgres.executePlainPrivateSendBatch has cognitive complexity 37 (threshold 15). Drivers by points: if/else 20 (29 pts), loops 4 (5 pts), boolean chains 3 (nesting depth added 10). Of this number, 36 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.TogglePrivateNoForwards (cognitive 37) · ×1
  • MessageStore.TogglePrivateNoForwards (cognitive 37) internal/store/postgres/message_no_forwards.go:45 — MessageStore.TogglePrivateNoForwards has cognitive complexity 37 (threshold 15). Drivers by points: if/else 25 (33 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 9). Most of this is not in the body itself: 10 of the 37 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 85, 183). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · PremiumStore.settlePremiumPayment (cognitive 37) · ×1
  • PremiumStore.settlePremiumPayment (cognitive 37) internal/store/postgres/premium.go:253 — PremiumStore.settlePremiumPayment has cognitive complexity 37 (threshold 15). Drivers by points: if/else 26 (27 pts), boolean chains 10 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · StarGiftLifecycleStore.BidStarGiftAuction (cognitive 37) · ×1
  • StarGiftLifecycleStore.BidStarGiftAuction (cognitive 37) internal/store/postgres/star_gift_craft_auction.go:994 — StarGiftLifecycleStore.BidStarGiftAuction has cognitive complexity 37 (threshold 15). Drivers by points: if/else 19 (29 pts), boolean chains 8 (nesting depth added 10). Of this number, 23 points are the body's own statements and 14 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · dialogs.dialogListForPeer (cognitive 36) · ×1
  • dialogs.dialogListForPeer (cognitive 36) internal/app/dialogs/read_model_cache.go:347 — dialogs.dialogListForPeer has cognitive complexity 36 (threshold 15). Drivers by points: if/else 8 (22 pts), loops 6 (10 pts), boolean chains 3, match/switch 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.documentsNeedSeedRepair (cognitive 36) · ×1
  • Service.documentsNeedSeedRepair (cognitive 36) internal/app/files/seed.go:1093 — Service.documentsNeedSeedRepair has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (26 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loadharness.snapshotDialogsObserved (cognitive 36) · ×1
  • loadharness.snapshotDialogsObserved (cognitive 36) internal/loadharness/snapshot.go:272 — loadharness.snapshotDialogsObserved has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (29 pts), loops 3, boolean chains 2, match/switch 1 (2 pts) (nesting depth added 14). Of this number, 35 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · serverExchangeCompat.run (cognitive 36) · ×1
  • serverExchangeCompat.run (cognitive 36) internal/mtprotoedge/exchange_compat.go:88 — serverExchangeCompat.run has cognitive complexity 36 (threshold 15). Drivers by points: if/else 31 (33 pts), boolean chains 1, jumps 1, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · inboundRPCBatchReservation.commit (cognitive 36) · ×1
  • inboundRPCBatchReservation.commit (cognitive 36) internal/mtprotoedge/inbound_rpc.go:677 — inboundRPCBatchReservation.commit has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 5, loops 3 (5 pts) (nesting depth added 13). Most of this is not in the body itself: 6 of the 36 points are its own statements and the rest belongs to one function literal inside it that branches (line 689). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · rpcResultWaiter.subscribe (cognitive 36) · ×1
  • rpcResultWaiter.subscribe (cognitive 36) internal/mtprotoedge/rpc_flight.go:189 — rpcResultWaiter.subscribe has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 8, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BatchedReverseContactStore.run (cognitive 36) · ×1
  • BatchedReverseContactStore.run (cognitive 36) internal/store/contact_reverse_batch.go:185 — BatchedReverseContactStore.run has cognitive complexity 36 (threshold 15). Drivers by points: if/else 6 (17 pts), match/switch 4 (14 pts), loops 2 (3 pts), jumps 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.
D2 · Cognitive Complexity · CommunityStore.ListCommunityPeerLinkRequests (cognitive 36) · ×1
  • CommunityStore.ListCommunityPeerLinkRequests (cognitive 36) internal/store/memory/community.go:484 — CommunityStore.ListCommunityPeerLinkRequests has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (28 pts), loops 4 (8 pts) (nesting depth added 17). Of this number, 34 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.ListByUser (cognitive 36) · ×1
  • MessageStore.ListByUser (cognitive 36) internal/store/postgres/message_history.go:80 — MessageStore.ListByUser has cognitive complexity 36 (threshold 15). Drivers by points: if/else 21 (31 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.UnpinAllPrivateMessages (cognitive 36) · ×1
  • MessageStore.UnpinAllPrivateMessages (cognitive 36) internal/store/postgres/message_pin.go:174 — MessageStore.UnpinAllPrivateMessages has cognitive complexity 36 (threshold 15). Drivers by points: if/else 21 (30 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 11). Of this number, 35 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StarGiftLifecycleStore.ListResaleStarGifts (cognitive 36) · ×1
  • StarGiftLifecycleStore.ListResaleStarGifts (cognitive 36) internal/store/postgres/star_gift_lifecycle.go:155 — StarGiftLifecycleStore.ListResaleStarGifts has cognitive complexity 36 (threshold 15). Drivers by points: if/else 19 (23 pts), boolean chains 7, match/switch 2 (4 pts), loops 2 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · StarGiftLifecycleStore.prepareStarGiftPurchase (cognitive 36) · ×1
  • StarGiftLifecycleStore.prepareStarGiftPurchase (cognitive 36) internal/store/postgres/star_gift_purchase.go:255 — StarGiftLifecycleStore.prepareStarGiftPurchase has cognitive complexity 36 (threshold 15). Drivers by points: if/else 20 (30 pts), boolean chains 6 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BatchedReadModelVersionStore.run (cognitive 36) · ×1
  • BatchedReadModelVersionStore.run (cognitive 36) internal/store/read_model_batch.go:187 — BatchedReadModelVersionStore.run has cognitive complexity 36 (threshold 15). Drivers by points: if/else 6 (17 pts), match/switch 4 (14 pts), loops 2 (3 pts), jumps 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.
D2 · Cognitive Complexity · Service.WatchChain (cognitive 35) · ×1
  • Service.WatchChain (cognitive 35) internal/app/donations/watcher.go:36 — Service.WatchChain has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (27 pts), match/switch 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 14). Of this number, 34 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · handler.getUpdates (cognitive 35) · ×1
  • handler.getUpdates (cognitive 35) internal/botapi/server.go:313 — handler.getUpdates has cognitive complexity 35 (threshold 15). Drivers by points: if/else 22 (32 pts), boolean chains 2, loops 1 (nesting depth added 10). Of this number, 33 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Server.handleRPC (cognitive 35) · ×1
  • Server.handleRPC (cognitive 35) internal/mtprotoedge/encrypted.go:745 — Server.handleRPC has cognitive complexity 35 (threshold 15). Drivers by points: if/else 22 (33 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onChannelsGetFullChannel (cognitive 35) · ×1
  • Router.onChannelsGetFullChannel (cognitive 35) internal/rpc/channels_core.go:143 — Router.onChannelsGetFullChannel has cognitive complexity 35 (threshold 15). Drivers by points: if/else 20 (33 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.cacheResolvedDurableSessionLayer (cognitive 35) · ×1
  • Router.cacheResolvedDurableSessionLayer (cognitive 35) internal/rpc/durable_layer_evidence.go:153 — Router.cacheResolvedDurableSessionLayer has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 9, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.DeleteHistory (cognitive 35) · ×1
  • MessageStore.DeleteHistory (cognitive 35) internal/store/memory/message_history.go:216 — MessageStore.DeleteHistory has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 13 (nesting depth added 8). Of this number, 22 points are the body's own statements and 13 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.ReadMessageContents (cognitive 35) · ×1
  • MessageStore.ReadMessageContents (cognitive 35) internal/store/memory/message_read.go:11 — MessageStore.ReadMessageContents has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (23 pts), loops 6 (7 pts), boolean chains 5 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.JoinChannel (cognitive 35) · ×1
  • ChannelStore.JoinChannel (cognitive 35) internal/store/postgres/channel_member_join.go:14 — ChannelStore.JoinChannel has cognitive complexity 35 (threshold 15). Drivers by points: if/else 25 (29 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 5). Of this number, 34 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MessageStore.DeliverLoginCodeMessage (cognitive 35) · ×1
  • MessageStore.DeliverLoginCodeMessage (cognitive 35) internal/store/postgres/login_code_delivery.go:43 — MessageStore.DeliverLoginCodeMessage has cognitive complexity 35 (threshold 15). Drivers by points: if/else 30 (33 pts), boolean chains 2 (nesting depth added 3). Of this number, 34 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MessageStore.SetMessageReactions (cognitive 35) · ×1
  • MessageStore.SetMessageReactions (cognitive 35) internal/store/postgres/message_reactions.go:16 — MessageStore.SetMessageReactions has cognitive complexity 35 (threshold 15). Drivers by points: if/else 21 (28 pts), loops 4, boolean chains 3 (nesting depth added 7). Of this number, 34 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StarGiftStore.PublishCollectibleRevision (cognitive 35) · ×1
  • StarGiftStore.PublishCollectibleRevision (cognitive 35) REDACTED:45 — StarGiftStore.PublishCollectibleRevision has cognitive complexity 35 (threshold 15). Drivers by points: if/else 21 (33 pts), loops 2 (nesting depth added 12). Most of this is not in the body itself: 1 of the 35 points is its own statement and the rest belongs to one function literal inside it that branches (line 53). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · StarGiftLifecycleStore.ResolveStarGiftOffer (cognitive 35) · ×1
  • StarGiftLifecycleStore.ResolveStarGiftOffer (cognitive 35) internal/store/postgres/star_gift_lifecycle.go:916 — StarGiftLifecycleStore.ResolveStarGiftOffer has cognitive complexity 35 (threshold 15). Drivers by points: if/else 26 (29 pts), boolean chains 6 (nesting depth added 3). Most of this is not in the body itself: 12 of the 35 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 951, 1019). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Service.hydrateDialogSnapshotPage (cognitive 34) · ×1
  • Service.hydrateDialogSnapshotPage (cognitive 34) internal/app/dialogs/service.go:472 — Service.hydrateDialogSnapshotPage has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 3 (8 pts), boolean chains 3 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Service.GetFile (cognitive 34) · ×1
  • Service.GetFile (cognitive 34) internal/app/files/service.go:498 — Service.GetFile has cognitive complexity 34 (threshold 15). Drivers by points: if/else 19 (32 pts), boolean chains 2 (nesting depth added 13). Of this number, 21 points are the body's own statements and 13 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.loadMembershipFactsForKeys (cognitive 34) · ×1
  • Service.loadMembershipFactsForKeys (cognitive 34) internal/app/privacy/service_sparse.go:165 — Service.loadMembershipFactsForKeys has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (24 pts), loops 5 (7 pts), boolean chains 3 (nesting depth added 13). Of this number, 24 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · botapi.apiMessage (cognitive 34) · ×1
  • botapi.apiMessage (cognitive 34) internal/botapi/projection.go:278 — botapi.apiMessage has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 6, loops 3 (5 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · loadharness.MutateOffline (cognitive 34) · ×1
  • loadharness.MutateOffline (cognitive 34) internal/loadharness/mutate.go:95 — loadharness.MutateOffline has cognitive complexity 34 (threshold 15). Drivers by points: if/else 26 (30 pts), loops 3, boolean chains 1 (nesting depth added 4). Of this number, 22 points are the body's own statements and 12 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · loadharness.seedGroup (cognitive 34) · ×1
  • loadharness.seedGroup (cognitive 34) internal/loadharness/seed.go:201 — loadharness.seedGroup has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (32 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.tgChannelFull (cognitive 34) · ×1
  • rpc.tgChannelFull (cognitive 34) internal/rpc/convert_channels_core.go:545 — rpc.tgChannelFull has cognitive complexity 34 (threshold 15). Drivers by points: if/else 27 (29 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · rpc.tgRequestPeerTypeWithFilter (cognitive 34) · ×1
  • rpc.tgRequestPeerTypeWithFilter (cognitive 34) internal/rpc/convert_markup.go:556 — rpc.tgRequestPeerTypeWithFilter has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (33 pts), match/switch 1 (nesting depth added 21). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Router.domainRichMessageFromInput (cognitive 34) · ×1
  • Router.domainRichMessageFromInput (cognitive 34) internal/rpc/convert_rich_message.go:305 — Router.domainRichMessageFromInput has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 6, loops 2, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.editChannelInlineBotMessage (cognitive 34) · ×1
  • Router.editChannelInlineBotMessage (cognitive 34) internal/rpc/messages_bot_no_state.go:190 — Router.editChannelInlineBotMessage has cognitive complexity 34 (threshold 15). Drivers by points: if/else 20 (31 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.fanoutStoryPrivacyChange (cognitive 34) · ×1
  • Router.fanoutStoryPrivacyChange (cognitive 34) internal/rpc/stories.go:2089 — Router.fanoutStoryPrivacyChange has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 10, loops 5 (6 pts), match/switch 1 (2 pts) (nesting depth added 7). Of this number, 25 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.fanoutDeletedUserStory (cognitive 34) · ×1
  • Router.fanoutDeletedUserStory (cognitive 34) internal/rpc/stories.go:2178 — Router.fanoutDeletedUserStory has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 10, loops 5 (6 pts) (nesting depth added 5). Of this number, 26 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.DeleteChannelHistory (cognitive 34) · ×1
  • ChannelStore.DeleteChannelHistory (cognitive 34) internal/store/memory/channel_message_delete.go:65 — ChannelStore.DeleteChannelHistory has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 4, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.ForwardPrivateMessages (cognitive 34) · ×1
  • MessageStore.ForwardPrivateMessages (cognitive 34) internal/store/memory/message_forward.go:9 — MessageStore.ForwardPrivateMessages has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.TogglePrivateNoForwards (cognitive 34) · ×1
  • MessageStore.TogglePrivateNoForwards (cognitive 34) internal/store/memory/message_no_forwards.go:45 — MessageStore.TogglePrivateNoForwards has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 4, loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TelegramLoginStore.ApproveTelegramLoginRequest (cognitive 34) · ×1
  • TelegramLoginStore.ApproveTelegramLoginRequest (cognitive 34) internal/store/memory/telegram_login.go:346 — TelegramLoginStore.ApproveTelegramLoginRequest has cognitive complexity 34 (threshold 15). Drivers by points: if/else 20 (25 pts), boolean chains 8, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · VerificationStore.ListVerificationApplications (cognitive 34) · ×1
  • VerificationStore.ListVerificationApplications (cognitive 34) internal/store/memory/verification.go:501 — VerificationStore.ListVerificationApplications has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 8, 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.
D2 · Cognitive Complexity · BatchedAuthKeyStore.run (cognitive 34) · ×1
  • BatchedAuthKeyStore.run (cognitive 34) internal/store/postgres/authkey_get_batch.go:158 — BatchedAuthKeyStore.run has cognitive complexity 34 (threshold 15). Drivers by points: match/switch 4 (17 pts), if/else 4 (12 pts), loops 2 (4 pts), jumps 1 (nesting depth added 23). 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.
D2 · Cognitive Complexity · BatchedAuthKeySessionLayerStore.run (cognitive 34) · ×1
  • BatchedAuthKeySessionLayerStore.run (cognitive 34) internal/store/postgres/authkey_session_layer_batch.go:168 — BatchedAuthKeySessionLayerStore.run has cognitive complexity 34 (threshold 15). Drivers by points: match/switch 4 (17 pts), if/else 4 (12 pts), loops 2 (4 pts), jumps 1 (nesting depth added 23). 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.
D2 · Cognitive Complexity · ChannelStore.LeaveChannel (cognitive 34) · ×1
  • ChannelStore.LeaveChannel (cognitive 34) internal/store/postgres/channel_member_join.go:159 — ChannelStore.LeaveChannel has cognitive complexity 34 (threshold 15). Drivers by points: if/else 23 (30 pts), boolean chains 3, loops 1 (nesting depth added 7). Of this number, 33 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · StarGiftStore.CreateCatalogRevision (cognitive 34) · ×1
  • StarGiftStore.CreateCatalogRevision (cognitive 34) internal/store/postgres/star_gift.go:204 — StarGiftStore.CreateCatalogRevision has cognitive complexity 34 (threshold 15). Drivers by points: if/else 21 (33 pts), boolean chains 1 (nesting depth added 12). Most of this is not in the body itself: 3 of the 34 points are its own statements and the rest belongs to one function literal inside it that branches (line 211). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · StarGiftUpgradeStore.loadUpgradeSourceReplay (cognitive 34) · ×1
  • StarGiftUpgradeStore.loadUpgradeSourceReplay (cognitive 34) REDACTED:1151 — StarGiftUpgradeStore.loadUpgradeSourceReplay has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (30 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · Service.verifyLoginCode (cognitive 33) · ×1
  • Service.verifyLoginCode (cognitive 33) internal/app/auth/service.go:1157 — Service.verifyLoginCode has cognitive complexity 33 (threshold 15). Drivers by points: if/else 19 (25 pts), boolean chains 7, match/switch 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Service.Search (cognitive 33) · ×1
  • Service.Search (cognitive 33) internal/app/contacts/service.go:349 — Service.Search has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 7, loops 2 (4 pts) (nesting depth added 11). Of this number, 30 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · handler.editMessageText (cognitive 33) · ×1
  • handler.editMessageText (cognitive 33) internal/botapi/server.go:740 — handler.editMessageText has cognitive complexity 33 (threshold 15). Drivers by points: if/else 22 (29 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · loadWorker.supervise (cognitive 33) · ×1
  • loadWorker.supervise (cognitive 33) REDACTED:224 — loadWorker.supervise has cognitive complexity 33 (threshold 15). Drivers by points: if/else 5 (16 pts), match/switch 4 (12 pts), loops 2 (3 pts), jumps 2 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Options.setDefaults (cognitive 33) · ×1
  • Options.setDefaults (cognitive 33) internal/mtprotoedge/server.go:383 — Options.setDefaults has cognitive complexity 33 (threshold 15). Drivers by points: if/else 32 (33 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · rpc.botAPIRichBlock (cognitive 33) · ×1
  • rpc.botAPIRichBlock (cognitive 33) REDACTED:41 — rpc.botAPIRichBlock has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 1, match/switch 1 (nesting depth added 16). Of this number, 31 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.normalizeOrderedListForClients (cognitive 33) · ×1
  • rpc.normalizeOrderedListForClients (cognitive 33) internal/rpc/convert_rich_message.go:257 — rpc.normalizeOrderedListForClients has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 6, match/switch 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onContactsGetStatuses (cognitive 33) · ×1
  • Router.onContactsGetStatuses (cognitive 33) internal/rpc/contacts.go:506 — Router.onContactsGetStatuses has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (24 pts), loops 3 (4 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesSendBotRequestedPeer (cognitive 33) · ×1
  • Router.onMessagesSendBotRequestedPeer (cognitive 33) internal/rpc/messages_bot_longtail.go:82 — Router.onMessagesSendBotRequestedPeer has cognitive complexity 33 (threshold 15). Drivers by points: if/else 22 (28 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Router.messageFilterFromSearchRequest (cognitive 33) · ×1
  • Router.messageFilterFromSearchRequest (cognitive 33) internal/rpc/messages_history.go:834 — Router.messageFilterFromSearchRequest has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesToggleNoForwards (cognitive 33) · ×1
  • Router.onMessagesToggleNoForwards (cognitive 33) internal/rpc/messages_no_forwards.go:17 — Router.onMessagesToggleNoForwards has cognitive complexity 33 (threshold 15). Drivers by points: if/else 22 (25 pts), boolean chains 8 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.usersForMessageUpdatesWithPreloaded (cognitive 33) · ×1
  • Router.usersForMessageUpdatesWithPreloaded (cognitive 33) internal/rpc/messages_send.go:1045 — Router.usersForMessageUpdatesWithPreloaded has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 6 (9 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 14). Of this number, 31 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.resolvePremiumInvoice (cognitive 33) · ×1
  • Router.resolvePremiumInvoice (cognitive 33) internal/rpc/payments_premium.go:170 — Router.resolvePremiumInvoice has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (27 pts), boolean chains 5, match/switch 1 (nesting depth added 15). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ChannelStore.ProcessSuggestedPostLifecycle (cognitive 33) · ×1
  • ChannelStore.ProcessSuggestedPostLifecycle (cognitive 33) internal/store/memory/channel_suggested_post.go:153 — ChannelStore.ProcessSuggestedPostLifecycle has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ListChannelReplies (cognitive 33) · ×1
  • ChannelStore.ListChannelReplies (cognitive 33) internal/store/memory/channel_topics.go:499 — ChannelStore.ListChannelReplies has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 9, 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.
D2 · Cognitive Complexity · LangPackStore.ReconcileSeed (cognitive 33) · ×1
  • LangPackStore.ReconcileSeed (cognitive 33) internal/store/memory/langpack.go:129 — LangPackStore.ReconcileSeed has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 6, boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommunityStore.ToggleCommunityParticipantBanned (cognitive 33) · ×1
  • CommunityStore.ToggleCommunityParticipantBanned (cognitive 33) internal/store/postgres/community.go:918 — CommunityStore.ToggleCommunityParticipantBanned has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 4, loops 4 (nesting depth added 8). None of this is in the body itself: all 33 points belong to one function literal inside it that branches (line 919). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · MessageStore.ForwardPrivateMessages (cognitive 33) · ×1
  • MessageStore.ForwardPrivateMessages (cognitive 33) internal/store/postgres/message_forward.go:19 — MessageStore.ForwardPrivateMessages has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 4, 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.
D2 · Cognitive Complexity · StarGiftLifecycleStore.PrepayStarGiftUpgrade (cognitive 33) · ×1
  • StarGiftLifecycleStore.PrepayStarGiftUpgrade (cognitive 33) internal/store/postgres/star_gift_entitlements.go:60 — StarGiftLifecycleStore.PrepayStarGiftUpgrade has cognitive complexity 33 (threshold 15). Drivers by points: if/else 22 (26 pts), boolean chains 7 (nesting depth added 4). Of this number, 16 points are the body's own statements and 17 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · main.normalizeSeedJSON (cognitive 32) · ×1
  • main.normalizeSeedJSON (cognitive 32) cmd/stickerseeddeploy/main.go:213 — main.normalizeSeedJSON has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (25 pts), loops 3 (6 pts), match/switch 1 (nesting depth added 21). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Service.SendLoginEmailCode (cognitive 32) · ×1
  • Service.SendLoginEmailCode (cognitive 32) internal/app/account/service.go:765 — Service.SendLoginEmailCode has cognitive complexity 32 (threshold 15). Drivers by points: if/else 21 (29 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.loadBaseUsersByIDs (cognitive 32) · ×1
  • Service.loadBaseUsersByIDs (cognitive 32) internal/app/users/service.go:851 — Service.loadBaseUsersByIDs has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 4 (9 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.candidateStates (cognitive 32) · ×1
  • Service.candidateStates (cognitive 32) internal/app/verification/service.go:1080 — Service.candidateStates has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 4, loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · domain.validateStarGiftAttributes (cognitive 32) · ×1
  • domain.validateStarGiftAttributes (cognitive 32) internal/domain/star_gift.go:1285 — domain.validateStarGiftAttributes has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 8, match/switch 1 (2 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Server.layerRPCDependencies (cognitive 32) · ×1
  • Server.layerRPCDependencies (cognitive 32) internal/mtprotoedge/inbound_layer_rpc.go:1279 — Server.layerRPCDependencies has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (25 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Manager.BootstrapEnv (cognitive 32) · ×1
  • Manager.BootstrapEnv (cognitive 32) internal/procctl/bootstrap.go:81 — Manager.BootstrapEnv has cognitive complexity 32 (threshold 15). Drivers by points: if/else 19 (29 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.botAPIRichTable (cognitive 32) · ×1
  • rpc.botAPIRichTable (cognitive 32) REDACTED:245 — rpc.botAPIRichTable has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (29 pts), loops 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.tgMessage (cognitive 32) · ×1
  • rpc.tgMessage (cognitive 32) internal/rpc/convert_messages.go:32 — rpc.tgMessage has cognitive complexity 32 (threshold 15). Drivers by points: if/else 25 (31 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.onContactsSetBlocked (cognitive 32) · ×1
  • Router.onContactsSetBlocked (cognitive 32) internal/rpc/contacts.go:345 — Router.onContactsSetBlocked has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (26 pts), loops 4, 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.
D2 · Cognitive Complexity · Router.onMessagesReadDiscussion (cognitive 32) · ×1
  • Router.onMessagesReadDiscussion (cognitive 32) internal/rpc/messages_history.go:380 — Router.onMessagesReadDiscussion has cognitive complexity 32 (threshold 15). Drivers by points: if/else 20 (31 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.checkedMessageReadPeer (cognitive 32) · ×1
  • Router.checkedMessageReadPeer (cognitive 32) internal/rpc/messages_read_filter.go:32 — Router.checkedMessageReadPeer has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 3, loops 1 (3 pts), 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.
D2 · Cognitive Complexity · Router.starGiftRefFromInput (cognitive 32) · ×1
  • Router.starGiftRefFromInput (cognitive 32) internal/rpc/payments_star_gifts.go:1366 — Router.starGiftRefFromInput has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 7, match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Router.editSelfParticipant (cognitive 32) · ×1
  • Router.editSelfParticipant (cognitive 32) internal/rpc/phone_group_call_edit.go:54 — Router.editSelfParticipant has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onStatsGetPollStats (cognitive 32) · ×1
  • Router.onStatsGetPollStats (cognitive 32) internal/rpc/stats.go:252 — Router.onStatsGetPollStats has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesAcceptURLAuth (cognitive 32) · ×1
  • Router.onMessagesAcceptURLAuth (cognitive 32) internal/rpc/telegram_login.go:168 — Router.onMessagesAcceptURLAuth has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 6 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.GetChannelDialogs (cognitive 32) · ×1
  • ChannelStore.GetChannelDialogs (cognitive 32) internal/store/memory/channel_dialogs.go:107 — ChannelStore.GetChannelDialogs has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 6, 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.
D2 · Cognitive Complexity · ChannelStore.channelMessageRepliesLocked (cognitive 32) · ×1
  • ChannelStore.channelMessageRepliesLocked (cognitive 32) internal/store/memory/channel_topics.go:578 — ChannelStore.channelMessageRepliesLocked has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 7, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.ListSavedDialogs (cognitive 32) · ×1
  • MessageStore.ListSavedDialogs (cognitive 32) internal/store/memory/saved_dialog.go:51 — MessageStore.ListSavedDialogs has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 7, loops 4 (5 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TelegramLoginStore.DeleteExpiredTelegramLoginArtifacts (cognitive 32) · ×1
  • TelegramLoginStore.DeleteExpiredTelegramLoginArtifacts (cognitive 32) internal/store/memory/telegram_login.go:670 — TelegramLoginStore.DeleteExpiredTelegramLoginArtifacts has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 7, loops 3 (5 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · postgres.pollViewerAggregates (cognitive 32) · ×1
  • postgres.pollViewerAggregates (cognitive 32) REDACTED:231 — postgres.pollViewerAggregates has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (27 pts), loops 4 (5 pts) (nesting depth added 11). Of this number, 31 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DialogStore.listByUser (cognitive 32) · ×1
  • DialogStore.listByUser (cognitive 32) internal/store/postgres/dialog.go:41 — DialogStore.listByUser has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (30 pts), loops 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModerationReportStore.ReviewModerationAppeal (cognitive 32) · ×1
  • ModerationReportStore.ReviewModerationAppeal (cognitive 32) internal/store/postgres/moderation_cases.go:200 — ModerationReportStore.ReviewModerationAppeal has cognitive complexity 32 (threshold 15). Drivers by points: if/else 24 (27 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · StarGiftLifecycleStore.loadCraftReplay (cognitive 32) · ×1
  • StarGiftLifecycleStore.loadCraftReplay (cognitive 32) internal/store/postgres/star_gift_craft_auction.go:514 — StarGiftLifecycleStore.loadCraftReplay has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 6, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StarGiftLifecycleStore.ConvertStarGift (cognitive 32) · ×1
  • StarGiftLifecycleStore.ConvertStarGift (cognitive 32) internal/store/postgres/star_gift_lifecycle.go:67 — StarGiftLifecycleStore.ConvertStarGift has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (27 pts), boolean chains 4, match/switch 1 (nesting depth added 9). Most of this is not in the body itself: 6 of the 32 points are its own statements and the rest belongs to one function literal inside it that branches (line 79). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Service.Configure (cognitive 31) · ×1
  • Service.Configure (cognitive 31) internal/admin/service.go:662 — Service.Configure has cognitive complexity 31 (threshold 15). Drivers by points: if/else 31. 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.
D2 · Cognitive Complexity · Service.SeedPremiumPromo (cognitive 31) · ×1
  • Service.SeedPremiumPromo (cognitive 31) internal/app/files/premium_promo_seed.go:64 — Service.SeedPremiumPromo has cognitive complexity 31 (threshold 15). Drivers by points: if/else 21 (28 pts), 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.
D2 · Cognitive Complexity · Service.seedDocumentJSONsReady (cognitive 31) · ×1
  • Service.seedDocumentJSONsReady (cognitive 31) internal/app/files/seed_state.go:124 — Service.seedDocumentJSONsReady has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (24 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BatchCache.UsersForView (cognitive 31) · ×1
  • BatchCache.UsersForView (cognitive 31) internal/app/peerview/cache.go:32 — BatchCache.UsersForView has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Manager.ReadEnvGroups (cognitive 31) · ×1
  • Manager.ReadEnvGroups (cognitive 31) internal/procctl/procctl.go:348 — Manager.ReadEnvGroups has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 2, loops 2 (nesting depth added 11). Of this number, 24 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Manager.Run (cognitive 31) · ×1
  • Manager.Run (cognitive 31) internal/procctl/supervisor.go:97 — Manager.Run has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 4 (6 pts), boolean chains 4, jumps 2, match/switch 1 (2 pts) (nesting depth added 10). Of this number, 17 points are the body's own statements and 14 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.tgStoryMediaAreas (cognitive 31) · ×1
  • rpc.tgStoryMediaAreas (cognitive 31) internal/rpc/convert_stories.go:144 — rpc.tgStoryMediaAreas has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (27 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · viewerPeerCache.channelsForIDs (cognitive 31) · ×1
  • viewerPeerCache.channelsForIDs (cognitive 31) internal/rpc/peer_projection_cache.go:195 — viewerPeerCache.channelsForIDs has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 5 (11 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.webViewBotAppFromInput (cognitive 31) · ×1
  • Router.webViewBotAppFromInput (cognitive 31) internal/rpc/messages_webview.go:441 — Router.webViewBotAppFromInput has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (27 pts), boolean chains 3, match/switch 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · memory.validateBotAPIUpdateRequest (cognitive 31) · ×1
  • memory.validateBotAPIUpdateRequest (cognitive 31) internal/store/memory/botapi_update.go:418 — memory.validateBotAPIUpdateRequest has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 11, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.approveInviteImporterLocked (cognitive 31) · ×1
  • ChannelStore.approveInviteImporterLocked (cognitive 31) internal/store/memory/channel_invites.go:732 — ChannelStore.approveInviteImporterLocked has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 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.
D2 · Cognitive Complexity · postgres.canonicalizeStoredPhoneIdentitiesInTableTx (cognitive 31) · ×1
  • postgres.canonicalizeStoredPhoneIdentitiesInTableTx (cognitive 31) REDACTED:53 — postgres.canonicalizeStoredPhoneIdentitiesInTableTx has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 3 (6 pts), match/switch 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.
D2 · Cognitive Complexity · ChannelStore.GetParticipants (cognitive 31) · ×1
  • ChannelStore.GetParticipants (cognitive 31) internal/store/postgres/channel_member_list.go:16 — ChannelStore.GetParticipants has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (25 pts), match/switch 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DialogStore.ListByPeers (cognitive 31) · ×1
  • DialogStore.ListByPeers (cognitive 31) internal/store/postgres/dialog.go:450 — DialogStore.ListByPeers has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (28 pts), loops 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.
D2 · Cognitive Complexity · postgresAdmissionController.claimControllerSlotLocked (cognitive 31) · ×1
  • postgresAdmissionController.claimControllerSlotLocked (cognitive 31) internal/store/postgres/postgres_connection_admission.go:179 — postgresAdmissionController.claimControllerSlotLocked has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (28 pts), loops 2 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Catalog.validateDesktop (cognitive 31) · ×1
  • Catalog.validateDesktop (cognitive 31) internal/updatecdn/catalog.go:140 — Catalog.validateDesktop has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (27 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.pythonBytesLiteralToHex (cognitive 30) · ×1
  • main.pythonBytesLiteralToHex (cognitive 30) cmd/stickerseeddeploy/main.go:256 — main.pythonBytesLiteralToHex has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 2 (5 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.classify (cognitive 30) · ×1
  • main.classify (cognitive 30) cmd/tl-coverage/main.go:389 — main.classify has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 4, match/switch 3 (4 pts), loops 1 (nesting depth added 13). Most of this is not in the body itself: 8 of the 30 points are its own statements and the rest belongs to one function literal inside it that branches (line 393). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Service.TogglePinned (cognitive 30) · ×1
  • Service.TogglePinned (cognitive 30) internal/app/dialogs/service.go:950 — Service.TogglePinned has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (26 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · Service.refreshConfirmationsAndCredit (cognitive 30) · ×1
  • Service.refreshConfirmationsAndCredit (cognitive 30) internal/app/donations/watcher.go:321 — Service.refreshConfirmationsAndCredit has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (27 pts), 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.
D2 · Cognitive Complexity · telegramlogin.LoadSigningKeyRing (cognitive 30) · ×1
  • telegramlogin.LoadSigningKeyRing (cognitive 30) internal/app/telegramlogin/keyfiles.go:41 — telegramlogin.LoadSigningKeyRing has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · handler.setWebhook (cognitive 30) · ×1
  • handler.setWebhook (cognitive 30) internal/botapi/server.go:973 — handler.setWebhook has cognitive complexity 30 (threshold 15). Drivers by points: if/else 21 (28 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · webhookDispatcher.deliver (cognitive 30) · ×1
  • webhookDispatcher.deliver (cognitive 30) internal/botapi/webhook.go:105 — webhookDispatcher.deliver has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 3, loops 3, match/switch 1 (2 pts) (nesting depth added 6). Of this number, 27 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SessionManager.pushToBusinessAuthKey (cognitive 30) · ×1
  • SessionManager.pushToBusinessAuthKey (cognitive 30) internal/mtprotoedge/session_manager.go:1681 — SessionManager.pushToBusinessAuthKey has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (28 pts), loops 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.
D2 · Cognitive Complexity · Router.nudgeBeyondCapChannelMessageAudience (cognitive 30) · ×1
  • Router.nudgeBeyondCapChannelMessageAudience (cognitive 30) internal/rpc/channel_fanout_dispatcher.go:1270 — Router.nudgeBeyondCapChannelMessageAudience has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 4 (7 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.channelMessagesUpdatesWithPeerCacheAndUsernames (cognitive 30) · ×1
  • Router.channelMessagesUpdatesWithPeerCacheAndUsernames (cognitive 30) internal/rpc/channels_updates.go:244 — Router.channelMessagesUpdatesWithPeerCacheAndUsernames has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 2, loops 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.fanoutCloseFriendStoryChanges (cognitive 30) · ×1
  • Router.fanoutCloseFriendStoryChanges (cognitive 30) internal/rpc/contacts.go:131 — Router.fanoutCloseFriendStoryChanges has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.applyLayerRPCWrapperEffects (cognitive 30) · ×1
  • Router.applyLayerRPCWrapperEffects (cognitive 30) internal/rpc/layer_dispatch.go:406 — Router.applyLayerRPCWrapperEffects has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesGetMessageEditData (cognitive 30) · ×1
  • Router.onMessagesGetMessageEditData (cognitive 30) internal/rpc/messages_edit.go:195 — Router.onMessagesGetMessageEditData has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 6, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesGetSearchCounters (cognitive 30) · ×1
  • Router.onMessagesGetSearchCounters (cognitive 30) internal/rpc/messages_history.go:230 — Router.onMessagesGetSearchCounters has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 2, loops 2, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.groupCallScopeFrom (cognitive 30) · ×1
  • Router.groupCallScopeFrom (cognitive 30) internal/rpc/phone_group_call.go:54 — Router.groupCallScopeFrom has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 3, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.rememberClientInfoAt (cognitive 30) · ×1
  • Router.rememberClientInfoAt (cognitive 30) internal/rpc/router.go:898 — Router.rememberClientInfoAt has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.rememberClientLayerAt (cognitive 30) · ×1
  • Router.rememberClientLayerAt (cognitive 30) internal/rpc/router.go:992 — Router.rememberClientLayerAt has cognitive complexity 30 (threshold 15). Drivers by points: if/else 19 (24 pts), boolean chains 6 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.onStoriesGetAllStories (cognitive 30) · ×1
  • Router.onStoriesGetAllStories (cognitive 30) internal/rpc/stories.go:139 — Router.onStoriesGetAllStories has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.SearchPublicPosts (cognitive 30) · ×1
  • ChannelStore.SearchPublicPosts (cognitive 30) internal/store/memory/channel_helpers.go:164 — ChannelStore.SearchPublicPosts has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 11). Of this number, 28 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.DeleteChannelParticipantReactions (cognitive 30) · ×1
  • ChannelStore.DeleteChannelParticipantReactions (cognitive 30) internal/store/memory/channel_reactions.go:204 — ChannelStore.DeleteChannelParticipantReactions has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 5 (6 pts), boolean chains 5 (nesting depth added 8). Of this number, 29 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ReadChannelReactions (cognitive 30) · ×1
  • ChannelStore.ReadChannelReactions (cognitive 30) internal/store/memory/channel_reactions.go:594 — ChannelStore.ReadChannelReactions has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 4 (7 pts), boolean chains 5 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PasswordStore.SaveMusic (cognitive 30) · ×1
  • PasswordStore.SaveMusic (cognitive 30) internal/store/postgres/account.go:785 — PasswordStore.SaveMusic has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17 (25 pts), loops 4, boolean chains 1 (nesting depth added 8). Most of this is not in the body itself: 2 of the 30 points are its own statements and the rest belongs to one function literal inside it that branches (line 789). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ChannelStore.TransferChannelOwnership (cognitive 30) · ×1
  • ChannelStore.TransferChannelOwnership (cognitive 30) internal/store/postgres/channel_member_admin.go:165 — ChannelStore.TransferChannelOwnership has cognitive complexity 30 (threshold 15). Drivers by points: if/else 26 (27 pts), boolean chains 3 (nesting depth added 1). Of this number, 29 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ChannelStore.processSuggestedPostLifecycleOne (cognitive 30) · ×1
  • ChannelStore.processSuggestedPostLifecycleOne (cognitive 30) internal/store/postgres/channel_suggested_post.go:540 — ChannelStore.processSuggestedPostLifecycleOne has cognitive complexity 30 (threshold 15). Drivers by points: if/else 22 (27 pts), boolean chains 3 (nesting depth added 5). Of this number, 29 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · plainPrivateSendBatchActor.run (cognitive 30) · ×1
  • plainPrivateSendBatchActor.run (cognitive 30) internal/store/postgres/message_send_batch_actor.go:156 — plainPrivateSendBatchActor.run has cognitive complexity 30 (threshold 15). Drivers by points: loops 7 (16 pts), if/else 4 (9 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 15). Most of this is not in the body itself: 14 of the 30 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 171, 163). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · MessageStore.CreateScheduledMessage (cognitive 30) · ×1
  • MessageStore.CreateScheduledMessage (cognitive 30) internal/store/postgres/scheduled_message.go:23 — MessageStore.CreateScheduledMessage has cognitive complexity 30 (threshold 15). Drivers by points: if/else 23 (27 pts), boolean chains 3 (nesting depth added 4). Of this number, 29 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ModerationReportStore.SubmitModerationAppealByLink (cognitive 30) · ×1
  • ModerationReportStore.SubmitModerationAppealByLink (cognitive 30) internal/store/postgres/moderation_cases.go:533 — ModerationReportStore.SubmitModerationAppealByLink has cognitive complexity 30 (threshold 15). Drivers by points: if/else 21 (24 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · TelegramLoginStore.PutTelegramLoginAuthorizationCode (cognitive 30) · ×1
  • TelegramLoginStore.PutTelegramLoginAuthorizationCode (cognitive 30) internal/store/postgres/telegram_login.go:742 — TelegramLoginStore.PutTelegramLoginAuthorizationCode has cognitive complexity 30 (threshold 15). Drivers by points: if/else 19 (25 pts), boolean chains 4, match/switch 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · bots.serviceBotCommandByteSpans (cognitive 29) · ×1
  • bots.serviceBotCommandByteSpans (cognitive 29) internal/app/bots/service_bot_entities.go:99 — bots.serviceBotCommandByteSpans has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.controls (cognitive 29) · ×1
  • Service.controls (cognitive 29) internal/app/botverification/service.go:1376 — Service.controls has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (26 pts), match/switch 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.getDialogs (cognitive 29) · ×1
  • Service.getDialogs (cognitive 29) internal/app/dialogs/service.go:148 — Service.getDialogs has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 4 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Service.appearanceSeedReady (cognitive 29) · ×1
  • Service.appearanceSeedReady (cognitive 29) internal/app/files/appearance_seed.go:96 — Service.appearanceSeedReady has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (18 pts), loops 7 (9 pts), boolean chains 2 (nesting depth added 8). Of this number, 28 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.CreateCatalogBundle (cognitive 29) · ×1
  • Service.CreateCatalogBundle (cognitive 29) internal/app/stargifts/service.go:259 — Service.CreateCatalogBundle has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 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.
D2 · Cognitive Complexity · Service.exchangeAuthorizationCode (cognitive 29) · ×1
  • Service.exchangeAuthorizationCode (cognitive 29) internal/app/telegramlogin/service.go:1297 — Service.exchangeAuthorizationCode has cognitive complexity 29 (threshold 15). Drivers by points: if/else 19 (25 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · handler.sendMedia (cognitive 29) · ×1
  • handler.sendMedia (cognitive 29) internal/botapi/server.go:650 — handler.sendMedia has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 6 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · DatasetSeedState.Validate (cognitive 29) · ×1
  • DatasetSeedState.Validate (cognitive 29) internal/loadharness/dataset.go:279 — DatasetSeedState.Validate has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 10, 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.
D2 · Cognitive Complexity · rpc.tgChannelMessageAction (cognitive 29) · ×1
  • rpc.tgChannelMessageAction (cognitive 29) internal/rpc/convert_channels_core.go:221 — rpc.tgChannelMessageAction has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (28 pts), match/switch 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Router.currentUserID (cognitive 29) · ×1
  • Router.currentUserID (cognitive 29) internal/rpc/convert_auth.go:29 — Router.currentUserID has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (27 pts), boolean chains 2 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Router.mentionedUserIDsFromMessage (cognitive 29) · ×1
  • Router.mentionedUserIDsFromMessage (cognitive 29) internal/rpc/messages_send.go:770 — Router.mentionedUserIDsFromMessage has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 14). Of this number, 27 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.withBotProfileFlagsForUsers (cognitive 29) · ×1
  • Router.withBotProfileFlagsForUsers (cognitive 29) internal/rpc/presence.go:819 — Router.withBotProfileFlagsForUsers has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 5 (11 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.resolveChannelReplyLocked (cognitive 29) · ×1
  • ChannelStore.resolveChannelReplyLocked (cognitive 29) internal/store/memory/channel_helpers.go:524 — ChannelStore.resolveChannelReplyLocked has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 9 (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.
D2 · Cognitive Complexity · MessageStore.refreshPrivateReactionDialogSnapshotsLocked (cognitive 29) · ×1
  • MessageStore.refreshPrivateReactionDialogSnapshotsLocked (cognitive 29) internal/store/memory/message_reactions.go:198 — MessageStore.refreshPrivateReactionDialogSnapshotsLocked has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 4 (9 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.resolveMemoryReplyLocked (cognitive 29) · ×1
  • MessageStore.resolveMemoryReplyLocked (cognitive 29) internal/store/memory/message_send.go:329 — MessageStore.resolveMemoryReplyLocked has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · postgres.selectPlainPrivateSendBatch (cognitive 29) · ×1
  • postgres.selectPlainPrivateSendBatch (cognitive 29) internal/store/postgres/message_send_batch_actor.go:219 — postgres.selectPlainPrivateSendBatch has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 4 (8 pts), boolean chains 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.
D2 · Cognitive Complexity · postgres.pruneConfirmedUserPrefixTx (cognitive 29) · ×1
  • postgres.pruneConfirmedUserPrefixTx (cognitive 29) internal/store/postgres/update_event_retention.go:114 — postgres.pruneConfirmedUserPrefixTx has cognitive complexity 29 (threshold 15). Drivers by points: if/else 20 (24 pts), boolean chains 3, loops 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.HydrateChannelDialogSnapshot (cognitive 29) · ×1
  • ChannelStore.HydrateChannelDialogSnapshot (cognitive 29) REDACTED:953 — ChannelStore.HydrateChannelDialogSnapshot has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 3, loops 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.approveInviteImporterTx (cognitive 29) · ×1
  • ChannelStore.approveInviteImporterTx (cognitive 29) internal/store/postgres/channel_invite_import.go:111 — ChannelStore.approveInviteImporterTx has cognitive complexity 29 (threshold 15). Drivers by points: if/else 22 (27 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.reconcileChannelEditMentionsTx (cognitive 29) · ×1
  • ChannelStore.reconcileChannelEditMentionsTx (cognitive 29) internal/store/postgres/channel_message_edit.go:639 — ChannelStore.reconcileChannelEditMentionsTx has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (22 pts), loops 4, boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.getChannelMessagesForMember (cognitive 29) · ×1
  • ChannelStore.getChannelMessagesForMember (cognitive 29) internal/store/postgres/channel_message_history.go:493 — ChannelStore.getChannelMessagesForMember has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (21 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.GetChannelMessageViews (cognitive 29) · ×1
  • ChannelStore.GetChannelMessageViews (cognitive 29) internal/store/postgres/channel_message_views.go:23 — ChannelStore.GetChannelMessageViews has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (24 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.DeleteChannelParticipantReactions (cognitive 29) · ×1
  • ChannelStore.DeleteChannelParticipantReactions (cognitive 29) internal/store/postgres/channel_reaction_messages.go:255 — ChannelStore.DeleteChannelParticipantReactions has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (24 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). Of this number, 28 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.ReserveAlbumGroup (cognitive 29) · ×1
  • MessageStore.ReserveAlbumGroup (cognitive 29) internal/store/postgres/album_group.go:18 — MessageStore.ReserveAlbumGroup has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (22 pts), loops 6, 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.
D2 · Cognitive Complexity · MessageStore.ListSavedDialogs (cognitive 29) · ×1
  • MessageStore.ListSavedDialogs (cognitive 29) internal/store/postgres/saved_dialog.go:15 — MessageStore.ListSavedDialogs has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.DeleteSavedHistory (cognitive 29) · ×1
  • MessageStore.DeleteSavedHistory (cognitive 29) internal/store/postgres/saved_dialog.go:253 — MessageStore.DeleteSavedHistory has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (26 pts), loops 2, boolean chains 1 (nesting depth added 10). Of this number, 28 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PremiumStore.UpsertPremiumPlan (cognitive 29) · ×1
  • PremiumStore.UpsertPremiumPlan (cognitive 29) internal/store/postgres/premium.go:87 — PremiumStore.UpsertPremiumPlan has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 4 (nesting depth added 9). Most of this is not in the body itself: 5 of the 29 points are its own statements and the rest belongs to one function literal inside it that branches (line 92). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · StarGiftStore.ListByOwnerFiltered (cognitive 29) · ×1
  • StarGiftStore.ListByOwnerFiltered (cognitive 29) internal/store/postgres/star_gift.go:552 — StarGiftStore.ListByOwnerFiltered has cognitive complexity 29 (threshold 15). Drivers by points: if/else 21 (26 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · server.runOperatorCommand (cognitive 28) · ×1
  • server.runOperatorCommand (cognitive 28) cmd/telesrv-admin/admin_command_runner.go:104 — server.runOperatorCommand has cognitive complexity 28 (threshold 15). Drivers by points: if/else 20 (23 pts), boolean chains 5 (nesting depth added 3). Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Service.SetAccountFrozen (cognitive 28) · ×1
  • Service.SetAccountFrozen (cognitive 28) internal/admin/service.go:1473 — Service.SetAccountFrozen has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 8 (nesting depth added 5). Most of this is not in the body itself: 13 of the 28 points are its own statements and the rest belongs to one function literal inside it that branches (line 1494). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Service.ChangePhone (cognitive 28) · ×1
  • Service.ChangePhone (cognitive 28) internal/app/account/phone_change.go:170 — Service.ChangePhone has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 8, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · dialogs.dialogOwnerSnapshotStructuralHash (cognitive 28) · ×1
  • dialogs.dialogOwnerSnapshotStructuralHash (cognitive 28) internal/app/dialogs/list_snapshot_cache.go:288 — dialogs.dialogOwnerSnapshotStructuralHash has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (27 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.ReorderPinned (cognitive 28) · ×1
  • Service.ReorderPinned (cognitive 28) internal/app/dialogs/service.go:1078 — Service.ReorderPinned has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 2 (6 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.SendFromClient (cognitive 28) · ×1
  • Service.SendFromClient (cognitive 28) internal/app/ephemeral/service.go:76 — Service.SendFromClient has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 7 (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.
D2 · Cognitive Complexity · Service.DeleteOrphanedOlderThan (cognitive 28) · ×1
  • Service.DeleteOrphanedOlderThan (cognitive 28) internal/app/files/retention.go:111 — Service.DeleteOrphanedOlderThan has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.SeedMedia (cognitive 28) · ×1
  • Service.SeedMedia (cognitive 28) internal/app/files/seed.go:41 — Service.SeedMedia has cognitive complexity 28 (threshold 15). Drivers by points: if/else 20 (25 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · uploadPartsReader.Read (cognitive 28) · ×1
  • uploadPartsReader.Read (cognitive 28) internal/app/files/service.go:877 — uploadPartsReader.Read has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (24 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tdesktop.catalogChatThemes (cognitive 28) · ×1
  • tdesktop.catalogChatThemes (cognitive 28) internal/compat/tdesktop/startup_stubs.go:96 — tdesktop.catalogChatThemes has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loadharness.SnapshotClientState (cognitive 28) · ×1
  • loadharness.SnapshotClientState (cognitive 28) internal/loadharness/snapshot.go:105 — loadharness.SnapshotClientState has cognitive complexity 28 (threshold 15). Drivers by points: if/else 22 (25 pts), loops 3 (nesting depth added 3). Of this number, 24 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Conn.sendOutboundWithTerminalReserved (cognitive 28) · ×1
  • Conn.sendOutboundWithTerminalReserved (cognitive 28) internal/mtprotoedge/outbound.go:1779 — Conn.sendOutboundWithTerminalReserved has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (20 pts), match/switch 3 (5 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionManager.OnlineChannelIDsSnapshot (cognitive 28) · ×1
  • SessionManager.OnlineChannelIDsSnapshot (cognitive 28) internal/mtprotoedge/session_manager.go:2392 — SessionManager.OnlineChannelIDsSnapshot has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 4 (6 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Manager.WriteEnvValues (cognitive 28) · ×1
  • Manager.WriteEnvValues (cognitive 28) internal/procctl/procctl.go:478 — Manager.WriteEnvValues has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 3, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.cacheBoundAuthKeyLayerResolution (cognitive 28) · ×1
  • Router.cacheBoundAuthKeyLayerResolution (cognitive 28) REDACTED:278 — Router.cacheBoundAuthKeyLayerResolution has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 9, loops 2, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.botAPIQueuedUpdates (cognitive 28) · ×1
  • Router.botAPIQueuedUpdates (cognitive 28) internal/rpc/botapi_update_queue.go:20 — Router.botAPIQueuedUpdates has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onChannelsGetChannels (cognitive 28) · ×1
  • Router.onChannelsGetChannels (cognitive 28) internal/rpc/channels_core.go:85 — Router.onChannelsGetChannels has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 5, loops 4 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.DispatchAdmitted (cognitive 28) · ×1
  • Router.DispatchAdmitted (cognitive 28) internal/rpc/layer_dispatch.go:254 — Router.DispatchAdmitted has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 7 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Router.channelMessagesReactionsUpdates (cognitive 28) · ×1
  • Router.channelMessagesReactionsUpdates (cognitive 28) internal/rpc/messages_reactions_send.go:391 — Router.channelMessagesReactionsUpdates has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · Router.starGiftAuctionBidTarget (cognitive 28) · ×1
  • Router.starGiftAuctionBidTarget (cognitive 28) internal/rpc/payments_star_gift_lifecycle.go:230 — Router.starGiftAuctionBidTarget has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.validateStarsGiveawayPurpose (cognitive 28) · ×1
  • Router.validateStarsGiveawayPurpose (cognitive 28) internal/rpc/payments_star_gifts.go:225 — Router.validateStarsGiveawayPurpose has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 4 (5 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.FreezeNegotiatedSessionLayerAt (cognitive 28) · ×1
  • Router.FreezeNegotiatedSessionLayerAt (cognitive 28) internal/rpc/router.go:1179 — Router.FreezeNegotiatedSessionLayerAt has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.HideAllChatJoinRequests (cognitive 28) · ×1
  • ChannelStore.HideAllChatJoinRequests (cognitive 28) internal/store/memory/channel_invites.go:666 — ChannelStore.HideAllChatJoinRequests has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 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.
D2 · Cognitive Complexity · CommunityStore.ListCommunityParticipants (cognitive 28) · ×1
  • CommunityStore.ListCommunityParticipants (cognitive 28) internal/store/memory/community.go:825 — CommunityStore.ListCommunityParticipants has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 6, loops 4 (5 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.CreateChannel (cognitive 28) · ×1
  • ChannelStore.CreateChannel (cognitive 28) internal/store/postgres/channel_core.go:60 — ChannelStore.CreateChannel has cognitive complexity 28 (threshold 15). Drivers by points: if/else 20 (23 pts), loops 3, boolean chains 2 (nesting depth added 3). Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.ListChannelDialogSnapshotHeaders (cognitive 28) · ×1
  • ChannelStore.ListChannelDialogSnapshotHeaders (cognitive 28) REDACTED:293 — ChannelStore.ListChannelDialogSnapshotHeaders has cognitive complexity 28 (threshold 15). Drivers by points: if/else 19 (21 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 3). Of this number, 24 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · server.storageEnvValues (cognitive 27) · ×1
  • server.storageEnvValues (cognitive 27) cmd/telesrv-admin/serverstorage.go:154 — server.storageEnvValues has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (21 pts), match/switch 3 (4 pts), boolean chains 2 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · main.analyzeHandlers (cognitive 27) · ×1
  • main.analyzeHandlers (cognitive 27) cmd/tl-coverage/main.go:237 — main.analyzeHandlers has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 4 (7 pts), boolean chains 3 (nesting depth added 12). Most of this is not in the body itself: 13 of the 27 points are its own statements and the rest belongs to one function literal inside it that branches (line 261). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Service.resolveTone (cognitive 27) · ×1
  • Service.resolveTone (cognitive 27) internal/app/ai/service.go:574 — Service.resolveTone has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 7, loops 2 (4 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.handleTelegramLoginConfigurationInput (cognitive 27) · ×1
  • Service.handleTelegramLoginConfigurationInput (cognitive 27) internal/app/bots/botfather.go:770 — Service.handleTelegramLoginConfigurationInput has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · files.inspectMP4Layout (cognitive 27) · ×1
  • files.inspectMP4Layout (cognitive 27) internal/app/files/mp4faststart.go:79 — files.inspectMP4Layout has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · botapi.apiPoll (cognitive 27) · ×1
  • botapi.apiPoll (cognitive 27) internal/botapi/projection.go:760 — botapi.apiPoll has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (23 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · botapi.richMessageInputFromAPI (cognitive 27) · ×1
  • botapi.richMessageInputFromAPI (cognitive 27) internal/botapi/rich_message.go:15 — botapi.richMessageInputFromAPI has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 7 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · config.validateVerificationConfig (cognitive 27) · ×1
  • config.validateVerificationConfig (cognitive 27) internal/config/config.go:1730 — config.validateVerificationConfig has cognitive complexity 27 (threshold 15). Drivers by points: if/else 18, 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.
D2 · Cognitive Complexity · loadharness.runStartupAccount (cognitive 27) · ×1
  • loadharness.runStartupAccount (cognitive 27) REDACTED:422 — loadharness.runStartupAccount has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 3, loops 1 (nesting depth added 6). Most of this is not in the body itself: 8 of the 27 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 461, 447). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · mtprotoedge.preflightInboundItem (cognitive 27) · ×1
  • mtprotoedge.preflightInboundItem (cognitive 27) internal/mtprotoedge/inbound_preflight.go:648 — mtprotoedge.preflightInboundItem has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (26 pts), match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Router.onMessagesUnpinAllMessages (cognitive 27) · ×1
  • Router.onMessagesUnpinAllMessages (cognitive 27) internal/rpc/channels_stubs.go:145 — Router.onMessagesUnpinAllMessages has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 7 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.editPrivateInlineBotMessage (cognitive 27) · ×1
  • Router.editPrivateInlineBotMessage (cognitive 27) internal/rpc/messages_bot_no_state.go:113 — Router.editPrivateInlineBotMessage has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesReorderPinnedDialogs (cognitive 27) · ×1
  • Router.onMessagesReorderPinnedDialogs (cognitive 27) internal/rpc/messages_dialogs.go:767 — Router.onMessagesReorderPinnedDialogs has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 5, loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.privateMessagesReactionsUpdates (cognitive 27) · ×1
  • Router.privateMessagesReactionsUpdates (cognitive 27) internal/rpc/messages_reactions_send.go:328 — Router.privateMessagesReactionsUpdates has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · Router.onPhoneDeleteConferenceCallParticipants (cognitive 27) · ×1
  • Router.onPhoneDeleteConferenceCallParticipants (cognitive 27) internal/rpc/phone_conference.go:232 — Router.onPhoneDeleteConferenceCallParticipants has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 4, loops 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.fillUserFullPhotos (cognitive 27) · ×1
  • Router.fillUserFullPhotos (cognitive 27) REDACTED:812 — Router.fillUserFullPhotos has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BotVerificationStore.ListCustomVerificationRequests (cognitive 27) · ×1
  • BotVerificationStore.ListCustomVerificationRequests (cognitive 27) internal/store/memory/bot_verification.go:705 — BotVerificationStore.ListCustomVerificationRequests has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 8, 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.
D2 · Cognitive Complexity · ChannelStore.ListInviteImporters (cognitive 27) · ×1
  • ChannelStore.ListInviteImporters (cognitive 27) internal/store/memory/channel_invites.go:562 — ChannelStore.ListInviteImporters has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 6). Of this number, 26 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.JoinChannel (cognitive 27) · ×1
  • ChannelStore.JoinChannel (cognitive 27) internal/store/memory/channel_members.go:108 — ChannelStore.JoinChannel has cognitive complexity 27 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContactStore.ContactProjectionForViewers (cognitive 27) · ×1
  • ContactStore.ContactProjectionForViewers (cognitive 27) REDACTED:94 — ContactStore.ContactProjectionForViewers has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 4 (5 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LangPackStore.ListLanguages (cognitive 27) · ×1
  • LangPackStore.ListLanguages (cognitive 27) internal/store/memory/langpack.go:82 — LangPackStore.ListLanguages has cognitive complexity 27 (threshold 15). Drivers by points: if/else 5 (18 pts), loops 3 (4 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.DeleteSavedHistory (cognitive 27) · ×1
  • MessageStore.DeleteSavedHistory (cognitive 27) internal/store/memory/saved_dialog.go:219 — MessageStore.DeleteSavedHistory has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 7). Of this number, 19 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.DeleteChannel (cognitive 27) · ×1
  • ChannelStore.DeleteChannel (cognitive 27) internal/store/postgres/channel_helpers.go:72 — ChannelStore.DeleteChannel has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (24 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 8). Of this number, 26 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.deleteChannelMessagesTx (cognitive 27) · ×1
  • ChannelStore.deleteChannelMessagesTx (cognitive 27) internal/store/postgres/channel_message_delete.go:438 — ChannelStore.deleteChannelMessagesTx has cognitive complexity 27 (threshold 15). Drivers by points: if/else 18 (24 pts), 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.
D2 · Cognitive Complexity · ChannelStore.SearchJoinedMessages (cognitive 27) · ×1
  • ChannelStore.SearchJoinedMessages (cognitive 27) internal/store/postgres/channel_message_history.go:351 — ChannelStore.SearchJoinedMessages has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 5, loops 2 (3 pts), match/switch 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.
D2 · Cognitive Complexity · ChannelStore.ListMonoforumDialogs (cognitive 27) · ×1
  • ChannelStore.ListMonoforumDialogs (cognitive 27) internal/store/postgres/channel_monoforum.go:308 — ChannelStore.ListMonoforumDialogs has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (22 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.pruneChannelUpdateEvents (cognitive 27) · ×1
  • ChannelStore.pruneChannelUpdateEvents (cognitive 27) internal/store/postgres/channel_update_retention.go:123 — ChannelStore.pruneChannelUpdateEvents has cognitive complexity 27 (threshold 15). Drivers by points: if/else 19 (23 pts), boolean chains 3, loops 1 (nesting depth added 4). Most of this is not in the body itself: 6 of the 27 points are its own statements and the rest belongs to one function literal inside it that branches (line 132). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · StoryStore.populateStoryViewState (cognitive 27) · ×1
  • StoryStore.populateStoryViewState (cognitive 27) internal/store/postgres/story.go:1906 — StoryStore.populateStoryViewState has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 4, 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.
D2 · Cognitive Complexity · Service.runCommand (cognitive 26) · ×1
  • Service.runCommand (cognitive 26) internal/admin/service.go:3933 — Service.runCommand has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Service.DeleteAccount (cognitive 26) · ×1
  • Service.DeleteAccount (cognitive 26) REDACTED:42 — Service.DeleteAccount has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Service.ChainBalance (cognitive 26) · ×1
  • Service.ChainBalance (cognitive 26) internal/app/donations/balance.go:20 — Service.ChainBalance has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 5 (6 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.CreateDocumentFromUpload (cognitive 26) · ×1
  • Service.CreateDocumentFromUpload (cognitive 26) internal/app/files/photos.go:324 — Service.CreateDocumentFromUpload has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.WarmCaches (cognitive 26) · ×1
  • Service.WarmCaches (cognitive 26) internal/app/files/warm.go:19 — Service.WarmCaches has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 7 (10 pts) (nesting depth added 9). Of this number, 24 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · telegramlogin.parseWebURL (cognitive 26) · ×1
  • telegramlogin.parseWebURL (cognitive 26) internal/app/telegramlogin/url.go:49 — telegramlogin.parseWebURL has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · Service.Translate (cognitive 26) · ×1
  • Service.Translate (cognitive 26) internal/app/translation/service.go:102 — Service.Translate has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 4, 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.
D2 · Cognitive Complexity · botapi.messageEntitiesFromAPI (cognitive 26) · ×1
  • botapi.messageEntitiesFromAPI (cognitive 26) internal/botapi/inline.go:72 — botapi.messageEntitiesFromAPI has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 2, match/switch 1 (2 pts), 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.
D2 · Cognitive Complexity · mtprotoedge.closeConnBatch (cognitive 26) · ×1
  • mtprotoedge.closeConnBatch (cognitive 26) internal/mtprotoedge/session_manager.go:1079 — mtprotoedge.closeConnBatch has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 6 (7 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 8). Of this number, 24 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Conn.enqueueEncodedDeliveryReserved (cognitive 26) · ×1
  • Conn.enqueueEncodedDeliveryReserved (cognitive 26) internal/mtprotoedge/outbound.go:1678 — Conn.enqueueEncodedDeliveryReserved has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Conn.handleOutboundResend (cognitive 26) · ×1
  • Conn.handleOutboundResend (cognitive 26) internal/mtprotoedge/outbound.go:2394 — Conn.handleOutboundResend has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 1, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Server.refreshActivatedInheritedLayerProfile (cognitive 26) · ×1
  • Server.refreshActivatedInheritedLayerProfile (cognitive 26) internal/mtprotoedge/conn_layer_profile.go:441 — Server.refreshActivatedInheritedLayerProfile has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Server.handleAdmittedLayerRPC (cognitive 26) · ×1
  • Server.handleAdmittedLayerRPC (cognitive 26) internal/mtprotoedge/layer_rpc_execution.go:237 — Server.handleAdmittedLayerRPC has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.tgBotInlineResult (cognitive 26) · ×1
  • rpc.tgBotInlineResult (cognitive 26) internal/rpc/bots_inline.go:1088 — rpc.tgBotInlineResult has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.domainRequestPeerFilter (cognitive 26) · ×1
  • rpc.domainRequestPeerFilter (cognitive 26) internal/rpc/convert_markup.go:495 — rpc.domainRequestPeerFilter has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 1, match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · rpc.tgWebPage (cognitive 26) · ×1
  • rpc.tgWebPage (cognitive 26) internal/rpc/convert_media.go:177 — rpc.tgWebPage has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (25 pts), match/switch 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · rpc.collectChannelMessagePeerRefs (cognitive 26) · ×1
  • rpc.collectChannelMessagePeerRefs (cognitive 26) internal/rpc/update_peer_refs.go:416 — rpc.collectChannelMessagePeerRefs has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (19 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · channelFanoutDispatcher.runRecoverySweeps (cognitive 26) · ×1
  • channelFanoutDispatcher.runRecoverySweeps (cognitive 26) internal/rpc/channel_fanout_dispatcher.go:768 — channelFanoutDispatcher.runRecoverySweeps has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (19 pts), match/switch 2 (6 pts), loops 1 (nesting depth added 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · channelFanoutDispatcher.sweepOnlineChannelRecovery (cognitive 26) · ×1
  • channelFanoutDispatcher.sweepOnlineChannelRecovery (cognitive 26) internal/rpc/channel_fanout_dispatcher.go:823 — channelFanoutDispatcher.sweepOnlineChannelRecovery has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesGetChats (cognitive 26) · ×1
  • Router.onMessagesGetChats (cognitive 26) internal/rpc/channels_legacy_chat.go:111 — Router.onMessagesGetChats has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 3 (6 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.tgChatlistPeerEnvelopeWithChannels (cognitive 26) · ×1
  • Router.tgChatlistPeerEnvelopeWithChannels (cognitive 26) internal/rpc/chatlists.go:337 — Router.tgChatlistPeerEnvelopeWithChannels has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.preflightVoiceOrRound (cognitive 26) · ×1
  • Router.preflightVoiceOrRound (cognitive 26) internal/rpc/privacy_voice.go:28 — Router.preflightVoiceOrRound has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (5 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onStoriesSendReaction (cognitive 26) · ×1
  • Router.onStoriesSendReaction (cognitive 26) internal/rpc/stories.go:2762 — Router.onStoriesSendReaction has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 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.
D2 · Cognitive Complexity · Router.applyStoryMaxIDsToPeerObjects (cognitive 26) · ×1
  • Router.applyStoryMaxIDsToPeerObjects (cognitive 26) internal/rpc/story_peer_projection.go:585 — Router.applyStoryMaxIDsToPeerObjects has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 4, boolean chains 3 (nesting depth added 8). Of this number, 24 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.prepareUpdateEventsForViewer (cognitive 26) · ×1
  • Router.prepareUpdateEventsForViewer (cognitive 26) internal/rpc/update_peer_refs.go:32 — Router.prepareUpdateEventsForViewer has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 2 (6 pts) (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ChannelStore.toggleSuggestedPostApprovalLocked (cognitive 26) · ×1
  • ChannelStore.toggleSuggestedPostApprovalLocked (cognitive 26) internal/store/memory/channel_suggested_post.go:43 — ChannelStore.toggleSuggestedPostApprovalLocked has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 8, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.SearchChannelMedia (cognitive 26) · ×1
  • ChannelStore.SearchChannelMedia (cognitive 26) internal/store/memory/media_search.go:163 — ChannelStore.SearchChannelMedia has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 5, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContactStore.ContactProjectionForViewerUserIDs (cognitive 26) · ×1
  • ContactStore.ContactProjectionForViewerUserIDs (cognitive 26) REDACTED:157 — ContactStore.ContactProjectionForViewerUserIDs has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.PinPrivateMessage (cognitive 26) · ×1
  • MessageStore.PinPrivateMessage (cognitive 26) internal/store/memory/message_pin.go:13 — MessageStore.PinPrivateMessage has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 8, loops 3 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · postgres.getModerationCase (cognitive 26) · ×1
  • postgres.getModerationCase (cognitive 26) internal/store/postgres/moderation_cases.go:1046 — postgres.getModerationCase has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (22 pts), loops 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.
D2 · Cognitive Complexity · AccountLifecycleStore.ExecuteAccountDeletion (cognitive 26) · ×1
  • AccountLifecycleStore.ExecuteAccountDeletion (cognitive 26) internal/store/postgres/account_lifecycle.go:121 — AccountLifecycleStore.ExecuteAccountDeletion has cognitive complexity 26 (threshold 15). Drivers by points: if/else 21 (23 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.ListChannelMessageReactions (cognitive 26) · ×1
  • ChannelStore.ListChannelMessageReactions (cognitive 26) internal/store/postgres/channel_reaction_messages.go:415 — ChannelStore.ListChannelMessageReactions has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 4, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ChannelStore.EditForumTopic (cognitive 26) · ×1
  • ChannelStore.EditForumTopic (cognitive 26) internal/store/postgres/channel_topics.go:194 — ChannelStore.EditForumTopic has cognitive complexity 26 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MessageStore.enrichPrivateMessageReactions (cognitive 26) · ×1
  • MessageStore.enrichPrivateMessageReactions (cognitive 26) internal/store/postgres/message_reactions.go:237 — MessageStore.enrichPrivateMessageReactions has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 3, loops 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.duplicateSendResult (cognitive 26) · ×1
  • MessageStore.duplicateSendResult (cognitive 26) internal/store/postgres/message_send.go:713 — MessageStore.duplicateSendResult has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 6 (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.
D2 · Cognitive Complexity · ModerationReportStore.CompleteModerationAction (cognitive 26) · ×1
  • ModerationReportStore.CompleteModerationAction (cognitive 26) internal/store/postgres/moderation_cases.go:816 — ModerationReportStore.CompleteModerationAction has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TelegramLoginStore.ConsumeTelegramLoginAuthorizationCode (cognitive 26) · ×1
  • TelegramLoginStore.ConsumeTelegramLoginAuthorizationCode (cognitive 26) internal/store/postgres/telegram_login.go:866 — TelegramLoginStore.ConsumeTelegramLoginAuthorizationCode has cognitive complexity 26 (threshold 15). Drivers by points: if/else 18 (20 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · TelegramLoginStore.ConsumeTelegramLoginDirectToken (cognitive 26) · ×1
  • TelegramLoginStore.ConsumeTelegramLoginDirectToken (cognitive 26) internal/store/postgres/telegram_login.go:936 — TelegramLoginStore.ConsumeTelegramLoginDirectToken has cognitive complexity 26 (threshold 15). Drivers by points: if/else 18 (20 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · userLaneActor.run (cognitive 26) · ×1
  • userLaneActor.run (cognitive 26) internal/store/postgres/user_lane_actor.go:89 — userLaneActor.run has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 6 (10 pts), match/switch 1 (2 pts) (nesting depth added 14). Of this number, 13 points are the body's own statements and 13 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · handler.publicUserPeer (cognitive 26) · ×1
  • handler.publicUserPeer (cognitive 26) internal/web/server.go:746 — handler.publicUserPeer has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.fetchAll (cognitive 25) · ×1
  • main.fetchAll (cognitive 25) cmd/langpackfetch/main.go:137 — main.fetchAll has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · readStore.PeerProfileContent (cognitive 25) · ×1
  • readStore.PeerProfileContent (cognitive 25) cmd/telesrv-admin/privateview_store.go:389 — readStore.PeerProfileContent has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.AccountFreezes (cognitive 25) · ×1
  • Service.AccountFreezes (cognitive 25) internal/admin/service.go:1372 — Service.AccountFreezes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · domain.detectBotCommandMessageEntities (cognitive 25) · ×1
  • domain.detectBotCommandMessageEntities (cognitive 25) internal/domain/message_entity_autodetect.go:97 — domain.detectBotCommandMessageEntities has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 8, loops 3 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Dataset.Validate (cognitive 25) · ×1
  • Dataset.Validate (cognitive 25) internal/loadharness/dataset.go:205 — Dataset.Validate has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RunConfig.validate (cognitive 25) · ×1
  • RunConfig.validate (cognitive 25) REDACTED:73 — RunConfig.validate has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 14, if/else 11. 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.
D2 · Cognitive Complexity · outboundTrackedBudget.waitReserveUntil (cognitive 25) · ×1
  • outboundTrackedBudget.waitReserveUntil (cognitive 25) internal/mtprotoedge/outbound.go:1269 — outboundTrackedBudget.waitReserveUntil has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 8). Of this number, 24 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Sender.send (cognitive 25) · ×1
  • Sender.send (cognitive 25) internal/otpdelivery/smtp/sender.go:71 — Sender.send has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20 (25 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · rpc.postProcessBotAPIRichHTML (cognitive 25) · ×1
  • rpc.postProcessBotAPIRichHTML (cognitive 25) internal/rpc/botapi_rich_message.go:141 — rpc.postProcessBotAPIRichHTML has cognitive complexity 25 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (10 pts), match/switch 1 (2 pts) (nesting depth added 17). None of this is in the body itself: all 25 points belong to one function literal inside it that branches (line 144). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · rpc.botAPIQueuedUpdateKind (cognitive 25) · ×1
  • rpc.botAPIQueuedUpdateKind (cognitive 25) internal/rpc/botapi_update_queue.go:169 — rpc.botAPIQueuedUpdateKind has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 6, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.domainChannelReactionPolicy (cognitive 25) · ×1
  • rpc.domainChannelReactionPolicy (cognitive 25) internal/rpc/channels_read_reactions.go:92 — rpc.domainChannelReactionPolicy has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 2 (4 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.tgChannel (cognitive 25) · ×1
  • rpc.tgChannel (cognitive 25) internal/rpc/convert_channels_core.go:449 — rpc.tgChannel has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · rpc.tgRequestedPeers (cognitive 25) · ×1
  • rpc.tgRequestedPeers (cognitive 25) internal/rpc/convert_messages.go:366 — rpc.tgRequestedPeers has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 2, loops 2, match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.tgForwardMessagesUpdates (cognitive 25) · ×1
  • rpc.tgForwardMessagesUpdates (cognitive 25) internal/rpc/messages_forward.go:793 — rpc.tgForwardMessagesUpdates has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.fileLocationKey (cognitive 25) · ×1
  • rpc.fileLocationKey (cognitive 25) internal/rpc/upload.go:228 — rpc.fileLocationKey has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 2, match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Router.botAPIQueuedUpdateEvents (cognitive 25) · ×1
  • Router.botAPIQueuedUpdateEvents (cognitive 25) internal/rpc/botapi_update_queue.go:73 — Router.botAPIQueuedUpdateEvents has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 2, match/switch 1 (2 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.mentionedUserIDsFromDomainMessage (cognitive 25) · ×1
  • Router.mentionedUserIDsFromDomainMessage (cognitive 25) internal/rpc/messages_bot_no_state.go:315 — Router.mentionedUserIDsFromDomainMessage has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 2 (3 pts) (nesting depth added 13). Of this number, 23 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesGetPollVotes (cognitive 25) · ×1
  • Router.onMessagesGetPollVotes (cognitive 25) internal/rpc/messages_polls.go:143 — Router.onMessagesGetPollVotes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 5, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.validateTelemetryMessageIDs (cognitive 25) · ×1
  • Router.validateTelemetryMessageIDs (cognitive 25) internal/rpc/messages_reports.go:322 — Router.validateTelemetryMessageIDs has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 3 (5 pts), boolean chains 2, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onPaymentsCraftStarGift (cognitive 25) · ×1
  • Router.onPaymentsCraftStarGift (cognitive 25) internal/rpc/payments_star_gift_lifecycle.go:792 — Router.onPaymentsCraftStarGift has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 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.
D2 · Cognitive Complexity · Router.effectiveUserID (cognitive 25) · ×1
  • Router.effectiveUserID (cognitive 25) internal/rpc/router.go:546 — Router.effectiveUserID has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onUpdatesGetDifference (cognitive 25) · ×1
  • Router.onUpdatesGetDifference (cognitive 25) internal/rpc/updates.go:82 — Router.onUpdatesGetDifference has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memory.channelDialogMatchesFilter (cognitive 25) · ×1
  • memory.channelDialogMatchesFilter (cognitive 25) internal/store/memory/channel_dialogs.go:517 — memory.channelDialogMatchesFilter has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.deleteChannelMessagesLocked (cognitive 25) · ×1
  • ChannelStore.deleteChannelMessagesLocked (cognitive 25) internal/store/memory/channel_message_delete.go:201 — ChannelStore.deleteChannelMessagesLocked has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 4, loops 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommunityStore.derivedMemberLocked (cognitive 25) · ×1
  • CommunityStore.derivedMemberLocked (cognitive 25) internal/store/memory/community.go:60 — CommunityStore.derivedMemberLocked has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 3 (7 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · postgres.insertChannelMessageWithFingerprintTx (cognitive 25) · ×1
  • postgres.insertChannelMessageWithFingerprintTx (cognitive 25) internal/store/postgres/channel_message_send.go:554 — postgres.insertChannelMessageWithFingerprintTx has cognitive complexity 25 (threshold 15). Drivers by points: if/else 21 (24 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.channelMessageViewReplies (cognitive 25) · ×1
  • ChannelStore.channelMessageViewReplies (cognitive 25) internal/store/postgres/channel_message_views.go:169 — ChannelStore.channelMessageViewReplies has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 6). Of this number, 22 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StarGiftLifecycleStore.creditPeerLifecycleAmount (cognitive 25) · ×1
  • StarGiftLifecycleStore.creditPeerLifecycleAmount (cognitive 25) internal/store/postgres/star_gift_lifecycle.go:1387 — StarGiftLifecycleStore.creditPeerLifecycleAmount has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Handler.token (cognitive 25) · ×1
  • Handler.token (cognitive 25) internal/telegramloginhttp/handler.go:587 — Handler.token has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 5, match/switch 2 (3 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · main.documentMedia (cognitive 24) · ×1
  • main.documentMedia (cognitive 24) cmd/telesrv-admin/privateview_store.go:781 — main.documentMedia has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 6, match/switch 2 (3 pts), 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.
D2 · Cognitive Complexity · files.scanSeedDir (cognitive 24) · ×1
  • files.scanSeedDir (cognitive 24) internal/app/files/seed.go:574 — files.scanSeedDir has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.cloneStickerSetDocument (cognitive 24) · ×1
  • Service.cloneStickerSetDocument (cognitive 24) internal/app/files/sticker_material.go:39 — Service.cloneStickerSetDocument has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · langpack.scanSeedCandidates (cognitive 24) · ×1
  • langpack.scanSeedCandidates (cognitive 24) internal/app/langpack/seed.go:123 — langpack.scanSeedCandidates has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 6). Most of this is not in the body itself: 6 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 129). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · botapi.validateBotAPIFormattedText (cognitive 24) · ×1
  • botapi.validateBotAPIFormattedText (cognitive 24) internal/botapi/formatted_text.go:87 — botapi.validateBotAPIFormattedText has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5, loops 4 (5 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · handler.downloadFile (cognitive 24) · ×1
  • handler.downloadFile (cognitive 24) internal/botapi/server.go:921 — handler.downloadFile has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModerationReport.Validate (cognitive 24) · ×1
  • ModerationReport.Validate (cognitive 24) internal/domain/moderation.go:312 — ModerationReport.Validate has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 6, 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.
D2 · Cognitive Complexity · deliveryTracker.report (cognitive 24) · ×1
  • deliveryTracker.report (cognitive 24) internal/loadharness/delivery.go:135 — deliveryTracker.report has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (4 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · prop.numbers (cognitive 24) · ×1
  • prop.numbers (cognitive 24) internal/lottieraster/lottieraster.go:219 — prop.numbers has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.rawURLByteSpans (cognitive 24) · ×1
  • rpc.rawURLByteSpans (cognitive 24) internal/rpc/webpage_url_extract.go:37 — rpc.rawURLByteSpans has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 10). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onAccountGetNotifyExceptions (cognitive 24) · ×1
  • Router.onAccountGetNotifyExceptions (cognitive 24) internal/rpc/account_notify.go:142 — Router.onAccountGetNotifyExceptions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onContactsDeleteContacts (cognitive 24) · ×1
  • Router.onContactsDeleteContacts (cognitive 24) internal/rpc/contacts.go:792 — Router.onContactsDeleteContacts has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (19 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.prepareRPCDispatchContext (cognitive 24) · ×1
  • Router.prepareRPCDispatchContext (cognitive 24) internal/rpc/dispatch_context.go:15 — Router.prepareRPCDispatchContext has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.ResolveInheritedAuthKeyLayer (cognitive 24) · ×1
  • Router.ResolveInheritedAuthKeyLayer (cognitive 24) internal/rpc/layer_inheritance.go:380 — Router.ResolveInheritedAuthKeyLayer has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (20 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onPaymentsConvertStarGift (cognitive 24) · ×1
  • Router.onPaymentsConvertStarGift (cognitive 24) internal/rpc/payments_star_gifts.go:1249 — Router.onPaymentsConvertStarGift has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onPhoneJoinGroupCall (cognitive 24) · ×1
  • Router.onPhoneJoinGroupCall (cognitive 24) internal/rpc/phone_group_call.go:264 — Router.onPhoneJoinGroupCall has cognitive complexity 24 (threshold 15). Drivers by points: if/else 18 (20 pts), boolean chains 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.onPhotosUploadContactProfilePhoto (cognitive 24) · ×1
  • Router.onPhotosUploadContactProfilePhoto (cognitive 24) internal/rpc/photos.go:158 — Router.onPhotosUploadContactProfilePhoto has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.onUsersGetFullUser (cognitive 24) · ×1
  • Router.onUsersGetFullUser (cognitive 24) REDACTED:130 — Router.onUsersGetFullUser has cognitive complexity 24 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.ListAdminLog (cognitive 24) · ×1
  • ChannelStore.ListAdminLog (cognitive 24) internal/store/memory/channel_invites.go:108 — ChannelStore.ListAdminLog has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 6, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.SetMessageReactions (cognitive 24) · ×1
  • MessageStore.SetMessageReactions (cognitive 24) internal/store/memory/message_reactions.go:12 — MessageStore.SetMessageReactions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · postgres.channelDialogMatchesFilter (cognitive 24) · ×1
  • postgres.channelDialogMatchesFilter (cognitive 24) REDACTED:2128 — postgres.channelDialogMatchesFilter has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.ProcessSuggestedPostLifecycle (cognitive 24) · ×1
  • ChannelStore.ProcessSuggestedPostLifecycle (cognitive 24) internal/store/postgres/channel_suggested_post.go:414 — ChannelStore.ProcessSuggestedPostLifecycle has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 2, 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.
D2 · Cognitive Complexity · CommunityStore.ReorderCommunityPinned (cognitive 24) · ×1
  • CommunityStore.ReorderCommunityPinned (cognitive 24) internal/store/postgres/community.go:1309 — CommunityStore.ReorderCommunityPinned has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 3, boolean chains 1 (nesting depth added 9). None of this is in the body itself: all 24 points belong to one function literal inside it that branches (line 1310). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · PhoneChangeStore.ChangePhone (cognitive 24) · ×1
  • PhoneChangeStore.ChangePhone (cognitive 24) internal/store/postgres/phone_change.go:25 — PhoneChangeStore.ChangePhone has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 2 (nesting depth added 6). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReadModelChangeListener.flush (cognitive 24) · ×1
  • ReadModelChangeListener.flush (cognitive 24) internal/store/postgres/read_model_listener.go:279 — ReadModelChangeListener.flush has cognitive complexity 24 (threshold 15). Drivers by points: if/else 23, 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.
D2 · Cognitive Complexity · StarGiftLifecycleStore.loadCraftInputMessageReplays (cognitive 24) · ×1
  • StarGiftLifecycleStore.loadCraftInputMessageReplays (cognitive 24) internal/store/postgres/star_gift_craft_projection.go:170 — StarGiftLifecycleStore.loadCraftInputMessageReplays has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.run (cognitive 23) · ×1
  • main.run (cognitive 23) cmd/blob-migrate/main.go:55 — main.run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14, boolean chains 3, loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 3). Of this number, 18 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, 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.
D2 · Cognitive Complexity · main.rotateSigning (cognitive 23) · ×1
  • main.rotateSigning (cognitive 23) cmd/telegramloginkeygen/main.go:177 — main.rotateSigning has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 4, 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.
D2 · Cognitive Complexity · readStore.fillPeers (cognitive 23) · ×1
  • readStore.fillPeers (cognitive 23) cmd/telesrv-admin/privateview_store.go:574 — readStore.fillPeers has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 4 (6 pts) (nesting depth added 9). Of this number, 20 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.resendCode (cognitive 23) · ×1
  • Service.resendCode (cognitive 23) internal/app/auth/service.go:861 — Service.resendCode has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · bots.normalizeStickersBotShortName (cognitive 23) · ×1
  • bots.normalizeStickersBotShortName (cognitive 23) internal/app/bots/stickersbot.go:749 — bots.normalizeStickersBotShortName has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (17 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Service.verifierStatusReply (cognitive 23) · ×1
  • Service.verifierStatusReply (cognitive 23) internal/app/bots/verifierbot.go:822 — Service.verifierStatusReply has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · giftpack.Import (cognitive 23) · ×1
  • giftpack.Import (cognitive 23) internal/app/giftpack/import.go:63 — giftpack.Import has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ActionWorker.runOnce (cognitive 23) · ×1
  • ActionWorker.runOnce (cognitive 23) internal/app/moderation/actions.go:456 — ActionWorker.runOnce has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.RepairDocumentThumbs (cognitive 23) · ×1
  • Service.RepairDocumentThumbs (cognitive 23) internal/app/stargifts/thumb.go:97 — Service.RepairDocumentThumbs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · botapi.replyKeyboardMarkupFromAPI (cognitive 23) · ×1
  • botapi.replyKeyboardMarkupFromAPI (cognitive 23) internal/botapi/inline.go:269 — botapi.replyKeyboardMarkupFromAPI has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loadharness.seedRichAccountState (cognitive 23) · ×1
  • loadharness.seedRichAccountState (cognitive 23) internal/loadharness/rich_state.go:48 — loadharness.seedRichAccountState has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14, boolean chains 9. Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 66). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · loadharness.startupResponseBytes (cognitive 23) · ×1
  • loadharness.startupResponseBytes (cognitive 23) REDACTED:928 — loadharness.startupResponseBytes has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (17 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OfflineMutationState.Validate (cognitive 23) · ×1
  • OfflineMutationState.Validate (cognitive 23) internal/loadharness/mutate.go:584 — OfflineMutationState.Validate has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 8, loops 3 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mtprotoedge.layerRPCAdmissionHasExplicitSelector (cognitive 23) · ×1
  • mtprotoedge.layerRPCAdmissionHasExplicitSelector (cognitive 23) internal/mtprotoedge/inbound_layer_rpc.go:938 — mtprotoedge.layerRPCAdmissionHasExplicitSelector has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Manager.supervise (cognitive 23) · ×1
  • Manager.supervise (cognitive 23) internal/procctl/supervisor.go:241 — Manager.supervise has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.contactNote (cognitive 23) · ×1
  • rpc.contactNote (cognitive 23) internal/rpc/contacts.go:1025 — rpc.contactNote has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.newGetMessagesInputTrace (cognitive 23) · ×1
  • rpc.newGetMessagesInputTrace (cognitive 23) internal/rpc/messages_getmessages_trace.go:27 — rpc.newGetMessagesInputTrace has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (20 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.extractMentionUsernames (cognitive 23) · ×1
  • rpc.extractMentionUsernames (cognitive 23) internal/rpc/messages_send.go:828 — rpc.extractMentionUsernames has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 5, loops 3 (5 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.botAPIMedia (cognitive 23) · ×1
  • Router.botAPIMedia (cognitive 23) internal/rpc/botapi_gateway.go:721 — Router.botAPIMedia has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 3 (5 pts), boolean chains 2 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Router.channelFanoutRecipients (cognitive 23) · ×1
  • Router.channelFanoutRecipients (cognitive 23) internal/rpc/channels_stubs.go:333 — Router.channelFanoutRecipients has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 2, loops 2, match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Router.encryptedStateUpdates (cognitive 23) · ×1
  • Router.encryptedStateUpdates (cognitive 23) internal/rpc/encrypted_messages.go:198 — Router.encryptedStateUpdates has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onEphemeralSendMessage (cognitive 23) · ×1
  • Router.onEphemeralSendMessage (cognitive 23) internal/rpc/ephemeral.go:44 — Router.onEphemeralSendMessage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 5 (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.
D2 · Cognitive Complexity · Router.dialogFolderFromTG (cognitive 23) · ×1
  • Router.dialogFolderFromTG (cognitive 23) internal/rpc/messages_dialogs.go:1047 — Router.dialogFolderFromTG has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesToggleStickerSets (cognitive 23) · ×1
  • Router.onMessagesToggleStickerSets (cognitive 23) internal/rpc/messages_sticker_sets.go:85 — Router.onMessagesToggleStickerSets has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onPhoneCreateGroupCall (cognitive 23) · ×1
  • Router.onPhoneCreateGroupCall (cognitive 23) internal/rpc/phone_group_call.go:183 — Router.onPhoneCreateGroupCall has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 6 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Router.onPhoneCheckGroupCall (cognitive 23) · ×1
  • Router.onPhoneCheckGroupCall (cognitive 23) internal/rpc/phone_group_call.go:552 — Router.onPhoneCheckGroupCall has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 4 (9 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.presenceFanoutCandidates (cognitive 23) · ×1
  • Router.presenceFanoutCandidates (cognitive 23) internal/rpc/presence.go:1091 — Router.presenceFanoutCandidates has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (15 pts), loops 2 (6 pts), boolean chains 2 (nesting depth added 7). Of this number, 20 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Router.effectiveAuthKeyID (cognitive 23) · ×1
  • Router.effectiveAuthKeyID (cognitive 23) internal/rpc/router.go:441 — Router.effectiveAuthKeyID has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.telegramLoginButtonFromMessage (cognitive 23) · ×1
  • Router.telegramLoginButtonFromMessage (cognitive 23) internal/rpc/telegram_login.go:263 — Router.telegramLoginButtonFromMessage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, loops 2 (3 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BotVerificationStore.ListCustomVerifications (cognitive 23) · ×1
  • BotVerificationStore.ListCustomVerifications (cognitive 23) internal/store/memory/bot_verification.go:499 — BotVerificationStore.ListCustomVerifications has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 7, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.GetChannels (cognitive 23) · ×1
  • ChannelStore.GetChannels (cognitive 23) internal/store/memory/channel_core.go:206 — ChannelStore.GetChannels has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 3, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.EditExportedInvite (cognitive 23) · ×1
  • ChannelStore.EditExportedInvite (cognitive 23) internal/store/memory/channel_invites.go:417 — ChannelStore.EditExportedInvite has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.EditChannelAdmin (cognitive 23) · ×1
  • ChannelStore.EditChannelAdmin (cognitive 23) internal/store/memory/channel_members.go:288 — ChannelStore.EditChannelAdmin has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ChannelStore.EditForumTopic (cognitive 23) · ×1
  • ChannelStore.EditForumTopic (cognitive 23) internal/store/memory/channel_topics.go:179 — ChannelStore.EditForumTopic has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CommunityStore.DecideAllCommunityPeerLinkRequests (cognitive 23) · ×1
  • CommunityStore.DecideAllCommunityPeerLinkRequests (cognitive 23) internal/store/memory/community.go:590 — CommunityStore.DecideAllCommunityPeerLinkRequests has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (18 pts), loops 4, boolean chains 1 (nesting depth added 6). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommunityStore.allParticipantsLocked (cognitive 23) · ×1
  • CommunityStore.allParticipantsLocked (cognitive 23) internal/store/memory/community.go:783 — CommunityStore.allParticipantsLocked has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (7 pts) (nesting depth added 12). Of this number, 20 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.UpsertSavedReactionTag (cognitive 23) · ×1
  • MessageStore.UpsertSavedReactionTag (cognitive 23) internal/store/memory/message_saved_reactions.go:115 — MessageStore.UpsertSavedReactionTag has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · postgres.validateBotAPIUpdateRequest (cognitive 23) · ×1
  • postgres.validateBotAPIUpdateRequest (cognitive 23) internal/store/postgres/botapi_update.go:684 — postgres.validateBotAPIUpdateRequest has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 7, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · postgres.cloneChannelTopMessage (cognitive 23) · ×1
  • postgres.cloneChannelTopMessage (cognitive 23) internal/store/postgres/channel_top_message_cache.go:166 — postgres.cloneChannelTopMessage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 3 (10 pts) (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.ApplyPremiumBoost (cognitive 23) · ×1
  • ChannelStore.ApplyPremiumBoost (cognitive 23) internal/store/postgres/channel_boosts.go:63 — ChannelStore.ApplyPremiumBoost has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 1, loops 1 (nesting depth added 7). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ReadChannelMessageContents (cognitive 23) · ×1
  • ChannelStore.ReadChannelMessageContents (cognitive 23) internal/store/postgres/channel_read.go:140 — ChannelStore.ReadChannelMessageContents has cognitive complexity 23 (threshold 15). Drivers by points: if/else 18 (20 pts), loops 2, boolean chains 1 (nesting depth added 2). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.GetChannelMessageStats (cognitive 23) · ×1
  • ChannelStore.GetChannelMessageStats (cognitive 23) internal/store/postgres/channel_stats.go:336 — ChannelStore.GetChannelMessageStats has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 3, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ListChannelReplies (cognitive 23) · ×1
  • ChannelStore.ListChannelReplies (cognitive 23) internal/store/postgres/channel_topics.go:588 — ChannelStore.ListChannelReplies has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CollectibleUsernameStore.MintCollectibleUsername (cognitive 23) · ×1
  • CollectibleUsernameStore.MintCollectibleUsername (cognitive 23) internal/store/postgres/collectible_username.go:182 — CollectibleUsernameStore.MintCollectibleUsername has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 1, match/switch 1 (nesting depth added 4). Most of this is not in the body itself: 4 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 196). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ModerationReportStore.DecideModerationCase (cognitive 23) · ×1
  • ModerationReportStore.DecideModerationCase (cognitive 23) internal/store/postgres/moderation_cases.go:112 — ModerationReportStore.DecideModerationCase has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 5 (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.
D2 · Cognitive Complexity · StarGiftStore.UpdateCollection (cognitive 23) · ×1
  • StarGiftStore.UpdateCollection (cognitive 23) REDACTED:662 — StarGiftStore.UpdateCollection has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 3, boolean chains 2 (nesting depth added 5). None of this is in the body itself: all 23 points belong to one function literal inside it that branches (line 664). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · StarGiftLifecycleStore.CompleteStarGiftWithdrawal (cognitive 23) · ×1
  • StarGiftLifecycleStore.CompleteStarGiftWithdrawal (cognitive 23) internal/store/postgres/star_gift_lifecycle.go:1596 — StarGiftLifecycleStore.CompleteStarGiftWithdrawal has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 5 (nesting depth added 1). Most of this is not in the body itself: 6 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 1602). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · main.fetchSet (cognitive 22) · ×1
  • main.fetchSet (cognitive 22) cmd/stickerfetch/main.go:200 — main.fetchSet has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (19 pts), 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.
D2 · Cognitive Complexity · Service.SendChangePhoneCode (cognitive 22) · ×1
  • Service.SendChangePhoneCode (cognitive 22) internal/app/account/phone_change.go:23 — Service.SendChangePhoneCode has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.handleStickers (cognitive 22) · ×1
  • Service.handleStickers (cognitive 22) internal/app/bots/stickersbot.go:84 — Service.handleStickers has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (19 pts), match/switch 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.PrivateDialogPeerIDs (cognitive 22) · ×1
  • Service.PrivateDialogPeerIDs (cognitive 22) internal/app/dialogs/service.go:255 — Service.PrivateDialogPeerIDs has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.editFieldsFromBot (cognitive 22) · ×1
  • Service.editFieldsFromBot (cognitive 22) internal/app/ephemeral/service.go:317 — Service.editFieldsFromBot has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · files.faststartMP4 (cognitive 22) · ×1
  • files.faststartMP4 (cognitive 22) internal/app/files/mp4faststart.go:13 — files.faststartMP4 has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 2, loops 2, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.EnsureDefaultEmojiStatusSet (cognitive 22) · ×1
  • Service.EnsureDefaultEmojiStatusSet (cognitive 22) internal/app/files/default_statuses.go:66 — Service.EnsureDefaultEmojiStatusSet has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.SeedGifs (cognitive 22) · ×1
  • Service.SeedGifs (cognitive 22) internal/app/files/gif_seed.go:40 — Service.SeedGifs has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2, match/switch 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.SeedDirectory (cognitive 22) · ×1
  • Service.SeedDirectory (cognitive 22) internal/app/langpack/seed.go:27 — Service.SeedDirectory has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 3, boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CachedContactStore.personalPhotoSnapshot (cognitive 22) · ×1
  • CachedContactStore.personalPhotoSnapshot (cognitive 22) internal/app/userprojection/contact_cache.go:706 — CachedContactStore.personalPhotoSnapshot has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (3 pts) (nesting depth added 11). Most of this is not in the body itself: 9 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 711). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · botapi.parseEphemeralSendTarget (cognitive 22) · ×1
  • botapi.parseEphemeralSendTarget (cognitive 22) internal/botapi/ephemeral.go:20 — botapi.parseEphemeralSendTarget has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 7 (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.
D2 · Cognitive Complexity · StarGiftCatalogWrite.ValidateLifecycleAuthoring (cognitive 22) · ×1
  • StarGiftCatalogWrite.ValidateLifecycleAuthoring (cognitive 22) internal/domain/star_gift.go:931 — StarGiftCatalogWrite.ValidateLifecycleAuthoring has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loadharness.prepareDownloadFixture (cognitive 22) · ×1
  • loadharness.prepareDownloadFixture (cognitive 22) REDACTED:592 — loadharness.prepareDownloadFixture has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16 (19 pts), loops 2, boolean chains 1 (nesting depth added 3). Most of this is not in the body itself: 5 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 607). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · loadWorker.runClient (cognitive 22) · ×1
  • loadWorker.runClient (cognitive 22) REDACTED:290 — loadWorker.runClient has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (12 pts), match/switch 3 (6 pts), boolean chains 3, loops 1 (nesting depth added 5). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 333, 299). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · rpc.tgMessageReplyHeader (cognitive 22) · ×1
  • rpc.tgMessageReplyHeader (cognitive 22) internal/rpc/convert_messages.go:441 — rpc.tgMessageReplyHeader has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.tgChannelUpdate (cognitive 22) · ×1
  • rpc.tgChannelUpdate (cognitive 22) internal/rpc/convert_updates.go:176 — rpc.tgChannelUpdate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 1, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · rpc.augmentAutoEntities (cognitive 22) · ×1
  • rpc.augmentAutoEntities (cognitive 22) internal/rpc/message_entities_autodetect.go:30 — rpc.augmentAutoEntities has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 5, boolean chains 2 (nesting depth added 5). Of this number, 15 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesGetBotCallbackAnswer (cognitive 22) · ×1
  • Router.onMessagesGetBotCallbackAnswer (cognitive 22) internal/rpc/bots_callback.go:30 — Router.onMessagesGetBotCallbackAnswer has cognitive complexity 22 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Router.runChannelFanoutJob (cognitive 22) · ×1
  • Router.runChannelFanoutJob (cognitive 22) internal/rpc/channel_fanout_dispatcher.go:877 — Router.runChannelFanoutJob has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onContactsImportContacts (cognitive 22) · ×1
  • Router.onContactsImportContacts (cognitive 22) internal/rpc/contacts.go:604 — Router.onContactsImportContacts has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 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.
D2 · Cognitive Complexity · Router.NotifyUserModerationFlagsChanged (cognitive 22) · ×1
  • Router.NotifyUserModerationFlagsChanged (cognitive 22) internal/rpc/premium_sweeper.go:102 — Router.NotifyUserModerationFlagsChanged has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.domainWelcomeEditFields (cognitive 22) · ×1
  • Router.domainWelcomeEditFields (cognitive 22) internal/rpc/welcome_messages.go:173 — Router.domainWelcomeEditFields has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pionSFU.livenessLoop (cognitive 22) · ×1
  • pionSFU.livenessLoop (cognitive 22) internal/sfu/pion.go:333 — pionSFU.livenessLoop has cognitive complexity 22 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 2 (8 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · ChannelStore.SearchPublicChannels (cognitive 22) · ×1
  • ChannelStore.SearchPublicChannels (cognitive 22) internal/store/memory/channel_helpers.go:74 — ChannelStore.SearchPublicChannels has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 5, loops 2 (nesting depth added 4). Of this number, 19 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.GetParticipants (cognitive 22) · ×1
  • ChannelStore.GetParticipants (cognitive 22) internal/store/memory/channel_members.go:15 — ChannelStore.GetParticipants has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 4). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ChannelStore.EditChannelBanned (cognitive 22) · ×1
  • ChannelStore.EditChannelBanned (cognitive 22) internal/store/memory/channel_members.go:534 — ChannelStore.EditChannelBanned has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 4, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ChannelStore.GetChannelMessages (cognitive 22) · ×1
  • ChannelStore.GetChannelMessages (cognitive 22) internal/store/memory/channel_message_history.go:330 — ChannelStore.GetChannelMessages has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 4, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ListChannelMessageReactions (cognitive 22) · ×1
  • ChannelStore.ListChannelMessageReactions (cognitive 22) internal/store/memory/channel_reactions.go:334 — ChannelStore.ListChannelMessageReactions has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 6). Of this number, 20 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.advanceChannelReadOutboxLocked (cognitive 22) · ×1
  • ChannelStore.advanceChannelReadOutboxLocked (cognitive 22) internal/store/memory/channel_read.go:304 — ChannelStore.advanceChannelReadOutboxLocked has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 3, 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.
D2 · Cognitive Complexity · ChannelStore.CountChannelMediaCategories (cognitive 22) · ×1
  • ChannelStore.CountChannelMediaCategories (cognitive 22) internal/store/memory/media_search.go:213 — ChannelStore.CountChannelMediaCategories has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommunityStore.validatePeerLocked (cognitive 22) · ×1
  • CommunityStore.validatePeerLocked (cognitive 22) internal/store/memory/community.go:216 — CommunityStore.validatePeerLocked has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 6, loops 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommunityStore.GetCommunityParticipantJoinedChats (cognitive 22) · ×1
  • CommunityStore.GetCommunityParticipantJoinedChats (cognitive 22) internal/store/memory/community.go:654 — CommunityStore.GetCommunityParticipantJoinedChats has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModerationReportStore.ReviewModerationAppeal (cognitive 22) · ×1
  • ModerationReportStore.ReviewModerationAppeal (cognitive 22) internal/store/memory/moderation.go:503 — ModerationReportStore.ReviewModerationAppeal has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 6, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · StarGiftStore.MarkConverted (cognitive 22) · ×1
  • StarGiftStore.MarkConverted (cognitive 22) REDACTED:592 — StarGiftStore.MarkConverted has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (8 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ListAllBuiltinChannelDialogSnapshot (cognitive 22) · ×1
  • ChannelStore.ListAllBuiltinChannelDialogSnapshot (cognitive 22) REDACTED:446 — ChannelStore.ListAllBuiltinChannelDialogSnapshot has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (17 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 5). Of this number, 18 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.DeleteExpiredChannelUpdateEvents (cognitive 22) · ×1
  • ChannelStore.DeleteExpiredChannelUpdateEvents (cognitive 22) internal/store/postgres/channel_update_retention.go:34 — ChannelStore.DeleteExpiredChannelUpdateEvents has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommunityStore.DecideAllCommunityPeerLinkRequests (cognitive 22) · ×1
  • CommunityStore.DecideAllCommunityPeerLinkRequests (cognitive 22) internal/store/postgres/community.go:748 — CommunityStore.DecideAllCommunityPeerLinkRequests has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (18 pts), loops 3, boolean chains 1 (nesting depth added 6). None of this is in the body itself: all 22 points belong to one function literal inside it that branches (line 749). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · StarGiftLifecycleStore.loadStarGiftAuction (cognitive 22) · ×1
  • StarGiftLifecycleStore.loadStarGiftAuction (cognitive 22) internal/store/postgres/star_gift_craft_auction.go:1139 — StarGiftLifecycleStore.loadStarGiftAuction has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 2, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StarGiftLifecycleStore.TransferStarGift (cognitive 22) · ×1
  • StarGiftLifecycleStore.TransferStarGift (cognitive 22) internal/store/postgres/star_gift_lifecycle.go:418 — StarGiftLifecycleStore.TransferStarGift has cognitive complexity 22 (threshold 15). Drivers by points: if/else 19 (21 pts), boolean chains 1 (nesting depth added 2). Most of this is not in the body itself: 10 of the 22 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 450, 481). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · main.main (cognitive 21) · ×1
  • main.main (cognitive 21) cmd/langpackfetch/main.go:68 — main.main has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (18 pts), loops 2 (3 pts) (nesting depth added 7). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 78). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Service.RevokeSessions (cognitive 21) · ×1
  • Service.RevokeSessions (cognitive 21) internal/admin/service.go:3120 — Service.RevokeSessions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 1, loops 1 (nesting depth added 4). Most of this is not in the body itself: 7 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 3140). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Service.scanNativeTransfers (cognitive 21) · ×1
  • Service.scanNativeTransfers (cognitive 21) internal/app/donations/watcher.go:238 — Service.scanNativeTransfers has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · files.patchChunkOffsets (cognitive 21) · ×1
  • files.patchChunkOffsets (cognitive 21) internal/app/files/mp4faststart.go:167 — files.patchChunkOffsets has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mapTileProxy.sweepDisk (cognitive 21) · ×1
  • mapTileProxy.sweepDisk (cognitive 21) internal/app/files/maptile_proxy.go:310 — mapTileProxy.sweepDisk has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 2, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.SeedAppearance (cognitive 21) · ×1
  • Service.SeedAppearance (cognitive 21) internal/app/files/appearance_seed.go:24 — Service.SeedAppearance has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (14 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 4). Of this number, 17 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Service.CreateDocumentFromBytes (cognitive 21) · ×1
  • Service.CreateDocumentFromBytes (cognitive 21) internal/app/files/photos.go:642 — Service.CreateDocumentFromBytes has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.SendPrivateText (cognitive 21) · ×1
  • Service.SendPrivateText (cognitive 21) internal/app/messages/service.go:129 — Service.SendPrivateText has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.ReportReaction (cognitive 21) · ×1
  • Service.ReportReaction (cognitive 21) internal/app/moderation/evidence.go:272 — Service.ReportReaction has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 4, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · telegramlogin.importSigningKey (cognitive 21) · ×1
  • telegramlogin.importSigningKey (cognitive 21) internal/app/telegramlogin/jose.go:89 — telegramlogin.importSigningKey has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 4, loops 1 (nesting depth added 3). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · userprojection.applyPrivacy (cognitive 21) · ×1
  • userprojection.applyPrivacy (cognitive 21) internal/app/userprojection/projection.go:634 — userprojection.applyPrivacy has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 5 (nesting depth added 2). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Service.EligibleTargets (cognitive 21) · ×1
  • Service.EligibleTargets (cognitive 21) internal/app/verification/service.go:427 — Service.EligibleTargets has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (18 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.targetState (cognitive 21) · ×1
  • Service.targetState (cognitive 21) internal/app/verification/service.go:976 — Service.targetState has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 4, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · botapi.apiMessageEntities (cognitive 21) · ×1
  • botapi.apiMessageEntities (cognitive 21) internal/botapi/projection.go:396 — botapi.apiMessageEntities has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · botapi.apiDocumentMedia (cognitive 21) · ×1
  • botapi.apiDocumentMedia (cognitive 21) internal/botapi/projection.go:657 — botapi.apiDocumentMedia has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (18 pts), match/switch 1 (2 pts), 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.
D2 · Cognitive Complexity · domain.EvaluatePrivacy (cognitive 21) · ×1
  • domain.EvaluatePrivacy (cognitive 21) internal/domain/privacy_evaluate.go:5 — domain.EvaluatePrivacy has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4, match/switch 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · domain.validateStarGiftUpgradePreviewPool (cognitive 21) · ×1
  • domain.validateStarGiftUpgradePreviewPool (cognitive 21) internal/domain/star_gift.go:1237 — domain.validateStarGiftUpgradePreviewPool has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 3, loops 2 (nesting depth added 6). Most of this is not in the body itself: 9 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 1238). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · loadharness.Seed (cognitive 21) · ×1
  • loadharness.Seed (cognitive 21) internal/loadharness/seed.go:61 — loadharness.Seed has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (16 pts), loops 5 (nesting depth added 1). Of this number, 18 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: 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.
D2 · Cognitive Complexity · Conn.writeFrame (cognitive 21) · ×1
  • Conn.writeFrame (cognitive 21) internal/mtprotoedge/outbound.go:2866 — Conn.writeFrame has cognitive complexity 21 (threshold 15). Drivers by points: if/else 18 (21 pts) (nesting depth added 3). Of this number, 17 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · connStateOverlay.validateSeq (cognitive 21) · ×1
  • connStateOverlay.validateSeq (cognitive 21) internal/mtprotoedge/inbound_preflight.go:255 — connStateOverlay.validateSeq has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · rpc.botAPIQueuedUpdateEventFromMessages (cognitive 21) · ×1
  • rpc.botAPIQueuedUpdateEventFromMessages (cognitive 21) internal/rpc/botapi_update_queue.go:230 — rpc.botAPIQueuedUpdateEventFromMessages has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 3, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.botAPIRequestedPeerProjectable (cognitive 21) · ×1
  • rpc.botAPIRequestedPeerProjectable (cognitive 21) internal/rpc/botapi_update_queue.go:576 — rpc.botAPIRequestedPeerProjectable has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 9, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.tgUniqueStarGift (cognitive 21) · ×1
  • rpc.tgUniqueStarGift (cognitive 21) internal/rpc/payments_star_gift_unique.go:374 — rpc.tgUniqueStarGift has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · rpc.tgMessageActionStarGift (cognitive 21) · ×1
  • rpc.tgMessageActionStarGift (cognitive 21) internal/rpc/payments_star_gifts.go:1623 — rpc.tgMessageActionStarGift has cognitive complexity 21 (threshold 15). Drivers by points: if/else 20, 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.
D2 · Cognitive Complexity · rpc.registerLayerRPCAdmissionFieldPreflights (cognitive 21) · ×1
  • rpc.registerLayerRPCAdmissionFieldPreflights (cognitive 21) internal/rpc/request_preflight.go:90 — rpc.registerLayerRPCAdmissionFieldPreflights has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 2, boolean chains 1 (nesting depth added 7). Most of this is not in the body itself: 8 of the 21 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 96, 133, 117). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · rpc.collectMessagePeerRefs (cognitive 21) · ×1
  • rpc.collectMessagePeerRefs (cognitive 21) internal/rpc/update_peer_refs.go:332 — rpc.collectMessagePeerRefs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesSendInlineBotResult (cognitive 21) · ×1
  • Router.onMessagesSendInlineBotResult (cognitive 21) internal/rpc/bots_inline.go:201 — Router.onMessagesSendInlineBotResult has cognitive complexity 21 (threshold 15). Drivers by points: if/else 18 (19 pts), 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.
D2 · Cognitive Complexity · Router.syncSessionChannelMemberships (cognitive 21) · ×1
  • Router.syncSessionChannelMemberships (cognitive 21) internal/rpc/channel_interest.go:61 — Router.syncSessionChannelMemberships has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.deliverEphemeralPushLocal (cognitive 21) · ×1
  • Router.deliverEphemeralPushLocal (cognitive 21) internal/rpc/ephemeral_push.go:58 — Router.deliverEphemeralPushLocal has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 6, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.loadLiveLocationMessage (cognitive 21) · ×1
  • Router.loadLiveLocationMessage (cognitive 21) internal/rpc/messages_edit_geolive.go:128 — Router.loadLiveLocationMessage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Router.loadMessagePoll (cognitive 21) · ×1
  • Router.loadMessagePoll (cognitive 21) internal/rpc/messages_polls_updates.go:41 — Router.loadMessagePoll has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Router.channelPollUpdates (cognitive 21) · ×1
  • Router.channelPollUpdates (cognitive 21) internal/rpc/messages_polls_updates.go:212 — Router.channelPollUpdates has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 1 (nesting depth added 8). Most of this is not in the body itself: 10 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 226). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Router.onMessagesSendQuickReplyMessages (cognitive 21) · ×1
  • Router.onMessagesSendQuickReplyMessages (cognitive 21) internal/rpc/messages_quick_replies.go:156 — Router.onMessagesSendQuickReplyMessages has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 2, loops 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.onMessagesGetSavedDialogs (cognitive 21) · ×1
  • Router.onMessagesGetSavedDialogs (cognitive 21) internal/rpc/messages_saved_dialogs.go:16 — Router.onMessagesGetSavedDialogs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesToggleTodoCompleted (cognitive 21) · ×1
  • Router.onMessagesToggleTodoCompleted (cognitive 21) internal/rpc/messages_todos.go:139 — Router.onMessagesToggleTodoCompleted has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 5, boolean chains 2 (nesting depth added 5). Most of this is not in the body itself: 5 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 151). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Router.loadTodoMessage (cognitive 21) · ×1
  • Router.loadTodoMessage (cognitive 21) internal/rpc/messages_todos.go:284 — Router.loadTodoMessage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Router.onMessagesRequestAppWebView (cognitive 21) · ×1
  • Router.onMessagesRequestAppWebView (cognitive 21) internal/rpc/messages_webview.go:138 — Router.onMessagesRequestAppWebView has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onPaymentsGetSavedStarGift (cognitive 21) · ×1
  • Router.onPaymentsGetSavedStarGift (cognitive 21) internal/rpc/payments_star_gifts.go:1152 — Router.onPaymentsGetSavedStarGift has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 2, loops 1 (nesting depth added 7). Of this number, 19 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onUsersGetSavedMusicByID (cognitive 21) · ×1
  • Router.onUsersGetSavedMusicByID (cognitive 21) REDACTED:733 — Router.onUsersGetSavedMusicByID has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodeStore.VerifyLogin (cognitive 21) · ×1
  • CodeStore.VerifyLogin (cognitive 21) internal/store/memory/login_code.go:11 — CodeStore.VerifyLogin has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ListExportedInvites (cognitive 21) · ×1
  • ChannelStore.ListExportedInvites (cognitive 21) internal/store/memory/channel_invites.go:334 — ChannelStore.ListExportedInvites has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 4). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.FilterActiveChannelMemberPairs (cognitive 21) · ×1
  • ChannelStore.FilterActiveChannelMemberPairs (cognitive 21) internal/store/memory/channel_members.go:910 — ChannelStore.FilterActiveChannelMemberPairs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ResolveDiscussionReadTarget (cognitive 21) · ×1
  • ChannelStore.ResolveDiscussionReadTarget (cognitive 21) internal/store/memory/channel_message_history.go:529 — ChannelStore.ResolveDiscussionReadTarget has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6, match/switch 1 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.SetPaidMessagesPrice (cognitive 21) · ×1
  • ChannelStore.SetPaidMessagesPrice (cognitive 21) internal/store/memory/channel_message_settings.go:52 — ChannelStore.SetPaidMessagesPrice has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.ListMessageReadParticipants (cognitive 21) · ×1
  • ChannelStore.ListMessageReadParticipants (cognitive 21) internal/store/memory/channel_read.go:361 — ChannelStore.ListMessageReadParticipants has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 6, loops 1 (nesting depth added 4). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ListChannelMessagePublicForwards (cognitive 21) · ×1
  • ChannelStore.ListChannelMessagePublicForwards (cognitive 21) internal/store/memory/channel_stats.go:241 — ChannelStore.ListChannelMessagePublicForwards has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.CreateForumTopic (cognitive 21) · ×1
  • ChannelStore.CreateForumTopic (cognitive 21) internal/store/memory/channel_topics.go:69 — ChannelStore.CreateForumTopic has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CommunityStore.ReorderCommunityPinned (cognitive 21) · ×1
  • CommunityStore.ReorderCommunityPinned (cognitive 21) internal/store/memory/community.go:1052 — CommunityStore.ReorderCommunityPinned has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, loops 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EphemeralMessageStore.PruneExpiredEphemeralMessages (cognitive 21) · ×1
  • EphemeralMessageStore.PruneExpiredEphemeralMessages (cognitive 21) internal/store/memory/ephemeral.go:301 — EphemeralMessageStore.PruneExpiredEphemeralMessages has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 4 (6 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.SearchPrivateMedia (cognitive 21) · ×1
  • MessageStore.SearchPrivateMedia (cognitive 21) internal/store/memory/media_search.go:100 — MessageStore.SearchPrivateMedia has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 5, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModerationReportStore.ListModerationCases (cognitive 21) · ×1
  • ModerationReportStore.ListModerationCases (cognitive 21) internal/store/memory/moderation.go:322 — ModerationReportStore.ListModerationCases has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, loops 2 (nesting depth added 6). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · postgres.lockRawAuthKeyInIdentityOrder (cognitive 21) · ×1
  • postgres.lockRawAuthKeyInIdentityOrder (cognitive 21) internal/store/postgres/auth_identity_lock.go:153 — postgres.lockRawAuthKeyInIdentityOrder has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · postgres.bindAuthorization (cognitive 21) · ×1
  • postgres.bindAuthorization (cognitive 21) internal/store/postgres/authorization.go:51 — postgres.bindAuthorization has cognitive complexity 21 (threshold 15). Drivers by points: if/else 18 (19 pts), 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.
D2 · Cognitive Complexity · postgres.MigrateAndStatus (cognitive 21) · ×1
  • postgres.MigrateAndStatus (cognitive 21) internal/store/postgres/postgres.go:155 — postgres.MigrateAndStatus has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.EnsurePermanentInvite (cognitive 21) · ×1
  • ChannelStore.EnsurePermanentInvite (cognitive 21) internal/store/postgres/channel_invite_exported.go:83 — ChannelStore.EnsurePermanentInvite has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17 (19 pts), boolean chains 1, loops 1 (nesting depth added 2). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.readChannelHistoryOnce (cognitive 21) · ×1
  • ChannelStore.readChannelHistoryOnce (cognitive 21) internal/store/postgres/channel_message_history.go:916 — ChannelStore.readChannelHistoryOnce has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17 (19 pts), boolean chains 2 (nesting depth added 2). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.SetChannelWallpaper (cognitive 21) · ×1
  • ChannelStore.SetChannelWallpaper (cognitive 21) internal/store/postgres/channel_settings.go:84 — ChannelStore.SetChannelWallpaper has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 1 (nesting depth added 4). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.SetChannelPhoto (cognitive 21) · ×1
  • ChannelStore.SetChannelPhoto (cognitive 21) internal/store/postgres/channel_settings.go:623 — ChannelStore.SetChannelPhoto has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17 (19 pts), boolean chains 2 (nesting depth added 2). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ChannelStore.DeleteForumTopicHistory (cognitive 21) · ×1
  • ChannelStore.DeleteForumTopicHistory (cognitive 21) internal/store/postgres/channel_topics.go:386 — ChannelStore.DeleteForumTopicHistory has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 2, loops 1 (nesting depth added 1). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: 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.
D2 · Cognitive Complexity · MessageStore.mutateMessagePoll (cognitive 21) · ×1
  • MessageStore.mutateMessagePoll (cognitive 21) internal/store/postgres/message_polls.go:30 — MessageStore.mutateMessagePoll has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 2, loops 1 (nesting depth added 2). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MessageStore.EditScheduledMessage (cognitive 21) · ×1
  • MessageStore.EditScheduledMessage (cognitive 21) internal/store/postgres/scheduled_message.go:138 — MessageStore.EditScheduledMessage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17 (18 pts), boolean chains 3 (nesting depth added 1). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: 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.
D2 · Cognitive Complexity · ModerationReportStore.ImportLegacyEphemeralReport (cognitive 21) · ×1
  • ModerationReportStore.ImportLegacyEphemeralReport (cognitive 21) internal/store/postgres/moderation.go:110 — ModerationReportStore.ImportLegacyEphemeralReport has cognitive complexity 21 (threshold 15). Drivers by points: if/else 18 (20 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · StoryStore.CreateStory (cognitive 21) · ×1
  • StoryStore.CreateStory (cognitive 21) internal/store/postgres/story.go:184 — StoryStore.CreateStory has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.runLoop (cognitive 20) · ×1
  • main.runLoop (cognitive 20) cmd/bots/botdemo/main.go:256 — main.runLoop has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 8). Of this number, 13 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.cmdRun (cognitive 20) · ×1
  • main.cmdRun (cognitive 20) cmd/owpengram-ctl/main.go:94 — main.cmdRun has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (20 pts) (nesting depth added 7). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 113, 145, 139). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Service.handleBotFatherCommand (cognitive 20) · ×1
  • Service.handleBotFatherCommand (cognitive 20) internal/app/bots/botfather.go:328 — Service.handleBotFatherCommand has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 1, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Service.premiumBotDepositReply (cognitive 20) · ×1
  • Service.premiumBotDepositReply (cognitive 20) internal/app/bots/premiumbot.go:203 — Service.premiumBotDepositReply has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.filterBotChannelEvent (cognitive 20) · ×1
  • Service.filterBotChannelEvent (cognitive 20) internal/app/channels/bot_policy.go:266 — Service.filterBotChannelEvent has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Service.attachArchiveSummary (cognitive 20) · ×1
  • Service.attachArchiveSummary (cognitive 20) internal/app/dialogs/service.go:605 — Service.attachArchiveSummary has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Service.RefreshPrices (cognitive 20) · ×1
  • Service.RefreshPrices (cognitive 20) internal/app/donations/pricefeed.go:64 — Service.RefreshPrices has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · stargifts.normalizeAndValidateLottie (cognitive 20) · ×1
  • stargifts.normalizeAndValidateLottie (cognitive 20) internal/app/stargifts/animation.go:94 — stargifts.normalizeAndValidateLottie has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AIProvider.Translate (cognitive 20) · ×1
  • AIProvider.Translate (cognitive 20) internal/app/translation/ai_provider.go:38 — AIProvider.Translate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 2 (5 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 8). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 57, 86). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · handler.sendMessage (cognitive 20) · ×1
  • handler.sendMessage (cognitive 20) internal/botapi/server.go:517 — handler.sendMessage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · tdesktop.lookupChatThemeWallpaperAlias (cognitive 20) · ×1
  • tdesktop.lookupChatThemeWallpaperAlias (cognitive 20) internal/compat/tdesktop/appearance_seed.go:66 — tdesktop.lookupChatThemeWallpaperAlias has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · domain.detectHashtagMessageEntities (cognitive 20) · ×1
  • domain.detectHashtagMessageEntities (cognitive 20) internal/domain/message_entity_autodetect.go:132 — domain.detectHashtagMessageEntities has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · domain.ValidateReplyMarkup (cognitive 20) · ×1
  • domain.ValidateReplyMarkup (cognitive 20) internal/domain/message_markup.go:236 — domain.ValidateReplyMarkup has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · domain.cloneReplyData (cognitive 20) · ×1
  • domain.cloneReplyData (cognitive 20) internal/domain/message_reply_external.go:140 — domain.cloneReplyData has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 4 (8 pts), match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ChannelReactionPolicy.AllowsReaction (cognitive 20) · ×1
  • ChannelReactionPolicy.AllowsReaction (cognitive 20) internal/domain/channel.go:320 — ChannelReactionPolicy.AllowsReaction has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (6 pts), match/switch 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Conn.setLayerProfile (cognitive 20) · ×1
  • Conn.setLayerProfile (cognitive 20) internal/mtprotoedge/conn_layer_profile.go:66 — Conn.setLayerProfile has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Server.decodeMessageContainerViews (cognitive 20) · ×1
  • Server.decodeMessageContainerViews (cognitive 20) internal/mtprotoedge/encrypted.go:517 — Server.decodeMessageContainerViews has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4, loops 1 (nesting depth added 5). Of this number, 18 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionManager.applyInheritedLayerForRawAuthKey (cognitive 20) · ×1
  • SessionManager.applyInheritedLayerForRawAuthKey (cognitive 20) internal/mtprotoedge/session_manager.go:394 — SessionManager.applyInheritedLayerForRawAuthKey has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionManager.ApplyOrderedRawLayerForSession (cognitive 20) · ×1
  • SessionManager.ApplyOrderedRawLayerForSession (cognitive 20) internal/mtprotoedge/session_manager.go:461 — SessionManager.ApplyOrderedRawLayerForSession has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionManager.ExplicitLayerEvidenceForAuthKey (cognitive 20) · ×1
  • SessionManager.ExplicitLayerEvidenceForAuthKey (cognitive 20) internal/mtprotoedge/session_manager.go:516 — SessionManager.ExplicitLayerEvidenceForAuthKey has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 6, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · progressiveDeadlineWriter.Write (cognitive 20) · ×1
  • progressiveDeadlineWriter.Write (cognitive 20) internal/mtprotoedge/transport_compat.go:331 — progressiveDeadlineWriter.Write has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.defaultProfilePhotoEmojiDocumentIDsFromKind (cognitive 20) · ×1
  • rpc.defaultProfilePhotoEmojiDocumentIDsFromKind (cognitive 20) internal/rpc/account.go:2131 — rpc.defaultProfilePhotoEmojiDocumentIDsFromKind has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.parseBotAPIRichHTML (cognitive 20) · ×1
  • rpc.parseBotAPIRichHTML (cognitive 20) internal/rpc/botapi_rich_message.go:53 — rpc.parseBotAPIRichHTML has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 8). Most of this is not in the body itself: 4 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 60). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · rpc.tgChannelDifference (cognitive 20) · ×1
  • rpc.tgChannelDifference (cognitive 20) internal/rpc/convert_updates.go:101 — rpc.tgChannelDifference has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.applyMonoforumPeerOverlays (cognitive 20) · ×1
  • rpc.applyMonoforumPeerOverlays (cognitive 20) internal/rpc/messages_monoforum.go:257 — rpc.applyMonoforumPeerOverlays has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, 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.
D2 · Cognitive Complexity · rpc.domainPhotoVideoMarkup (cognitive 20) · ×1
  • rpc.domainPhotoVideoMarkup (cognitive 20) internal/rpc/photos.go:321 — rpc.domainPhotoVideoMarkup has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · rpc.storyViewPeers (cognitive 20) · ×1
  • rpc.storyViewPeers (cognitive 20) internal/rpc/story_peer_projection.go:372 — rpc.storyViewPeers has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onAuthBindTempAuthKey (cognitive 20) · ×1
  • Router.onAuthBindTempAuthKey (cognitive 20) REDACTED:205 — Router.onAuthBindTempAuthKey has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Router.BotAPISendRichMessage (cognitive 20) · ×1
  • Router.BotAPISendRichMessage (cognitive 20) internal/rpc/botapi_gateway.go:236 — Router.BotAPISendRichMessage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Router.tgAttachMenuIcons (cognitive 20) · ×1
  • Router.tgAttachMenuIcons (cognitive 20) internal/rpc/messages_attach_menu.go:161 — Router.tgAttachMenuIcons has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.mentionUserIDsFromDomain (cognitive 20) · ×1
  • Router.mentionUserIDsFromDomain (cognitive 20) internal/rpc/messages_send.go:1222 — Router.mentionUserIDsFromDomain has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 9). Of this number, 17 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.stickerCollectionDocuments (cognitive 20) · ×1
  • Router.stickerCollectionDocuments (cognitive 20) internal/rpc/messages_stickers_personal.go:244 — Router.stickerCollectionDocuments has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.createProfilePhoto (cognitive 20) · ×1
  • Router.createProfilePhoto (cognitive 20) internal/rpc/photos.go:270 — Router.createProfilePhoto has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 1, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Router.onPhotosGetUserPhotos (cognitive 20) · ×1
  • Router.onPhotosGetUserPhotos (cognitive 20) internal/rpc/photos.go:426 — Router.onPhotosGetUserPhotos has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 4, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Router.resolveInputChatPhoto (cognitive 20) · ×1
  • Router.resolveInputChatPhoto (cognitive 20) internal/rpc/photos.go:773 — Router.resolveInputChatPhoto has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 2 (3 pts) (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Router.onStoriesEditStory (cognitive 20) · ×1
  • Router.onStoriesEditStory (cognitive 20) internal/rpc/stories.go:1366 — Router.onStoriesEditStory has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · endpoint.run (cognitive 20) · ×1
  • endpoint.run (cognitive 20) internal/sfu/pion.go:411 — endpoint.run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · memory.adjustStoryReactionCounts (cognitive 20) · ×1
  • memory.adjustStoryReactionCounts (cognitive 20) internal/store/memory/story.go:1736 — memory.adjustStoryReactionCounts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodeStore.VerifyScoped (cognitive 20) · ×1
  • CodeStore.VerifyScoped (cognitive 20) internal/store/memory/login_code.go:74 — CodeStore.VerifyScoped has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.DeleteChannelMessages (cognitive 20) · ×1
  • ChannelStore.DeleteChannelMessages (cognitive 20) internal/store/memory/channel_message_delete.go:8 — ChannelStore.DeleteChannelMessages has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, loops 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.
D2 · Cognitive Complexity · ChannelStore.ListChannelUnreadMentions (cognitive 20) · ×1
  • ChannelStore.ListChannelUnreadMentions (cognitive 20) internal/store/memory/channel_read.go:148 — ChannelStore.ListChannelUnreadMentions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 6, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.addChannelUnreadMentionsLocked (cognitive 20) · ×1
  • ChannelStore.addChannelUnreadMentionsLocked (cognitive 20) internal/store/memory/channel_read.go:450 — ChannelStore.addChannelUnreadMentionsLocked has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 4, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LoginCodeDeliveryStore.DeliverLoginCodeMessage (cognitive 20) · ×1
  • LoginCodeDeliveryStore.DeliverLoginCodeMessage (cognitive 20) internal/store/memory/login_code_delivery.go:38 — LoginCodeDeliveryStore.DeliverLoginCodeMessage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · StarsStore.ListTransactions (cognitive 20) · ×1
  • StarsStore.ListTransactions (cognitive 20) internal/store/memory/stars.go:148 — StarsStore.ListTransactions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 4). Of this number, 12 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · postgres.revokeByUserExceptTx (cognitive 20) · ×1
  • postgres.revokeByUserExceptTx (cognitive 20) internal/store/postgres/authorization.go:394 — postgres.revokeByUserExceptTx has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (16 pts), loops 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · postgres.validateCommunityPeerForLink (cognitive 20) · ×1
  • postgres.validateCommunityPeerForLink (cognitive 20) internal/store/postgres/community.go:380 — postgres.validateCommunityPeerForLink has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 4, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · postgres.getModerationReport (cognitive 20) · ×1
  • postgres.getModerationReport (cognitive 20) internal/store/postgres/moderation.go:338 — postgres.getModerationReport has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 2, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BotStore.DeleteBotAccount (cognitive 20) · ×1
  • BotStore.DeleteBotAccount (cognitive 20) internal/store/postgres/bot.go:98 — BotStore.DeleteBotAccount has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · BotVerificationStore.DecideCustomVerificationRequest (cognitive 20) · ×1
  • BotVerificationStore.DecideCustomVerificationRequest (cognitive 20) internal/store/postgres/bot_verification.go:855 — BotVerificationStore.DecideCustomVerificationRequest has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 4 (nesting depth added 1). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 876). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ChannelStore.getChannelDialogs (cognitive 20) · ×1
  • ChannelStore.getChannelDialogs (cognitive 20) REDACTED:1725 — ChannelStore.getChannelDialogs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.CreateForumTopic (cognitive 20) · ×1
  • ChannelStore.CreateForumTopic (cognitive 20) internal/store/postgres/channel_topics.go:116 — ChannelStore.CreateForumTopic has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.ReorderPinnedForumTopics (cognitive 20) · ×1
  • ChannelStore.ReorderPinnedForumTopics (cognitive 20) internal/store/postgres/channel_topics.go:341 — ChannelStore.ReorderPinnedForumTopics has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · CommunityStore.ToggleCommunityPeerLink (cognitive 20) · ×1
  • CommunityStore.ToggleCommunityPeerLink (cognitive 20) internal/store/postgres/community.go:531 — CommunityStore.ToggleCommunityPeerLink has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (20 pts) (nesting depth added 7). None of this is in the body itself: all 20 points belong to one function literal inside it that branches (line 532). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ContactStore.ContactProjectionForViewers (cognitive 20) · ×1
  • ContactStore.ContactProjectionForViewers (cognitive 20) REDACTED:220 — ContactStore.ContactProjectionForViewers has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 2, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MediaStore.GetDocuments (cognitive 20) · ×1
  • MediaStore.GetDocuments (cognitive 20) internal/store/postgres/media.go:437 — MediaStore.GetDocuments has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StarGiftLifecycleStore.PurchaseStarGift (cognitive 20) · ×1
  • StarGiftLifecycleStore.PurchaseStarGift (cognitive 20) internal/store/postgres/star_gift_purchase.go:122 — StarGiftLifecycleStore.PurchaseStarGift has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 3 (nesting depth added 3). Of this number, 15 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · StarGiftLifecycleStore.loadStarGiftPurchaseReplay (cognitive 20) · ×1
  • StarGiftLifecycleStore.loadStarGiftPurchaseReplay (cognitive 20) internal/store/postgres/star_gift_purchase.go:358 — StarGiftLifecycleStore.loadStarGiftPurchaseReplay has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 6 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VerificationStore.DecideVerificationApplication (cognitive 20) · ×1
  • VerificationStore.DecideVerificationApplication (cognitive 20) internal/store/postgres/verification.go:479 — VerificationStore.DecideVerificationApplication has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 1 (nesting depth added 3). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 502). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Handler.authorizationStatus (cognitive 20) · ×1
  • Handler.authorizationStatus (cognitive 20) internal/telegramloginhttp/handler.go:499 — Handler.authorizationStatus has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · readStore.DashboardActivity (cognitive 19) · ×1
  • readStore.DashboardActivity (cognitive 19) cmd/telesrv-admin/activity.go:34 — readStore.DashboardActivity has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 5 (6 pts) (nesting depth added 5). Of this number, 11 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.UpdatePasswordSettings (cognitive 19) · ×1
  • Service.UpdatePasswordSettings (cognitive 19) internal/app/account/service.go:360 — Service.UpdatePasswordSettings has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.SendCode (cognitive 19) · ×1
  • Service.SendCode (cognitive 19) internal/app/auth/service.go:493 — Service.SendCode has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.createPhoneCode (cognitive 19) · ×1
  • Service.createPhoneCode (cognitive 19) internal/app/auth/service.go:599 — Service.createPhoneCode has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (19 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · broadcast.normalizeRequest (cognitive 19) · ×1
  • broadcast.normalizeRequest (cognitive 19) internal/app/broadcast/service.go:96 — broadcast.normalizeRequest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, loops 1 (2 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.cachedActiveChannelIDsForUser (cognitive 19) · ×1
  • Service.cachedActiveChannelIDsForUser (cognitive 19) internal/app/channels/active_ids_cache.go:84 — Service.cachedActiveChannelIDsForUser has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), 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.
D2 · Cognitive Complexity · Service.ExportInvite (cognitive 19) · ×1
  • Service.ExportInvite (cognitive 19) internal/app/chatlists/service.go:69 — Service.ExportInvite has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.JoinInvite (cognitive 19) · ×1
  • Service.JoinInvite (cognitive 19) internal/app/chatlists/service.go:253 — Service.JoinInvite has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16 (19 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Service.dialogDraftsReadModel (cognitive 19) · ×1
  • Service.dialogDraftsReadModel (cognitive 19) internal/app/dialogs/draft_read_model_cache.go:39 — Service.dialogDraftsReadModel has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 5, boolean chains 2 (nesting depth added 3). Of this number, 10 points are the body's own statements and 9 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.loadDialogOwnerSnapshotHeaders (cognitive 19) · ×1
  • Service.loadDialogOwnerSnapshotHeaders (cognitive 19) internal/app/dialogs/service.go:353 — Service.loadDialogOwnerSnapshotHeaders has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.seedAppearanceDocument (cognitive 19) · ×1
  • Service.seedAppearanceDocument (cognitive 19) internal/app/files/appearance_seed.go:162 — Service.seedAppearanceDocument has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.AdminDeleteUncategorizedGifs (cognitive 19) · ×1
  • Service.AdminDeleteUncategorizedGifs (cognitive 19) internal/app/files/gif_admin.go:262 — Service.AdminDeleteUncategorizedGifs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), 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.
D2 · Cognitive Complexity · Service.avatarMarkupBytes (cognitive 19) · ×1
  • Service.avatarMarkupBytes (cognitive 19) internal/app/files/photos.go:1210 — Service.avatarMarkupBytes has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.accountAppConfig (cognitive 19) · ×1
  • Service.accountAppConfig (cognitive 19) internal/app/help/service.go:247 — Service.accountAppConfig has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.deliverConnectedBusinessBotAutomation (cognitive 19) · ×1
  • Service.deliverConnectedBusinessBotAutomation (cognitive 19) internal/app/messages/business_automation.go:185 — Service.deliverConnectedBusinessBotAutomation has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 6, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · stargifts.containsLottieExpression (cognitive 19) · ×1
  • stargifts.containsLottieExpression (cognitive 19) internal/app/stargifts/animation.go:143 — stargifts.containsLottieExpression has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Service.AuthorizeMessageButton (cognitive 19) · ×1
  • Service.AuthorizeMessageButton (cognitive 19) internal/app/telegramlogin/service.go:430 — Service.AuthorizeMessageButton has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14, boolean chains 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Service.recordEventCore (cognitive 19) · ×1
  • Service.recordEventCore (cognitive 19) internal/app/updates/service.go:755 — Service.recordEventCore has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CachedContactStore.GetReverseContacts (cognitive 19) · ×1
  • CachedContactStore.GetReverseContacts (cognitive 19) internal/app/userprojection/contact_cache.go:285 — CachedContactStore.GetReverseContacts has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), 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.
D2 · Cognitive Complexity · CachedContactStore.loadContactProjectionForViewers (cognitive 19) · ×1
  • CachedContactStore.loadContactProjectionForViewers (cognitive 19) internal/app/userprojection/contact_cache.go:423 — CachedContactStore.loadContactProjectionForViewers has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (8 pts), boolean chains 1 (nesting depth added 10). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 430). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · handler.sendEphemeralLocation (cognitive 19) · ×1
  • handler.sendEphemeralLocation (cognitive 19) internal/botapi/ephemeral.go:135 — handler.sendEphemeralLocation has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · config.validateAdminRBACConfig (cognitive 19) · ×1
  • config.validateAdminRBACConfig (cognitive 19) internal/config/config.go:1866 — config.validateAdminRBACConfig has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · config.parseAdminScopedTokens (cognitive 19) · ×1
  • config.parseAdminScopedTokens (cognitive 19) internal/config/config.go:1908 — config.parseAdminScopedTokens has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · domain.ApplyPremiumBoostSlot (cognitive 19) · ×1
  • domain.ApplyPremiumBoostSlot (cognitive 19) internal/domain/boost.go:218 — domain.ApplyPremiumBoostSlot has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (12 pts), 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.
D2 · Cognitive Complexity · ModerationDecisionRequest.Validate (cognitive 19) · ×1
  • ModerationDecisionRequest.Validate (cognitive 19) internal/domain/moderation_case.go:317 — ModerationDecisionRequest.Validate has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 8 (9 pts), loops 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · loadharness.runSeedAccountPhase (cognitive 19) · ×1
  • loadharness.runSeedAccountPhase (cognitive 19) internal/loadharness/seed.go:495 — loadharness.runSeedAccountPhase has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 4 (5 pts), match/switch 1 (2 pts) (nesting depth added 7). Of this number, 11 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Manifest.Validate (cognitive 19) · ×1
  • Manifest.Validate (cognitive 19) internal/loadharness/types.go:70 — Manifest.Validate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Server.initialLayerRPCAdmissionCursor (cognitive 19) · ×1
  • Server.initialLayerRPCAdmissionCursor (cognitive 19) internal/mtprotoedge/inbound_layer_rpc.go:105 — Server.initialLayerRPCAdmissionCursor has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionManager.CloseSessionsForBusinessAuthKey (cognitive 19) · ×1
  • SessionManager.CloseSessionsForBusinessAuthKey (cognitive 19) internal/mtprotoedge/session_manager.go:947 — SessionManager.CloseSessionsForBusinessAuthKey has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 5 (6 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Sender.Deliver (cognitive 19) · ×1
  • Sender.Deliver (cognitive 19) internal/otpdelivery/webhook/sender.go:91 — Sender.Deliver has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · rpc.validateChannelSearchPostsRequest (cognitive 19) · ×1
  • rpc.validateChannelSearchPostsRequest (cognitive 19) internal/rpc/channels_messages.go:109 — rpc.validateChannelSearchPostsRequest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.domainMessageEntitiesForViewer (cognitive 19) · ×1
  • rpc.domainMessageEntitiesForViewer (cognitive 19) internal/rpc/convert_messages.go:673 — rpc.domainMessageEntitiesForViewer has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (7 pts), boolean chains 6, match/switch 2 (5 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.applyUsernamesFromRegistry (cognitive 19) · ×1
  • rpc.applyUsernamesFromRegistry (cognitive 19) internal/rpc/fragment.go:336 — rpc.applyUsernamesFromRegistry has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.channelMemberHasRequestRights (cognitive 19) · ×1
  • rpc.channelMemberHasRequestRights (cognitive 19) internal/rpc/messages_bot_longtail.go:392 — rpc.channelMemberHasRequestRights has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 17, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · rpc.mergeByteSpans (cognitive 19) · ×1
  • rpc.mergeByteSpans (cognitive 19) internal/rpc/messages_send.go:871 — rpc.mergeByteSpans has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.validateStoryInputPrivacyRulesShape (cognitive 19) · ×1
  • rpc.validateStoryInputPrivacyRulesShape (cognitive 19) internal/rpc/stories.go:882 — rpc.validateStoryInputPrivacyRulesShape has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 3 (7 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · presenceTracker.statusFor (cognitive 19) · ×1
  • presenceTracker.statusFor (cognitive 19) internal/rpc/presence.go:210 — presenceTracker.statusFor has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onAccountUpdateEmojiStatus (cognitive 19) · ×1
  • Router.onAccountUpdateEmojiStatus (cognitive 19) internal/rpc/account.go:1786 — Router.onAccountUpdateEmojiStatus has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (19 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onAccountDeleteAccount (cognitive 19) · ×1
  • Router.onAccountDeleteAccount (cognitive 19) internal/rpc/account_deletion.go:29 — Router.onAccountDeleteAccount has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.BotAPISendEphemeral (cognitive 19) · ×1
  • Router.BotAPISendEphemeral (cognitive 19) internal/rpc/botapi_gateway.go:350 — Router.BotAPISendEphemeral has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 5 (nesting depth added 3). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 375). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Router.onMessagesGetChatInviteImporters (cognitive 19) · ×1
  • Router.onMessagesGetChatInviteImporters (cognitive 19) internal/rpc/channels_invites.go:307 — Router.onMessagesGetChatInviteImporters has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onChannelsEditAdmin (cognitive 19) · ×1
  • Router.onChannelsEditAdmin (cognitive 19) internal/rpc/channels_members.go:447 — Router.onChannelsEditAdmin has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Router.communityPeerFromInput (cognitive 19) · ×1
  • Router.communityPeerFromInput (cognitive 19) internal/rpc/communities.go:95 — Router.communityPeerFromInput has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.resolveRichMessagePhotos (cognitive 19) · ×1
  • Router.resolveRichMessagePhotos (cognitive 19) internal/rpc/convert_rich_message.go:168 — Router.resolveRichMessagePhotos has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesGetSavedHistory (cognitive 19) · ×1
  • Router.onMessagesGetSavedHistory (cognitive 19) internal/rpc/messages_compat.go:19 — Router.onMessagesGetSavedHistory has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (16 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesDeleteHistory (cognitive 19) · ×1
  • Router.onMessagesDeleteHistory (cognitive 19) internal/rpc/messages_delete.go:44 — Router.onMessagesDeleteHistory has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.inputPeerForDomainPeer (cognitive 19) · ×1
  • Router.inputPeerForDomainPeer (cognitive 19) internal/rpc/messages_helpers.go:63 — Router.inputPeerForDomainPeer has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 4, match/switch 2 (3 pts) (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Router.onMessagesGetMessagesViews (cognitive 19) · ×1
  • Router.onMessagesGetMessagesViews (cognitive 19) internal/rpc/messages_history.go:151 — Router.onMessagesGetMessagesViews has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.availableReactionCatalog (cognitive 19) · ×1
  • Router.availableReactionCatalog (cognitive 19) REDACTED:174 — Router.availableReactionCatalog has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesReadMessageContents (cognitive 19) · ×1
  • Router.onMessagesReadMessageContents (cognitive 19) internal/rpc/messages_read.go:10 — Router.onMessagesReadMessageContents has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 pts), 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.
D2 · Cognitive Complexity · Router.onPaymentsValidateRequestedInfo (cognitive 19) · ×1
  • Router.onPaymentsValidateRequestedInfo (cognitive 19) internal/rpc/payments_star_gifts.go:486 — Router.onPaymentsValidateRequestedInfo has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.tgSavedStarGiftsResponse (cognitive 19) · ×1
  • Router.tgSavedStarGiftsResponse (cognitive 19) internal/rpc/payments_star_gifts.go:1454 — Router.tgSavedStarGiftsResponse has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onPhotosUpdateProfilePhoto (cognitive 19) · ×1
  • Router.onPhotosUpdateProfilePhoto (cognitive 19) internal/rpc/photos.go:85 — Router.onPhotosUpdateProfilePhoto has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 2, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesGetStickerSet (cognitive 19) · ×1
  • Router.onMessagesGetStickerSet (cognitive 19) internal/rpc/stickers.go:69 — Router.onMessagesGetStickerSet has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.tgBotInfos (cognitive 19) · ×1
  • Router.tgBotInfos (cognitive 19) REDACTED:880 — Router.tgBotInfos has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.welcomeDeliveryUpdates (cognitive 19) · ×1
  • Router.welcomeDeliveryUpdates (cognitive 19) internal/rpc/welcome_delivery_dispatcher.go:167 — Router.welcomeDeliveryUpdates has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.premiumMyBoostsLocked (cognitive 19) · ×1
  • ChannelStore.premiumMyBoostsLocked (cognitive 19) internal/store/memory/channel_boosts.go:156 — ChannelStore.premiumMyBoostsLocked has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ReorderChannelPinnedDialogs (cognitive 19) · ×1
  • ChannelStore.ReorderChannelPinnedDialogs (cognitive 19) internal/store/memory/channel_dialogs.go:335 — ChannelStore.ReorderChannelPinnedDialogs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · ChannelStore.ListChannelInviteAdminMemberIDs (cognitive 19) · ×1
  • ChannelStore.ListChannelInviteAdminMemberIDs (cognitive 19) internal/store/memory/channel_invites.go:939 — ChannelStore.ListChannelInviteAdminMemberIDs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ListMonoforumDialogs (cognitive 19) · ×1
  • ChannelStore.ListMonoforumDialogs (cognitive 19) internal/store/memory/channel_monoforum.go:212 — ChannelStore.ListMonoforumDialogs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, loops 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.
D2 · Cognitive Complexity · ChannelStore.ListChannelUnreadReactions (cognitive 19) · ×1
  • ChannelStore.ListChannelUnreadReactions (cognitive 19) internal/store/memory/channel_reactions.go:545 — ChannelStore.ListChannelUnreadReactions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.channelMessageReactionsLocked (cognitive 19) · ×1
  • ChannelStore.channelMessageReactionsLocked (cognitive 19) internal/store/memory/channel_reactions.go:769 — ChannelStore.channelMessageReactionsLocked has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, loops 3 (nesting depth added 3). Of this number, 15 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.UpdateUsername (cognitive 19) · ×1
  • ChannelStore.UpdateUsername (cognitive 19) internal/store/memory/channel_settings.go:145 — ChannelStore.UpdateUsername has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.DeleteForumTopicHistory (cognitive 19) · ×1
  • ChannelStore.DeleteForumTopicHistory (cognitive 19) internal/store/memory/channel_topics.go:366 — ChannelStore.DeleteForumTopicHistory has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 4, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ContactStore.Delete (cognitive 19) · ×1
  • ContactStore.Delete (cognitive 19) REDACTED:390 — ContactStore.Delete has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.UnpinAllPrivateMessages (cognitive 19) · ×1
  • MessageStore.UnpinAllPrivateMessages (cognitive 19) internal/store/memory/message_pin.go:91 — MessageStore.UnpinAllPrivateMessages has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.ListSavedReactionTags (cognitive 19) · ×1
  • MessageStore.ListSavedReactionTags (cognitive 19) internal/store/memory/message_saved_reactions.go:65 — MessageStore.ListSavedReactionTags has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 4 (5 pts), boolean chains 3 (nesting depth added 5). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PasswordStore.SaveMusic (cognitive 19) · ×1
  • PasswordStore.SaveMusic (cognitive 19) internal/store/memory/password.go:432 — PasswordStore.SaveMusic has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PollStore.ListPollVotes (cognitive 19) · ×1
  • PollStore.ListPollVotes (cognitive 19) internal/store/memory/poll.go:52 — PollStore.ListPollVotes has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 4). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StarGiftStore.SetUnsaved (cognitive 19) · ×1
  • StarGiftStore.SetUnsaved (cognitive 19) REDACTED:568 — StarGiftStore.SetUnsaved has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · postgres.loadDeleteUnreadCorrections (cognitive 19) · ×1
  • postgres.loadDeleteUnreadCorrections (cognitive 19) internal/store/postgres/message_read.go:296 — postgres.loadDeleteUnreadCorrections has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 3 (4 pts) (nesting depth added 8). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · postgres.enrichPollMediaRefs (cognitive 19) · ×1
  • postgres.enrichPollMediaRefs (cognitive 19) REDACTED:364 — postgres.enrichPollMediaRefs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.listActiveChannelIDPages (cognitive 19) · ×1
  • ChannelStore.listActiveChannelIDPages (cognitive 19) internal/store/postgres/active_channel_ids_batch.go:277 — ChannelStore.listActiveChannelIDPages has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.SearchPublicPosts (cognitive 19) · ×1
  • ChannelStore.SearchPublicPosts (cognitive 19) internal/store/postgres/channel_helpers.go:232 — ChannelStore.SearchPublicPosts has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 3, loops 2 (3 pts), match/switch 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.
D2 · Cognitive Complexity · ChannelStore.HideAllChatJoinRequests (cognitive 19) · ×1
  • ChannelStore.HideAllChatJoinRequests (cognitive 19) internal/store/postgres/channel_invite_requests.go:109 — ChannelStore.HideAllChatJoinRequests has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.getLinkedDiscussionGuest (cognitive 19) · ×1
  • ChannelStore.getLinkedDiscussionGuest (cognitive 19) internal/store/postgres/channel_member_helpers.go:51 — ChannelStore.getLinkedDiscussionGuest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ChannelPollFanoutViews (cognitive 19) · ×1
  • ChannelStore.ChannelPollFanoutViews (cognitive 19) internal/store/postgres/channel_polls.go:104 — ChannelStore.ChannelPollFanoutViews has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 4, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.SetChannelScamFake (cognitive 19) · ×1
  • ChannelStore.SetChannelScamFake (cognitive 19) internal/store/postgres/channel_settings.go:294 — ChannelStore.SetChannelScamFake has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 3 (nesting depth added 2). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.SetForum (cognitive 19) · ×1
  • ChannelStore.SetForum (cognitive 19) internal/store/postgres/channel_topics.go:14 — ChannelStore.SetForum has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 5 (nesting depth added 1). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: 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.
D2 · Cognitive Complexity · EphemeralReportStore.ListUnmigratedEphemeralReports (cognitive 19) · ×1
  • EphemeralReportStore.ListUnmigratedEphemeralReports (cognitive 19) internal/store/postgres/ephemeral_report.go:53 — EphemeralReportStore.ListUnmigratedEphemeralReports has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GroupCallStore.JoinGroupCall (cognitive 19) · ×1
  • GroupCallStore.JoinGroupCall (cognitive 19) internal/store/postgres/groupcall.go:273 — GroupCallStore.JoinGroupCall has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 4 (nesting depth added 1). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: 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.
D2 · Cognitive Complexity · MessageStore.DeleteMessages (cognitive 19) · ×1
  • MessageStore.DeleteMessages (cognitive 19) internal/store/postgres/message_delete.go:14 — MessageStore.DeleteMessages has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 1 (nesting depth added 2). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MessageStore.setSavedMessageTags (cognitive 19) · ×1
  • MessageStore.setSavedMessageTags (cognitive 19) internal/store/postgres/message_saved_reactions.go:16 — MessageStore.setSavedMessageTags has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15 (18 pts), loops 1 (nesting depth added 3). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · StarGiftLifecycleStore.DropStarGiftOriginalDetails (cognitive 19) · ×1
  • StarGiftLifecycleStore.DropStarGiftOriginalDetails (cognitive 19) internal/store/postgres/star_gift_entitlements.go:212 — StarGiftLifecycleStore.DropStarGiftOriginalDetails has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 5 (nesting depth added 3). Of this number, 13 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · StarGiftLifecycleStore.SendStarGiftOffer (cognitive 19) · ×1
  • StarGiftLifecycleStore.SendStarGiftOffer (cognitive 19) internal/store/postgres/star_gift_lifecycle.go:778 — StarGiftLifecycleStore.SendStarGiftOffer has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, boolean chains 4. Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 802, 852). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · StarGiftUpgradeStore.loadAdminStarGiftGrantReplay (cognitive 19) · ×1
  • StarGiftUpgradeStore.loadAdminStarGiftGrantReplay (cognitive 19) REDACTED:282 — StarGiftUpgradeStore.loadAdminStarGiftGrantReplay has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · echo.parse_args (cognitive 19) · ×1
  • echo.parse_args (cognitive 19) cmd/bots/aiogramecho/echo.py:40 — echo.parse_args has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 7, error handling 1 (2 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · main.resolveTarget (cognitive 18) · ×1
  • main.resolveTarget (cognitive 18) cmd/bots/botdemo/main.go:225 — main.resolveTarget has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.deploy (cognitive 18) · ×1
  • main.deploy (cognitive 18) cmd/stickerseeddeploy/main.go:67 — main.deploy has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (15 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · admin.revokeTargets (cognitive 18) · ×1
  • admin.revokeTargets (cognitive 18) internal/admin/service.go:4092 — admin.revokeTargets has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.SetCustomVerification (cognitive 18) · ×1
  • Service.SetCustomVerification (cognitive 18) internal/app/botverification/service.go:511 — Service.SetCustomVerification has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Service.resolvePeer (cognitive 18) · ×1
  • Service.resolvePeer (cognitive 18) internal/app/botverification/service.go:1313 — Service.resolvePeer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.AddContact (cognitive 18) · ×1
  • Service.AddContact (cognitive 18) internal/app/contacts/service.go:129 — Service.AddContact has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.EditCloseFriends (cognitive 18) · ×1
  • Service.EditCloseFriends (cognitive 18) internal/app/contacts/service.go:429 — Service.EditCloseFriends has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.EditPeerFolders (cognitive 18) · ×1
  • Service.EditPeerFolders (cognitive 18) internal/app/dialogs/service.go:1232 — Service.EditPeerFolders has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · files.stickerSetShortNameBase (cognitive 18) · ×1
  • files.stickerSetShortNameBase (cognitive 18) internal/app/files/sticker_creator.go:578 — files.stickerSetShortNameBase has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.availableReactionSeedNeedsRepair (cognitive 18) · ×1
  • Service.availableReactionSeedNeedsRepair (cognitive 18) internal/app/files/seed.go:213 — Service.availableReactionSeedNeedsRepair has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · giftpack.Summarize (cognitive 18) · ×1
  • giftpack.Summarize (cognitive 18) internal/app/giftpack/summary.go:62 — giftpack.Summarize has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (10 pts), if/else 4 (7 pts), boolean chains 1 (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Service.ReportPeer (cognitive 18) · ×1
  • Service.ReportPeer (cognitive 18) internal/app/moderation/evidence.go:125 — Service.ReportPeer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.MigrateLegacyEphemeralReports (cognitive 18) · ×1
  • Service.MigrateLegacyEphemeralReports (cognitive 18) internal/app/moderation/legacy.go:15 — Service.MigrateLegacyEphemeralReports has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.GetDifference (cognitive 18) · ×1
  • Service.GetDifference (cognitive 18) internal/app/updates/service.go:176 — Service.GetDifference has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CachedContactStore.loadSparseContactProjection (cognitive 18) · ×1
  • CachedContactStore.loadSparseContactProjection (cognitive 18) internal/app/userprojection/contact_cache_sparse.go:113 — CachedContactStore.loadSparseContactProjection has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 8). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 121). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · botapi.replyMarkupFromAPI (cognitive 18) · ×1
  • botapi.replyMarkupFromAPI (cognitive 18) internal/botapi/inline.go:179 — botapi.replyMarkupFromAPI has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · botapi.markupButtonFromAPI (cognitive 18) · ×1
  • botapi.markupButtonFromAPI (cognitive 18) internal/botapi/inline.go:330 — botapi.markupButtonFromAPI has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · handler.getWebhookInfo (cognitive 18) · ×1
  • handler.getWebhookInfo (cognitive 18) internal/botapi/server.go:454 — handler.getWebhookInfo has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 1 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · handler.sendRichMessage (cognitive 18) · ×1
  • handler.sendRichMessage (cognitive 18) internal/botapi/server.go:585 — handler.sendRichMessage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · handler.setUserEmojiStatus (cognitive 18) · ×1
  • handler.setUserEmojiStatus (cognitive 18) internal/botapi/server.go:1162 — handler.setUserEmojiStatus has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · config.validateBlobStorageConfig (cognitive 18) · ×1
  • config.validateBlobStorageConfig (cognitive 18) internal/config/config.go:1575 — config.validateBlobStorageConfig has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · domain.BusinessBotRecipientsMatch (cognitive 18) · ×1
  • domain.BusinessBotRecipientsMatch (cognitive 18) internal/domain/business.go:269 — domain.BusinessBotRecipientsMatch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · domain.ValidatePollVote (cognitive 18) · ×1
  • domain.ValidatePollVote (cognitive 18) internal/domain/poll.go:151 — domain.ValidatePollVote has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · domain.validateVerificationHost (cognitive 18) · ×1
  • domain.validateVerificationHost (cognitive 18) internal/domain/verification.go:465 — domain.validateVerificationHost has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 5, loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loadharness.provisionPhase (cognitive 18) · ×1
  • loadharness.provisionPhase (cognitive 18) internal/loadharness/provision.go:129 — loadharness.provisionPhase has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 4 (5 pts), match/switch 1 (2 pts) (nesting depth added 6). Of this number, 10 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · loadharness.runFixedMessageSchedule (cognitive 18) · ×1
  • loadharness.runFixedMessageSchedule (cognitive 18) REDACTED:1032 — loadharness.runFixedMessageSchedule has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 4 (9 pts), if/else 4 (6 pts), loops 2, boolean chains 1 (nesting depth added 7). 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.
D2 · Cognitive Complexity · rpc.botAPIRichText (cognitive 18) · ×1
  • rpc.botAPIRichText (cognitive 18) REDACTED:320 — rpc.botAPIRichText has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 8). Of this number, 16 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.domainOutgoingReplyMarkupForSender (cognitive 18) · ×1
  • rpc.domainOutgoingReplyMarkupForSender (cognitive 18) internal/rpc/convert_markup.go:178 — rpc.domainOutgoingReplyMarkupForSender has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (5 pts), 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.
D2 · Cognitive Complexity · rpc.tgMessageReactions (cognitive 18) · ×1
  • rpc.tgMessageReactions (cognitive 18) internal/rpc/convert_messages.go:515 — rpc.tgMessageReactions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.validateStoriesGetAllStoriesRequest (cognitive 18) · ×1
  • rpc.validateStoriesGetAllStoriesRequest (cognitive 18) internal/rpc/stories.go:207 — rpc.validateStoriesGetAllStoriesRequest has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.validateStoryCaptionEntities (cognitive 18) · ×1
  • rpc.validateStoryCaptionEntities (cognitive 18) internal/rpc/stories.go:1463 — rpc.validateStoryCaptionEntities has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · presenceLastSeenBatchDispatcher.executeWithRetry (cognitive 18) · ×1
  • presenceLastSeenBatchDispatcher.executeWithRetry (cognitive 18) internal/rpc/presence_last_seen_batch.go:217 — presenceLastSeenBatchDispatcher.executeWithRetry has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 2 (6 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.registerAccount (cognitive 18) · ×1
  • Router.registerAccount (cognitive 18) internal/rpc/account.go:27 — Router.registerAccount has cognitive complexity 18 (threshold 15). Drivers by points: if/else 18. None of this is in the body itself: all 18 points belong to 10 function literals inside it that branch (lines 281, 298, 311, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Router.BotAPIEditRichMessage (cognitive 18) · ×1
  • Router.BotAPIEditRichMessage (cognitive 18) internal/rpc/botapi_gateway.go:875 — Router.BotAPIEditRichMessage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.onMessagesCreateChat (cognitive 18) · ×1
  • Router.onMessagesCreateChat (cognitive 18) internal/rpc/channels_legacy_chat.go:13 — Router.onMessagesCreateChat has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.onMessagesSetChatTheme (cognitive 18) · ×1
  • Router.onMessagesSetChatTheme (cognitive 18) internal/rpc/channels_legacy_chat.go:456 — Router.onMessagesSetChatTheme has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.onFoldersEditPeerFolders (cognitive 18) · ×1
  • Router.onFoldersEditPeerFolders (cognitive 18) internal/rpc/folders.go:20 — Router.onFoldersEditPeerFolders has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.resolveAuthKeyLayerDefault (cognitive 18) · ×1
  • Router.resolveAuthKeyLayerDefault (cognitive 18) internal/rpc/layer_inheritance.go:453 — Router.resolveAuthKeyLayerDefault has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 1 (nesting depth added 4). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 466). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Router.onMessagesMarkDialogUnread (cognitive 18) · ×1
  • Router.onMessagesMarkDialogUnread (cognitive 18) internal/rpc/messages_dialogs.go:843 — Router.onMessagesMarkDialogUnread has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (18 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.forwardSourcesFromPrivateMessages (cognitive 18) · ×1
  • Router.forwardSourcesFromPrivateMessages (cognitive 18) internal/rpc/messages_forward.go:687 — Router.forwardSourcesFromPrivateMessages has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.updatePrivatePinnedMessage (cognitive 18) · ×1
  • Router.updatePrivatePinnedMessage (cognitive 18) internal/rpc/messages_pin.go:17 — Router.updatePrivatePinnedMessage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesSendVote (cognitive 18) · ×1
  • Router.onMessagesSendVote (cognitive 18) internal/rpc/messages_polls.go:27 — Router.onMessagesSendVote has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesGetUnreadReactions (cognitive 18) · ×1
  • Router.onMessagesGetUnreadReactions (cognitive 18) internal/rpc/messages_reactions_lists.go:262 — Router.onMessagesGetUnreadReactions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.validateDefaultReaction (cognitive 18) · ×1
  • Router.validateDefaultReaction (cognitive 18) internal/rpc/messages_reactions_privacy.go:80 — Router.validateDefaultReaction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.mutateTodoMedia (cognitive 18) · ×1
  • Router.mutateTodoMedia (cognitive 18) internal/rpc/messages_todos.go:197 — Router.mutateTodoMedia has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.onMessagesSetHistoryTTL (cognitive 18) · ×1
  • Router.onMessagesSetHistoryTTL (cognitive 18) internal/rpc/messages_ttl.go:46 — Router.onMessagesSetHistoryTTL has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onPaymentsUpdateStarGiftPrice (cognitive 18) · ×1
  • Router.onPaymentsUpdateStarGiftPrice (cognitive 18) internal/rpc/payments_star_gift_lifecycle.go:565 — Router.onPaymentsUpdateStarGiftPrice has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, 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.
D2 · Cognitive Complexity · storySparseProjectionCache.activePeers (cognitive 18) · ×1
  • storySparseProjectionCache.activePeers (cognitive 18) internal/rpc/story_sparse_projection_cache.go:75 — storySparseProjectionCache.activePeers has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 5, boolean chains 2 (nesting depth added 3). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BatchedReverseContactStore.execute (cognitive 18) · ×1
  • BatchedReverseContactStore.execute (cognitive 18) internal/store/contact_reverse_batch.go:244 — BatchedReverseContactStore.execute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 5 (8 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memory.channelDialogAfterOffset (cognitive 18) · ×1
  • memory.channelDialogAfterOffset (cognitive 18) internal/store/memory/channel_dialogs.go:566 — memory.channelDialogAfterOffset has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memory.dialogMatchesFolder (cognitive 18) · ×1
  • memory.dialogMatchesFolder (cognitive 18) internal/store/memory/dialogs.go:780 — memory.dialogMatchesFolder has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AuthKeyStore.AdvanceSessionLayer (cognitive 18) · ×1
  • AuthKeyStore.AdvanceSessionLayer (cognitive 18) internal/store/memory/authkey_session_layer.go:37 — AuthKeyStore.AdvanceSessionLayer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ChannelStore.ListCommonChannels (cognitive 18) · ×1
  • ChannelStore.ListCommonChannels (cognitive 18) internal/store/memory/channel_dialogs.go:163 — ChannelStore.ListCommonChannels has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ListActiveChannelIDsForUser (cognitive 18) · ×1
  • ChannelStore.ListActiveChannelIDsForUser (cognitive 18) internal/store/memory/channel_helpers.go:281 — ChannelStore.ListActiveChannelIDsForUser has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.channelForViewerLocked (cognitive 18) · ×1
  • ChannelStore.channelForViewerLocked (cognitive 18) internal/store/memory/channel_helpers.go:424 — ChannelStore.channelForViewerLocked has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.ReorderPinnedForumTopics (cognitive 18) · ×1
  • ChannelStore.ReorderPinnedForumTopics (cognitive 18) internal/store/memory/channel_topics.go:318 — ChannelStore.ReorderPinnedForumTopics has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DialogStore.ReorderPinned (cognitive 18) · ×1
  • DialogStore.ReorderPinned (cognitive 18) internal/store/memory/dialogs.go:370 — DialogStore.ReorderPinned has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · GroupCallStore.SweepStaleParticipants (cognitive 18) · ×1
  • GroupCallStore.SweepStaleParticipants (cognitive 18) internal/store/memory/groupcall.go:500 — GroupCallStore.SweepStaleParticipants has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModerationReportStore.SubmitModerationAppealByLink (cognitive 18) · ×1
  • ModerationReportStore.SubmitModerationAppealByLink (cognitive 18) internal/store/memory/moderation.go:690 — ModerationReportStore.SubmitModerationAppealByLink has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · StarGiftStore.UpdateCollection (cognitive 18) · ×1
  • StarGiftStore.UpdateCollection (cognitive 18) REDACTED:656 — StarGiftStore.UpdateCollection has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 3, boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · postgres.channelDialogAfterOffset (cognitive 18) · ×1
  • postgres.channelDialogAfterOffset (cognitive 18) REDACTED:2174 — postgres.channelDialogAfterOffset has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · postgres.validateAppealSanctionOwnership (cognitive 18) · ×1
  • postgres.validateAppealSanctionOwnership (cognitive 18) internal/store/postgres/moderation_cases.go:934 — postgres.validateAppealSanctionOwnership has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.premiumMyBoosts (cognitive 18) · ×1
  • ChannelStore.premiumMyBoosts (cognitive 18) internal/store/postgres/channel_boosts.go:231 — ChannelStore.premiumMyBoosts has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ListDirtyActiveChannelsForUser (cognitive 18) · ×1
  • ChannelStore.ListDirtyActiveChannelsForUser (cognitive 18) internal/store/postgres/channel_helpers.go:368 — ChannelStore.ListDirtyActiveChannelsForUser has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 3, boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.HideChatJoinRequest (cognitive 18) · ×1
  • ChannelStore.HideChatJoinRequest (cognitive 18) internal/store/postgres/channel_member_join_requests.go:123 — ChannelStore.HideChatJoinRequest has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 1 (nesting depth added 2). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ChannelStore.UnpinAllChannelMessages (cognitive 18) · ×1
  • ChannelStore.UnpinAllChannelMessages (cognitive 18) internal/store/postgres/channel_message_edit.go:513 — ChannelStore.UnpinAllChannelMessages has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 1, loops 1 (nesting depth added 1). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ChannelStore.ListStoryMessageForwards (cognitive 18) · ×1
  • ChannelStore.ListStoryMessageForwards (cognitive 18) internal/store/postgres/channel_message_history.go:583 — ChannelStore.ListStoryMessageForwards has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.GetChannelMessageReactions (cognitive 18) · ×1
  • ChannelStore.GetChannelMessageReactions (cognitive 18) internal/store/postgres/channel_reaction_messages.go:353 — ChannelStore.GetChannelMessageReactions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 2, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MessageStore.GetMessageReactions (cognitive 18) · ×1
  • MessageStore.GetMessageReactions (cognitive 18) internal/store/postgres/message_reactions.go:178 — MessageStore.GetMessageReactions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, loops 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.
D2 · Cognitive Complexity · ModerationReportStore.IssueModerationAppealLink (cognitive 18) · ×1
  • ModerationReportStore.IssueModerationAppealLink (cognitive 18) internal/store/postgres/moderation_cases.go:447 — ModerationReportStore.IssueModerationAppealLink has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ModerationReportStore.CreateSponsoredModerationReport (cognitive 18) · ×1
  • ModerationReportStore.CreateSponsoredModerationReport (cognitive 18) internal/store/postgres/moderation_registries.go:81 — ModerationReportStore.CreateSponsoredModerationReport has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · postgresAdmissionController.reserve (cognitive 18) · ×1
  • postgresAdmissionController.reserve (cognitive 18) internal/store/postgres/postgres_connection_admission.go:231 — postgresAdmissionController.reserve has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UserStore.SetScamFake (cognitive 18) · ×1
  • UserStore.SetScamFake (cognitive 18) internal/store/postgres/user.go:658 — UserStore.SetScamFake has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 2 (nesting depth added 4). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VerificationStore.RevokeVerification (cognitive 18) · ×1
  • VerificationStore.RevokeVerification (cognitive 18) internal/store/postgres/verification.go:584 — VerificationStore.RevokeVerification has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 1, match/switch 1 (nesting depth added 4). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 603). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · BatchedReadModelVersionStore.execute (cognitive 18) · ×1
  • BatchedReadModelVersionStore.execute (cognitive 18) internal/store/read_model_batch.go:246 — BatchedReadModelVersionStore.execute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 5 (8 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · server.callAdminCollectibleMultipart (cognitive 17) · ×1
  • server.callAdminCollectibleMultipart (cognitive 17) cmd/telesrv-admin/star_gift_catalog.go:258 — server.callAdminCollectibleMultipart has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 1, loops 1 (nesting depth added 3). Of this number, 12 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · main.parseWebAppSession (cognitive 17) · ×1
  • main.parseWebAppSession (cognitive 17) cmd/walletminiapp/main.go:309 — main.parseWebAppSession has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.DeletePrivateHistory (cognitive 17) · ×1
  • Service.DeletePrivateHistory (cognitive 17) internal/admin/service.go:3233 — Service.DeletePrivateHistory has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, loops 1 (nesting depth added 2). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 3249). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Service.RevokeVerification (cognitive 17) · ×1
  • Service.RevokeVerification (cognitive 17) internal/admin/verification.go:254 — Service.RevokeVerification has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 3 (nesting depth added 1). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 272). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Service.UpdateTone (cognitive 17) · ×1
  • Service.UpdateTone (cognitive 17) internal/app/ai/service.go:240 — Service.UpdateTone has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Service.ConsumeLoginEmailReset (cognitive 17) · ×1
  • Service.ConsumeLoginEmailReset (cognitive 17) internal/app/auth/service.go:999 — Service.ConsumeLoginEmailReset has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, boolean chains 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Service.bind (cognitive 17) · ×1
  • Service.bind (cognitive 17) internal/app/auth/service.go:1625 — Service.bind has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.submitVerifyApplication (cognitive 17) · ×1
  • Service.submitVerifyApplication (cognitive 17) internal/app/bots/verifybot.go:648 — Service.submitVerifyApplication has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.SendMessage (cognitive 17) · ×1
  • Service.SendMessage (cognitive 17) internal/app/channels/service.go:1430 — Service.SendMessage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.maybeFaststartVideoBlob (cognitive 17) · ×1
  • Service.maybeFaststartVideoBlob (cognitive 17) internal/app/files/photos.go:551 — Service.maybeFaststartVideoBlob has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Service.EvictOldestMediaOverBudget (cognitive 17) · ×1
  • Service.EvictOldestMediaOverBudget (cognitive 17) internal/app/files/retention.go:442 — Service.EvictOldestMediaOverBudget has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.importStickerSetDir (cognitive 17) · ×1
  • Service.importStickerSetDir (cognitive 17) internal/app/files/seed.go:319 — Service.importStickerSetDir has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 1, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Service.ReviewAppeal (cognitive 17) · ×1
  • Service.ReviewAppeal (cognitive 17) internal/app/moderation/cases.go:92 — Service.ReviewAppeal has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · stargifts.prepareAnimationWithPolicy (cognitive 17) · ×1
  • stargifts.prepareAnimationWithPolicy (cognitive 17) internal/app/stargifts/animation.go:35 — stargifts.prepareAnimationWithPolicy has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.deepLinkToken (cognitive 17) · ×1
  • Service.deepLinkToken (cognitive 17) internal/app/telegramlogin/service.go:914 — Service.deepLinkToken has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (6 pts), match/switch 1 (nesting depth added 1). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · Service.ByIDsForViewerUserIDs (cognitive 17) · ×1
  • Service.ByIDsForViewerUserIDs (cognitive 17) internal/app/users/service_sparse.go:13 — Service.ByIDsForViewerUserIDs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.controls (cognitive 17) · ×1
  • Service.controls (cognitive 17) internal/app/verification/service.go:1044 — Service.controls has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · config.validateTelegramLoginConfig (cognitive 17) · ×1
  • config.validateTelegramLoginConfig (cognitive 17) internal/config/config.go:1680 — config.validateTelegramLoginConfig has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, loops 1, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · domain.DetectAutomaticMessageEntities (cognitive 17) · ×1
  • domain.DetectAutomaticMessageEntities (cognitive 17) internal/domain/message_entity_autodetect.go:24 — domain.DetectAutomaticMessageEntities has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 6, boolean chains 4 (nesting depth added 2). Of this number, 10 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · domain.detectCashtagMessageEntities (cognitive 17) · ×1
  • domain.detectCashtagMessageEntities (cognitive 17) internal/domain/message_entity_autodetect.go:167 — domain.detectCashtagMessageEntities has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · domain.publicVerificationIP (cognitive 17) · ×1
  • domain.publicVerificationIP (cognitive 17) internal/domain/verification.go:502 — domain.publicVerificationIP has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (7 pts), match/switch 1 (2 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · layerRPCGZIPExpansionBudget.expand (cognitive 17) · ×1
  • layerRPCGZIPExpansionBudget.expand (cognitive 17) internal/mtprotoedge/inbound_layer_rpc.go:256 — layerRPCGZIPExpansionBudget.expand has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionManager.ClearInheritedLayerForRawAuthKey (cognitive 17) · ×1
  • SessionManager.ClearInheritedLayerForRawAuthKey (cognitive 17) internal/mtprotoedge/session_manager.go:318 — SessionManager.ClearInheritedLayerForRawAuthKey has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionManager.SeedInheritedLayerForBusinessAuthKey (cognitive 17) · ×1
  • SessionManager.SeedInheritedLayerForBusinessAuthKey (cognitive 17) internal/mtprotoedge/session_manager.go:355 — SessionManager.SeedInheritedLayerForBusinessAuthKey has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionManager.pushToBusinessAuthKeyBestEffort (cognitive 17) · ×1
  • SessionManager.pushToBusinessAuthKeyBestEffort (cognitive 17) internal/mtprotoedge/session_manager.go:1635 — SessionManager.pushToBusinessAuthKeyBestEffort has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4 (nesting depth added 2). Of this number, 10 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: one other method here (SessionManager.pushToUserBestEffort) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · SessionManager.pushToUserBestEffort (cognitive 17) · ×1
  • SessionManager.pushToUserBestEffort (cognitive 17) internal/mtprotoedge/session_manager.go:1801 — SessionManager.pushToUserBestEffort has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4 (nesting depth added 2). Of this number, 10 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. This shape REPEATS in the file: one other method here (SessionManager.pushToBusinessAuthKeyBestEffort) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · SessionManager.onlineChannelSubscriberUserIDsExcluding (cognitive 17) · ×1
  • SessionManager.onlineChannelSubscriberUserIDsExcluding (cognitive 17) internal/mtprotoedge/session_manager.go:2214 — SessionManager.onlineChannelSubscriberUserIDsExcluding has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.domainSuggestedPost (cognitive 17) · ×1
  • rpc.domainSuggestedPost (cognitive 17) internal/rpc/messages_suggested_post.go:84 — rpc.domainSuggestedPost has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.tgBoosts (cognitive 17) · ×1
  • rpc.tgBoosts (cognitive 17) internal/rpc/premium.go:259 — rpc.tgBoosts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.validateStoryInputMediaClass (cognitive 17) · ×1
  • rpc.validateStoryInputMediaClass (cognitive 17) internal/rpc/stories.go:2966 — rpc.validateStoryInputMediaClass has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Router.onAccountGetThemes (cognitive 17) · ×1
  • Router.onAccountGetThemes (cognitive 17) internal/rpc/account_themes.go:31 — Router.onAccountGetThemes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 1 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.fanoutStoryBlocklistChange (cognitive 17) · ×1
  • Router.fanoutStoryBlocklistChange (cognitive 17) internal/rpc/contacts.go:204 — Router.fanoutStoryBlocklistChange has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.snapshotLayerRPCWrapperEffects (cognitive 17) · ×1
  • Router.snapshotLayerRPCWrapperEffects (cognitive 17) internal/rpc/layer_dispatch.go:361 — Router.snapshotLayerRPCWrapperEffects has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesToggleBotInAttachMenu (cognitive 17) · ×1
  • Router.onMessagesToggleBotInAttachMenu (cognitive 17) internal/rpc/messages_attach_menu.go:75 — Router.onMessagesToggleBotInAttachMenu has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.dialogDraftFromSaveDraft (cognitive 17) · ×1
  • Router.dialogDraftFromSaveDraft (cognitive 17) internal/rpc/messages_dialogs.go:155 — Router.dialogDraftFromSaveDraft has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.onMessagesGetForumTopicsByID (cognitive 17) · ×1
  • Router.onMessagesGetForumTopicsByID (cognitive 17) internal/rpc/messages_forum.go:319 — Router.onMessagesGetForumTopicsByID has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesSetTyping (cognitive 17) · ×1
  • Router.onMessagesSetTyping (cognitive 17) internal/rpc/messages_helpers.go:161 — Router.onMessagesSetTyping has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.resolveMonoforumForAdmin (cognitive 17) · ×1
  • Router.resolveMonoforumForAdmin (cognitive 17) internal/rpc/messages_monoforum.go:21 — Router.resolveMonoforumForAdmin has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesReadReactions (cognitive 17) · ×1
  • Router.onMessagesReadReactions (cognitive 17) internal/rpc/messages_reactions_lists.go:317 — Router.onMessagesReadReactions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5 (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.
D2 · Cognitive Complexity · Router.suggestedPostApprovalUpdatesWithPeerCacheAndOverlaysStrict (cognitive 17) · ×1
  • Router.suggestedPostApprovalUpdatesWithPeerCacheAndOverlaysStrict (cognitive 17) internal/rpc/messages_suggested_post_updates.go:20 — Router.suggestedPostApprovalUpdatesWithPeerCacheAndOverlaysStrict has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.onPaymentsGetPremiumGiftCodeOptions (cognitive 17) · ×1
  • Router.onPaymentsGetPremiumGiftCodeOptions (cognitive 17) internal/rpc/payments_premium.go:17 — Router.onPaymentsGetPremiumGiftCodeOptions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.storyProjectionMaps (cognitive 17) · ×1
  • Router.storyProjectionMaps (cognitive 17) internal/rpc/story_projection_cache.go:152 — Router.storyProjectionMaps has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onAccountGetWebAuthorizations (cognitive 17) · ×1
  • Router.onAccountGetWebAuthorizations (cognitive 17) internal/rpc/telegram_login.go:345 — Router.onAccountGetWebAuthorizations has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AccountRatingStore.ListAccountRatings (cognitive 17) · ×1
  • AccountRatingStore.ListAccountRatings (cognitive 17) internal/store/memory/account_rating.go:203 — AccountRatingStore.ListAccountRatings has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BotStore.UpsertBotApp (cognitive 17) · ×1
  • BotStore.UpsertBotApp (cognitive 17) internal/store/memory/bot.go:323 — BotStore.UpsertBotApp has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · BotAPIUpdateStore.ListTailBotAPIUpdates (cognitive 17) · ×1
  • BotAPIUpdateStore.ListTailBotAPIUpdates (cognitive 17) internal/store/memory/botapi_update.go:268 — BotAPIUpdateStore.ListTailBotAPIUpdates has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ListInactiveChannels (cognitive 17) · ×1
  • ChannelStore.ListInactiveChannels (cognitive 17) internal/store/memory/channel_dialogs.go:248 — ChannelStore.ListInactiveChannels has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, loops 2 (nesting depth added 3). Of this number, 15 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.EditChannelPeerFolders (cognitive 17) · ×1
  • ChannelStore.EditChannelPeerFolders (cognitive 17) internal/store/memory/channel_dialogs.go:375 — ChannelStore.EditChannelPeerFolders has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.FilterChannelMessageAudienceIDs (cognitive 17) · ×1
  • ChannelStore.FilterChannelMessageAudienceIDs (cognitive 17) internal/store/memory/channel_members.go:949 — ChannelStore.FilterChannelMessageAudienceIDs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, 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.
D2 · Cognitive Complexity · ChannelStore.GetDiscussionMessage (cognitive 17) · ×1
  • ChannelStore.GetDiscussionMessage (cognitive 17) internal/store/memory/channel_message_history.go:477 — ChannelStore.GetDiscussionMessage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.GetChannelMessageReactions (cognitive 17) · ×1
  • ChannelStore.GetChannelMessageReactions (cognitive 17) internal/store/memory/channel_reactions.go:286 — ChannelStore.GetChannelMessageReactions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.ListChannelRecommendations (cognitive 17) · ×1
  • ChannelStore.ListChannelRecommendations (cognitive 17) internal/store/memory/channel_settings.go:638 — ChannelStore.ListChannelRecommendations has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 1 (nesting depth added 4). Of this number, 15 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.GetChannelMessageStats (cognitive 17) · ×1
  • ChannelStore.GetChannelMessageStats (cognitive 17) internal/store/memory/channel_stats.go:202 — ChannelStore.GetChannelMessageStats has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 4 (5 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CollectibleUsernameStore.ListCollectibleUsernames (cognitive 17) · ×1
  • CollectibleUsernameStore.ListCollectibleUsernames (cognitive 17) internal/store/memory/collectible_username.go:563 — CollectibleUsernameStore.ListCollectibleUsernames has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), 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.
D2 · Cognitive Complexity · CommunityStore.ToggleCommunityPeerLink (cognitive 17) · ×1
  • CommunityStore.ToggleCommunityPeerLink (cognitive 17) internal/store/memory/community.go:375 — CommunityStore.ToggleCommunityPeerLink has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (17 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GroupCallStore.JoinGroupCall (cognitive 17) · ×1
  • GroupCallStore.JoinGroupCall (cognitive 17) internal/store/memory/groupcall.go:161 — GroupCallStore.JoinGroupCall has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · GroupCallStore.ListParticipants (cognitive 17) · ×1
  • GroupCallStore.ListParticipants (cognitive 17) internal/store/memory/groupcall.go:391 — GroupCallStore.ListParticipants has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, loops 2 (nesting depth added 3). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.setSavedMessageTagsLocked (cognitive 17) · ×1
  • MessageStore.setSavedMessageTagsLocked (cognitive 17) internal/store/memory/message_saved_reactions.go:10 — MessageStore.setSavedMessageTagsLocked has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), 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.
D2 · Cognitive Complexity · TelegramLoginStore.PutTelegramLoginAuthorizationCode (cognitive 17) · ×1
  • TelegramLoginStore.PutTelegramLoginAuthorizationCode (cognitive 17) internal/store/memory/telegram_login.go:469 — TelegramLoginStore.PutTelegramLoginAuthorizationCode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · postgres.privateMessageReactionsFromRows (cognitive 17) · ×1
  • postgres.privateMessageReactionsFromRows (cognitive 17) internal/store/postgres/message_reactions.go:351 — postgres.privateMessageReactionsFromRows has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 3, boolean chains 2 (nesting depth added 3). Of this number, 13 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · postgres.persistPlainPrivateSendProjection (cognitive 17) · ×1
  • postgres.persistPlainPrivateSendProjection (cognitive 17) internal/store/postgres/message_send_hotpath.go:101 — postgres.persistPlainPrivateSendProjection has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, boolean chains 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · PasswordStore.GetPeerNotifySettings (cognitive 17) · ×1
  • PasswordStore.GetPeerNotifySettings (cognitive 17) internal/store/postgres/account.go:422 — PasswordStore.GetPeerNotifySettings has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PasswordStore.ListNotifyExceptions (cognitive 17) · ×1
  • PasswordStore.ListNotifyExceptions (cognitive 17) internal/store/postgres/account.go:520 — PasswordStore.ListNotifyExceptions has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BotVerificationStore.GrantCustomVerification (cognitive 17) · ×1
  • BotVerificationStore.GrantCustomVerification (cognitive 17) internal/store/postgres/bot_verification.go:537 — BotVerificationStore.GrantCustomVerification has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 2, match/switch 1 (nesting depth added 2). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 553). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ChannelStore.ListAdminLog (cognitive 17) · ×1
  • ChannelStore.ListAdminLog (cognitive 17) internal/store/postgres/channel_admin_log.go:11 — ChannelStore.ListAdminLog has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 2, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ChannelStore.getChannelForViewer (cognitive 17) · ×1
  • ChannelStore.getChannelForViewer (cognitive 17) internal/store/postgres/channel_helpers.go:466 — ChannelStore.getChannelForViewer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.UpdatePinnedMessage (cognitive 17) · ×1
  • ChannelStore.UpdatePinnedMessage (cognitive 17) internal/store/postgres/channel_message_edit.go:417 — ChannelStore.UpdatePinnedMessage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15, boolean chains 2. Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ChannelStore.mutateChannelMessagePoll (cognitive 17) · ×1
  • ChannelStore.mutateChannelMessagePoll (cognitive 17) internal/store/postgres/channel_polls.go:31 — ChannelStore.mutateChannelMessagePoll has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, boolean chains 3. Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ChannelStore.DeleteChannelParticipantReaction (cognitive 17) · ×1
  • ChannelStore.DeleteChannelParticipantReaction (cognitive 17) internal/store/postgres/channel_reaction_messages.go:186 — ChannelStore.DeleteChannelParticipantReaction has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15, boolean chains 2. Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ChannelStore.ListMessageReadParticipants (cognitive 17) · ×1
  • ChannelStore.ListMessageReadParticipants (cognitive 17) internal/store/postgres/channel_read.go:413 — ChannelStore.ListMessageReadParticipants has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 5, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CollectibleUsernameStore.TransferCollectibleUsername (cognitive 17) · ×1
  • CollectibleUsernameStore.TransferCollectibleUsername (cognitive 17) internal/store/postgres/collectible_username.go:294 — CollectibleUsernameStore.TransferCollectibleUsername has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15, boolean chains 2. Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 308). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ContactStore.ContactProjectionForViewerUserIDs (cognitive 17) · ×1
  • ContactStore.ContactProjectionForViewerUserIDs (cognitive 17) REDACTED:332 — ContactStore.ContactProjectionForViewerUserIDs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ModerationReportStore.CreateModerationAppeal (cognitive 17) · ×1
  • ModerationReportStore.CreateModerationAppeal (cognitive 17) internal/store/postgres/moderation_cases.go:350 — ModerationReportStore.CreateModerationAppeal has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, 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.
D2 · Cognitive Complexity · ModerationReportStore.CreateAntiSpamFalsePositiveReport (cognitive 17) · ×1
  • ModerationReportStore.CreateAntiSpamFalsePositiveReport (cognitive 17) internal/store/postgres/moderation_registries.go:206 — ModerationReportStore.CreateAntiSpamFalsePositiveReport has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PremiumStore.RefundPremiumPayment (cognitive 17) · ×1
  • PremiumStore.RefundPremiumPayment (cognitive 17) internal/store/postgres/premium.go:623 — PremiumStore.RefundPremiumPayment has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, boolean chains 3. Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 633). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · StarGiftLifecycleStore.ListCraftStarGifts (cognitive 17) · ×1
  • StarGiftLifecycleStore.ListCraftStarGifts (cognitive 17) internal/store/postgres/star_gift_craft_auction.go:207 — StarGiftLifecycleStore.ListCraftStarGifts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 2, loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · StarGiftLifecycleStore.debitLifecycleAmount (cognitive 17) · ×1
  • StarGiftLifecycleStore.debitLifecycleAmount (cognitive 17) internal/store/postgres/star_gift_lifecycle.go:1319 — StarGiftLifecycleStore.debitLifecycleAmount has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (17 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StoryStore.ListStoryViews (cognitive 17) · ×1
  • StoryStore.ListStoryViews (cognitive 17) internal/store/postgres/story.go:1188 — StoryStore.ListStoryViews has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · UpdateEventStore.DeleteConfirmedPrefix (cognitive 17) · ×1
  • UpdateEventStore.DeleteConfirmedPrefix (cognitive 17) internal/store/postgres/update_event_retention.go:20 — UpdateEventStore.DeleteConfirmedPrefix has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 1, loops 1 (nesting depth added 6). Of this number, 15 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WelcomeMessageStore.CreateWelcomeMessage (cognitive 17) · ×1
  • WelcomeMessageStore.CreateWelcomeMessage (cognitive 17) internal/store/postgres/welcome_message.go:36 — WelcomeMessageStore.CreateWelcomeMessage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 2 (nesting depth added 1). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 47). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Handler.inApp (cognitive 17) · ×1
  • Handler.inApp (cognitive 17) internal/telegramloginhttp/handler.go:303 — Handler.inApp has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · handler.channelToPublicPeer (cognitive 17) · ×1
  • handler.channelToPublicPeer (cognitive 17) internal/web/server.go:824 — handler.channelToPublicPeer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.evidenceToChat (cognitive 16) · ×1
  • main.evidenceToChat (cognitive 16) cmd/telesrv-admin/report_evidence.go:84 — main.evidenceToChat has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · server.streamStoredFile (cognitive 16) · ×1
  • server.streamStoredFile (cognitive 16) cmd/telesrv-admin/privateview.go:567 — server.streamStoredFile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · server.handleModerationReportEvidenceAPI (cognitive 16) · ×1
  • server.handleModerationReportEvidenceAPI (cognitive 16) cmd/telesrv-admin/report_evidence.go:130 — server.handleModerationReportEvidenceAPI has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3, boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.render (cognitive 16) · ×1
  • main.render (cognitive 16) cmd/tl-coverage/main.go:568 — main.render has cognitive complexity 16 (threshold 15). Drivers by points: loops 9 (11 pts), if/else 2 (3 pts), boolean chains 2 (nesting depth added 3). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, 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.
D2 · Cognitive Complexity · Service.GrantBotVerifier (cognitive 16) · ×1
  • Service.GrantBotVerifier (cognitive 16) internal/admin/botverification.go:276 — Service.GrantBotVerifier has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 1 (nesting depth added 2). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 301). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Server.handleModerationCases (cognitive 16) · ×1
  • Server.handleModerationCases (cognitive 16) internal/adminapi/server.go:1455 — Server.handleModerationCases has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ai.NewProviderFromConfig (cognitive 16) · ×1
  • ai.NewProviderFromConfig (cognitive 16) internal/app/ai/provider_http.go:42 — ai.NewProviderFromConfig has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 1, 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.
D2 · Cognitive Complexity · Service.createEmailLoginCode (cognitive 16) · ×1
  • Service.createEmailLoginCode (cognitive 16) internal/app/auth/service.go:723 — Service.createEmailLoginCode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (16 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Service.cancelCode (cognitive 16) · ×1
  • Service.cancelCode (cognitive 16) internal/app/auth/service.go:1071 — Service.cancelCode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · bots.serviceBotURLByteSpans (cognitive 16) · ×1
  • bots.serviceBotURLByteSpans (cognitive 16) internal/app/bots/service_bot_entities.go:57 — bots.serviceBotURLByteSpans has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.getBotParticipants (cognitive 16) · ×1
  • Service.getBotParticipants (cognitive 16) internal/app/channels/bot_policy.go:28 — Service.getBotParticipants has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · Service.filterBotChannelDifference (cognitive 16) · ×1
  • Service.filterBotChannelDifference (cognitive 16) internal/app/channels/bot_policy.go:228 — Service.filterBotChannelDifference has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 3, loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.botCanSeeChannelMessage (cognitive 16) · ×1
  • Service.botCanSeeChannelMessage (cognitive 16) internal/app/channels/bot_policy.go:310 — Service.botCanSeeChannelMessage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · dialogs.dialogListSnapshotPageHeaders (cognitive 16) · ×1
  • dialogs.dialogListSnapshotPageHeaders (cognitive 16) internal/app/dialogs/list_snapshot_cache.go:219 — dialogs.dialogListSnapshotPageHeaders has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.cachedPeerDialogsReadModel (cognitive 16) · ×1
  • Service.cachedPeerDialogsReadModel (cognitive 16) internal/app/dialogs/read_model_cache.go:74 — Service.cachedPeerDialogsReadModel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.loadDialogs (cognitive 16) · ×1
  • Service.loadDialogs (cognitive 16) internal/app/dialogs/service.go:544 — Service.loadDialogs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Service.GetPeerDialogs (cognitive 16) · ×1
  • Service.GetPeerDialogs (cognitive 16) internal/app/dialogs/service.go:686 — Service.GetPeerDialogs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Service.loadDialogListSnapshotAtOwnerHash (cognitive 16) · ×1
  • Service.loadDialogListSnapshotAtOwnerHash (cognitive 16) internal/app/dialogs/shared_list_snapshot.go:46 — Service.loadDialogListSnapshotAtOwnerHash has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (16 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · files.validatePremiumPromoAttributes (cognitive 16) · ×1
  • files.validatePremiumPromoAttributes (cognitive 16) internal/app/files/premium_promo_seed.go:334 — files.validatePremiumPromoAttributes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.seedReactions (cognitive 16) · ×1
  • Service.seedReactions (cognitive 16) internal/app/files/seed.go:151 — Service.seedReactions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). Of this number, 11 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · langpack.packFromFilename (cognitive 16) · ×1
  • langpack.packFromFilename (cognitive 16) internal/app/langpack/parser.go:58 — langpack.packFromFilename has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · messages.businessWorkHoursOpen (cognitive 16) · ×1
  • messages.businessWorkHoursOpen (cognitive 16) internal/app/messages/business_automation.go:364 — messages.businessWorkHoursOpen has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.ReportStories (cognitive 16) · ×1
  • Service.ReportStories (cognitive 16) internal/app/moderation/evidence.go:368 — Service.ReportStories has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · privacy.validateRules (cognitive 16) · ×1
  • privacy.validateRules (cognitive 16) internal/app/privacy/service.go:515 — privacy.validateRules has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (5 pts), match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Service.RequestEncryption (cognitive 16) · ×1
  • Service.RequestEncryption (cognitive 16) internal/app/secretchat/service.go:31 — Service.RequestEncryption has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · domain.ValidateUsernameReorder (cognitive 16) · ×1
  • domain.ValidateUsernameReorder (cognitive 16) internal/domain/collectible_username.go:373 — domain.ValidateUsernameReorder has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · domain.classifyDocumentCategory (cognitive 16) · ×1
  • domain.classifyDocumentCategory (cognitive 16) internal/domain/media_category.go:113 — domain.classifyDocumentCategory has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · domain.ValidateExternalReplyQuote (cognitive 16) · ×1
  • domain.ValidateExternalReplyQuote (cognitive 16) internal/domain/message_reply_external.go:89 — domain.ValidateExternalReplyQuote has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, 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.
D2 · Cognitive Complexity · domain.NewModerationReport (cognitive 16) · ×1
  • domain.NewModerationReport (cognitive 16) internal/domain/moderation.go:250 — domain.NewModerationReport has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 3, boolean chains 1 (nesting depth added 4). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClientTelemetryEvent.Validate (cognitive 16) · ×1
  • ClientTelemetryEvent.Validate (cognitive 16) internal/domain/client_telemetry.go:102 — ClientTelemetryEvent.Validate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · loadharness.provisionOne (cognitive 16) · ×1
  • loadharness.provisionOne (cognitive 16) internal/loadharness/provision.go:204 — loadharness.provisionOne has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 1 (nesting depth added 1). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 210). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · mutationJournal.assertComplete (cognitive 16) · ×1
  • mutationJournal.assertComplete (cognitive 16) internal/loadharness/mutate.go:736 — mutationJournal.assertComplete has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpcResultDeliveryCoordinator.claimReplayDeliveredHook (cognitive 16) · ×1
  • rpcResultDeliveryCoordinator.claimReplayDeliveredHook (cognitive 16) internal/mtprotoedge/outbound.go:498 — rpcResultDeliveryCoordinator.claimReplayDeliveredHook has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpcExecutionLedger.completeOnce (cognitive 16) · ×1
  • rpcExecutionLedger.completeOnce (cognitive 16) internal/mtprotoedge/rpc_execution_ledger.go:310 — rpcExecutionLedger.completeOnce has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 2, loops 2, 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.
D2 · Cognitive Complexity · Server.encodeRPCResultWithoutSlot (cognitive 16) · ×1
  • Server.encodeRPCResultWithoutSlot (cognitive 16) internal/mtprotoedge/encrypted.go:1308 — Server.encodeRPCResultWithoutSlot has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Server.admitInboundLayerRPCAt (cognitive 16) · ×1
  • Server.admitInboundLayerRPCAt (cognitive 16) internal/mtprotoedge/inbound_layer_rpc.go:909 — Server.admitInboundLayerRPCAt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 1 (nesting depth added 8). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Server.newInboundLayerRPCTask (cognitive 16) · ×1
  • Server.newInboundLayerRPCTask (cognitive 16) internal/mtprotoedge/layer_rpc_execution.go:117 — Server.newInboundLayerRPCTask has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5 (nesting depth added 2). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 165, 137, 157). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · SessionManager.DestroySessionForAuthKey (cognitive 16) · ×1
  • SessionManager.DestroySessionForAuthKey (cognitive 16) internal/mtprotoedge/session_manager.go:756 — SessionManager.DestroySessionForAuthKey has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.botAPIUnorderedRichList (cognitive 16) · ×1
  • rpc.botAPIUnorderedRichList (cognitive 16) REDACTED:169 — rpc.botAPIUnorderedRichList has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.tgChannelParticipant (cognitive 16) · ×1
  • rpc.tgChannelParticipant (cognitive 16) internal/rpc/convert_channels_core.go:726 — rpc.tgChannelParticipant has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · rpc.mergeReactionCatalogFallback (cognitive 16) · ×1
  • rpc.mergeReactionCatalogFallback (cognitive 16) REDACTED:209 — rpc.mergeReactionCatalogFallback has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.sliceTGEntitiesForChunk (cognitive 16) · ×1
  • rpc.sliceTGEntitiesForChunk (cognitive 16) internal/rpc/messages_send.go:142 — rpc.sliceTGEntitiesForChunk has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.validateTodoItems (cognitive 16) · ×1
  • rpc.validateTodoItems (cognitive 16) internal/rpc/messages_todos.go:316 — rpc.validateTodoItems has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.combineSendUpdates (cognitive 16) · ×1
  • rpc.combineSendUpdates (cognitive 16) internal/rpc/send_replay.go:93 — rpc.combineSendUpdates has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.applyContactNoteToUserFull (cognitive 16) · ×1
  • rpc.applyContactNoteToUserFull (cognitive 16) REDACTED:271 — rpc.applyContactNoteToUserFull has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rpc.domainWallpaperSettings (cognitive 16) · ×1
  • rpc.domainWallpaperSettings (cognitive 16) internal/rpc/wallpaper.go:133 — rpc.domainWallpaperSettings has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, 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.
D2 · Cognitive Complexity · presenceLastSeenBatchDispatcher.drain (cognitive 16) · ×1
  • presenceLastSeenBatchDispatcher.drain (cognitive 16) internal/rpc/presence_last_seen_batch.go:263 — presenceLastSeenBatchDispatcher.drain has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onAccountVerifyEmail (cognitive 16) · ×1
  • Router.onAccountVerifyEmail (cognitive 16) internal/rpc/account.go:791 — Router.onAccountVerifyEmail has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.runAccountLifecycleOnce (cognitive 16) · ×1
  • Router.runAccountLifecycleOnce (cognitive 16) internal/rpc/account_lifecycle_worker.go:39 — Router.runAccountLifecycleOnce has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.BotAPISendMessage (cognitive 16) · ×1
  • Router.BotAPISendMessage (cognitive 16) internal/rpc/botapi_gateway.go:178 — Router.BotAPISendMessage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (14 pts), 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.
D2 · Cognitive Complexity · Router.BotAPISendMedia (cognitive 16) · ×1
  • Router.BotAPISendMedia (cognitive 16) internal/rpc/botapi_gateway.go:294 — Router.BotAPISendMedia has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (14 pts), 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.
D2 · Cognitive Complexity · Router.BotAPIEditEphemeral (cognitive 16) · ×1
  • Router.BotAPIEditEphemeral (cognitive 16) internal/rpc/botapi_gateway.go:404 — Router.BotAPIEditEphemeral has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4 (nesting depth added 3). Of this number, 13 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.botAPIQueuedChannelMessages (cognitive 16) · ×1
  • Router.botAPIQueuedChannelMessages (cognitive 16) internal/rpc/botapi_update_queue.go:142 — Router.botAPIQueuedChannelMessages has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.channelInlineMessageIDFromSendUpdates (cognitive 16) · ×1
  • Router.channelInlineMessageIDFromSendUpdates (cognitive 16) internal/rpc/bots_inline_message_id.go:139 — Router.channelInlineMessageIDFromSendUpdates has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesSetChatWallPaper (cognitive 16) · ×1
  • Router.onMessagesSetChatWallPaper (cognitive 16) internal/rpc/channels_legacy_chat.go:540 — Router.onMessagesSetChatWallPaper has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · Router.onChannelsDeleteChannel (cognitive 16) · ×1
  • Router.onChannelsDeleteChannel (cognitive 16) internal/rpc/channels_stubs.go:87 — Router.onChannelsDeleteChannel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 3). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.tgUsersForIDs (cognitive 16) · ×1
  • Router.tgUsersForIDs (cognitive 16) internal/rpc/channels_stubs.go:451 — Router.tgUsersForIDs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3, 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.
D2 · Cognitive Complexity · Router.onCommunitiesToggleAllPeerLinkRequestApproval (cognitive 16) · ×1
  • Router.onCommunitiesToggleAllPeerLinkRequestApproval (cognitive 16) internal/rpc/communities.go:379 — Router.onCommunitiesToggleAllPeerLinkRequestApproval has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onCommunitiesToggleParticipantBanned (cognitive 16) · ×1
  • Router.onCommunitiesToggleParticipantBanned (cognitive 16) internal/rpc/communities.go:413 — Router.onCommunitiesToggleParticipantBanned has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, loops 2 (nesting depth added 3). Of this number, 10 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onContactsAddContact (cognitive 16) · ×1
  • Router.onContactsAddContact (cognitive 16) internal/rpc/contacts.go:678 — Router.onContactsAddContact has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Router.domainEphemeralInputContent (cognitive 16) · ×1
  • Router.domainEphemeralInputContent (cognitive 16) internal/rpc/ephemeral.go:282 — Router.domainEphemeralInputContent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.onHelpGetPremiumPromo (cognitive 16) · ×1
  • Router.onHelpGetPremiumPromo (cognitive 16) internal/rpc/help.go:179 — Router.onHelpGetPremiumPromo has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.chatsForDrafts (cognitive 16) · ×1
  • Router.chatsForDrafts (cognitive 16) internal/rpc/messages_dialogs.go:312 — Router.chatsForDrafts has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3, boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesUpdateDialogFilter (cognitive 16) · ×1
  • Router.onMessagesUpdateDialogFilter (cognitive 16) internal/rpc/messages_dialogs.go:435 — Router.onMessagesUpdateDialogFilter has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (16 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.dialogPeersFromInput (cognitive 16) · ×1
  • Router.dialogPeersFromInput (cognitive 16) internal/rpc/messages_dialogs.go:1010 — Router.dialogPeersFromInput has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesGetForumTopics (cognitive 16) · ×1
  • Router.onMessagesGetForumTopics (cognitive 16) internal/rpc/messages_forum.go:274 — Router.onMessagesGetForumTopics has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onMessagesReport (cognitive 16) · ×1
  • Router.onMessagesReport (cognitive 16) internal/rpc/messages_reports.go:46 — Router.onMessagesReport has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 2, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.sendClaimedScheduledMessages (cognitive 16) · ×1
  • Router.sendClaimedScheduledMessages (cognitive 16) internal/rpc/messages_scheduled.go:220 — Router.sendClaimedScheduledMessages has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onPaymentsUpdateStarGiftCollection (cognitive 16) · ×1
  • Router.onPaymentsUpdateStarGiftCollection (cognitive 16) internal/rpc/payments_star_gift_collections.go:71 — Router.onPaymentsUpdateStarGiftCollection has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.onPhoneDiscardCall (cognitive 16) · ×1
  • Router.onPhoneDiscardCall (cognitive 16) internal/rpc/phone_calls.go:206 — Router.onPhoneDiscardCall has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.onPhoneInviteConferenceCallParticipant (cognitive 16) · ×1
  • Router.onPhoneInviteConferenceCallParticipant (cognitive 16) internal/rpc/phone_conference.go:118 — Router.onPhoneInviteConferenceCallParticipant has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, 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.
D2 · Cognitive Complexity · Router.onPhoneInviteToGroupCall (cognitive 16) · ×1
  • Router.onPhoneInviteToGroupCall (cognitive 16) internal/rpc/phone_group_call_edit.go:271 — Router.onPhoneInviteToGroupCall has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.filterChatInvitePrivacy (cognitive 16) · ×1
  • Router.filterChatInvitePrivacy (cognitive 16) internal/rpc/privacy_invites.go:14 — Router.filterChatInvitePrivacy has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (5 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onStatsGetStoryStats (cognitive 16) · ×1
  • Router.onStatsGetStoryStats (cognitive 16) internal/rpc/stats.go:153 — Router.onStatsGetStoryStats has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Router.onStatsGetStoryPublicForwards (cognitive 16) · ×1
  • Router.onStatsGetStoryPublicForwards (cognitive 16) internal/rpc/stats.go:194 — Router.onStatsGetStoryPublicForwards has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 5 (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.
D2 · Cognitive Complexity · Router.onStickersCreateStickerSet (cognitive 16) · ×1
  • Router.onStickersCreateStickerSet (cognitive 16) internal/rpc/stickers_creator.go:45 — Router.onStickersCreateStickerSet has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 2, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Router.onMessagesRequestURLAuth (cognitive 16) · ×1
  • Router.onMessagesRequestURLAuth (cognitive 16) internal/rpc/telegram_login.go:126 — Router.onMessagesRequestURLAuth has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5 (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.
D2 · Cognitive Complexity · Router.resolvePendingWebPage (cognitive 16) · ×1
  • Router.resolvePendingWebPage (cognitive 16) internal/rpc/webpage_resolver.go:100 — Router.resolvePendingWebPage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), 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.
D2 · Cognitive Complexity · sfu.buildMediaPlan (cognitive 16) · ×1
  • sfu.buildMediaPlan (cognitive 16) internal/sfu/pion.go:77 — sfu.buildMediaPlan has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 4 (5 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memory.adminRightsSubset (cognitive 16) · ×1
  • memory.adminRightsSubset (cognitive 16) internal/store/memory/channel_helpers.go:641 — memory.adminRightsSubset has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 16. 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.
D2 · Cognitive Complexity · memory.filterDialogList (cognitive 16) · ×1
  • memory.filterDialogList (cognitive 16) internal/store/memory/dialogs.go:737 — memory.filterDialogList has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · memory.projectCollectibleAttributes (cognitive 16) · ×1
  • memory.projectCollectibleAttributes (cognitive 16) REDACTED:896 — memory.projectCollectibleAttributes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AIComposeStore.ListAIComposeTonesForUser (cognitive 16) · ×1
  • AIComposeStore.ListAIComposeTonesForUser (cognitive 16) internal/store/memory/ai.go:108 — AIComposeStore.ListAIComposeTonesForUser has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (5 pts) (nesting depth added 7). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.EnsurePermanentInvite (cognitive 16) · ×1
  • ChannelStore.EnsurePermanentInvite (cognitive 16) internal/store/memory/channel_invites.go:202 — ChannelStore.EnsurePermanentInvite has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.ReadChannelMentions (cognitive 16) · ×1
  • ChannelStore.ReadChannelMentions (cognitive 16) internal/store/memory/channel_read.go:198 — ChannelStore.ReadChannelMentions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, loops 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.DeleteExpiredChannelUpdateEvents (cognitive 16) · ×1
  • ChannelStore.DeleteExpiredChannelUpdateEvents (cognitive 16) internal/store/memory/channel_updates.go:221 — ChannelStore.DeleteExpiredChannelUpdateEvents has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (4 pts) (nesting depth added 7). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChannelStore.pruneChannelUpdateEventsLocked (cognitive 16) · ×1
  • ChannelStore.pruneChannelUpdateEventsLocked (cognitive 16) internal/store/memory/channel_updates.go:269 — ChannelStore.pruneChannelUpdateEventsLocked has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DialogStore.SetPinned (cognitive 16) · ×1
  • DialogStore.SetPinned (cognitive 16) internal/store/memory/dialogs.go:333 — DialogStore.SetPinned has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), 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.
D2 · Cognitive Complexity · MessageStore.rebuildMemoryDialogLocked (cognitive 16) · ×1
  • MessageStore.rebuildMemoryDialogLocked (cognitive 16) internal/store/memory/message_delete.go:218 — MessageStore.rebuildMemoryDialogLocked has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PasswordStore.ListUserStickerSets (cognitive 16) · ×1
  • PasswordStore.ListUserStickerSets (cognitive 16) internal/store/memory/password.go:349 — PasswordStore.ListUserStickerSets has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 5). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StarGiftStore.ResolveSavedIDs (cognitive 16) · ×1
  • StarGiftStore.ResolveSavedIDs (cognitive 16) REDACTED:504 — StarGiftStore.ResolveSavedIDs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StoryStore.ListPinnedStories (cognitive 16) · ×1
  • StoryStore.ListPinnedStories (cognitive 16) internal/store/memory/story.go:359 — StoryStore.ListPinnedStories has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, loops 2 (nesting depth added 3). Of this number, 14 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StoryStore.ListStoriesArchive (cognitive 16) · ×1
  • StoryStore.ListStoriesArchive (cognitive 16) internal/store/memory/story.go:424 — StoryStore.ListStoriesArchive has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 6, loops 1 (nesting depth added 2). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · postgres.deleteOrphanedAuthKeysTx (cognitive 16) · ×1
  • postgres.deleteOrphanedAuthKeysTx (cognitive 16) internal/store/postgres/authkey.go:364 — postgres.deleteOrphanedAuthKeysTx has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), loops 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · postgres.adminRightsSubset (cognitive 16) · ×1
  • postgres.adminRightsSubset (cognitive 16) internal/store/postgres/channel_helpers.go:959 — postgres.adminRightsSubset has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 16. 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.
D2 · Cognitive Complexity · postgres.populateChannelMessageUnreadFlags (cognitive 16) · ×1
  • postgres.populateChannelMessageUnreadFlags (cognitive 16) internal/store/postgres/channel_read.go:468 — postgres.populateChannelMessageUnreadFlags has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · postgres.createModerationReportTx (cognitive 16) · ×1
  • postgres.createModerationReportTx (cognitive 16) internal/store/postgres/moderation.go:49 — postgres.createModerationReportTx has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · postgres.listAnimatedCollectibleAttributes (cognitive 16) · ×1
  • postgres.listAnimatedCollectibleAttributes (cognitive 16) REDACTED:279 — postgres.listAnimatedCollectibleAttributes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 1 (nesting depth added 4). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · postgres.appendUserUpdateEvent (cognitive 16) · ×1
  • postgres.appendUserUpdateEvent (cognitive 16) internal/store/postgres/update_event.go:164 — postgres.appendUserUpdateEvent 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.
D2 · Cognitive Complexity · AccountLifecycleStore.ScheduleAccountDeletion (cognitive 16) · ×1
  • AccountLifecycleStore.ScheduleAccountDeletion (cognitive 16) internal/store/postgres/account_lifecycle.go:53 — AccountLifecycleStore.ScheduleAccountDeletion has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AccountRatingStore.SaveAccountRating (cognitive 16) · ×1
  • AccountRatingStore.SaveAccountRating (cognitive 16) internal/store/postgres/account_rating.go:111 — AccountRatingStore.SaveAccountRating has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ActiveChannelIDsPageBatcher.run (cognitive 16) · ×1
  • ActiveChannelIDsPageBatcher.run (cognitive 16) internal/store/postgres/active_channel_ids_batch.go:161 — ActiveChannelIDsPageBatcher.run has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 2 (7 pts), if/else 2 (4 pts), loops 2 (4 pts), jumps 1 (nesting depth added 9). 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.
D2 · Cognitive Complexity · BatchedBootstrapUpdateJobStore.run (cognitive 16) · ×1
  • BatchedBootstrapUpdateJobStore.run (cognitive 16) internal/store/postgres/bootstrap_update_job_batch.go:179 — BatchedBootstrapUpdateJobStore.run has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 2 (7 pts), if/else 2 (4 pts), loops 2 (4 pts), jumps 1 (nesting depth added 9). 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.
D2 · Cognitive Complexity · ChannelStore.ExportInvite (cognitive 16) · ×1
  • ChannelStore.ExportInvite (cognitive 16) internal/store/postgres/channel_invite_exported.go:15 — ChannelStore.ExportInvite has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 2 (nesting depth added 1). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ChannelStore.ImportInvite (cognitive 16) · ×1
  • ChannelStore.ImportInvite (cognitive 16) internal/store/postgres/channel_invite_import.go:60 — ChannelStore.ImportInvite has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 2 (nesting depth added 2). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChannelStore.cascadeDeleteDiscussionRootsTx (cognitive 16) · ×1
  • ChannelStore.cascadeDeleteDiscussionRootsTx (cognitive 16) internal/store/postgres/channel_message_delete.go:156 — ChannelStore.cascadeDeleteDiscussionRootsTx has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, loops 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.
D2 · Cognitive Complexity · ChannelStore.DeleteChannelParticipantHistory (cognitive 16) · ×1
  • ChannelStore.DeleteChannelParticipantHistory (cognitive 16) internal/store/postgres/channel_message_delete.go:369 — ChannelStore.DeleteChannelParticipantHistory has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 1, loops 1 (nesting depth added 1). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ChannelStore.ListChannelMessagePublicForwards (cognitive 16) · ×1
  • ChannelStore.ListChannelMessagePublicForwards (cognitive 16) internal/store/postgres/channel_stats.go:412 — ChannelStore.ListChannelMessagePublicForwards has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 3, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ChannelStore.loadSuggestedPostResultTx (cognitive 16) · ×1
  • ChannelStore.loadSuggestedPostResultTx (cognitive 16) internal/store/postgres/channel_suggested_post.go:360 — ChannelStore.loadSuggestedPostResultTx has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CommunityStore.ListCommunityPeerLinkRequests (cognitive 16) · ×1
  • CommunityStore.ListCommunityPeerLinkRequests (cognitive 16) internal/store/postgres/community.go:640 — CommunityStore.ListCommunityPeerLinkRequests has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 2, boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ContactStore.SetCloseFriends (cognitive 16) · ×1
  • ContactStore.SetCloseFriends (cognitive 16) REDACTED:703 — ContactStore.SetCloseFriends has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 2, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GroupCallStore.ResetAllParticipants (cognitive 16) · ×1
  • GroupCallStore.ResetAllParticipants (cognitive 16) internal/store/postgres/groupcall.go:817 — GroupCallStore.ResetAllParticipants has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageStore.enrichSavedMessageTags (cognitive 16) · ×1
  • MessageStore.enrichSavedMessageTags (cognitive 16) internal/store/postgres/message_saved_reactions.go:100 — MessageStore.enrichSavedMessageTags has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 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.
D2 · Cognitive Complexity · PollStore.ListPollVotes (cognitive 16) · ×1
  • PollStore.ListPollVotes (cognitive 16) REDACTED:73 — PollStore.ListPollVotes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 2, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · StarGiftLifecycleStore.dispatchChannelStarGiftNotifications (cognitive 16) · ×1
  • StarGiftLifecycleStore.dispatchChannelStarGiftNotifications (cognitive 16) internal/store/postgres/star_gift_channel_notifications.go:78 — StarGiftLifecycleStore.dispatchChannelStarGiftNotifications has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StoryStore.ListStoryReactions (cognitive 16) · ×1
  • StoryStore.ListStoryReactions (cognitive 16) internal/store/postgres/story.go:1315 — StoryStore.ListStoryReactions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14 (16 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WelcomeMessageStore.ClaimWelcomeMessageDeliveries (cognitive 16) · ×1
  • WelcomeMessageStore.ClaimWelcomeMessageDeliveries (cognitive 16) internal/store/postgres/welcome_message_delivery.go:136 — WelcomeMessageStore.ClaimWelcomeMessageDeliveries has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, loops 1 (nesting depth added 3). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · web.newHandler (cognitive 16) · ×1
  • web.newHandler (cognitive 16) internal/web/server.go:136 — web.newHandler has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15 (16 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · handler.moderationAppeal (cognitive 16) · ×1
  • handler.moderationAppeal (cognitive 16) internal/web/server.go:284 — handler.moderationAppeal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D31 · IaC & Container Security · Medium IaC · ×1
  • REDACTED
D32 · Data Compliance (PII/GDPR) · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (8 members, 18 shared lines) · ×1
  • Near-duplicate member family (8 members, 18 shared lines) internal/store/postgres/channel_settings.go:573 — internal/store/postgres/channel_settings.go:573-620 | internal/store/postgres/channel_settings.go:710-757 | internal/store/postgres/channel_settings.go:759-793 | internal/store/postgres/channel_settings.go:795-842 | internal/store/postgres/channel_settings.go:844-891 | internal/store/postgres/channel_settings.go:893-927 | internal/store/postgres/channel_settings.go:929-972 | internal/store/postgres/channel_topics.go:14-78 — These 8 members are variants of one another: a block of 18 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication · Near-duplicate member family (5 members, 15 shared lines) · ×1
  • Near-duplicate member family (5 members, 15 shared lines) internal/adminapi/server.go:827 — internal/adminapi/server.go:827-859 | internal/adminapi/server.go:861-893 | internal/adminapi/server.go:904-936 | internal/adminapi/server.go:956-988 | internal/adminapi/server.go:1308-1342 — These 5 members are variants of one another: a block of 15 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Near-duplicate member family (3 members, 37 shared lines) · ×1
  • Near-duplicate member family (3 members, 37 shared lines) internal/store/postgres/channel_message_delete.go:196 — internal/store/postgres/channel_message_delete.go:196-367 | internal/store/postgres/channel_message_delete.go:369-436 | internal/store/postgres/channel_topics.go:386-470 — These 3 members are variants of one another: a block of 37 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication · Near-duplicate member pair (58 shared lines) · ×1
  • Near-duplicate member pair (58 shared lines) internal/store/postgres/moderation_cases.go:112 — internal/store/postgres/moderation_cases.go:112-198 | internal/store/postgres/moderation_cases.go:200-318 — These two members are variants of one another: 58 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (48 shared lines) · ×1
  • Near-duplicate member pair (48 shared lines) REDACTED:220 — REDACTED:220-330 | REDACTED:332-423 — These two members are variants of one another: 48 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (40 shared lines) · ×1
  • Near-duplicate member pair (40 shared lines) internal/store/memory/channel_helpers.go:524 — internal/store/memory/channel_helpers.go:524-583 | internal/store/postgres/channel_helpers.go:808-910 — These two members are variants of one another: 40 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (37 shared lines) · ×1
  • Near-duplicate member pair (37 shared lines) internal/store/postgres/message_pin.go:25 — internal/store/postgres/message_pin.go:25-169 | internal/store/postgres/message_pin.go:174-317 — These two members are variants of one another: 37 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (35 shared lines) · ×1
  • Near-duplicate member pair (35 shared lines) internal/store/memory/channel_settings.go:708 — internal/store/memory/channel_settings.go:708-837 | internal/store/postgres/channel_settings.go:1121-1295 — These two members are variants of one another: 35 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (29 shared lines) · ×1
  • Near-duplicate member pair (29 shared lines) internal/store/postgres/channel_invite_import.go:111 — internal/store/postgres/channel_invite_import.go:111-233 | internal/store/postgres/channel_member_join.go:14-143 — These two members are variants of one another: 29 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (25 shared lines) · ×1
  • Near-duplicate member pair (25 shared lines) internal/store/postgres/channel_message_helpers.go:20 — internal/store/postgres/channel_message_helpers.go:20-76 | internal/store/postgres/channel_message_helpers.go:78-135 — These two members are variants of one another: 25 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (24 shared lines) · ×1
  • Near-duplicate member pair (24 shared lines) internal/mtprotoedge/encrypted.go:745 — internal/mtprotoedge/encrypted.go:745-870 | internal/mtprotoedge/layer_rpc_execution.go:246-326 — These two members are variants of one another: 24 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (19 shared lines) · ×1
  • Near-duplicate member pair (19 shared lines) internal/store/postgres/telegram_login.go:866 — internal/store/postgres/telegram_login.go:866-934 | internal/store/postgres/telegram_login.go:936-1002 — These two members are variants of one another: 19 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Members sharing a duplicated core (15 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (15 members, 50+ identical tokens) internal/store/memory/channel_members.go:754 — internal/store/memory/channel_members.go:754-771 | internal/store/memory/channel_members.go:773-790 | internal/store/memory/channel_members.go:792-812 | internal/store/memory/channel_message_settings.go:9-50 | internal/store/memory/channel_reactions.go:12-29 | internal/store/memory/channel_settings.go:419-447 | internal/store/memory/channel_settings.go:449-477 | internal/store/memory/channel_settings.go:479-496 | internal/store/memory/channel_settings.go:498-526 | internal/store/memory/channel_settings.go:528-556 | internal/store/memory/channel_settings.go:558-575 | internal/store/memory/channel_settings.go:577-594 | internal/store/memory/channel_settings.go:596-617 | internal/store/memory/channel_settings.go:619-636 | internal/store/memory/channel_topics.go:11-47 — These 15 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 15 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 15 times.
D4 · Code Duplication · Members sharing a duplicated core (13 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (13 members, 50+ identical tokens) internal/rpc/stats.go:194 — internal/rpc/stats.go:194-250 | internal/rpc/stories.go:409-429 | internal/rpc/stories.go:550-572 | internal/rpc/stories.go:584-623 | internal/rpc/stories.go:1207-1273 | internal/rpc/stories.go:1366-1443 | internal/rpc/stories.go:2300-2338 | internal/rpc/stories.go:2356-2394 | internal/rpc/stories.go:2456-2487 | internal/rpc/stories.go:2538-2559 | internal/rpc/stories.go:2574-2614 | internal/rpc/stories.go:2646-2690 | internal/rpc/stories.go:2762-2818 — These 13 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 13 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 13 times.
D4 · Code Duplication · Members sharing a duplicated core (11 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (11 members, 50+ identical tokens) internal/store/postgres/message_forward.go:119 — internal/store/postgres/message_forward.go:119-178 | internal/store/postgres/message_history.go:80-278 | internal/store/postgres/message_history.go:653-723 | internal/store/postgres/message_history.go:725-795 | internal/store/postgres/message_history.go:797-867 | internal/store/postgres/message_history.go:869-939 | internal/store/postgres/message_history.go:941-1011 | internal/store/postgres/message_send.go:1050-1069 | internal/store/postgres/saved_dialog.go:414-484 | internal/store/postgres/update_event.go:326-485 | internal/store/postgres/update_event.go:530-694 — These 11 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 11 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 11 times.
D4 · Code Duplication · Members sharing a duplicated core (10 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (10 members, 50+ identical tokens) internal/admin/service.go:1552 — internal/admin/service.go:1552-1592 | internal/admin/service.go:1898-1931 | internal/admin/service.go:1935-1972 | internal/admin/service.go:1975-2004 | internal/admin/service.go:2006-2037 | internal/admin/service.go:2040-2082 | internal/admin/service.go:2087-2127 | internal/admin/service.go:2133-2181 | internal/admin/service.go:2186-2224 | internal/admin/service.go:2232-2270 — These 10 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 10 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 10 times.
D4 · Code Duplication · Members sharing a duplicated core (9 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (9 members, 50+ identical tokens) REDACTED:960 — REDACTED:960-995 | REDACTED:1624-1659 | REDACTED:1669-1705 | REDACTED:2023-2058 | REDACTED:2069-2103 | REDACTED:2146-2180 | cmd/telesrv-admin/serversettings.go:230-271 | cmd/telesrv-admin/star_gift_catalog.go:81-122 | cmd/telesrv-admin/star_gift_catalog.go:364-398 — These 9 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 9 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 9 times.
D4 · Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (8 members, 50+ identical tokens) cmd/telesrv-admin/readstore.go:430 — cmd/telesrv-admin/readstore.go:430-503 | cmd/telesrv-admin/readstore.go:1038-1093 | cmd/telesrv-admin/readstore.go:1873-1910 | cmd/telesrv-admin/readstore.go:2094-2147 | cmd/telesrv-admin/readstore.go:2529-2588 | cmd/telesrv-admin/readstore.go:2653-2694 | cmd/telesrv-admin/readstore.go:3008-3083 | cmd/telesrv-admin/readstore.go:3354-3424 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (7 members, 50+ identical tokens) cmd/telesrv-admin/botverification.go:104 — cmd/telesrv-admin/botverification.go:104-144 | cmd/telesrv-admin/botverification.go:146-193 | cmd/telesrv-admin/donations.go:69-95 | REDACTED:2671-2715 | cmd/telesrv-admin/verification.go:31-73 | internal/adminapi/botverification.go:72-117 | internal/adminapi/botverification.go:120-178 — These 7 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 7 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 7 times.
D4 · Code Duplication · Edited copy of a member (155 corresponding lines) · ×1
  • Edited copy of a member (155 corresponding lines) internal/store/postgres/dialog.go:41 — internal/store/postgres/dialog.go:41-259 | internal/store/postgres/dialog.go:450-604 — These two members are one piece of code written twice and then edited apart: 155 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (89 corresponding lines) · ×1
  • Edited copy of a member (89 corresponding lines) internal/store/postgres/channel_helpers.go:232 — internal/store/postgres/channel_helpers.go:232-320 | internal/store/postgres/channel_message_history.go:351-480 — These two members are one piece of code written twice and then edited apart: 89 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (99 corresponding lines) · ×1
  • Edited copy of a member (99 corresponding lines) internal/store/memory/channel_topics.go:179 — internal/store/memory/channel_topics.go:179-277 | internal/store/postgres/channel_topics.go:194-293 — These two members are one piece of code written twice and then edited apart: 99 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (65 corresponding lines) · ×1
  • Edited copy of a member (65 corresponding lines) internal/store/memory/moderation.go:437 — internal/store/memory/moderation.go:437-501 | internal/store/memory/moderation.go:503-585 — These two members are one piece of code written twice and then edited apart: 65 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (59 corresponding lines) · ×1
  • Edited copy of a member (59 corresponding lines) cmd/telesrv-admin/star_gift_catalog.go:185 — cmd/telesrv-admin/star_gift_catalog.go:185-253 | internal/adminapi/server.go:1240-1298 — These two members are one piece of code written twice and then edited apart: 59 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (84 corresponding lines) · ×1
  • Edited copy of a member (84 corresponding lines) internal/rpc/stories.go:2089 — internal/rpc/stories.go:2089-2176 | internal/rpc/stories.go:2178-2261 — These two members are one piece of code written twice and then edited apart: 84 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (64 corresponding lines) · ×1
  • Edited copy of a member (64 corresponding lines) internal/app/files/retention.go:111 — internal/app/files/retention.go:111-174 | internal/app/files/retention.go:192-267 — These two members are one piece of code written twice and then edited apart: 64 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (63 corresponding lines) · ×1
  • Edited copy of a member (63 corresponding lines) internal/store/postgres/auth_delivery_report.go:23 — internal/store/postgres/auth_delivery_report.go:23-90 | internal/store/postgres/client_telemetry.go:24-86 — These two members are one piece of code written twice and then edited apart: 63 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (76 corresponding lines) · ×1
  • Edited copy of a member (76 corresponding lines) internal/rpc/messages_bot_no_state.go:113 — internal/rpc/messages_bot_no_state.go:113-188 | internal/rpc/messages_bot_no_state.go:190-282 — These two members are one piece of code written twice and then edited apart: 76 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (51 corresponding lines) · ×1
  • Edited copy of a member (51 corresponding lines) internal/rpc/channels_settings.go:366 — internal/rpc/channels_settings.go:366-422 | internal/rpc/channels_settings.go:424-474 — These two members are one piece of code written twice and then edited apart: 51 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (69 corresponding lines) · ×1
  • Edited copy of a member (69 corresponding lines) internal/app/auth/service.go:599 — internal/app/auth/service.go:599-667 | internal/app/auth/service.go:723-792 — These two members are one piece of code written twice and then edited apart: 69 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (61 corresponding lines) · ×1
  • Edited copy of a member (61 corresponding lines) internal/rpc/messages_webview.go:23 — internal/rpc/messages_webview.go:23-83 | internal/rpc/messages_webview.go:138-202 — These two members are one piece of code written twice and then edited apart: 61 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (53 corresponding lines) · ×1
  • Edited copy of a member (53 corresponding lines) internal/store/postgres/story.go:1636 — internal/store/postgres/story.go:1636-1688 | internal/store/postgres/story.go:1690-1743 — These two members are one piece of code written twice and then edited apart: 53 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (72 corresponding lines) · ×1
  • Edited copy of a member (72 corresponding lines) internal/store/postgres/authkey_session_layer_batch.go:282 — internal/store/postgres/authkey_session_layer_batch.go:282-406 | internal/store/postgres/bootstrap_update_job_batch.go:306-377 — These two members are one piece of code written twice and then edited apart: 72 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 51+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 51+ corresponding lines) REDACTED:718 — REDACTED:718-768 | REDACTED:1010-1069 | REDACTED:1192-1246 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 51 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 33+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 33+ corresponding lines) cmd/telesrv-load/main.go:126 — cmd/telesrv-load/main.go:126-158 | cmd/telesrv-load/main.go:160-196 | cmd/telesrv-load/main.go:198-233 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 33 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (42 corresponding lines) · ×1
  • Edited copy of a member (42 corresponding lines) internal/rpc/payments_star_gift_unique.go:28 — internal/rpc/payments_star_gift_unique.go:28-69 | internal/rpc/payments_star_gift_unique.go:71-113 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 58+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 58+ corresponding lines) internal/store/postgres/verification.go:211 — internal/store/postgres/verification.go:211-274 | internal/store/postgres/verification.go:283-340 | internal/store/postgres/verification.go:345-403 | internal/store/postgres/verification.go:408-465 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 58 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 59+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 59+ corresponding lines) REDACTED:920 — REDACTED:920-978 | REDACTED:980-1039 | REDACTED:1082-1144 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 59 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 42+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 42+ corresponding lines) internal/store/postgres/channel_member_admin.go:525 — internal/store/postgres/channel_member_admin.go:525-566 | internal/store/postgres/channel_member_admin.go:606-652 | internal/store/postgres/channel_member_admin.go:654-700 | internal/store/postgres/channel_settings.go:1073-1119 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 42 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 25+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 25+ corresponding lines) internal/store/contact_reverse_batch.go:62 — internal/store/contact_reverse_batch.go:62-94 | internal/store/postgres/active_channel_ids_batch.go:76-103 | internal/store/postgres/authkey_get_batch.go:53-80 | internal/store/postgres/authkey_session_layer_batch.go:63-87 | internal/store/postgres/bootstrap_update_job_batch.go:80-107 | internal/store/read_model_batch.go:56-83 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 36+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 36+ corresponding lines) internal/store/memory/verification.go:158 — internal/store/memory/verification.go:158-195 | internal/store/memory/verification.go:201-236 | internal/store/memory/verification.go:241-277 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 36 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 30+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 30+ corresponding lines) internal/store/postgres/counter_source.go:21 — internal/store/postgres/counter_source.go:21-50 | internal/store/postgres/counter_source.go:110-139 | internal/store/postgres/message_helpers.go:227-257 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 30 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 25+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 25+ corresponding lines) internal/store/postgres/channel_member_join_requests.go:12 — internal/store/postgres/channel_member_join_requests.go:12-36 | internal/store/postgres/channel_member_join_requests.go:38-62 | internal/store/postgres/channel_member_join_requests.go:64-91 | internal/store/postgres/channel_reaction_settings.go:12-43 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 7+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 7+ corresponding lines) REDACTED:846 — REDACTED:846-852 | REDACTED:854-860 | REDACTED:862-868 | REDACTED:870-876 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 25+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 25+ corresponding lines) internal/store/postgres/bot.go:287 — internal/store/postgres/bot.go:287-312 | internal/store/postgres/bot_miniapp.go:16-40 | internal/store/postgres/dispatch_outbox.go:215-242 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 32+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 32+ corresponding lines) internal/store/postgres/botapi_update.go:383 — internal/store/postgres/botapi_update.go:383-425 | internal/store/postgres/botapi_update.go:427-463 | internal/store/postgres/dialog.go:417-448 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 32 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 20+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 20+ corresponding lines) internal/adminapi/server.go:339 — internal/adminapi/server.go:339-359 | internal/adminapi/server.go:599-619 | internal/adminapi/server.go:1053-1072 | internal/adminapi/server.go:1118-1137 | internal/adminapi/server.go:1139-1158 | internal/adminapi/server.go:1401-1420 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 45+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 45+ corresponding lines) REDACTED:63 — REDACTED:63-113 | REDACTED:115-165 | REDACTED:174-218 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 45 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 23+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 23+ corresponding lines) internal/rpc/story_pinned_stories_cache.go:155 — internal/rpc/story_pinned_stories_cache.go:155-180 | internal/store/memory/story.go:1428-1450 | internal/store/postgres/story.go:2555-2577 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 20+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 20+ corresponding lines) internal/rpc/messages_sticker_sets.go:63 — internal/rpc/messages_sticker_sets.go:63-83 | internal/rpc/messages_stickers_personal.go:62-81 | internal/rpc/messages_stickers_personal.go:83-106 | internal/rpc/messages_stickers_personal.go:108-127 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 18+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 18+ corresponding lines) cmd/telesrv-admin/botverification.go:253 — cmd/telesrv-admin/botverification.go:253-270 | cmd/telesrv-admin/botverification.go:272-289 | cmd/telesrv-admin/botverification.go:291-308 | cmd/telesrv-admin/verification.go:131-148 | cmd/telesrv-admin/verification.go:150-167 | cmd/telesrv-admin/verification.go:169-186 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 21+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 21+ corresponding lines) internal/app/users/service.go:528 — internal/app/users/service.go:528-551 | internal/app/users/service.go:555-578 | internal/app/users/service.go:598-618 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (7 members, 18+ corresponding lines) · ×1
  • Edited copies of one member (7 members, 18+ corresponding lines) internal/rpc/account_business.go:21 — internal/rpc/account_business.go:21-39 | internal/rpc/account_business.go:41-59 | internal/rpc/account_business.go:61-79 | internal/rpc/account_business.go:81-99 | internal/rpc/account_business.go:101-119 | internal/rpc/messages_quick_replies.go:54-71 | internal/rpc/messages_quick_replies.go:73-93 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 15+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 15+ corresponding lines) internal/app/dialogs/draft_read_model_cache.go:102 — internal/app/dialogs/draft_read_model_cache.go:102-116 | internal/app/dialogs/read_model_cache.go:305-319 | internal/app/dialogs/read_model_cache.go:321-335 | internal/rpc/story_sparse_projection_cache.go:202-216 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 14+ corresponding lines) internal/adminapi/botverification.go:290 — internal/adminapi/botverification.go:290-305 | internal/adminapi/botverification.go:307-320 | internal/adminapi/botverification.go:322-335 | internal/adminapi/verification.go:118-133 | internal/adminapi/verification.go:135-148 | internal/adminapi/verification.go:150-163 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 15+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 15+ corresponding lines) internal/rpc/bots.go:301 — internal/rpc/bots.go:301-317 | internal/rpc/bots.go:319-333 | internal/rpc/bots.go:427-442 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 15+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 15+ corresponding lines) internal/app/channels/bot_member_ids_cache.go:67 — internal/app/channels/bot_member_ids_cache.go:67-83 | internal/app/channels/media_count_cache.go:109-123 | internal/app/channels/participants_cache.go:102-119 | internal/app/channels/read_model_cache.go:69-87 | internal/app/channels/resolve_cache.go:71-85 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 11+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 11+ corresponding lines) internal/store/postgres/groupcall.go:100 — internal/store/postgres/groupcall.go:100-110 | internal/store/postgres/groupcall.go:220-231 | internal/store/postgres/groupcall.go:233-243 | internal/store/postgres/groupcall.go:245-255 | internal/store/postgres/groupcall.go:743-753 | internal/store/postgres/groupcall.go:755-765 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 13+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 13+ corresponding lines) internal/store/postgres/media_codec.go:34 — internal/store/postgres/media_codec.go:34-46 | internal/store/postgres/media_codec.go:62-77 | internal/store/postgres/media_codec.go:90-102 | internal/store/postgres/story.go:2499-2511 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 13+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 13+ corresponding lines) internal/app/messages/service.go:671 — internal/app/messages/service.go:671-683 | internal/app/messages/service.go:685-697 | internal/app/messages/service.go:699-711 | internal/app/messages/service.go:713-725 | internal/app/messages/service.go:727-739 | internal/app/messages/service.go:741-753 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 12+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 12+ corresponding lines) internal/app/account/business.go:28 — internal/app/account/business.go:28-39 | internal/app/account/business.go:41-52 | internal/app/account/business.go:54-65 | internal/app/account/business.go:67-78 | internal/app/account/business.go:80-91 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 5+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 5+ corresponding lines) internal/store/postgres/channel_polls.go:19 — internal/store/postgres/channel_polls.go:19-23 | internal/store/postgres/channel_polls.go:25-29 | internal/store/postgres/message_polls.go:18-22 | internal/store/postgres/message_polls.go:24-28 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 7+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 7+ corresponding lines) internal/app/account/phone_change.go:332 — internal/app/account/phone_change.go:332-338 | internal/app/chatlists/service.go:828-834 | internal/app/groupcalls/service.go:275-281 | internal/otpdelivery/delivery.go:125-131 | internal/store/code.go:96-102 | internal/store/postgres/channel_invite_exported.go:577-583 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (139 lines × 2) · ×1
  • Duplicated block (139 lines × 2) internal/store/postgres/update_event.go:338 — internal/store/postgres/update_event.go:338-476 | internal/store/postgres/update_event.go:547-685 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/update_event.go:338` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (118–119 lines × 2) · ×1
  • Duplicated block (118–119 lines × 2) internal/store/postgres/dialog.go:139 — internal/store/postgres/dialog.go:139-257 | internal/store/postgres/dialog.go:483-600 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/dialog.go:139` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/store/postgres/dialog.go:602` calls `dialogListHash` and `internal/store/postgres/dialog.go:258` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (46 lines × 2) · ×1
  • Duplicated block (46 lines × 2) internal/store/postgres/message_history.go:654 — internal/store/postgres/message_history.go:654-699 | internal/store/postgres/message_history.go:726-771 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/message_history.go:654` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (4–42 lines × 6) · ×1
  • Duplicated block (4–42 lines × 6) REDACTED:637 — REDACTED:637-655 | REDACTED:922-963 | REDACTED:982-1023 | REDACTED:1085-1126 | internal/store/postgres/media.go:1175-1178 | internal/store/postgres/media.go:1179-1182 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:637` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (31–34 lines × 2) · ×1
  • Duplicated block (31–34 lines × 2) REDACTED:122 — REDACTED:122-155 | REDACTED:178-208 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:122` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (34 lines × 2) · ×1
  • Duplicated block (34 lines × 2) internal/store/postgres/channel_helpers.go:287 — internal/store/postgres/channel_helpers.go:287-320 | internal/store/postgres/channel_message_history.go:447-480 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_helpers.go:287` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (33 lines × 2) · ×1
  • Duplicated block (33 lines × 2) internal/app/files/sticker_admin.go:149 — internal/app/files/sticker_admin.go:149-181 | internal/app/files/sticker_management.go:15-47 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/files/sticker_admin.go:149` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (31–32 lines × 2) · ×1
  • Duplicated block (31–32 lines × 2) internal/rpc/convert_users.go:12 — internal/rpc/convert_users.go:12-43 | internal/rpc/convert_users.go:46-76 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×1
  • Duplicated block (30 lines × 2) internal/rpc/messages_bot_no_state.go:120 — internal/rpc/messages_bot_no_state.go:120-149 | internal/rpc/messages_bot_no_state.go:201-230 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_bot_no_state.go:120` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×1
  • Duplicated block (28 lines × 2) internal/store/memory/groupcall.go:260 — internal/store/memory/groupcall.go:260-287 | internal/store/postgres/groupcall.go:460-487 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/groupcall.go:260` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (22–25 lines × 2) · ×1
  • Duplicated block (22–25 lines × 2) internal/mtprotoedge/session_manager.go:1636 — internal/mtprotoedge/session_manager.go:1636-1657 | internal/mtprotoedge/session_manager.go:1802-1826 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (18–23 lines × 2) · ×1
  • Duplicated block (18–23 lines × 2) internal/rpc/account.go:485 — internal/rpc/account.go:485-507 | internal/rpc/account.go:519-536 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (20–23 lines × 2) · ×1
  • Duplicated block (20–23 lines × 2) REDACTED:175 — REDACTED:175-194 | REDACTED:200-222 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:175` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (3–23 lines × 3) · ×1
  • Duplicated block (3–23 lines × 3) internal/app/dialogs/list_snapshot_cache.go:301 — internal/app/dialogs/list_snapshot_cache.go:301-303 | internal/store/memory/dialogs.go:992-1014 | internal/store/postgres/dialog.go:1259-1281 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/dialogs.go:992` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (18–22 lines × 2) · ×1
  • Duplicated block (18–22 lines × 2) REDACTED:53 — REDACTED:53-74 | cmd/bots/botdemo/main.go:75-92 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (16–22 lines × 2) · ×1
  • Duplicated block (16–22 lines × 2) internal/store/memory/channel_helpers.go:559 — internal/store/memory/channel_helpers.go:559-574 | internal/store/postgres/channel_helpers.go:878-899 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_helpers.go:559` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21 lines × 10) · ×1
  • Duplicated block (21 lines × 10) internal/store/postgres/message_forward.go:124 — internal/store/postgres/message_forward.go:124-144 | internal/store/postgres/message_history.go:194-214 | internal/store/postgres/message_history.go:670-690 | internal/store/postgres/message_history.go:742-762 | internal/store/postgres/message_history.go:802-822 | internal/store/postgres/message_history.go:874-894 | internal/store/postgres/message_history.go:946-966 | internal/store/postgres/saved_dialog.go:419-439 | internal/store/postgres/update_event.go:344-364 | internal/store/postgres/update_event.go:553-573 — before extracting anything, compare `internal/store/postgres/message_forward.go` and `internal/store/postgres/message_history.go` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/message_forward.go:124` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21 lines × 3) · ×1
  • Duplicated block (21 lines × 3) internal/app/channels/service.go:2526 — internal/app/channels/service.go:2526-2546 | internal/app/users/service.go:979-999 | internal/domain/collectible_username.go:301-321 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/channels/service.go:2526` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (20–21 lines × 3) · ×1
  • Duplicated block (20–21 lines × 3) internal/store/postgres/active_channel_ids_batch.go:164 — internal/store/postgres/active_channel_ids_batch.go:164-183 | internal/store/postgres/authkey_session_layer_batch.go:171-191 | internal/store/postgres/bootstrap_update_job_batch.go:182-202 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/active_channel_ids_batch.go:164` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (38–40 lines × 2) · ×1
  • Duplicated block (38–40 lines × 2) internal/store/memory/message_forward.go:61 — internal/store/memory/message_forward.go:61-98 | internal/store/postgres/message_forward.go:78-117 — `internal/store/memory/message_forward.go` and `internal/store/postgres/message_forward.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 51 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/message_forward.go:61` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (17–19 lines × 2) · ×1
  • Duplicated block (17–19 lines × 2) internal/mtprotoedge/same_port_mux.go:83 — internal/mtprotoedge/same_port_mux.go:83-101 | internal/mtprotoedge/server.go:865-881 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/mtprotoedge/same_port_mux.go:83` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (14–19 lines × 2) · ×1
  • Duplicated block (14–19 lines × 2) internal/mtprotoedge/session_manager.go:1889 — internal/mtprotoedge/session_manager.go:1889-1907 | internal/mtprotoedge/session_manager.go:1924-1937 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/mtprotoedge/session_manager.go:1889` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (16–19 lines × 2) · ×1
  • Duplicated block (16–19 lines × 2) internal/store/postgres/message_send_batch_sql.go:186 — internal/store/postgres/message_send_batch_sql.go:186-201 | internal/store/postgres/message_send_hotpath.go:127-145 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/message_send_batch_sql.go:186` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–18 lines × 2) · ×1
  • Duplicated block (17–18 lines × 2) internal/store/memory/channel_topics.go:243 — internal/store/memory/channel_topics.go:243-260 | internal/store/postgres/channel_topics.go:253-269 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/store/memory/channel_topics.go:242` calls `Unlock` and `internal/store/postgres/channel_topics.go:252` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (17 lines × 4) · ×1
  • Duplicated block (17 lines × 4) internal/store/postgres/account.go:355 — internal/store/postgres/account.go:355-371 | internal/store/postgres/account.go:451-467 | internal/store/postgres/account.go:495-511 | internal/store/postgres/account.go:540-556 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (15–17 lines × 2) · ×1
  • Duplicated block (15–17 lines × 2) internal/mtprotoedge/encrypted.go:713 — internal/mtprotoedge/encrypted.go:713-729 | internal/mtprotoedge/layer_rpc_execution.go:172-186 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/mtprotoedge/encrypted.go:713` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–17 lines × 2) · ×1
  • Duplicated block (13–17 lines × 2) internal/mtprotoedge/encrypted.go:811 — internal/mtprotoedge/encrypted.go:811-827 | internal/mtprotoedge/layer_rpc_execution.go:278-290 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/mtprotoedge/encrypted.go:811` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–16 lines × 3) · ×1
  • Duplicated block (14–16 lines × 3) internal/rpc/ephemeral.go:259 — internal/rpc/ephemeral.go:259-272 | internal/rpc/messages_reports.go:74-87 | internal/rpc/stories.go:596-611 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×1
  • Duplicated block (15–16 lines × 2) internal/store/postgres/channel_invite_import.go:146 — internal/store/postgres/channel_invite_import.go:146-160 | internal/store/postgres/channel_member_join.go:77-92 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (13–14 lines × 8) · ×1
  • Duplicated block (13–14 lines × 8) cmd/telesrv-admin/readstore.go:491 — cmd/telesrv-admin/readstore.go:491-503 | cmd/telesrv-admin/readstore.go:1081-1093 | cmd/telesrv-admin/readstore.go:1898-1910 | cmd/telesrv-admin/readstore.go:2135-2147 | cmd/telesrv-admin/readstore.go:2575-2588 | cmd/telesrv-admin/readstore.go:2682-2694 | cmd/telesrv-admin/readstore.go:3071-3083 | cmd/telesrv-admin/readstore.go:3412-3424 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/telesrv-admin/readstore.go:491` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14 lines × 6) · ×1
  • Duplicated block (14 lines × 6) internal/store/postgres/message_forward.go:161 — internal/store/postgres/message_forward.go:161-174 | internal/store/postgres/message_history.go:705-718 | internal/store/postgres/message_history.go:777-790 | internal/store/postgres/message_history.go:849-862 | internal/store/postgres/message_history.go:921-934 | internal/store/postgres/message_history.go:993-1006 — before extracting anything, compare `internal/store/postgres/message_forward.go` and `internal/store/postgres/message_history.go` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (14 lines × 4) · ×1
  • Duplicated block (14 lines × 4) internal/rpc/chatlists.go:55 — internal/rpc/chatlists.go:55-68 | internal/rpc/chatlists.go:206-219 | internal/rpc/chatlists.go:248-261 | internal/rpc/chatlists.go:299-312 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (17–20 lines × 2) · ×1
  • Duplicated block (17–20 lines × 2) internal/app/auth/service.go:625 — internal/app/auth/service.go:625-644 | internal/app/auth/service.go:744-760 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/auth/service.go:625` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/app/auth/service.go:743` calls `TrimSpace` and `internal/app/auth/service.go:624` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11–14 lines × 2) · ×1
  • Duplicated block (11–14 lines × 2) internal/rpc/channels_members.go:498 — internal/rpc/channels_members.go:498-508 | internal/rpc/channels_members.go:538-551 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/channels_members.go:498` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (12–14 lines × 2) · ×1
  • Duplicated block (12–14 lines × 2) internal/store/postgres/message_send.go:307 — internal/store/postgres/message_send.go:307-318 | internal/store/postgres/message_send.go:397-410 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/message_send.go:307` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (13 lines × 7) · ×1
  • Duplicated block (13 lines × 7) internal/store/postgres/message_forward.go:158 — internal/store/postgres/message_forward.go:158-170 | internal/store/postgres/message_history.go:702-714 | internal/store/postgres/message_history.go:774-786 | internal/store/postgres/message_history.go:846-858 | internal/store/postgres/message_history.go:918-930 | internal/store/postgres/message_history.go:990-1002 | internal/store/postgres/saved_dialog.go:460-472 — before extracting anything, compare `internal/store/postgres/message_forward.go` and `internal/store/postgres/message_history.go` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (13 lines × 6) · ×1
  • Duplicated block (13 lines × 6) internal/store/postgres/channel_settings.go:585 — internal/store/postgres/channel_settings.go:585-597 | internal/store/postgres/channel_settings.go:722-734 | internal/store/postgres/channel_settings.go:771-783 | internal/store/postgres/channel_settings.go:905-917 | internal/store/postgres/channel_settings.go:941-953 | internal/store/postgres/channel_settings.go:989-1001 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (11–13 lines × 3) · ×1
  • Duplicated block (11–13 lines × 3) internal/rpc/messages_edit.go:138 — internal/rpc/messages_edit.go:138-150 | internal/rpc/messages_edit_geolive.go:85-95 | internal/rpc/messages_todos.go:234-244 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_edit.go:138` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/rpc/messages_edit.go:137` calls `Now`, `Unix` and `internal/rpc/messages_edit_geolive.go:84` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10–13 lines × 2) · ×1
  • Duplicated block (10–13 lines × 2) internal/app/account/service.go:927 — internal/app/account/service.go:927-939 | internal/app/account/service.go:994-1003 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (3–13 lines × 4) · ×1
  • Duplicated block (3–13 lines × 4) internal/store/memory/message_reactions.go:237 — internal/store/memory/message_reactions.go:237-249 | internal/store/memory/message_reactions.go:259-261 | internal/store/postgres/message_reactions.go:428-440 | internal/store/postgres/message_reactions.go:450-452 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/message_reactions.go:237` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×1
  • Duplicated block (12–13 lines × 2) internal/store/postgres/dispatch_outbox.go:131 — internal/store/postgres/dispatch_outbox.go:131-142 | internal/store/postgres/dispatch_outbox.go:147-159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12 lines × 7) · ×1
  • Duplicated block (12 lines × 7) REDACTED:589 — REDACTED:589-600 | internal/app/privacy/cache.go:257-268 | internal/app/privacy/service.go:476-487 | internal/app/userprojection/contact_cache.go:1141-1152 | internal/app/userprojection/projection.go:279-290 | internal/store/memory/channel_core.go:300-311 | internal/store/postgres/channel_core.go:647-658 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 7 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 7 times. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:589` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (8–12 lines × 5) · ×1
  • Duplicated block (8–12 lines × 5) cmd/telesrv-admin/botverification.go:131 — cmd/telesrv-admin/botverification.go:131-141 | cmd/telesrv-admin/botverification.go:179-190 | cmd/telesrv-admin/donations.go:86-93 | REDACTED:2702-2712 | cmd/telesrv-admin/verification.go:59-70 — there are 5 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/telesrv-admin/botverification.go:131` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (10–12 lines × 3) · ×1
  • Duplicated block (10–12 lines × 3) internal/app/privacy/service.go:277 — internal/app/privacy/service.go:277-288 | internal/app/privacy/service.go:451-462 | internal/app/privacy/service_sparse.go:145-154 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/privacy/service.go:277` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×1
  • Duplicated block (10–12 lines × 2) internal/app/auth/service.go:428 — internal/app/auth/service.go:428-439 | internal/app/auth/service.go:451-460 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/auth/service.go:428` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (8–12 lines × 2) · ×1
  • Duplicated block (8–12 lines × 2) internal/mtprotoedge/encrypted.go:670 — internal/mtprotoedge/encrypted.go:670-681 | internal/mtprotoedge/layer_rpc_execution.go:137-144 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/mtprotoedge/encrypted.go:670` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (20–21 lines × 2) · ×1
  • Duplicated block (20–21 lines × 2) internal/store/memory/moderation.go:466 — internal/store/memory/moderation.go:466-486 | internal/store/memory/moderation.go:541-560 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: `internal/store/memory/moderation.go:541` is reached only past a guard at line 527 that tests `item.ID` and leaves the function early, and `internal/store/memory/moderation.go:466` reads `item.ID` with no such check. What separates these copies is not which lines they run but which PRECONDITION they enforce, so one of them is operating on state the other one refuses. Decide which is intended BEFORE unifying them — extract the shared part and whichever copy is missing the check keeps running unchecked, and if the guard is the correct behaviour then that hole is already live.
D4 · Code Duplication · Duplicated block (11 lines × 10) · ×1
  • Duplicated block (11 lines × 10) REDACTED:588 — REDACTED:588-598 | internal/app/files/seed.go:1098-1108 | internal/app/privacy/cache.go:256-266 | internal/app/privacy/service.go:475-485 | internal/app/userprojection/contact_cache.go:1140-1150 | internal/app/userprojection/projection.go:278-288 | internal/store/contact_reverse_batch.go:302-312 | internal/store/memory/channel_core.go:299-309 | internal/store/postgres/channel_core.go:646-656 | internal/store/postgres/community.go:1387-1397 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 10 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 10 times. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/store/contact_reverse_batch.go:313` calls `Slice` and `REDACTED:599` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11 lines × 9) · ×1
  • Duplicated block (11 lines × 9) internal/store/postgres/message_forward.go:157 — internal/store/postgres/message_forward.go:157-167 | internal/store/postgres/message_history.go:701-711 | internal/store/postgres/message_history.go:773-783 | internal/store/postgres/message_history.go:845-855 | internal/store/postgres/message_history.go:917-927 | internal/store/postgres/message_history.go:989-999 | internal/store/postgres/saved_dialog.go:459-469 | internal/store/postgres/update_event.go:452-462 | internal/store/postgres/update_event.go:661-671 — before extracting anything, compare `internal/store/postgres/message_forward.go` and `internal/store/postgres/message_history.go` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (11 lines × 7) · ×1
  • Duplicated block (11 lines × 7) internal/app/rating/service.go:201 — internal/app/rating/service.go:201-211 | internal/rpc/account.go:2208-2218 | internal/rpc/channels_legacy_chat.go:121-131 | internal/store/postgres/bot_verification.go:451-461 | internal/store/postgres/dispatch_outbox.go:245-255 | internal/store/postgres/message_send.go:959-969 | internal/store/postgres/user_lane_actor.go:73-83 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 7 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 7 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/rating/service.go:201` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/rpc/account.go:2207` calls `uniquePositiveDocumentIDs` and `internal/store/postgres/message_send.go:958` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11 lines × 6) · ×1
  • Duplicated block (11 lines × 6) internal/mtprotoedge/session_manager.go:1620 — internal/mtprotoedge/session_manager.go:1620-1630 | internal/mtprotoedge/session_manager.go:1659-1669 | internal/mtprotoedge/session_manager.go:1741-1751 | internal/mtprotoedge/session_manager.go:1764-1774 | internal/mtprotoedge/session_manager.go:1782-1792 | internal/mtprotoedge/session_manager.go:1828-1838 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9–11 lines × 3) · ×1
  • Duplicated block (9–11 lines × 3) internal/rpc/messages_forward.go:73 — internal/rpc/messages_forward.go:73-81 | internal/rpc/messages_send.go:431-441 | internal/rpc/send_media.go:298-306 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_forward.go:73` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10 lines × 11) · ×1
  • Duplicated block (10 lines × 11) internal/admin/service.go:1412 — internal/admin/service.go:1412-1421 | internal/app/channels/service.go:2452-2461 | internal/app/peerview/cache.go:153-162 | internal/app/userprojection/durable_user_facts.go:131-140 | internal/domain/media.go:1038-1047 | internal/domain/media.go:1055-1064 | internal/rpc/channels_stubs.go:413-422 | internal/rpc/channels_stubs.go:457-466 | internal/rpc/peer_projection_cache.go:267-276 | REDACTED:761-770 | internal/store/postgres/media.go:657-666 — there are 11 copies across 9 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 11 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (10 lines × 10) · ×1
  • Duplicated block (10 lines × 10) REDACTED:587 — REDACTED:587-596 | internal/app/dialogs/service.go:737-746 | internal/app/files/seed.go:1097-1106 | internal/app/privacy/cache.go:255-264 | internal/app/privacy/service.go:474-483 | internal/app/userprojection/contact_cache.go:1139-1148 | internal/app/userprojection/projection.go:277-286 | internal/store/contact_reverse_batch.go:301-310 | internal/store/memory/channel_core.go:298-307 | internal/store/postgres/channel_core.go:645-654 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 10 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 10 times. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:587` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `int64` to `userID` in one and `targetID` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/store/contact_reverse_batch.go:313` calls `Slice` and `REDACTED:599` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–10 lines × 4) · ×1
  • Duplicated block (8–10 lines × 4) internal/store/storetest/groupcall.go:65 — internal/store/storetest/groupcall.go:65-72 | internal/store/storetest/groupcall.go:389-396 | internal/store/storetest/groupcall.go:437-444 | internal/store/storetest/groupcall.go:486-495 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (12–14 lines × 3) · ×1
  • Duplicated block (12–14 lines × 3) internal/rpc/botapi_gateway.go:205 — internal/rpc/botapi_gateway.go:205-218 | internal/rpc/botapi_gateway.go:271-282 | internal/rpc/botapi_gateway.go:322-335 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/botapi_gateway.go:205` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7–10 lines × 2) · ×1
  • Duplicated block (7–10 lines × 2) internal/store/postgres/message_edit.go:269 — internal/store/postgres/message_edit.go:269-278 | REDACTED:846-852 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/message_edit.go:269` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9 lines × 20) · ×1
  • Duplicated block (9 lines × 20) internal/admin/service.go:1411 — internal/admin/service.go:1411-1419 | internal/app/channels/service.go:2451-2459 | internal/app/dialogs/read_model_cache.go:307-315 | internal/app/peerview/cache.go:152-160 | internal/app/privacy/service.go:194-202 | internal/app/userprojection/durable_user_facts.go:130-138 | internal/app/users/service.go:947-955 | internal/domain/media.go:1037-1045 | internal/domain/media.go:1054-1062 | internal/rpc/channels_stubs.go:412-420 | internal/rpc/channels_stubs.go:456-464 | internal/rpc/messages_sticker_sets.go:216-224 | internal/rpc/peer_projection_cache.go:266-274 | internal/store/memory/channel_core.go:213-221 | internal/store/memory/channel_members.go:891-899 | internal/store/memory/channel_members.go:962-970 | internal/store/memory/users.go:57-65 | REDACTED:760-768 | REDACTED:1732-1740 | internal/store/postgres/media.go:656-664 — there are 20 copies across 16 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 20 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/admin/service.go:1411` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `int64` to `userID` in one and `s *Service) invalidateDialogListHashes(userID` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/app/userprojection/durable_user_facts.go:128` calls `uniqueDurableFactUserIDs` and `internal/app/privacy/service.go:192` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9 lines × 18) · ×1
  • Duplicated block (9 lines × 18) internal/admin/service.go:1410 — internal/admin/service.go:1410-1418 | internal/app/channels/service.go:2450-2458 | internal/app/peerview/cache.go:151-159 | internal/app/privacy/service.go:193-201 | internal/app/userprojection/durable_user_facts.go:129-137 | internal/app/users/service.go:210-218 | internal/app/users/service.go:946-954 | internal/domain/media.go:1036-1044 | internal/domain/media.go:1053-1061 | internal/rpc/channels_stubs.go:411-419 | internal/rpc/channels_stubs.go:455-463 | internal/rpc/messages_sticker_sets.go:215-223 | internal/rpc/peer_projection_cache.go:265-273 | internal/store/memory/channel_members.go:890-898 | internal/store/memory/channel_members.go:961-969 | REDACTED:759-767 | REDACTED:1731-1739 | internal/store/postgres/media.go:655-663 — there are 18 copies across 13 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 18 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/admin/service.go:1410` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `int64` to `userID` in one and `c *BatchCache) PrimeExpected(viewerUserID` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/admin/service.go:1409` calls `uniqueFreezeUserIDs` and `internal/app/privacy/service.go:192` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9 lines × 15) · ×1
  • Duplicated block (9 lines × 15) internal/store/memory/channel_members.go:756 — internal/store/memory/channel_members.go:756-764 | internal/store/memory/channel_members.go:775-783 | internal/store/memory/channel_members.go:794-802 | internal/store/memory/channel_message_settings.go:11-19 | internal/store/memory/channel_reactions.go:14-22 | internal/store/memory/channel_settings.go:421-429 | internal/store/memory/channel_settings.go:451-459 | internal/store/memory/channel_settings.go:481-489 | internal/store/memory/channel_settings.go:500-508 | internal/store/memory/channel_settings.go:530-538 | internal/store/memory/channel_settings.go:560-568 | internal/store/memory/channel_settings.go:579-587 | internal/store/memory/channel_settings.go:598-606 | internal/store/memory/channel_settings.go:621-629 | internal/store/memory/channel_topics.go:13-21 — there are 15 copies across 5 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 15 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_members.go:756` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (9 lines × 5) · ×1
  • Duplicated block (9 lines × 5) internal/store/postgres/channel_helpers.go:356 — internal/store/postgres/channel_helpers.go:356-364 | internal/store/postgres/channel_invite_requests.go:201-209 | internal/store/postgres/channel_member_join.go:308-316 | internal/store/postgres/channel_member_list.go:204-212 | internal/store/postgres/channel_settings.go:1095-1103 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Note first that the copies are not typed on the same thing: the declarations holding them bind `int64` to `afterChannelID` in one and `channelID` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (4–9 lines × 3) · ×1
  • Duplicated block (4–9 lines × 3) internal/app/messages/service.go:472 — internal/app/messages/service.go:472-475 | internal/app/messages/service.go:483-491 | internal/app/messages/service.go:497-505 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/messages/service.go:472` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7–8 lines × 7) · ×1
  • Duplicated block (7–8 lines × 7) internal/admin/service.go:1906 — internal/admin/service.go:1906-1913 | internal/admin/service.go:1946-1953 | internal/admin/service.go:1983-1989 | internal/admin/service.go:2016-2022 | internal/admin/service.go:2053-2060 | internal/admin/service.go:2200-2206 | internal/admin/service.go:2246-2252 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/admin/service.go:1906` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/admin/service.go:2013` calls `TrimSpace`, `TrimPrefix` and `internal/admin/service.go:1904` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (3–8 lines × 3) · ×1
  • Duplicated block (3–8 lines × 3) internal/app/channels/service.go:2026 — internal/app/channels/service.go:2026-2028 | internal/app/channels/service.go:2113-2120 | internal/app/channels/service.go:2144-2151 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/channels/service.go:2026` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7 lines × 10) · ×1
  • Duplicated block (7 lines × 10) internal/admin/service.go:1563 — internal/admin/service.go:1563-1569 | internal/admin/service.go:1906-1912 | internal/admin/service.go:1946-1952 | internal/admin/service.go:1983-1989 | internal/admin/service.go:2016-2022 | internal/admin/service.go:2053-2059 | internal/admin/service.go:2099-2105 | internal/admin/service.go:2145-2151 | internal/admin/service.go:2200-2206 | internal/admin/service.go:2246-2252 — all 10 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/admin/service.go:2013` calls `TrimSpace`, `TrimPrefix` and `internal/admin/service.go:1561` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (4–7 lines × 3) · ×1
  • Duplicated block (4–7 lines × 3) internal/store/memory/channel_message_delete.go:123 — internal/store/memory/channel_message_delete.go:123-130 | internal/store/memory/channel_message_delete.go:168-174 | internal/store/memory/channel_topics.go:385-388 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/channel_message_delete.go:123` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (2–7 lines × 3) · ×1
  • Duplicated block (2–7 lines × 3) internal/app/dialogs/list_snapshot_cache.go:296 — internal/app/dialogs/list_snapshot_cache.go:296-297 | internal/store/memory/dialogs.go:979-985 | internal/store/postgres/dialog.go:1246-1252 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/memory/dialogs.go:979` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/store/memory/dialogs.go:985` calls `PutUint64` and `internal/app/dialogs/list_snapshot_cache.go:297` does not — after which the two agree again for 5 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6 lines × 7) · ×1
  • Duplicated block (6 lines × 7) internal/rpc/messages_send.go:1142 — internal/rpc/messages_send.go:1142-1147 | internal/rpc/messages_send.go:1178-1183 | internal/store/memory/groupcall.go:512-517 | internal/store/memory/message_delete.go:87-92 | internal/store/memory/message_read.go:61-66 | internal/store/postgres/message_delete.go:216-221 | internal/store/postgres/message_read.go:197-202 — there are 7 copies across 6 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 7 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/messages_send.go:1142` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×1
  • Duplicated block (6 lines × 5) internal/app/usernames/service.go:363 — internal/app/usernames/service.go:363-368 | internal/app/usernames/service.go:387-392 | internal/store/postgres/collectible_username.go:187-192 | internal/store/postgres/collectible_username.go:299-304 | internal/store/postgres/collectible_username.go:390-395 — there are 5 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (5–6 lines × 2) · ×1
  • Duplicated block (5–6 lines × 2) internal/app/dialogs/shared_list_snapshot.go:173 — internal/app/dialogs/shared_list_snapshot.go:173-178 | internal/store/memory/story.go:590-594 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/dialogs/shared_list_snapshot.go:173` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×1
  • Duplicated block (6–7 lines × 2) internal/rpc/stories.go:1065 — internal/rpc/stories.go:1065-1071 | internal/store/memory/story.go:468-473 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8 lines × 10) · ×1
  • Duplicated block (8 lines × 10) internal/store/postgres/message_forward.go:154 — internal/store/postgres/message_forward.go:154-161 | internal/store/postgres/message_history.go:698-705 | internal/store/postgres/message_history.go:770-777 | internal/store/postgres/message_history.go:842-849 | internal/store/postgres/message_history.go:914-921 | internal/store/postgres/message_history.go:986-993 | internal/store/postgres/message_send.go:1057-1064 | internal/store/postgres/saved_dialog.go:456-463 | internal/store/postgres/update_event.go:449-456 | internal/store/postgres/update_event.go:658-665 — before extracting anything, compare `internal/store/postgres/message_forward.go` and `internal/store/postgres/message_history.go` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (3–5 lines × 3) · ×1
  • Duplicated block (3–5 lines × 3) internal/rpc/phone_group_call_edit.go:117 — internal/rpc/phone_group_call_edit.go:117-121 | internal/rpc/phone_group_call_edit.go:205-209 | internal/rpc/phone_group_call_presentation.go:139-141 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/rpc/phone_group_call_edit.go:117` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/rpc/phone_group_call_edit.go:115` calls `tgEmptyUpdates`, `Now`, `Unix` and `internal/rpc/phone_group_call_edit.go:204` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12 lines × 5) · ×1
  • Duplicated block (12 lines × 5) internal/rpc/channel_fanout_dispatcher.go:1109 — internal/rpc/channel_fanout_dispatcher.go:1109-1120 | internal/rpc/login_token.go:214-225 | internal/store/memory/channel_helpers.go:721-732 | internal/store/memory/channel_message_send.go:329-340 | internal/store/postgres/channel_message_send.go:376-387 — `internal/store/memory/channel_message_send.go` and `internal/store/postgres/channel_message_send.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 43 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (7 lines × 7) · ×1
  • Duplicated block (7 lines × 7) internal/app/contacts/read_model_cache.go:115 — internal/app/contacts/read_model_cache.go:115-121 | internal/app/dialogs/read_model_cache.go:418-424 | internal/app/dialogs/read_model_cache.go:442-448 | internal/app/dialogs/read_model_cache.go:465-471 | internal/app/dialogs/read_model_cache.go:540-546 | internal/app/dialogs/read_model_cache.go:558-564 | internal/app/userprojection/contact_cache.go:1154-1160 — there are 7 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 7 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (6 lines × 6) · ×1
  • Duplicated block (6 lines × 6) internal/rpc/channel_full_bot_cache.go:66 — internal/rpc/channel_full_bot_cache.go:66-71 | internal/rpc/rpc_projection_cache.go:50-55 | internal/rpc/rpc_projection_cache.go:57-62 | internal/rpc/rpc_projection_cache.go:102-107 | internal/rpc/rpc_projection_cache.go:161-166 | internal/rpc/rpc_projection_cache.go:168-173 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. Note first that the copies are not typed on the same thing: the declarations holding them bind `int64` to `c *channelFullBotInfoCache) DeleteChannel(channelID` in one and `c *userFullProjectionCache) DeleteViewer(viewerUserID` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (5 lines × 6) · ×1
  • Duplicated block (5 lines × 6) internal/rpc/channels_members.go:79 — internal/rpc/channels_members.go:79-83 | internal/rpc/channels_members.go:85-89 | internal/rpc/channels_members.go:91-95 | internal/rpc/channels_settings.go:60-64 | internal/rpc/channels_settings.go:66-70 | internal/rpc/channels_settings.go:241-245 — there are 6 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (8 lines × 13) · ×1
  • Duplicated block (8 lines × 13) internal/store/postgres/channel_invite_members.go:22 — internal/store/postgres/channel_invite_members.go:22-29 | internal/store/postgres/channel_member_join.go:171-178 | internal/store/postgres/channel_polls.go:52-59 | internal/store/postgres/channel_settings.go:585-592 | internal/store/postgres/channel_settings.go:638-645 | internal/store/postgres/channel_settings.go:722-729 | internal/store/postgres/channel_settings.go:771-778 | internal/store/postgres/channel_settings.go:807-814 | internal/store/postgres/channel_settings.go:856-863 | internal/store/postgres/channel_settings.go:905-912 | internal/store/postgres/channel_settings.go:941-948 | internal/store/postgres/channel_settings.go:989-996 | internal/store/postgres/channel_topics.go:26-33 — there are 13 copies across 5 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 13 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_invite_members.go:22` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (8 lines × 20) · ×1
  • Duplicated block (8 lines × 20) internal/store/postgres/channel_helpers.go:84 — internal/store/postgres/channel_helpers.go:84-91 | internal/store/postgres/channel_invite_exported.go:30-37 | internal/store/postgres/channel_member_admin.go:25-32 | internal/store/postgres/channel_member_admin.go:180-187 | internal/store/postgres/channel_member_admin.go:320-327 | internal/store/postgres/channel_member_admin.go:384-391 | internal/store/postgres/channel_member_join_requests.go:138-145 | internal/store/postgres/channel_message_delete.go:31-38 | internal/store/postgres/channel_message_delete.go:211-218 | internal/store/postgres/channel_message_delete.go:384-391 | internal/store/postgres/channel_message_edit.go:432-439 | internal/store/postgres/channel_message_edit.go:528-535 | internal/store/postgres/channel_reaction_messages.go:198-205 | internal/store/postgres/channel_reaction_messages.go:270-277 | internal/store/postgres/channel_read.go:152-159 | internal/store/postgres/channel_settings.go:31-38 | internal/store/postgres/channel_settings.go:100-107 | internal/store/postgres/channel_settings.go:176-183 | internal/store/postgres/channel_settings.go:228-235 | internal/store/postgres/channel_topics.go:401-408 — there are 20 copies across 10 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 20 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_helpers.go:84` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (8 lines × 8) · ×1
  • Duplicated block (8 lines × 8) internal/store/postgres/channel_settings.go:166 — internal/store/postgres/channel_settings.go:166-173 | internal/store/postgres/channel_settings.go:575-582 | internal/store/postgres/channel_settings.go:712-719 | internal/store/postgres/channel_settings.go:761-768 | internal/store/postgres/channel_settings.go:797-804 | internal/store/postgres/channel_settings.go:895-902 | internal/store/postgres/channel_settings.go:931-938 | internal/store/postgres/channel_topics.go:16-23 — there are 8 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 8 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_settings.go:166` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 6) · ×1
  • Duplicated block (8 lines × 6) cmd/telesrv-admin/readstore.go:566 — cmd/telesrv-admin/readstore.go:566-573 | internal/store/postgres/account.go:886-893 | internal/store/postgres/account_rating.go:452-459 | internal/store/postgres/account_rating.go:496-503 | internal/store/postgres/channel_read.go:894-901 | internal/store/postgres/channel_update_retention.go:110-117 — there are 6 copies across 5 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/telesrv-admin/readstore.go:566` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `int64` to `userID` in one and `olderThanUnix` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. Check import visibility before settling on that home: `internal/store/postgres/account.go`, `internal/store/postgres/account_rating.go`, `internal/store/postgres/channel_read.go` sit under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
D4 · Code Duplication · Duplicated block (2–5 lines × 3) · ×1
  • Duplicated block (2–5 lines × 3) internal/store/postgres/channel_member_admin.go:89 — internal/store/postgres/channel_member_admin.go:89-93 | internal/store/postgres/channel_member_admin.go:157-161 | internal/store/postgres/channel_member_admin.go:364-365 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/store/postgres/channel_member_admin.go:89` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
P1 · CI/CD gates · No CI pipeline · ×1
  • No CI pipeline — No CI workflow found (.github/workflows, azure-pipelines.yml, .gitlab-ci.yml, …) — changes aren't gated by an automated build/test.
P5 · DR & Backup · No DR/backup evidence · ×1
  • No DR/backup evidence — A persistence guard (data volume / purge-protection) was found, but no backup, geo-recovery or RTO/RPO controls were evidenced — a volume that survives a container recreate is not a tested restore from catastrophic loss.
X14 · Bypassable address classification · IP classification is bypassable through an IPv4-in-IPv6 embedding · ×1
  • IP classification is bypassable through an IPv4-in-IPv6 embedding internal/domain/verification.go:530 — This function unwraps IPv4-MAPPED IPv6 (`To4`, line 508) and then rejects `192.168.0.0/16` on its IPv4 path — but the IPv6 decision at line 530 classifies the address as written, and IPv4 reaches IPv6 through three MORE embeddings this function never mentions: IPv4-compatible (`::a.b.c.d`), 6to4 (`2002::/16`) and NAT64 (`64:ff9b::/96`). So `::192.168.0.1`, `2002:c0a8:0001::` and `64:ff9b::192.168.0.0` all name a host inside `192.168.0.0/16` — the range this same function declares non-public — and all reach the IPv6 decision un-unwrapped, taking the opposite verdict. Unwrap every embedding to its IPv4 form before classifying, or reject any IPv6 address carrying an embedded IPv4 outright.
Minor — 486 finding(s)
D34 · Knowledge Freshness · Orphaned file · ×344
  • Orphaned file internal/rpc/ephemeral.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/app/files/webpage.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/store/memory/channel_read.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/rpc/messages_forum.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/store/postgres/saved_dialog.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/store/postgres/channel_boosts.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/mtprotoedge/conn_layer_profile.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/app/usernames/service.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/app/files/premium_promo_seed.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/app/phone/service.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/rpc/account_business.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/store/postgres/bot.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/store/memory/password.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/app/account/business.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/domain/moderation.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/domain/telegram_login.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/app/moderation/actions.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/app/dialogs/read_model_cache.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file REDACTED:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/store/postgres/message_read.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/store/postgres/langpack.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/domain/story.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/domain/moderation_case.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/store/memory/message_send.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file internal/store/postgres/moderation.go:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • + 319 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×40
  • Duplicated predicate internal/app/files/external_media.go:81 — `!allowPrivate && isBlockedExternalIP(ip)` appears character-identically in 2 files — internal/app/files/external_media.go, internal/app/files/webpage.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/store/memory/community.go:779 — `!alreadyKicked || len(result.ChannelBans) > 0 || len(result.RemovedLinks) > 0` appears character-identically in 2 files — internal/store/memory/community.go, internal/store/postgres/community.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/store/memory/channel_topics.go:384 — `!canManageForumTopic(channel, member, topic, req.UserID, 0) && !canDeleteAnyChannelMessage(member)` appears character-identically in 2 files — internal/store/memory/channel_topics.go, internal/store/postgres/channel_topics.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/store/memory/channel_core.go:34 — `!channel.Broadcast && !channel.Megagroup` appears character-identically in 2 files — internal/store/memory/channel_core.go, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/store/memory/channel_message_send.go:412 — `!channel.Broadcast || !channel.Signatures` appears character-identically in 2 files — internal/store/memory/channel_message_send.go, internal/store/postgres/channel_message_send.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/store/memory/channel_topics.go:87 — `!channel.Forum || channel.Broadcast || !channel.Megagroup` appears character-identically in 2 files — internal/store/memory/channel_topics.go, internal/store/postgres/channel_topics.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/store/memory/channel_members.go:765 — `!channel.Megagroup || !canBanChannelUsers(member)` appears character-identically in 2 files — internal/store/memory/channel_members.go, internal/store/postgres/channel_member_join_requests.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/store/memory/channel_settings.go:509 — `!channel.Megagroup || !canChangeChannelInfo(member)` appears character-identically in 2 files — internal/store/memory/channel_settings.go, internal/store/postgres/channel_settings.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/store/memory/channel_members.go:784 — `!channel.Megagroup || !canExportChannelInvite(member)` appears character-identically in 2 files — internal/store/memory/channel_members.go, internal/store/postgres/channel_member_join_requests.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/store/memory/channel_read.go:377 — `!channel.Megagroup || channel.ParticipantsHidden || channel.ParticipantsCount > domain.MaxChannelReadParticipants` appears character-identically in 2 files — internal/store/memory/channel_read.go, internal/store/postgres/channel_read.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/store/memory/channel_invites.go:66 — `!channel.PreHistoryHidden && member.AvailableMinID > 0 && member.HistoryClearAnchorID == 0` appears character-identically in 2 files — internal/store/memory/channel_invites.go, internal/store/memory/channel_members.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/rpc/messages_compat.go:181 — `!found || target.ID == 0 || target.ID == userID` appears character-identically in 2 files — internal/rpc/messages_compat.go, internal/rpc/photos.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/domain/bot_verification.go:266 — `!from.Valid() || !to.Valid() || from == to` appears character-identically in 2 files — internal/domain/bot_verification.go, internal/domain/verification.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/domain/botapi_update.go:117 — `!m.ExpiresAt.IsZero() && !now.Before(m.ExpiresAt)` appears character-identically in 2 files — internal/domain/botapi_update.go, internal/domain/ephemeral.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/store/memory/channel_dialogs.go:221 — `!ok || channel.Deleted || (!channel.Broadcast && !channel.Megagroup)` appears character-identically in 2 files — internal/store/memory/channel_dialogs.go, internal/store/memory/channel_members.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/rpc/account.go:628 — `!ok || in.ID == 0 || r.deps.Files == nil` appears character-identically in 2 files — internal/rpc/account.go, internal/rpc/messages_stickers_personal.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/store/memory/channel_dialogs.go:265 — `!ok || member.Status != domain.ChannelMemberActive` appears character-identically in 3 files — internal/store/memory/channel_dialogs.go, internal/store/memory/channel_helpers.go, internal/store/memory/channel_members.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/store/memory/channel_reactions.go:695 — `!ok || member.Status != domain.ChannelMemberActive || member.BannedRights.ViewMessages` appears character-identically in 2 files — internal/store/memory/channel_reactions.go, internal/store/memory/channel_read.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/store/memory/channel_monoforum.go:202 — `!ok || mono.Deleted || !mono.Monoforum || mono.LinkedMonoforumID == 0` appears character-identically in 2 files — internal/store/memory/channel_monoforum.go, internal/store/memory/channel_suggested_post.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/store/memory/channel_message_history.go:485 — `!ok || msg.Deleted || msg.ID <= member.AvailableMinID` appears character-identically in 3 files — internal/store/memory/channel_message_history.go, internal/store/memory/channel_reactions.go, internal/store/memory/channel_read.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/rpc/channels_legacy_chat.go:435 — `!ok || participant.Type != domain.PeerTypeUser || participant.ID == 0` appears character-identically in 2 files — internal/rpc/channels_legacy_chat.go, internal/rpc/channels_members.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/rpc/channels_legacy_chat.go:474 — `!ok || peer.Type != domain.PeerTypeUser || peer.ID == 0` appears character-identically in 2 files — internal/rpc/channels_legacy_chat.go, internal/rpc/channels_members.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/store/memory/message_no_forwards.go:47 — `!ok || req.RequestMsgID < 0 || req.RequestMsgID > domain.MaxMessageBoxID` appears character-identically in 2 files — internal/store/memory/message_no_forwards.go, internal/store/postgres/message_no_forwards.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/store/memory/channel_updates.go:23 — `!preview && member.AvailableMinPts > req.Pts` appears character-identically in 2 files — internal/store/memory/channel_updates.go, internal/store/postgres/channel_updates.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/rpc/channels_stubs.go:619 — `!ref.CheckAccessHash || r.deps.Channels == nil` appears character-identically in 2 files — internal/rpc/channels_stubs.go, internal/rpc/messages_helpers.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • + 15 more in this group — see findings.md.
AX6 · Interface segregation · Fat interface · ×34
  • Fat interface: BotVerificationService (16 methods) internal/admin/botverification.go:44 — `BotVerificationService` declares 16 methods: `Icons`, `UpsertIcon`, `SetIconActive`, `Verifiers`, `VerifierSettings`, `GrantVerifier`, `SetVerifierEnabled`, `RevokeVerifier`, `Marks`, `RevokeMark`, `Requests`, `Request`, `RequestCounts`, `Approve`, `Reject`, `RevokeRequest`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: Service (119 methods) internal/adminapi/server.go:42 — `Service` declares 119 methods: `AccountAvatar`, `SetAccountFrozen`, `GrantPremium`, `GrantStars`, `UpsertPremiumPlan`, `RefundPremium`, `UpdateDonationChain`, `CreateDonationChain`, `DeleteDonationChain`, `SweepDonationChain`, `UpsertDonationToken`, `DeleteDonationToken`, `DonationChainBalance`, `DonationPricePreview`, `DonationStarPriceMicros`, `SetVerified`, `SetUserFlags`, `SetChannelVerified`, `SetChannelFlags`, `CreateBot`, `CreateBroadcast`, `DeleteBot`, `ExportBotToken`, `SetSupport`, `SetUsername`, `SetProfile`, `SetPhone`, `SetLoginEmail`, `SetAccountAvatar`, `SetAccountAvatarVideo`, `ChannelAvatar`, `SetChannelAvatar`, `SetUserColor`, `SetUserEmojiStatus`, `SetChannelSettings`, `SetChannelUsername`, `SetChannelColor`, `SetChannelEmojiStatus`, `RevokeSessions`, `DeletePrivateMessages`, and 79 more. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: AuthService (22 methods) internal/rpc/deps.go:23 — `AuthService` declares 22 methods: `BindTempAuthKey`, `ResolveAuthKey`, `UserID`, `PendingPasswordUserID`, `CompletePasswordSignIn`, `SendCode`, `CodeDelivery`, `ResendCode`, `CancelCode`, `SignIn`, `SignInWithEmail`, `SignUp`, `AcceptLoginToken`, `BindVerifiedLogin`, `SignInBot`, `LogOut`, `Authorization`, `AuthKeyClientInfo`, `UpdateAuthKeyClientInfo`, `ListAuthorizations`, `ResetAuthorization`, `ResetAuthorizations`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: BotsService (37 methods) internal/rpc/deps.go:346 — `BotsService` declares 37 methods: `BotInfo`, `OwnsBot`, `CheckUsername`, `CreateBot`, `ListOwnedBots`, `ExportBotToken`, `SetBotCommands`, `GetBotCommands`, `SetBotInfo`, `GetBotInfo`, `SetBotMenuButton`, `GetBotMenuButton`, `SetInlinePlaceholder`, `CanSendMessage`, `AllowSendMessage`, `UpsertBotApp`, `GetBotAppByID`, `GetBotAppByShortName`, `GetMainBotApp`, `ListBotApps`, `GetBotAppSettings`, `UpsertBotAppSettings`, `ListBotAppPreviewMedia`, `UpsertBotAppPreviewMedia`, `DeleteBotAppPreviewMedia`, `ReorderBotAppPreviewMedia`, `UpsertAttachMenuBot`, `GetAttachMenuBot`, `ListAttachMenuBots`, `GetAttachMenuState`, `SetAttachMenuState`, `SaveRequestedWebViewButton`, `GetRequestedWebViewButton`, `DeleteRequestedWebViewButton`, `SetBotEmojiStatusPermission`, `BotEmojiStatusPermission`, `PutWebViewCustomMethodQuery`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: AccountService (27 methods) internal/rpc/deps.go:469 — `AccountService` declares 27 methods: `SendChangePhoneCode`, `ChangePhone`, `GetPassword`, `GetPasswordSettings`, `UpdatePasswordSettings`, `CheckPassword`, `IssueTmpPassword`, `CheckTmpPassword`, `RevenueWithdrawalPasswordState`, `RequestPasswordRecovery`, `CheckRecoveryPassword`, `RecoverPassword`, `ConfirmPasswordEmail`, `ResendPasswordEmail`, `CancelPasswordEmail`, `SendLoginEmailCode`, `VerifyLoginEmail`, `SetLoginEmail`, `LoginEmail`, `LoginEmailByPhone`, `ClearLoginEmail`, `ResetPassword`, `DeclinePasswordReset`, `SaveMusic`, `ListSavedMusicIDs`, `ListSavedMusic`, `GetSavedMusicByIDs`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: AccountBusinessAutomationService (25 methods) internal/rpc/deps.go:502 — `AccountBusinessAutomationService` declares 25 methods: `GetBusinessProfile`, `UpdateBusinessWorkHours`, `UpdateBusinessLocation`, `UpdateBusinessIntro`, `UpdateBusinessGreetingMessage`, `UpdateBusinessAwayMessage`, `ListBusinessChatLinks`, `CreateBusinessChatLink`, `EditBusinessChatLink`, `DeleteBusinessChatLink`, `ResolveBusinessChatLink`, `ListQuickReplies`, `CheckQuickReplyShortcut`, `SaveQuickReplyText`, `GetQuickReplyMessages`, `RenameQuickReplyShortcut`, `ReorderQuickReplies`, `DeleteQuickReplyShortcut`, `DeleteQuickReplyMessages`, `GetConnectedBusinessBot`, `SaveConnectedBusinessBot`, `DeleteConnectedBusinessBot`, `SetConnectedBusinessBotPaused`, `DisableConnectedBusinessBotForPeer`, `GetConnectedBusinessBotPeerState`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: UpdatesService (33 methods) internal/rpc/deps.go:573 — `UpdatesService` declares 33 methods: `GetState`, `CurrentState`, `ConfirmedState`, `ObserveDifferenceRequest`, `GetDifference`, `CommitDeliveredState`, `ClearAuthKey`, `RecordNewMessage`, `PublishNewMessage`, `RecordStory`, `RecordStoryFanout`, `RecordReadStories`, `RecordSentStoryReaction`, `RecordNewStoryReaction`, `RecordQuickReplyMutation`, `RecordReadHistory`, `RecordContactsReset`, `RecordChannelState`, `RecordDialogPinned`, `RecordPinnedDialogs`, `RecordSavedDialogPinned`, `RecordPinnedSavedDialogs`, `RecordDialogUnreadMark`, `RecordPeerSettings`, `RecordNotifySettings`, `RecordPeerStoryBlocked`, `RecordDialogFilter`, `RecordDialogFilterOrder`, `RecordDialogFiltersReload`, `RecordFolderPeers`, `RecordChannelViewForumAsMessages`, `RecordChannelDiscussionInbox`, `RecordDraftMessage`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: ContactsService (17 methods) internal/rpc/deps.go:617 — `ContactsService` declares 17 methods: `GetContacts`, `ContactIDs`, `AddContact`, `AcceptContact`, `ImportContacts`, `Search`, `DeleteContacts`, `EditCloseFriends`, `UpdateContactNote`, `SetPersonalPhoto`, `ClearPersonalPhoto`, `PersonalPhotos`, `GetPeerSettings`, `BlockContact`, `UnblockContact`, `IsBlocked`, `GetBlocked`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: DialogsService (21 methods) internal/rpc/deps.go:638 — `DialogsService` declares 21 methods: `GetDialogsHash`, `GetDialogs`, `GetPeerDialogs`, `SaveDraft`, `GetDraft`, `DeleteDraft`, `ListDrafts`, `ClearDrafts`, `TogglePinned`, `ToggleArchivePinned`, `ReorderPinned`, `MarkUnread`, `UnreadMarks`, `HidePeerSettingsBar`, `PeerSettingsBarHidden`, `GetDialogFolders`, `SaveDialogFolder`, `DeleteDialogFolder`, `ReorderDialogFolders`, `ToggleDialogFolderTags`, `EditPeerFolders`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: MessagesService (30 methods) internal/rpc/deps.go:678 — `MessagesService` declares 30 methods: `SendPrivateText`, `SetChatTheme`, `ForwardPrivateMessages`, `GetMessages`, `GetHistory`, `Search`, `SearchPrivateMedia`, `CountPrivateMediaCategories`, `ReadHistory`, `ReadMessageContents`, `GetOutboxReadDate`, `SetMessageReactions`, `GetMessageReactions`, `SavedReactionTags`, `UpdateSavedReactionTag`, `VoteMessagePoll`, `CloseMessagePoll`, `ListUnreadReactionMessages`, `ReadPeerReactions`, `EditMessage`, `PinPrivateMessage`, `UnpinAllPrivateMessages`, `DeleteMessages`, `DeleteHistory`, `GetSavedDialogs`, `GetPinnedSavedDialogs`, `GetSavedDialogsByPeers`, `ToggleSavedDialogPin`, `ReorderPinnedSavedDialogs`, `DeleteSavedHistory`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: StoriesService (28 methods) internal/rpc/deps.go:734 — `StoriesService` declares 28 methods: `CreateStory`, `GetAllStories`, `GetAllStoriesPage`, `GetAllStoriesDigest`, `ListOwnerActiveStories`, `GetPeerStories`, `GetStoriesByID`, `GetStoriesArchive`, `GetPinnedStories`, `HasPinnedStories`, `ListReadStates`, `GetPeerMaxIDs`, `GetPeerHiddenStates`, `GetPeerStoryProjections`, `ReadStories`, `IncrementViews`, `SendReaction`, `GetStoryViewsList`, `GetStoryReactionsList`, `GetStoryPublicForwards`, `CanViewStoryStats`, `ListStoryViewerIDs`, `EditStory`, `DeleteStories`, `TogglePinned`, `TogglePinnedToTop`, `TogglePeerStoriesHidden`, `CanSendStory`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: ChannelsService (137 methods) internal/rpc/deps.go:766 — `ChannelsService` declares 137 methods: `CreateMegagroupFromCreateChat`, `CreateChannel`, `GetChannel`, `ResolveChannel`, `GetChannels`, `GetJoinableChannel`, `GetParticipants`, `GetParticipant`, `FutureCreatorAfterLeave`, `InviteToChannel`, `JoinChannel`, `LeaveChannel`, `EditTitle`, `SetWallpaper`, `EditAbout`, `EditAdmin`, `TransferOwnership`, `EditMemberRank`, `EditBanned`, `EditDefaultBannedRights`, `DeleteChannel`, `CheckUsername`, `UpdateUsername`, `ListAdminedPublicChannels`, `ListCommunityLinkableChannels`, `ListStoryPostableChannels`, `ListSendAsChannels`, `ResolvePublicUsername`, `SearchPublicChannels`, `SetSignatures`, `SetPhoto`, `SetPreHistoryHidden`, `SetParticipantsHidden`, `SetForum`, `SetAutotranslation`, `SetRestrictedSponsored`, `SetPaidMessagesPrice`, `SetAntiSpam`, `SetSlowMode`, `SetBoostsToUnblockRestrictions`, and 97 more. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: CommunitiesService (21 methods) internal/rpc/deps.go:926 — `CommunitiesService` declares 21 methods: `Create`, `Get`, `GetMany`, `ListJoined`, `TogglePeerLink`, `SetCollapsed`, `ListPeerLinkRequests`, `DecidePeerLinkRequest`, `DecideAllPeerLinkRequests`, `ToggleParticipantBanned`, `ParticipantJoinedChats`, `Participants`, `EditTitle`, `EditAbout`, `EditAdmin`, `EditDefaultBannedRights`, `SetPhoto`, `Delete`, `SetPinned`, `ReorderPinned`, `SearchScope`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: FilesService (45 methods) internal/rpc/deps.go:952 — `FilesService` declares 45 methods: `SaveFilePart`, `SaveBigFilePart`, `GetFile`, `CreateEncryptedFileFromUpload`, `DeleteEncryptedFileBlob`, `GeoMapTile`, `ListAvailableReactions`, `AvailableEffects`, `GetDocuments`, `ResolveStickerSet`, `ListStickerSets`, `CheckStickerSetShortName`, `SuggestStickerSetShortName`, `CreateStickerSet`, `ListCreatedStickerSets`, `AddStickerToSet`, `RemoveStickerFromSet`, `ChangeStickerPosition`, `RenameStickerSet`, `DeleteStickerSet`, `CreatePhotoFromUpload`, `CreatePhotoFromBytes`, `CreatePhotoFromURL`, `CreateDocumentFromURL`, `ResolveWebPage`, `WebPagePreviewEnabled`, `LookupWebPage`, `CreateAvatarFromUpload`, `CreateAvatarVideoFromUpload`, `CreateAvatarVideoMarkupFromUpload`, `CreateAvatarMarkup`, `CreateDocumentFromUpload`, `CreateDocumentFromBytes`, `GetPhoto`, `GetDocument`, `UploadProfilePhoto`, `UploadProfilePhotoKind`, `SetCurrentProfilePhoto`, `SetCurrentProfilePhotoKind`, `CurrentProfilePhoto`, and 5 more. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: GiftsService (50 methods) internal/rpc/deps.go:1259 — `GiftsService` declares 50 methods: `Catalog`, `CatalogHash`, `GiftByID`, `GiftRevisionByID`, `CollectiblePreview`, `CollectiblePreviewSample`, `CollectibleAvailability`, `UniqueBySlug`, `UniqueByID`, `UniqueByIDs`, `ListUniqueByOwner`, `Upgrade`, `UpgradeReceipt`, `RecordSavedGift`, `ListSaved`, `ListSavedFiltered`, `GetSaved`, `ResolveSavedIDs`, `CountSaved`, `ToggleSaved`, `ConvertAggregate`, `ListCollections`, `CreateCollection`, `UpdateCollection`, `DeleteCollection`, `ReorderCollections`, `SetPinned`, `ListResale`, `ValueInfo`, `SetListing`, `Transfer`, `PurchaseResale`, `SendOffer`, `ResolveOffer`, `ListCraft`, `Craft`, `AuctionState`, `ActiveAuctions`, `AuctionAcquired`, `BidAuction`, and 10 more. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: GroupCallsService (30 methods) internal/rpc/deps.go:1379 — `GroupCallsService` declares 30 methods: `Create`, `RtmpStreamKey`, `StartScheduled`, `SetScheduleSubscription`, `ScheduleSubscriberIDs`, `CreateConference`, `Get`, `GetBySlug`, `GetByInviteMessage`, `Join`, `Leave`, `RemoveConferenceParticipants`, `Discard`, `Touch`, `Participant`, `Participants`, `UpdateParticipant`, `SetTitle`, `SetJoinMuted`, `SetStartedMessageID`, `SweepStale`, `ResetAllParticipants`, `NextRaiseHandRating`, `SetParticipantOverride`, `ParticipantOverride`, `CreateConferenceInvite`, `SetConferenceInviteStatus`, `ConferenceRecipients`, `AppendChainBlock`, `ChainBlocks`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: BusinessAutomationStore (24 methods) internal/store/account.go:89 — `BusinessAutomationStore` declares 24 methods: `HasBusinessAutomation`, `GetBusinessProfile`, `SaveBusinessProfile`, `ListBusinessChatLinks`, `CreateBusinessChatLink`, `UpdateBusinessChatLink`, `DeleteBusinessChatLink`, `ResolveBusinessChatLink`, `ListQuickReplies`, `CheckQuickReplyShortcut`, `SaveQuickReplyText`, `GetQuickReplyMessages`, `RenameQuickReplyShortcut`, `ReorderQuickReplies`, `DeleteQuickReplyShortcut`, `DeleteQuickReplyMessages`, `ReserveBusinessAutomationDelivery`, `LastBusinessAutomationDelivery`, `GetConnectedBusinessBot`, `SaveConnectedBusinessBot`, `DeleteConnectedBusinessBot`, `SetConnectedBusinessBotPaused`, `DisableConnectedBusinessBotForPeer`, `GetConnectedBusinessBotPeerState`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: BotStore (39 methods) internal/store/bot.go:13 — `BotStore` declares 39 methods: `CreateBotAccount`, `GetBot`, `ListBotsByOwner`, `CountBotsByOwner`, `UpdateBotTokenSecret`, `UpdateBotCommands`, `UpdateBotInfo`, `UpdateBotMenuButton`, `SetBotInlinePlaceholder`, `SetBotInlineGeo`, `SetBotNochats`, `SetBotChatHistory`, `CanBotSendMessage`, `AllowBotSendMessage`, `UpsertBotApp`, `GetBotAppByID`, `GetBotAppByShortName`, `GetMainBotApp`, `ListBotApps`, `GetBotAppSettings`, `UpsertBotAppSettings`, `ListBotAppPreviewMedia`, `UpsertBotAppPreviewMedia`, `DeleteBotAppPreviewMedia`, `ReorderBotAppPreviewMedia`, `UpsertAttachMenuBot`, `GetAttachMenuBot`, `ListAttachMenuBots`, `GetAttachMenuState`, `SetAttachMenuState`, `SaveRequestedWebViewButton`, `GetRequestedWebViewButton`, `DeleteRequestedWebViewButton`, `SetBotEmojiStatusPermission`, `BotEmojiStatusPermission`, `PutWebViewCustomMethodQuery`, `GetBotChatState`, `UpsertBotChatState`, `DeleteBotChatState`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: BotVerificationStore (25 methods) internal/store/bot_verification.go:15 — `BotVerificationStore` declares 25 methods: `UpsertVerificationIcon`, `SetVerificationIconActive`, `VerificationIcon`, `VerificationIconByDocument`, `ListVerificationIcons`, `UpsertBotVerifierSettings`, `SetBotVerifierEnabled`, `DeleteBotVerifierSettings`, `BotVerifierSettings`, `BotVerifierSettingsBatch`, `ListBotVerifiers`, `GrantCustomVerification`, `RevokeCustomVerification`, `CustomVerification`, `PeerVerification`, `PeerVerificationBatch`, `CountCustomVerifications`, `ListCustomVerifications`, `CreateCustomVerificationRequest`, `DecideCustomVerificationRequest`, `CustomVerificationRequest`, `PendingCustomVerificationRequest`, `ListCustomVerificationRequests`, `CustomVerificationRequestsForApplicant`, `CustomVerificationRequestCounts`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: ChannelStore (153 methods) internal/store/channel.go:18 — `ChannelStore` declares 153 methods: `CreateChannel`, `GetChannel`, `ResolveChannel`, `GetChannels`, `GetChannelByID`, `SaveChannelDefaultSendAs`, `GetParticipants`, `GetParticipant`, `FutureCreatorAfterLeave`, `InviteToChannel`, `JoinChannel`, `LeaveChannel`, `EditChannelTitle`, `SetChannelWallpaper`, `EditChannelAbout`, `EditChannelAdmin`, `TransferChannelOwnership`, `EditChannelMemberRank`, `EditChannelBanned`, `EditChannelDefaultBannedRights`, `DeleteChannel`, `CheckUsername`, `UpdateUsername`, `SetChannelVerified`, `SetChannelScamFake`, `SetChannelAdminSettings`, `SetChannelUsernameAdmin`, `SetChannelColorAdmin`, `SetChannelEmojiStatusAdmin`, `SetChannelPhotoAdmin`, `ListAdminedPublicChannels`, `ListCommunityLinkableChannels`, `ListStoryPostableChannels`, `ListSendAsChannels`, `ResolvePublicChannelUsername`, `ResolvePublicChannelInvite`, `SearchPublicChannels`, `SetSignatures`, `SetChannelPhoto`, `SetPreHistoryHidden`, and 113 more. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: CommunityStore (21 methods) internal/store/community.go:12 — `CommunityStore` declares 21 methods: `CreateCommunity`, `GetCommunity`, `GetCommunities`, `ListJoinedCommunities`, `ToggleCommunityPeerLink`, `SetCommunityCollapsed`, `ListCommunityPeerLinkRequests`, `DecideCommunityPeerLinkRequest`, `DecideAllCommunityPeerLinkRequests`, `ToggleCommunityParticipantBanned`, `GetCommunityParticipantJoinedChats`, `ListCommunityParticipants`, `EditCommunityTitle`, `EditCommunityAbout`, `EditCommunityAdmin`, `EditCommunityDefaultBannedRights`, `SetCommunityPhoto`, `DeleteCommunity`, `SetCommunityPinned`, `ReorderCommunityPinned`, `CommunitySearchScope`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: ContactStore (16 methods) internal/store/contact.go:10 — `ContactStore` declares 16 methods: `ListByUser`, `Get`, `GetMany`, `GetReverseContacts`, `ContactProjectionForViewers`, `Upsert`, `UpsertMany`, `UpdateNote`, `SetCloseFriends`, `SetPersonalPhoto`, `PersonalPhotos`, `Delete`, `Block`, `Unblock`, `IsBlocked`, `ListBlocked`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: DialogStore (30 methods) internal/store/dialog.go:10 — `DialogStore` declares 30 methods: `ListByUser`, `ListByPeers`, `Upsert`, `UpsertInbox`, `SaveDraft`, `GetDraft`, `DeleteDraft`, `ListDrafts`, `ListDraftsByPeers`, `ClearDrafts`, `MarkRead`, `SetPinned`, `ReorderPinned`, `SetUnreadMark`, `ListUnreadMarked`, `SetChatTheme`, `SetPeerSettingsBarHidden`, `PeerSettingsBarHidden`, `SetTranslationDisabled`, `TranslationDisabled`, `ListFolders`, `GetFolder`, `UpsertFolder`, `DeleteFolder`, `ReorderFolders`, `SetFolderTagsEnabled`, `EditPeerFolders`, `CountArchiveUnread`, `SetArchivePinned`, `ArchivePinned`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: DonationStore (25 methods) internal/store/donations.go:15 — `DonationStore` declares 25 methods: `WalletSeed`, `CreateWalletSeed`, `DonationAddressForUser`, `DonationUserByAddress`, `NextDonationAddressIndex`, `InsertDonationAddress`, `ListDonationAddresses`, `CreateDonationChain`, `DeleteDonationChain`, `EnabledDonationChains`, `DonationChain`, `UpdateDonationChainConfig`, `SetDonationChainPrice`, `DonationTokens`, `AllDonationTokens`, `UpsertDonationToken`, `DeleteDonationToken`, `DonationChainCursor`, `SetDonationChainCursor`, `RecordDonationDeposit`, `UpdateDonationDepositConfirmations`, `PendingDonationDeposits`, `ConfirmedUncreditedDeposits`, `CreditDonationDeposit`, `UserDonationDeposits`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: GroupCallStore (31 methods) internal/store/groupcall.go:11 — `GroupCallStore` declares 31 methods: `CreateGroupCall`, `CreateConferenceCall`, `GetGroupCall`, `GetGroupCallBySlug`, `GetGroupCallByInviteMessage`, `JoinGroupCall`, `LeaveGroupCall`, `RemoveConferenceCallParticipants`, `DiscardGroupCall`, `TouchParticipant`, `GetParticipant`, `ListParticipants`, `UpdateParticipant`, `SetGroupCallTitle`, `SetGroupCallJoinMuted`, `SetStartedMessageID`, `SweepStaleParticipants`, `ResetAllParticipants`, `NextRaiseHandRating`, `SetParticipantOverride`, `GetParticipantOverride`, `CreateConferenceInvite`, `SetConferenceInviteStatus`, `ListConferenceRecipientUserIDs`, `AppendGroupCallChainBlock`, `ListGroupCallChainBlocks`, `GetRtmpStreamKey`, `SetRtmpStreamKey`, `StartScheduledGroupCall`, `SetScheduleStartSubscription`, `ListScheduleSubscriberIDs`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • + 9 more in this group — see findings.md.
X7 · Silent fallback defaults · Silent fallback default on error · ×20
  • Silent fallback default on error internal/admin/botverification.go:752 — `botVerifierMarkCount` turns a non-nil `err` into `return "unknown"` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/app/bots/verifierbot.go:512 — `verifierMarkDescription` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/app/bots/verifierbot.go:1425 — `verifierDraftInt` turns a non-nil `err` into `return 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/app/bots/verifybot.go:1237 — `verifyDraftInt` turns a non-nil `err` into `return 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/app/files/seed.go:626 — `docIDFromName` turns a non-nil `err` into `return 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/hoststats/cpu_unix.go:26 — `sample` turns a non-nil `err` into `return 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/links/links.go:260 — `Host` turns a non-nil `err` into `return "telesrv.net"` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/otpdelivery/webhook/sender.go:189 — `decodeResponse` turns a non-nil `err` into `return responseBody{}` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/procctl/supervisor.go:38 — `EnvValue` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/rpc/phone_group_call_rtmp.go:184 — `randomSSRC` turns a non-nil `err` into `return 1` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/rpc/account.go:925 — `passkeyDisplayName` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/rpc/bot_verification_projection.go:214 — `peerBotVerificationIcon` turns a non-nil `err` into `return 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/rpc/channel_full_bot_cache.go:98 — `loadChannelFullBotInfo` turns a non-nil `err` into `return channelFullBotInfoResult{}` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/rpc/encrypted_messages.go:140 — `deviceEncryptedQts` turns a non-nil `err` into `return 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/rpc/messages_attach_menu.go:220 — `attachMenuUsers` turns a non-nil `err` into `return []tg.UserClass{}` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/rpc/messages_dialogs.go:332 — `chatsForDrafts` turns a non-nil `err` into `return []tg.ChatClass{}` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/rpc/messages_helpers.go:155 — `channelOnlineCount` turns a non-nil `err` into `return 1` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/rpc/send_media.go:1208 — `channelPostAuthorName` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/rpc/stories.go:3307 — `storyMessageForwardPage` turns a non-nil `err` into `return domain.StoryMessageForwardList{}` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
  • Silent fallback default on error internal/store/memory/channel_dialogs.go:306 — `SetChannelDialogPinned` turns a non-nil `err` into `return false, 0, nil` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
D8 · Code Coverage · Tests reach code only in some runs · ×16
  • Tests reach code only in some runs: internal/app/langpack/service.go internal/app/langpack/service.go:252 — 2 line(s) (252-253) were executed in some of the 3 runs of the suite and not in others. A test that does not take the same path every run only tests the part it always takes, so these lines are not counted as covered. Make the tests that reach them deterministic (a fixed clock, seed or ordering, or waiting on the event instead of on time), or test the paths directly.
  • Tests reach code only in some runs: internal/app/telegramlogin/service.go internal/app/telegramlogin/service.go:967 — 2 line(s) (967-968) were executed in some of the 3 runs of the suite and not in others. A test that does not take the same path every run only tests the part it always takes, so these lines are not counted as covered. Make the tests that reach them deterministic (a fixed clock, seed or ordering, or waiting on the event instead of on time), or test the paths directly.
  • Tests reach code only in some runs: internal/hoststats/cpu_unix.go internal/hoststats/cpu_unix.go:38 — 5 line(s) (38-41, 47) were executed in some of the 3 runs of the suite and not in others. A test that does not take the same path every run only tests the part it always takes, so these lines are not counted as covered. Make the tests that reach them deterministic (a fixed clock, seed or ordering, or waiting on the event instead of on time), or test the paths directly.
  • Tests reach code only in some runs: internal/mtprotoedge/exchange.go internal/mtprotoedge/exchange.go:122 — 2 line(s) (122-123) were executed in some of the 3 runs of the suite and not in others. A test that does not take the same path every run only tests the part it always takes, so these lines are not counted as covered. Make the tests that reach them deterministic (a fixed clock, seed or ordering, or waiting on the event instead of on time), or test the paths directly.
  • Tests reach code only in some runs: internal/mtprotoedge/inbound_preflight.go internal/mtprotoedge/inbound_preflight.go:970 — 14 line(s) (970-971, 974-975, 987-988, 996-997, 1015-1016, 1055-1056, 1063-1064) were executed in some of the 3 runs of the suite and not in others. A test that does not take the same path every run only tests the part it always takes, so these lines are not counted as covered. Make the tests that reach them deterministic (a fixed clock, seed or ordering, or waiting on the event instead of on time), or test the paths directly.
  • Tests reach code only in some runs: internal/mtprotoedge/layer_rpc_execution.go internal/mtprotoedge/layer_rpc_execution.go:172 — 20 line(s) (172-178, 181, 290-295, 298-301, 303-304) were executed in some of the 3 runs of the suite and not in others. A test that does not take the same path every run only tests the part it always takes, so these lines are not counted as covered. Make the tests that reach them deterministic (a fixed clock, seed or ordering, or waiting on the event instead of on time), or test the paths directly.
  • Tests reach code only in some runs: internal/mtprotoedge/outbound.go internal/mtprotoedge/outbound.go:1205 — 21 line(s) (1205, 1634-1636, 2111-2117, 2185-2187, 2189-2191, 2893-2894, 2971-2972) were executed in some of the 3 runs of the suite and not in others. A test that does not take the same path every run only tests the part it always takes, so these lines are not counted as covered. Make the tests that reach them deterministic (a fixed clock, seed or ordering, or waiting on the event instead of on time), or test the paths directly.
  • Tests reach code only in some runs: internal/mtprotoedge/same_port_mux.go internal/mtprotoedge/same_port_mux.go:187 — 8 line(s) (187-190, 210-212, 386) were executed in some of the 3 runs of the suite and not in others. A test that does not take the same path every run only tests the part it always takes, so these lines are not counted as covered. Make the tests that reach them deterministic (a fixed clock, seed or ordering, or waiting on the event instead of on time), or test the paths directly.
  • Tests reach code only in some runs: internal/mtprotoedge/server.go internal/mtprotoedge/server.go:1145 — 2 line(s) (1145-1146) were executed in some of the 3 runs of the suite and not in others. A test that does not take the same path every run only tests the part it always takes, so these lines are not counted as covered. Make the tests that reach them deterministic (a fixed clock, seed or ordering, or waiting on the event instead of on time), or test the paths directly.
  • Tests reach code only in some runs: internal/mtprotoedge/session_manager.go internal/mtprotoedge/session_manager.go:422 — 5 line(s) (422, 1502-1504, 2043) were executed in some of the 3 runs of the suite and not in others. A test that does not take the same path every run only tests the part it always takes, so these lines are not counted as covered. Make the tests that reach them deterministic (a fixed clock, seed or ordering, or waiting on the event instead of on time), or test the paths directly.
  • Tests reach code only in some runs: internal/mtprotoedge/transport_compat.go internal/mtprotoedge/transport_compat.go:305 — 2 line(s) (305-306) were executed in some of the 3 runs of the suite and not in others. A test that does not take the same path every run only tests the part it always takes, so these lines are not counted as covered. Make the tests that reach them deterministic (a fixed clock, seed or ordering, or waiting on the event instead of on time), or test the paths directly.
  • Tests reach code only in some runs: internal/readmodelcache/cache.go internal/readmodelcache/cache.go:173 — 2 line(s) (173-174) were executed in some of the 3 runs of the suite and not in others. A test that does not take the same path every run only tests the part it always takes, so these lines are not counted as covered. Make the tests that reach them deterministic (a fixed clock, seed or ordering, or waiting on the event instead of on time), or test the paths directly.
  • Tests reach code only in some runs: internal/rpc/presence_last_seen_batch.go internal/rpc/presence_last_seen_batch.go:189 — 2 line(s) (189, 271) were executed in some of the 3 runs of the suite and not in others. A test that does not take the same path every run only tests the part it always takes, so these lines are not counted as covered. Make the tests that reach them deterministic (a fixed clock, seed or ordering, or waiting on the event instead of on time), or test the paths directly.
  • Tests reach code only in some runs: internal/store/memory/moderation.go internal/store/memory/moderation.go:930 — 1 line(s) (930) were executed in some of the 3 runs of the suite and not in others. A test that does not take the same path every run only tests the part it always takes, so these lines are not counted as covered. Make the tests that reach them deterministic (a fixed clock, seed or ordering, or waiting on the event instead of on time), or test the paths directly.
  • Tests reach code only in some runs: internal/store/postgres/active_channel_ids_batch.go internal/store/postgres/active_channel_ids_batch.go:263 — 5 line(s) (263, 271-274) were executed in some of the 3 runs of the suite and not in others. A test that does not take the same path every run only tests the part it always takes, so these lines are not counted as covered. Make the tests that reach them deterministic (a fixed clock, seed or ordering, or waiting on the event instead of on time), or test the paths directly.
  • Tests reach code only in some runs: internal/store/postgres/bootstrap_update_job_batch.go internal/store/postgres/bootstrap_update_job_batch.go:289 — 5 line(s) (289, 297-300) were executed in some of the 3 runs of the suite and not in others. A test that does not take the same path every run only tests the part it always takes, so these lines are not counted as covered. Make the tests that reach them deterministic (a fixed clock, seed or ordering, or waiting on the event instead of on time), or test the paths directly.
D29 · Static Analysis (SAST) · REDACTED · ×5
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
DM2 · Strongly-typed ids · Primitive id on a domain type · ×3
  • Primitive id on a domain type: StarGiftCatalogWrite.GiftID internal/domain/star_gift.go:884 — `StarGiftCatalogWrite.GiftID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that.
  • Primitive id on a domain type: StarGiftCatalogWrite.CommandID internal/domain/star_gift.go:895 — `StarGiftCatalogWrite.CommandID` is a raw `string` — give it a strongly-typed id: a dedicated single-field type wrapping the `string`, in whatever form your language spells that.
  • Primitive id on a domain type: StarGiftCatalogWrite.OfficialGiftID internal/domain/star_gift.go:896 — `StarGiftCatalogWrite.OfficialGiftID` is a raw `int64` — give it a strongly-typed id: a dedicated single-field type wrapping the `int64`, in whatever form your language spells that.
X4 · Structured logging · Interpolated log message defeats structured logging · ×3
  • Interpolated log message defeats structured logging internal/rpc/messages_polls.go:95 — `Warn` at line 95 is handed a message assembled at the call — `fmt.Sprintf` with values, or a string concatenated with a value — so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass a constant message and the values as attributes instead: `slog.Warn("order moved", "order_id", orderID, "status", status)` with log/slog, `logger.Warn("order moved", zap.String("order_id", orderID))` with zap, `log.WithFields(log.Fields{"order_id": orderID}).Warn("order moved")` with logrus, or `log.Info().Str("order_id", orderID).Msg("order moved")` with zerolog.
  • Interpolated log message defeats structured logging internal/app/bots/verifierbot.go:1594 — `Error` at line 1594 is handed a message assembled at the call — `fmt.Sprintf` with values, or a string concatenated with a value — so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass a constant message and the values as attributes instead: `slog.Error("order moved", "order_id", orderID, "status", status)` with log/slog, `logger.Error("order moved", zap.String("order_id", orderID))` with zap, `log.WithFields(log.Fields{"order_id": orderID}).Error("order moved")` with logrus, or `log.Info().Str("order_id", orderID).Msg("order moved")` with zerolog.
  • Interpolated log message defeats structured logging internal/app/bots/verifybot.go:1423 — `Error` at line 1423 is handed a message assembled at the call — `fmt.Sprintf` with values, or a string concatenated with a value — so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass a constant message and the values as attributes instead: `slog.Error("order moved", "order_id", orderID, "status", status)` with log/slog, `logger.Error("order moved", zap.String("order_id", orderID))` with zap, `log.WithFields(log.Fields{"order_id": orderID}).Error("order moved")` with logrus, or `log.Info().Str("order_id", orderID).Msg("order moved")` with zerolog.
D16 · Bus Factor · Off-boarding risk · ×2
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 46 significant file(s) lose their only recent owner: internal/app/files/retention.go, internal/admin/star_gift_catalog.go, internal/store/postgres/donations.go, internal/store/postgres/media_refs.go, internal/app/donations/service.go, cmd/telesrv-admin/star_gift_catalog.go, internal/procctl/procctl.go, cmd/telesrv-admin/security.go (+38 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 20 significant file(s) lose their only recent owner: internal/botapi/server.go, REDACTED, internal/telegramloginhttp/handler.go, internal/botapi/projection.go, internal/botapi/inline.go, internal/store/postgres/authkey.go, internal/rpc/communities.go, internal/domain/message_markup.go (+12 more). Pair on, review, or document these before any departure.
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 1 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (68 single-owned of 819 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 819 of the 1037 production source files in this repository met that bar). They are anonymized user #3 (2 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: internal/rpc/account_themes.go, internal/store/postgres/channel_message_views.go.
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found cmd/walletminiapp/main.go:6 — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`. ADRs are expected here because `cmd/walletminiapp/main.go` makes this repository a deployable product (line 6).
D21 · Naming Consistency · `defaultBulkACKWindow` spells `ACK` where 38 names in the project spell it `Ack` · ×1
  • `defaultBulkACKWindow` spells `ACK` where 38 names in the project spell it `Ack` internal/mtprotoedge/outbound.go:59 — 38 of 39 names in project telesrv spell the token `Ack` (38 of 39; unit: names in project telesrv containing `Ack`). Peers: mtprotoedge.sendQuickAckIfRequested (internal/mtprotoedge/encrypted.go:311); mtprotoedge.clientQuickAckToken (internal/mtprotoedge/encrypted.go:338); Server.sendAck (internal/mtprotoedge/encrypted.go:1476); mtprotoedge.isUnencryptedMsgsAckFrame (internal/mtprotoedge/exchange.go:233); mtprotoedge.inboundFrameCodecQuickAckAbridged (internal/mtprotoedge/frame_budget.go:102). Rename to `defaultBulkAckWindow`. [rule N6]
D21 · Naming Consistency · `registerAiCompose` spells `Ai` where 77 names in the project spell it `AI` · ×1
  • `registerAiCompose` spells `Ai` where 77 names in the project spell it `AI` internal/rpc/aicompose.go:15 — 77 of 78 names in project telesrv spell the token `AI` (77 of 78; unit: names in project telesrv containing `AI`). Peers: main.newAIComposeOptions (REDACTED:163); ai.ProviderKindOpenAIResponses (internal/app/ai/provider_http.go:23); ai.ProviderKindOpenAIChat (internal/app/ai/provider_http.go:24); HTTPProvider.composeOpenAIResponses (internal/app/ai/provider_http.go:149); HTTPProvider.composeOpenAIChat (internal/app/ai/provider_http.go:191). Rename to `registerAICompose`. [rule N6]
D21 · Naming Consistency · `DeliveryEffectAccountPTS` spells `PTS` where 70 names in the project spell it `Pts` · ×1
  • `DeliveryEffectAccountPTS` spells `PTS` where 70 names in the project spell it `Pts` internal/store/delivery_effect.go:27 — 70 of 72 names in project telesrv spell the token `Pts` (70 of 72; unit: names in project telesrv containing `Pts`). Peers: Service.MaxChannelPts (internal/app/channels/service.go:2342); Service.MaxChannelPtsBatch (internal/app/channels/service.go:2351); Service.currentPts (internal/app/updates/service.go:816); BotAPIUpdate.SourcePts (internal/domain/botapi_update.go:152); EnqueueBotAPIUpdateRequest.SourcePts (internal/domain/botapi_update.go:165). Rename to `DeliveryEffectAccountPts`. [rule N6]
D21 · Naming Consistency · `AccountPTSDeliveryEffect` spells `PTS` where 70 names in the project spell it `Pts` · ×1
  • `AccountPTSDeliveryEffect` spells `PTS` where 70 names in the project spell it `Pts` internal/store/delivery_effect.go:32 — 70 of 72 names in project telesrv spell the token `Pts` (70 of 72; unit: names in project telesrv containing `Pts`). Peers: Service.MaxChannelPts (internal/app/channels/service.go:2342); Service.MaxChannelPtsBatch (internal/app/channels/service.go:2351); Service.currentPts (internal/app/updates/service.go:816); BotAPIUpdate.SourcePts (internal/domain/botapi_update.go:152); EnqueueBotAPIUpdateRequest.SourcePts (internal/domain/botapi_update.go:165). Rename to `AccountPtsDeliveryEffect`. [rule N6]
D21 · Naming Consistency · `nextBID` spells `BID` where 12 names in the project spell it `Bid` · ×1
  • `nextBID` spells `BID` where 12 names in the project spell it `Bid` internal/store/memory/broadcast.go:23 — 12 of 13 names in project telesrv spell the token `Bid` (12 of 13; unit: names in project telesrv containing `Bid`). Peers: domain.MaxStarGiftAuctionBidStars (internal/domain/star_gift.go:289); StarGiftAuction.MinBidAmount (internal/domain/star_gift.go:689); telesrv/internal/domain.StarGiftAuctionBidLevel (internal/domain/star_gift.go:704); StarGiftAuctionUserState.MinBidAmount (internal/domain/star_gift.go:714); telesrv/internal/domain.StarGiftAuctionBidRequest (internal/domain/star_gift.go:727). Rename to `nextBid`. [rule N6]
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion REDACTED:1 — `(repository root)` (345999 LoC, 2069 module-visible types across 114 directories) overshoots its size bounds. 1 of 3 build unit(s) (Go, Python) overshoot their size bounds, lowering Project Cohesion to 3.3/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D34 · Knowledge Freshness · Further orphaned files (smaller) · ×1
  • Further orphaned files (smaller) — 344 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: internal/domain/moderation.go, internal/domain/telegram_login.go, internal/domain/story.go, internal/domain/moderation_case.go, internal/domain/bot_verification.go, internal/domain/ephemeral.go, internal/rpc/ephemeral.go, internal/app/files/webpage.go (and 336 more) (400 orphaned of 819 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 819 of the 1037 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
DM5 · Encapsulated state · Mutable entity · ×1
  • Mutable entity: StarGiftCatalogWrite internal/domain/star_gift.go:883 — `StarGiftCatalogWrite` exposes publicly writable state (GiftID, Title, Stars, ConvertStars, Enabled, SortOrder, and 32 more).
M2 · Architecture documentation · No ADRs · ×1
  • No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
M2 · Architecture documentation · No architecture diagram/doc · ×1
  • No architecture diagram/doc — No C4/Structurizr/PlantUML/Mermaid/Graphviz/D2 diagram, no drawn diagram named for the architecture, no file named `architecture` or `design` in any markup this check reads, and nothing in the README, docs or contributor guides that announces the shape — no `## Architecture` heading, no "architecture overview"/"high-level design" phrasing, no "the architecture is …" introduction, no guided code tour. A shape laid out in prose that never names itself as the architecture is not visible to this check, and neither is one kept outside the repository, so this row reports the absence of a re-findable shape document — not evidence that nobody wrote the shape down.
P3 · Security & performance tooling · No SAST · ×1
  • No SAST — No static application security testing detected. For this repository's stack, add gosec / govulncheck (or golangci-lint) (or `semgrep --config=auto`, which runs on any language) — this repository has no CI pipeline yet, so run it locally to clear the existing findings, then make it a step of the first workflow you add so a regression fails the build. What was searched, so you can tell an absence from a miss: the 0 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
P3 · Security & performance tooling · No dependency-update automation · ×1
  • No dependency-update automation cmd/telesrv-admin/web/package.json:11 — `cmd/telesrv-admin/web/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
X2 · Cancellation propagation · Not all functions that make a request accept a context.Context · ×1
  • Not all functions that make a request accept a context.Context — Only 35/38 functions that make a cancellable request (net/http, net.Dial) accept a context.Context or pass one on, so a request keeps running after whatever wanted it has given up — a cancelled request, a shutdown, an expired deadline. Take `ctx context.Context` as the first parameter and build the request with it (`http.NewRequestWithContext`, `DialContext`); where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
X7 · Silent fallback defaults · Silent fallback default in catch · ×1
  • Silent fallback default in catch cmd/telesrv-admin/web/src/lib/format.ts:72 — `safeHttpURL` swallows every exception into `return ""` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Minor — 24 finding(s)
D12 · Dependency Hygiene · Outdated · ×24
  • Outdated: github.com/ethereum/go-ethereum — `github.com/ethereum/go-ethereum` is required at v1.17.6 in REDACTED, but v1.17.10 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/ethereum/go-ethereum@v1.17.10 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/fxamacker/cbor/v2 — `github.com/fxamacker/cbor/v2` is required at v2.8.0 in REDACTED, but v2.10.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/fxamacker/cbor/v2@v2.10.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/go-faster/errors — `github.com/go-faster/errors` is required at v0.7.1 in REDACTED, but v0.8.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/go-faster/errors@v0.8.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/golang-migrate/migrate/v4 — `github.com/golang-migrate/migrate/v4` is required at v4.19.1 in REDACTED, but v4.20.1 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/golang-migrate/migrate/v4@v4.20.1 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/jackc/pgx/v5 — `github.com/jackc/pgx/v5` is required at v5.9.2 in REDACTED, but v5.13.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/jackc/pgx/v5@v5.13.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/lestrrat-go/jwx/v3 — `github.com/lestrrat-go/jwx/v3` is required at v3.1.1 in REDACTED, but v3.4.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/lestrrat-go/jwx/v3@v3.4.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/minio/minio-go/v7 — `github.com/minio/minio-go/v7` is required at v7.2.1 in REDACTED, but v7.4.1 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/minio/minio-go/v7@v7.4.1 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/owpengram/owpengram-td — `github.com/owpengram/owpengram-td` is required at v1.7.0 in REDACTED, but v1.8.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/owpengram/owpengram-td@v1.8.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/pion/datachannel — `github.com/pion/datachannel` is required at v1.6.2 in REDACTED, but v1.6.4 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/pion/datachannel@v1.6.4 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/pion/dtls/v3 — `github.com/pion/dtls/v3` is required at v3.1.5 in REDACTED, but v3.1.15 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/pion/dtls/v3@v3.1.15 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/pion/ice/v4 — `github.com/pion/ice/v4` is required at v4.3.0 in REDACTED, but v4.4.9 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/pion/ice/v4@v4.4.9 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/pion/rtcp — `github.com/pion/rtcp` is required at v1.2.17 in REDACTED, but v1.2.20 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/pion/rtcp@v1.2.20 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/pion/rtp — `github.com/pion/rtp` is required at v1.10.4 in REDACTED, but v1.10.6 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/pion/rtp@v1.10.6 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/pion/sctp — `github.com/pion/sctp` is required at v1.11.0 in REDACTED, but v1.12.1 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/pion/sctp@v1.12.1 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/pion/srtp/v3 — `github.com/pion/srtp/v3` is required at v3.0.12 in REDACTED, but v3.1.3 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/pion/srtp/v3@v3.1.3 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/pion/transport/v4 — `github.com/pion/transport/v4` is required at v4.0.2 in REDACTED, but v4.1.3 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/pion/transport/v4@v4.1.3 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/pion/turn/v5 — `github.com/pion/turn/v5` is required at v5.0.12 in REDACTED, but v5.1.3 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/pion/turn/v5@v5.1.3 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: go.yaml.in/yaml/v3 — `go.yaml.in/yaml/v3` is required at v3.0.5 in REDACTED, but v3.0.6 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get go.yaml.in/yaml/v3@v3.0.6 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: golang.org/x/crypto — `golang.org/x/crypto` is required at v0.55.0 in REDACTED, but v0.59.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get golang.org/x/crypto@v0.59.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: golang.org/x/image — `golang.org/x/image` is required at v0.31.0 in REDACTED, but v0.48.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get golang.org/x/image@v0.48.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: golang.org/x/net — `golang.org/x/net` is required at v0.58.0 in REDACTED, but v0.62.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get golang.org/x/net@v0.62.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: golang.org/x/sync — `golang.org/x/sync` is required at v0.22.0 in REDACTED, but v0.25.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get golang.org/x/sync@v0.25.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: golang.org/x/sys — `golang.org/x/sys` is required at v0.47.0 in REDACTED, but v0.50.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get golang.org/x/sys@v0.50.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: golang.org/x/text — `golang.org/x/text` is required at v0.41.0 in REDACTED, but v0.44.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get golang.org/x/text@v0.44.0 && go mod tidy` and commit the updated REDACTED and go.sum.

Appendix B — Reproduction & audit trail

Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-26e8fb9a56034b689d7df949215f9f2d/tree.json --exit-code 0 --source .0—
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt --exclude cmd/telesrv-admin/web --exclude internal/store/postgres/sqlcgen .28artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .13artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .2artifacts/raw/trivy-config.json
D32 · Data Compliance (PII/GDPR)semgrep—semgrep --config /opt/semgrep-rules/gdpr.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt --exclude cmd/telesrv-admin/web --exclude internal/store/postgres/sqlcgen .7artifacts/raw/semgrep-gdpr.json
D36 · Supply-chain Provenance & Signingprovenance—provenance: not applicable — No CI/build pipeline found (.github/.forgejo/.gitea workflows, .circleci, .buildkite, .woodpecker, .teamcity, .gitlab-ci.yml, .travis.yml, bitbucket-pipelines.yml, .drone.yml, .cirrus.yml, .woodpecker.yml, appveyor.yml, azure-pipelines*.yml, .pipelines/, .vsts-ci/, .azuredevops/, Jenkinsfile); there is no build to attest provenance for.0—
D37 · Vulnerability-disclosure Policydisclosure—disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .0artifacts/raw/trivy-fs.json

Run 01a1ea43-c94a-7057-813a-60274587fd60 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

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.

⬇ Findings, MITRE CWE-tagged .sarif⬇ Health changelog .md