Public report — Newtonsoft.Json, published 5 Aug 2026.
Concrete security findings (CVE IDs, secret matches, dependency versions) are hidden in this version;
ask the repo owner for the full report.
327findings with an exact file:lineof 345 — the remainder are repo-wide signals (a dimension-level measurement, not a single line); open any file:line and verify
49/98dimensions across the health lenses60883 LoC · 21 projects — wide & deep
Executive summary
Read through the Production lens — the standard calibration. *Green* means good enough to run in production. The score is absolute and comparable across repos.
JamesNK/Newtonsoft.Json is sound in substance but carries real gaps (60%). It is not in crisis, but the issues below raise the cost of changing it — friction its consumers ultimately inherit.
It is strongest in Architecture (97%) — the structure is clean and changes stay contained. Code Health (86%) is solid too.
The area that most needs attention is Maturity (53%) — onboarding is slow — key decisions and the architecture aren't written down, so contributors have to reverse-engineer the intent. Security (59%) is the next concern — exposure to security and compliance incidents is elevated.
Leadership focus, highest impact first: Expand the README with getting-started (Documentation (README)); Record significant decisions one document per decision (Architecture documentation); Enable Dependabot/Renovate or a dependency-review gate (Security & performance tooling).
For scale: Medium (~60,883 production lines); rebuilding it from scratch would take roughly ~2.1 person-years (~1–5 engineers). Approximate, ±~30%.
It builds on a genuinely strong Architecture foundation (97%); the priorities above are the highest-leverage way to bring the rest up to that level.
How the score is built — each lens's share of the headlineWidth is the lens's weight in the worst-heaviest fold (the weakest area pulls hardest); colour is that lens's own band. A lens fixes the score in proportion to its width.
A full-fidelity diff against the previous run's complete recorded findings — line-move tolerant: a finding that only shifted line counts as unchanged, only genuinely new titles/files surface here.
Rebuild cost & value ~ Modeled — €100,000–€510,000
This codebase represents roughly ~2.1 person-years of build effort (about ~€310,000 to rebuild). Its weakest lens is Maturity at 53% — the part of that asset most exposed by the findings below.
How we model this: boilerplate at a scaffolding rate + logic × domain Standard (×1.0) — library/CLI, high decision density × a 0.8× quality factor, at €60–95/h; indicative, ±~30%. Indicative only — most sensitive to the hourly rate and the domain tier (both tunable in config).
Top priorities
The highest-leverage moves; the full ranked list is in the Roadmap below.
1
Resolve the 2 Low XML-doc coverage finding(s) in Documentation Quality — start with Newtonsoft.Json.FuzzTests.csproj, Newtonsoft.Json.TestConsole.csproj.
Record significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree with `NNNN-title.md` names is the most discoverable form).
Value concentrated against a weak lens · Medium · Value at risk
This is a Medium asset (~2.1 person-years to rebuild), and its weakest lens is Maturity at 53%. The operational and business risk on an asset this size concentrates there — that's where remediation buys the most protection.
→ Direct remediation budget at Maturity first — highest risk-reduction per euro on an asset this size.
Highest-leverage move · Medium · Leverage
Of everything flagged, the best return on effort is: Expand the README with getting-started, architecture overview and a project map. The rest can wait behind it.
Evidence: priority ranking: top of 5 ranked by impact/effort
→ Expand the README with getting-started, architecture overview and a project map.
A velocity tax on every change · Medium · Economics
The code-quality signals (complexity, duplication, cohesion) average 7.1/10, which acts as a tax on every change in the weaker areas: modifications there plausibly cost on the order of 2–5% more than in clean code, and the tax compounds as the codebase grows. (A modelled estimate, not a measured fact.)
Evidence: D1/D2/D4/D6 code quality: averaging 7.1/10 across the code-quality signals actually measured
→ Pay it down where churn is highest — the hotspots — not everywhere; that's where the tax is actually paid.
Architecture — module dependency graph
Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways — a layering smell or cycle. A clean layered graph has none.
Architecture — module dependency matrix
12 modules, 24 dependencies — 1 dependency cycle, shown as the red cell(s) above the diagonal. Rows and columns are the same modules, ordered so that a module only depends on ones above it. A cell means the row depends on the column, and its number is how many type pairs create that dependency. Read one thing: is anything above the diagonal? A mark there is a dependency cycle. (A cycle is all this shows — an unusual but cycle-free dependency sits below the diagonal like any other.)
At a glance — Code Health · 86% · Adequate · gated by D2
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A03:2021 — Injection
6
High / Critical
A06:2021 — Vulnerable & Outdated Components
4
High / Critical
Roadmap
Begin by expanding the README with a project map, getting-started guide, and architecture overview. Next, establish a centralized repository for architecture decisions, ensuring each is dated and includes context, the decision, and its consequences. Simultaneously, enable automated dependency and security scanning to improve security and performance tooling. Finally, implement automated deployment pipelines to ensure releases are repeatable and reversible, and maintain a changelog to track what is shipped in each release.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 2 Low XML-doc coverage finding(s) in Documentation Quality — start with Newtonsoft.Json.FuzzTests.csproj, Newtonsoft.Json.TestConsole.csproj.
Record significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree with `NNNN-title.md` names is the most discoverable form).
Resolve the 6 High finding(s) in Static Analysis (SAST) — start with codeql.yml (3), DeserializeComparisonBenchmarks.cs, SerializeComparisonBenchmarks.cs.
Automate the release in CI — a deploy stage for a service (Helm/Kubernetes manifests or an equivalent rollout), or a tag-triggered publish job for an artifact — so releases are repeatable and reversible.
Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 46 of 49 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 3 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 0.6 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.
Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.
What we checked — 49 dimensions across the health lenses
Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.
How to trust any code-health report — three questions
Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 327 of 345 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D24 Comment Value — LLM provider failed — The model provider returned an unusable result, so this LLM-assisted dimension fell back to a measurement gap (confidence 0) rather than a penalty. Re-run with a reachable provider to score it.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
Watchdog assesses the repository exactly as committed, and only the repository. By design it does not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity (jscpd) — it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
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").
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.
D18 Solution Shape: Build integrity reflects whether the solution compiled in this environment — a build that needs a private feed, a specific SDK, or a generated file absent from the repo can read as broken when it is merely unreproducible here.
D19 Documentation Quality: Documentation quality is judged by an LLM over a bounded sample of docs — it reads what is written, not whether the docs match the running system, and it is advisory, not a measurement.
D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
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.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and the advisory database — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen.
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.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
The LLM boundary
LLM-set scores this run (3): D19, D21, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score (documentation, ADR quality, naming, comment value, onboarding) — D25 sets the ADR-conformance fraction over sampled code, D22 judges API accuracy over a sample. These are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
82 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was JValue.Operation at 69. A further 13 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 JsonTextReader.ReadNumberCharIntoBuffer at 34 — they are counted neither in the figure above nor in this dimension's score.
+ 77 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 JValue.Operation (cyclomatic 69) finding(s) in Cyclomatic Complexity — start with JValue.cs. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 JsonWriter.WriteValueAsync (cyclomatic 62) finding(s) in Cyclomatic Complexity — start with JsonWriter.Async.cs. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 JsonWriter.WriteValue (cyclomatic 62) finding(s) in Cyclomatic Complexity — start with JsonWriter.cs. — One of this dimension's main actionable groups (1 warning-level).
Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
138 method(s) exceeded the cognitive complexity threshold of 15; the worst was JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters at 144.
+ 132 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 2 DateTimeUtils.TryParseDateTime (cognitive 21) finding(s) in Cognitive Complexity — start with DateTimeUtils.cs (2). — One of this dimension's main actionable groups (2 warning-level).
Resolve the 1 JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters… finding(s) in Cognitive Complexity — start with JsonSerializerInternalReader.cs. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 ConvertUtils.DecimalTryParse (cognitive 123) finding(s) in Cognitive Complexity — start with ConvertUtils.cs. — One of this dimension's main actionable groups (1 warning-level).
Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes8.1 / 10Strong✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
Resolve the 17 TooManyMethods finding(s) in God Classes — start with JsonTextWriter.Async.cs, JsonWriter.cs, JToken.cs. — One of this dimension's main actionable groups (17 warning-level).
Resolve the 14 FileTooLong finding(s) in God Classes — start with JsonTextReader.cs, JsonSerializerInternalReader.cs, XmlNodeConverter.cs. — One of this dimension's main actionable groups (14 warning-level).
Resolve the 5 ClassTooLong finding(s) in God Classes — start with XmlNodeConverter.cs, ConvertUtils.cs, JsonSerializer.cs. — One of this dimension's main actionable groups (5 warning-level).
Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Copy-pasted code that should be shared instead.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.
+ 4 more group(s) — more in Appendix A; the complete list is findings.md.
✓ On the Gold path — maintain.
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.
Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.
Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.
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.
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D9 · Test Distribution10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.
Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.
25855 test methods: 25855 unit, 0 integration, 0 BDD, 0 e2e.
✓ On the Gold path — maintain.
Detailed fixes: d9_recommendation.md.
Do you agree with this assessment?
D10 · Test Quality10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the tests truly assert behaviour rather than just running the code.
Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.
What it measures: Whether dependencies are current, secure, and not bloated.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (saturating for vulnerabilities, capped-linear for deprecation/outdated) per KLoC. Exhaustive, deterministic.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
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.
3 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is Src/Newtonsoft.Json/Linq/JToken.cs.
Off-boarding risk: anonymized user #1
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.
Do you agree with this assessment?
D17 · Explicit Debt8.5 / 10Strong✓ 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.
+ 2 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 NoWarnInCsproj finding(s) in Explicit Debt — start with Newtonsoft.Json.Tests.csproj. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 24 BarePragmaDisable finding(s) in Explicit Debt — start with ExtensionDataTests.cs (2), JValue.cs (2), JsonSerializerInternalReader.cs (2). — One of this dimension's main actionable groups (24 warning-level).
Resolve the 11 CommentedOutCode finding(s) in Explicit Debt — start with JsonSerializerTest.cs (4), BsonReaderAsyncTests.cs (2), BsonReaderTests.cs (2). — One of this dimension's main actionable groups (11 warning-level).
Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the solution is laid out in a sensible, conventional structure.
Method: Solution structure: project count, decomposition, shell-project detection, build success (confirmed failures cap the score); traced to actual .sln files and binaries. Deterministic.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic doc sample (READMEs plus first 25 architecture docs), with two-pass stability filtering. Advisory, sampled.
The documentation is clear and complete for a high-performance JSON framework: the READMEs are well written with links to the homepage, NuGet package, release notes, contributing guidelines, and license; there is an architecture/versions doc that lists .NET Framework versions supported by each library (net45/net40/net35/net20/portable-net45+win8+wpa81+wp8/portable-net40+win8+wpa81+wp8+sl5/netstandard1.0-2.0) and notes the Compact Framework 3.5/Silverlight 3.0 build path; a detailed serialization example covers Serialize, Deserialize, LINQ to JSON with code output, and links to all standard resources.
Resolve the 2 Low XML-doc coverage finding(s) in Documentation Quality — start with Newtonsoft.Json.FuzzTests.csproj, Newtonsoft.Json.TestConsole.csproj. — One of this dimension's main actionable groups (2 warning-level).
Detailed fixes: d19_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.
1 of 4 projects flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion
What to do
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — 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.
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.
Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.
93 % of calls cross a namespace and 0 % go through an interface, but 100 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: large — vertical-slice locality expected.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: Git-history secret scan via gitleaks detect over full history in an isolated checkout; each match flagged High. Exhaustive; degrades cleanly when tool absent.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
High: github-actions-mutable-action-tag · ×6.github/workflows/codeql.yml:58detected by semgrep finding
What to do
Resolve the 6 High finding(s) in Static Analysis (SAST) — start with codeql.yml (3), DeserializeComparisonBenchmarks.cs, SerializeComparisonBenchmarks.cs. — One of this dimension's main actionable groups (6 issue-level).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependencies have known published vulnerabilities (CVEs), direct or transitive.
Method: NuGet CVE scan via dotnet list package --vulnerable including transitive; severity tally (Critical/High/Medium/Low) to 0-10 tight normalizer. Exhaustive, deterministic; degrades when absent.
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.
19 of 166 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is Src/Newtonsoft.Json/JsonWriter.Async.cs.
Resolve the 3 Orphaned knowledge finding(s) in Knowledge Freshness — start with JsonWriter.Async.cs, JsonTextReader.Async.cs, JsonTextWriter.Async.cs. — One of this dimension's main actionable groups (3 issue-level).
Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling; coupling through a build step, config, or non-source file isn't seen.
What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.
Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.
Resolve the 1 Unpinned build actions finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 No build provenance finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 No SBOM finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
What to do
The domain core is a small share of production code — check that business logic isn't leaking into the application/infrastructure layers (a thin domain is the anemic-domain smell).
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Other · Architecture — Whether the codebase has a recognisable, scale-appropriate structure (a named architectural style, or modular enough for its size) rather than being an ad-hoc ball of mud.
Method: Roslyn plus csproj analysis: architecture style detection (DDD, clean, vertical-slice, CQRS) and structure fitness for repo size. Deterministic.
Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface member counts; fat-interface threshold (over 15 members) flagged per type. Deterministic, type-level.
Do you agree with this assessment?
AX8 · Test isolation10.0 / 10Exemplary✓ Tool-verified
Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.
Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.
Other · Code Health — Unreviewed-generation residue: shipped members still throwing NotImplementedException, and placeholder string literals left in non-test, non-generated code. Scored as a quality signature, never as a claim about authorship.
Method: Roslyn syntax scan: NotImplementedException throws and placeholder string literals in non-test, non-generated shipped code. Deterministic, code-shape signature.
A shipped member still throws NotImplementedException — generated scaffolding that was never completed. Implement it or remove the dead surface. (×2) — JObject.cs:641, JToken.Async.cs:50
What to do
Finish or delete NotImplementedException stubs and replace placeholder literals before shipping.
Other · Code Health — Unfinished work detected by code SHAPE, not keywords: members that only throw a "not implemented" exception, methods that take inputs and return a constant, async methods that never await, dead `if (false)` / `#if false` branches, and skeleton types most of whose members are holes. A real, objective slice of technical debt.
`InternalWriteRaw` has an empty body — confirm it's an intentional no-op and not an unfinished method. — JsonWriter.cs:1756
What to do
Clear the softer debt: remove commented-out code and dead branches, re-enable or delete skipped tests, and replace blanket warning suppressions with targeted ones.
Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
The root README is 26 words — likely missing build/run/architecture context.
What to do
Expand the README with getting-started, architecture overview and a project map.
Add a build/run (quick start) section to the root README — the first thing a newcomer needs.
Add a 'Testing' section to the root README — how to run the test suite.
Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
Add a README to the 3 of 4 project(s) that lack one — worth up to 1.5 pts.
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 `NNNN-title.md` documents 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/PlantUML/Mermaid diagram or architecture.md — the high-level shape isn't documented.
What to do
Record significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree with `NNNN-title.md` names is the most discoverable form).
Add a C4 context/container diagram (Structurizr, PlantUML or Mermaid) or an architecture.md overview.
Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).
Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.
Readiness · Readiness — Whether 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.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries. Exhaustive, deterministic.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
What to do
Enable Dependabot/Renovate or a dependency-review gate.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
No release automation was found in CI — neither a deploy stage (Helm/Kubernetes/compose manifests, an orchestrated rollout) nor a publish job that ships the built artifact. Releases appear to be run by hand, which is slower, less repeatable and harder to reverse.
What to do
Automate the release in CI — a deploy stage for a service (Helm/Kubernetes manifests or an equivalent rollout), or a tag-triggered publish job for an artifact — so releases are repeatable and reversible.
Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.
Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.
No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
What to do
Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.
Readiness · Performance — Whether the library 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 — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.
A BenchmarkDotNet suite exists but no [MemoryDiagnoser] — allocations (the main way a library pressures its host's GC) aren't being measured.
What to do
Add [MemoryDiagnoser] to the benchmarks so allocation regressions are visible, not just time.
Readiness · Performance — Whether the code is written to minimise allocations so it doesn't pressure its host's memory manager — buffer/slice views over copies, object pooling, stack or value-type allocation, and buffer writers. Reward-only: credited where present, never penalised where a simpler style is fine.
Raise allocation-aware density on the hot paths — currently 14 use(s) across 61,152 production line(s) (~0.2/1k). More Span/Memory, pooling (ArrayPool/ObjectPool), stackalloc and ValueTask on the allocation-heavy paths climbs this toward 10.
Readiness · Performance — Whether asynchronous code keeps its host responsive — a library awaits with ConfigureAwait(false) (so it never captures and stalls the host's context) and avoids sync-over-async blocking (.Wait()/.GetAwaiter().GetResult()) that wastes threads and risks deadlock.
Method: Production-source scan: sync-over-async blocking (.Wait()/.GetAwaiter().GetResult()) counted everywhere, and — for a library with ≥5 awaits — the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
Other · Code Health — Whether 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.
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. Deterministic.
Other · Code Health — Whether nullable reference types are enabled and not undermined by heavy `!` suppression.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
~2.4 `!` suppressions per 1k syntax nodes — 454 suppression(s) across the 191163 syntax node(s) in code where nullable warnings are ENABLED, which is the only code a `!` can suppress anything in (a `!` under `#nullable disable` is inert and is not counted, and its file's nodes are not in the denominator). Each one tells the compiler to trust you about null, suppressing the very safety NRTs provide.
What to do
Enable <Nullable>enable</Nullable> across all projects and resolve warnings rather than suppressing with `!`.
Do you agree with this assessment?
Reference — by lens
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Not included — 49 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
AC7 A11y enforcement — No web markup found — accessibility is not applicable to this repository.
AX1 Captive dependencies — no DI registrations detected
AX2 Stateful singletons — no singleton implementations detected
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
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.
C1 Data Protection — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
C2 Access Controls — No access-control surface detected in the analyzed source — no web/app surface to authorize (no HTTP API or web-UI project) and no authorization code at all (no [Authorize]/policies, no imperative guard methods). Access control is therefore N/A here — this is a library/CLI, which is authorized by its CALLER, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
C3 Audit Trail — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
C4 Data Retention — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
C5 Data-Subject Rights — No personal data detected in the analyzed source — no PII-typed entity/column names (Email, FirstName, DateOfBirth, …), no ASP.NET Identity / user-account model, and no stored user credentials. GDPR data-protection controls are therefore N/A here. If this is intentional, record the no-PII posture in an ADR; if the app does process personal data, name those fields conventionally so this dimension activates.
D11 Test Reliability — Test runner surfaced no tests
D14 License Compliance — license scan produced no result — the tool ran but its JSON output could not be parsed; the offline NuGet fallback resolved nothing
D20 ADR Quality — N/A — ADRs are expected on deployable products with a user-facing host, not consumed libraries; no ADR log is required here.
D22 Internal API Consistency — No exposed public API
D23 Boundary Type-Coupling — Bounded contexts not declared
D24 Comment Value — LLM evaluation failed
D25 ADR Conformance — no ADRs to check
D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Terraform, Kubernetes/Helm, CloudFormation); nothing to scan.
D32 Data Compliance (PII/GDPR) — No PII/GDPR-handling patterns detected (p/gdpr ruleset) — no data-compliance surface to assess.
D33 JS/npm Dependency Vulnerabilities — No JS/npm manifest or lockfile found outside build output (package.json, package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb); no JS dependencies to scan.
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.
D38 OSV Dependency Vulnerabilities — No supported non-.NET dependency lockfile found outside build output (npm package-lock/yarn/pnpm/bun, Go go.mod, Rust Cargo.lock, Maven pom.xml, Gradle lockfiles, Python requirements.txt/poetry.lock/Pipfile.lock/pdm.lock, PHP composer.lock, Ruby Gemfile.lock, Elixir mix.lock, Dart pubspec.lock, Swift Package.resolved); nothing for OSV to scan. A NuGet-only repo stays NotApplicable — .NET CVEs are D30's domain.
D39 IL Efficiency — The target did not build, so no IL was available to measure.
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.
D7 Architectural Integrity — no checkable ADRs and no dependency cycles — architectural integrity not assessed
D8 Code Coverage — Coverage not measured — analyzer environment
DM1 Domain Modelling — not scored — this repository shows none of the 3 signals this check looks for
ED1 Event-Driven — not scored — this repository shows none of the 3 signals this check looks for
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this check looks for
P12 CI test-gate honesty — Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
P2 Observability — This repo is a library, not a deployed service — it has no process to operate, so production observability (structured logging, tracing/metrics, health checks) is N/A. A library may log via an injected ILogger, but the absence of operational telemetry is not a defect here. If it grows a host (web API, worker), the dimension reactivates.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
P7 Outbound HTTP resilience — not applicable — this isn't a service/API/worker
P8 Schema migrations — no EF Core usage detected
P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (Cobertura — `dotnet test --collect:"XPlat Code Coverage"` with a `coverlet.collector` PackageReference) into the repo working tree before the scan — a CI step is the usual place, since the artefact is commonly gitignored, or wire coverage collection into CI, to enable this cross-layer check
S1 Web-Security Posture — No web surface detected in the analyzed source — no HTTP API or web-UI project (no controllers/minimal-API endpoints, no Razor/Blazor views) and no web middleware (HTTPS redirection, HSTS, security headers, cookies). Transport security, security headers, secure cookies, CSRF/input-validation and middleware-order controls are therefore N/A here — this is a library/CLI/worker, not a web app. Crypto hygiene was still checked and found nothing to flag. If this codebase becomes web-facing, the dimension reactivates automatically.
SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X6 Hand-rolled structured-format parsing — Reported, not scored — this card publishes what it found rather than grading it. Its content is the findings and the key metric above.
X7 Silent fallback defaults — Reported, not scored — this card publishes what it found rather than grading it. Its content is the findings and the key metric above.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
High: github-actions-mutable-action-tag .github/workflows/codeql.yml:58— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: actions/checkout@<40-character SHA>`. This step references `actions/checkout@v4`; resolve the SHA it points at today with `gh api repos/actions/checkout/commits/v4 --jq .sha`.
High: github-actions-mutable-action-tag .github/workflows/codeql.yml:68— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: github/codeql-action/init@<40-character SHA>`. This step references `github/codeql-action/init@v3`; resolve the SHA it points at today with `gh api repos/github/codeql-action/commits/v3 --jq .sha`. `github/codeql-action/init` is hosted INSIDE the `github/codeql-action` repository (a subdirectory action or a reusable workflow), so the SHA to pin is that repository's commit — keep the full `github/codeql-action/init` path in `uses:` and query only `github/codeql-action`.
High: github-actions-mutable-action-tag .github/workflows/codeql.yml:96— GitHub Actions step uses a mutable tag or branch reference. Tags and branch names can be silently repointed by the action owner, enabling supply-chain attacks — as seen in the trivy-action and kics-github-action compromises. Pin the reference to a full 40-character commit SHA instead, e.g. `uses: github/codeql-action/analyze@<40-character SHA>`. This step references `github/codeql-action/analyze@v3`; resolve the SHA it points at today with `gh api repos/github/codeql-action/commits/v3 --jq .sha`. `github/codeql-action/analyze` is hosted INSIDE the `github/codeql-action` repository (a subdirectory action or a reusable workflow), so the SHA to pin is that repository's commit — keep the full `github/codeql-action/analyze` path in `uses:` and query only `github/codeql-action`.
High: insecure-binaryformatter-deserialization Src/Newtonsoft.Json.Tests/Benchmarks/DeserializeComparisonBenchmarks.cs:83— The BinaryFormatter type is dangerous and is not recommended for data processing. Applications should stop using BinaryFormatter as soon as possible, even if they believe the data they're processing to be trustworthy. BinaryFormatter is insecure and can't be made secure
High: insecure-binaryformatter-deserialization Src/Newtonsoft.Json.Tests/Benchmarks/SerializeComparisonBenchmarks.cs:108— The BinaryFormatter type is dangerous and is not recommended for data processing. Applications should stop using BinaryFormatter as soon as possible, even if they believe the data they're processing to be trustworthy. BinaryFormatter is insecure and can't be made secure
High: insecure-binaryformatter-deserialization Src/Newtonsoft.Json.Tests/ExceptionTests.cs:116— The BinaryFormatter type is dangerous and is not recommended for data processing. Applications should stop using BinaryFormatter as soon as possible, even if they believe the data they're processing to be trustworthy. BinaryFormatter is insecure and can't be made secure
High CVE: System.Net.Http 4.3.0 — System.Net.Http 4.3.0 (transitive) has a High advisory; affects 3 projects — one upgrade fixes all. https://github.com/advisories/[GHSA redacted]
High CVE: System.Text.RegularExpressions 4.3.0 — System.Text.RegularExpressions 4.3.0 (transitive) has a High advisory; affects 3 projects — one upgrade fixes all. https://github.com/advisories/[GHSA redacted]
High CVE: System.Net.Http 4.1.0 — System.Net.Http 4.1.0 (transitive) has a High advisory. https://github.com/advisories/[GHSA redacted]
High CVE: System.Security.Cryptography.X509Certificates 4.1.0 — System.Security.Cryptography.X509Certificates 4.1.0 (transitive) has a High advisory. https://github.com/advisories/[GHSA redacted]
Orphaned knowledge Src/Newtonsoft.Json/JsonWriter.Async.cs— 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 Src/Newtonsoft.Json/JsonTextReader.Async.cs— 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 Src/Newtonsoft.Json/JsonTextWriter.Async.cs— 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.
NoWarnInCsproj Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj:216— NETSDK1023 — this warning is switched off for the WHOLE project, in every file it builds, including code written years from now: nothing at the call site records that the rule was ever silenced, so the next reader has no reason to look here. Fix what the rule is reporting and drop the code from the list, or — if some occurrences really are legitimate — narrow the suppression to those sites and give each one its reason, so the rule keeps protecting the rest of the project.
BarePragmaDisable Src/Newtonsoft.Json.Tests/Documentation/Samples/Serializer/SerializeExtensionData.cs:44— #pragma warning disable 169 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json.Tests/Serialization/ExtensionDataTests.cs:251— #pragma warning disable 169 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json.Tests/FuzzRegressionTests.cs:36— #pragma warning disable xUnit1013 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json.Tests/Serialization/ExtensionDataTests.cs:243— #pragma warning disable 649 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs:2318— #pragma warning disable CS0618 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json.Tests/TestObjects/SubWithContractNewProperties.cs:34— #pragma warning disable 108, 114 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json.Tests/TestObjects/SubWithContractVirtualProperties.cs:34— #pragma warning disable 108, 114 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json.Tests/TestObjects/SubWithoutContractNewProperties.cs:34— #pragma warning disable 108, 114 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json/Bson/BsonReader.cs:578— #pragma warning disable 612,618 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json/JsonException.cs:79— #pragma warning disable SYSLIB0051 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json/Linq/JContainer.cs:970— #pragma warning disable IL2026 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json/Linq/JObject.cs:850— #pragma warning disable IL2026, IL3050 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json/Linq/JToken.cs:2501— #pragma warning disable IL2026, IL3050 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json/Linq/JValue.cs:983— #pragma warning disable IL2026, IL3050 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json/Linq/JValue.cs:1209— #pragma warning disable IL2026, IL3050 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json/Schema/JsonSchema.cs:363— #pragma warning disable IL2026, IL3050 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json/MemberSerialization.cs:37— #pragma warning disable 1584,1711,1572,1581,1580,1574 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json/Serialization/JsonFormatterConverter.cs:36— #pragma warning disable SYSLIB0050 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json/Serialization/JsonObjectContract.cs:192— #pragma warning disable SYSLIB0050 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:1761— #pragma warning disable SYSLIB0050 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:891— #pragma warning disable SYSLIB0050 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:1657— #pragma warning disable CS8600, CS8602, CS8603, CS8604 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:1085— #pragma warning disable CS8600, CS8602, CS8604 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
BarePragmaDisable Src/Newtonsoft.Json/Utilities/LinqBridge.cs:3037— #pragma warning disable 1591 — the disable has no matching restore, so it does not end with the construct that needed it: it runs to the end of the file and silences the rule for everything written below, including code added years later. Close it with the matching restore directive immediately after the construct it covers, or fix the cause and drop the directive entirely.
TooManyMethods: JsonTextWriter Src/Newtonsoft.Json/JsonTextWriter.Async.cs:0— TooManyMethods — 739 significant lines (blank, comment-only and punctuation-only lines excluded), 177 methods, declared across 2 files: Newtonsoft.Json/JsonTextWriter.Async.cs (122), Newtonsoft.Json/JsonTextWriter.cs (55). 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: JsonWriter Src/Newtonsoft.Json/JsonWriter.cs:0— TooManyMethods — 1413 significant lines (blank, comment-only and punctuation-only lines excluded), 173 methods, declared across 2 files: Newtonsoft.Json/JsonWriter.cs (96), Newtonsoft.Json/JsonWriter.Async.cs (77). 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: JToken Src/Newtonsoft.Json/Linq/JToken.cs:0— TooManyMethods — 1016 significant lines (blank, comment-only and punctuation-only lines excluded), 146 methods, declared across 2 files: Linq/JToken.cs (138), Linq/JToken.Async.cs (8). 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: JsonTextReader Src/Newtonsoft.Json/JsonTextReader.cs:0— TooManyMethods — 2431 significant lines (blank, comment-only and punctuation-only lines excluded), 128 methods, declared across 2 files: Newtonsoft.Json/JsonTextReader.cs (73), Newtonsoft.Json/JsonTextReader.Async.cs (55). 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: JContainer Src/Newtonsoft.Json/Linq/JContainer.cs:0— TooManyMethods — 513 significant lines (blank, comment-only and punctuation-only lines excluded), 70 methods. 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: JsonReader Src/Newtonsoft.Json/JsonReader.cs:0— TooManyMethods — 635 significant lines (blank, comment-only and punctuation-only lines excluded), 60 methods, declared across 2 files: Newtonsoft.Json/JsonReader.cs (44), Newtonsoft.Json/JsonReader.Async.cs (16). 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: JValue Src/Newtonsoft.Json/Linq/JValue.cs:0— TooManyMethods — 518 significant lines (blank, comment-only and punctuation-only lines excluded), 59 methods, declared across 2 files: Linq/JValue.cs (58), Linq/JValue.Async.cs (1). 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: JObject Src/Newtonsoft.Json/Linq/JObject.cs:0— TooManyMethods — 290 significant lines (blank, comment-only and punctuation-only lines excluded), 57 methods, declared across 2 files: Linq/JObject.cs (54), Linq/JObject.Async.cs (3). 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: TraceJsonWriter Src/Newtonsoft.Json/Serialization/TraceJsonWriter.cs:0— TooManyMethods — 297 significant lines (blank, comment-only and punctuation-only lines excluded), 56 methods. 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: JsonSerializerInternalReader Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:0— TooManyMethods — 1313 significant lines (blank, comment-only and punctuation-only lines excluded), 48 methods. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
TooManyMethods: DefaultContractResolver Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs:0— TooManyMethods — 669 significant lines (blank, comment-only and punctuation-only lines excluded), 48 methods. 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: ReflectionUtils Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs:0— TooManyMethods — 513 significant lines (blank, comment-only and punctuation-only lines excluded), 46 methods. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
TooManyMethods: BsonWriter Src/Newtonsoft.Json/Bson/BsonWriter.cs:0— TooManyMethods — 161 significant lines (blank, comment-only and punctuation-only lines excluded), 41 methods. 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: JsonSerializerInternalWriter Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:0— TooManyMethods — 591 significant lines (blank, comment-only and punctuation-only lines excluded), 40 methods. 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: JTokenWriter Src/Newtonsoft.Json/Linq/JTokenWriter.cs:0— TooManyMethods — 171 significant lines (blank, comment-only and punctuation-only lines excluded), 40 methods, declared across 2 files: Linq/JTokenWriter.cs (39), Linq/JTokenWriter.Async.cs (1). 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: JsonValidatingReader Src/Newtonsoft.Json/JsonValidatingReader.cs:0— TooManyMethods — 412 significant lines (blank, comment-only and punctuation-only lines excluded), 35 methods. 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: DateTimeUtils Src/Newtonsoft.Json/Utilities/DateTimeUtils.cs:0— TooManyMethods — 390 significant lines (blank, comment-only and punctuation-only lines excluded), 33 methods. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
FileTooLong: Newtonsoft.Json/JsonTextReader.cs Src/Newtonsoft.Json/JsonTextReader.cs:0— FileTooLong — 1453 significant lines (blank, comment-only and punctuation-only lines excluded). 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: Serialization/JsonSerializerInternalReader.cs Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:0— FileTooLong — 1339 significant lines (blank, comment-only and punctuation-only lines excluded). 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: Converters/XmlNodeConverter.cs Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs:0— FileTooLong — 1065 significant lines (blank, comment-only and punctuation-only lines excluded). 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: Newtonsoft.Json/JsonTextReader.Async.cs Src/Newtonsoft.Json/JsonTextReader.Async.cs:0— FileTooLong — 1006 significant lines (blank, comment-only and punctuation-only lines excluded). 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: Linq/JToken.cs Src/Newtonsoft.Json/Linq/JToken.cs:0— FileTooLong — 977 significant lines (blank, comment-only and punctuation-only lines excluded). 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: Newtonsoft.Json/JsonWriter.cs Src/Newtonsoft.Json/JsonWriter.cs:0— FileTooLong — 764 significant lines (blank, comment-only and punctuation-only lines excluded). 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: Serialization/DefaultContractResolver.cs Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs:0— FileTooLong — 698 significant lines (blank, comment-only and punctuation-only lines excluded). 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: Newtonsoft.Json/JsonWriter.Async.cs Src/Newtonsoft.Json/JsonWriter.Async.cs:0— FileTooLong — 664 significant lines (blank, comment-only and punctuation-only lines excluded). 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: Serialization/JsonSerializerInternalWriter.cs Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:0— FileTooLong — 607 significant lines (blank, comment-only and punctuation-only lines excluded). 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: Newtonsoft.Json/JsonReader.cs Src/Newtonsoft.Json/JsonReader.cs:0— FileTooLong — 580 significant lines (blank, comment-only and punctuation-only lines excluded). 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: Utilities/ConvertUtils.cs Src/Newtonsoft.Json/Utilities/ConvertUtils.cs:0— FileTooLong — 572 significant lines (blank, comment-only and punctuation-only lines excluded). 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: Linq/JContainer.cs Src/Newtonsoft.Json/Linq/JContainer.cs:0— FileTooLong — 526 significant lines (blank, comment-only and punctuation-only lines excluded). 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: Utilities/ReflectionUtils.cs Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs:0— FileTooLong — 525 significant lines (blank, comment-only and punctuation-only lines excluded). 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: Linq/JValue.cs Src/Newtonsoft.Json/Linq/JValue.cs:0— FileTooLong — 524 significant lines (blank, comment-only and punctuation-only lines excluded). 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.
TodoComment Src/Newtonsoft.Json/Linq/Extensions.cs:218— //TODO — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment Src/Newtonsoft.Json/Linq/Extensions.cs:301— //TODO — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment Src/Newtonsoft.Json/Linq/JToken.cs:441— // TODO: Make public in Newtonsoft.Json 14.0+
TodoComment Src/Newtonsoft.Json/Linq/JToken.cs:478— // TODO: Make public in Newtonsoft.Json 14.0+
TodoComment Src/Newtonsoft.Json/Linq/JValue.Async.cs:58— // TODO: Call WriteJsonAsync when it exists. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment Src/Newtonsoft.Json/Schema/JsonSchemaGenerator.cs:304— // todo: Add GetSchema to JsonConverter and use here? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
ClassTooLong: XmlNodeConverter Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs:0— ClassTooLong — 660 significant lines (blank, comment-only and punctuation-only lines excluded), 30 methods. 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: ConvertUtils Src/Newtonsoft.Json/Utilities/ConvertUtils.cs:0— ClassTooLong — 502 significant lines (blank, comment-only and punctuation-only lines excluded), 20 methods. The type holds no instance state, so there is no shared data to group its members by. To reduce it, split it by area instead: give each cohesive family of members its own smaller type, so no one type has to be read whole to change one of them.
ClassTooLong: JsonSerializer Src/Newtonsoft.Json/JsonSerializer.cs:0— ClassTooLong — 460 significant lines (blank, comment-only and punctuation-only lines excluded), 27 methods. 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: JPath Src/Newtonsoft.Json/Linq/JsonPath/JPath.cs:0— ClassTooLong — 438 significant lines (blank, comment-only and punctuation-only lines excluded), 21 methods. 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: BsonReader Src/Newtonsoft.Json/Bson/BsonReader.cs:0— ClassTooLong — 430 significant lines (blank, comment-only and punctuation-only lines excluded), 27 methods. 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.
HackComment Src/Newtonsoft.Json/Bson/BsonWriter.cs:520— // hack to update the writer state — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment Src/Newtonsoft.Json/Bson/BsonWriter.cs:534— // hack to update the writer state — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment Src/Newtonsoft.Json/JsonWriter.cs:931— // hack. want writer to change state as if a value had been written — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
DateTimeUtils.TryParseDateTime (cognitive 21) Src/Newtonsoft.Json/Utilities/DateTimeUtils.cs:344— DateTimeUtils.TryParseDateTime has cognitive complexity 21 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
DateTimeUtils.TryParseDateTime (cognitive 21) Src/Newtonsoft.Json/Utilities/DateTimeUtils.cs:380— DateTimeUtils.TryParseDateTime has cognitive complexity 21 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
Duplicated block (24 lines × 2) Src/Newtonsoft.Json/JsonTextReader.cs:702— Src/Newtonsoft.Json/JsonTextReader.cs:702-725 | Src/Newtonsoft.Json/JsonTextReader.cs:988-1011 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Src/Newtonsoft.Json/JsonTextReader.cs:702` it begins part-way through the construct above it, so those exact lines 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) Src/Newtonsoft.Json/Utilities/MathUtils.cs:52— Src/Newtonsoft.Json/Utilities/MathUtils.cs:52-75 | Src/Newtonsoft.Json/Utilities/MathUtils.cs:93-116 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Src/Newtonsoft.Json/Utilities/MathUtils.cs:52` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Low cohesion: JValue (LCOM4 11) Src/Newtonsoft.Json/Linq/JValue.cs:46— JValue's methods form 11 groups that share no state and don't call each other — a sign it may have several responsibilities. Review whether it splits into focused classes.
Low cohesion: JToken (LCOM4 6) Src/Newtonsoft.Json/Linq/JToken.cs:55— JToken's methods form 6 groups that share no state and don't call each other — a sign it may have several responsibilities. Review whether it splits into focused classes.
JValue.Operation (cyclomatic 69) Src/Newtonsoft.Json/Linq/JValue.cs:421— JValue.Operation has cyclomatic complexity 69 (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.
JsonWriter.WriteValueAsync (cyclomatic 62) Src/Newtonsoft.Json/JsonWriter.Async.cs:1694— JsonWriter.WriteValueAsync has cyclomatic complexity 62 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
JsonWriter.WriteValue (cyclomatic 62) Src/Newtonsoft.Json/JsonWriter.cs:1478— JsonWriter.WriteValue has cyclomatic complexity 62 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters (cyclomatic 54) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:1987— JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ConvertUtils.DecimalTryParse (cyclomatic 54) Src/Newtonsoft.Json/Utilities/ConvertUtils.cs:1309— ConvertUtils.DecimalTryParse has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
JsonTextReader.ReadStringValueAsync (cyclomatic 49) Src/Newtonsoft.Json/JsonTextReader.Async.cs:1167— JsonTextReader.ReadStringValueAsync has cyclomatic complexity 49 (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.
JsonTextReader.ReadStringValue (cyclomatic 49) Src/Newtonsoft.Json/JsonTextReader.cs:603— JsonTextReader.ReadStringValue has cyclomatic complexity 49 (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.
JToken.ToObject (cyclomatic 46) Src/Newtonsoft.Json/Linq/JToken.cs:2015— JToken.ToObject has cyclomatic complexity 46 (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.
JsonTextReader.DoReadAsBooleanAsync (cyclomatic 44) Src/Newtonsoft.Json/JsonTextReader.Async.cs:1430— JsonTextReader.DoReadAsBooleanAsync has cyclomatic complexity 44 (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.
JsonTextReader.ReadAsBoolean (cyclomatic 44) Src/Newtonsoft.Json/JsonTextReader.cs:770— JsonTextReader.ReadAsBoolean has cyclomatic complexity 44 (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.
JsonTextReader.ReadNumberValueAsync (cyclomatic 43) Src/Newtonsoft.Json/JsonTextReader.Async.cs:1303— JsonTextReader.ReadNumberValueAsync has cyclomatic complexity 43 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
JsonTextReader.ReadNumberValue (cyclomatic 43) Src/Newtonsoft.Json/JsonTextReader.cs:908— JsonTextReader.ReadNumberValue has cyclomatic complexity 43 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
JsonTextReader.ParseReadNumber (cyclomatic 42) Src/Newtonsoft.Json/JsonTextReader.cs:1981— JsonTextReader.ParseReadNumber 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.
XmlNodeConverter.SerializeNode (cyclomatic 41) Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs:1295— XmlNodeConverter.SerializeNode 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.
JavaScriptUtils.WriteEscapedJavaScriptString (cyclomatic 39) Src/Newtonsoft.Json/Utilities/JavaScriptUtils.cs:147— JavaScriptUtils.WriteEscapedJavaScriptString 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.
JValue.Compare (cyclomatic 38) Src/Newtonsoft.Json/Linq/JValue.cs:255— JValue.Compare 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.
ConvertUtils.TryConvertInternal (cyclomatic 36) Src/Newtonsoft.Json/Utilities/ConvertUtils.cs:420— ConvertUtils.TryConvertInternal 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.
JsonTextReader.ParseValueAsync (cyclomatic 33) Src/Newtonsoft.Json/JsonTextReader.Async.cs:252— JsonTextReader.ParseValueAsync has cyclomatic complexity 33 (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.
JsonTextReader.ParseValue (cyclomatic 33) Src/Newtonsoft.Json/JsonTextReader.cs:1693— JsonTextReader.ParseValue 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.
JsonSerializer.ApplySerializerSettings (cyclomatic 31) Src/Newtonsoft.Json/JsonSerializer.cs:653— JsonSerializer.ApplySerializerSettings 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.
JsonTextReader.DoReadAsBytesAsync (cyclomatic 31) Src/Newtonsoft.Json/JsonTextReader.Async.cs:1566— JsonTextReader.DoReadAsBytesAsync 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.
JsonTextReader.ReadAsBytes (cyclomatic 31) Src/Newtonsoft.Json/JsonTextReader.cs:497— JsonTextReader.ReadAsBytes 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.
JsonTextReader.ReadStringIntoBufferAsync (cyclomatic 30) Src/Newtonsoft.Json/JsonTextReader.Async.cs:383— JsonTextReader.ReadStringIntoBufferAsync 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.
JsonTextReader.ReadStringIntoBuffer (cyclomatic 30) Src/Newtonsoft.Json/JsonTextReader.cs:1136— JsonTextReader.ReadStringIntoBuffer 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.
JsonSerializerInternalReader.CreateObject (cyclomatic 30) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:435— JsonSerializerInternalReader.CreateObject 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.
JavaScriptUtils.WriteDefinitelyEscapedJavaScriptStringWithoutDelimitersAsync (cyclomatic 30) Src/Newtonsoft.Json/Utilities/JavaScriptUtils.cs:437— JavaScriptUtils.WriteDefinitelyEscapedJavaScriptStringWithoutDelimitersAsync 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.
JPath.ParsePath (cyclomatic 29) Src/Newtonsoft.Json/Linq/JsonPath/JPath.cs:93— JPath.ParsePath 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.
JValue.WriteToAsync (cyclomatic 29) Src/Newtonsoft.Json/Linq/JValue.Async.cs:49— JValue.WriteToAsync 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.
JValue.WriteTo (cyclomatic 29) Src/Newtonsoft.Json/Linq/JValue.cs:730— JValue.WriteTo 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.
JsonSchemaGenerator.GenerateInternal (cyclomatic 29) Src/Newtonsoft.Json/Schema/JsonSchemaGenerator.cs:246— JsonSchemaGenerator.GenerateInternal 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.
JsonValidatingReader.ValidateCurrentToken (cyclomatic 28) Src/Newtonsoft.Json/JsonValidatingReader.cs:500— JsonValidatingReader.ValidateCurrentToken has cyclomatic complexity 28 (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.
JContainer.ReadContentFromAsync (cyclomatic 28) Src/Newtonsoft.Json/Linq/JContainer.Async.cs:57— JContainer.ReadContentFromAsync 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.
JContainer.ReadContentFrom (cyclomatic 28) Src/Newtonsoft.Json/Linq/JContainer.cs:796— JContainer.ReadContentFrom 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.
JsonSerializerInternalReader.PopulateDictionary (cyclomatic 27) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:1376— JsonSerializerInternalReader.PopulateDictionary 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.
JsonWriter.WriteTokenAsync (cyclomatic 26) Src/Newtonsoft.Json/JsonWriter.Async.cs:689— JsonWriter.WriteTokenAsync has cyclomatic complexity 26 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
JsonSchemaBuilder.ResolveReferences (cyclomatic 26) Src/Newtonsoft.Json/Schema/JsonSchemaBuilder.cs:98— JsonSchemaBuilder.ResolveReferences 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.
JsonSerializerInternalReader.PopulateObject (cyclomatic 26) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:2388— JsonSerializerInternalReader.PopulateObject 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.
JsonSerializer.SerializeInternal (cyclomatic 25) Src/Newtonsoft.Json/JsonSerializer.cs:1089— JsonSerializer.SerializeInternal 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.
JsonWriter.WriteToken (cyclomatic 25) Src/Newtonsoft.Json/JsonWriter.cs:525— JsonWriter.WriteToken has cyclomatic complexity 25 (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.
BooleanQueryExpression.MatchTokens (cyclomatic 24) Src/Newtonsoft.Json/Linq/JsonPath/QueryExpression.cs:145— BooleanQueryExpression.MatchTokens 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.
JValue.GetValueType (cyclomatic 24) Src/Newtonsoft.Json/Linq/JValue.cs:611— JValue.GetValueType 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.
DefaultContractResolver.SetPropertySettingsFromAttributes (cyclomatic 24) Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs:1477— DefaultContractResolver.SetPropertySettingsFromAttributes 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.
JsonSerializerInternalReader.CalculatePropertyDetails (cyclomatic 23) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:1100— JsonSerializerInternalReader.CalculatePropertyDetails 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.
BsonReader.ReadNormal (cyclomatic 22) Src/Newtonsoft.Json/Bson/BsonReader.cs:346— BsonReader.ReadNormal 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.
XmlNodeConverter.ReadAttributeElements (cyclomatic 22) Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs:1875— XmlNodeConverter.ReadAttributeElements 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.
XmlNodeConverter.DeserializeNode (cyclomatic 22) Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs:2087— XmlNodeConverter.DeserializeNode 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.
JPath.ParseArrayIndexer (cyclomatic 22) Src/Newtonsoft.Json/Linq/JsonPath/JPath.cs:231— JPath.ParseArrayIndexer 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.
JsonArrayContract.JsonArrayContract.ctor (cyclomatic 22) Src/Newtonsoft.Json/Serialization/JsonArrayContract.cs:120— JsonArrayContract.JsonArrayContract.ctor 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.
JsonSerializerInternalReader.CreateDynamic (cyclomatic 22) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:1859— JsonSerializerInternalReader.CreateDynamic 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.
DateTimeParser.ParseTime (cyclomatic 21) Src/Newtonsoft.Json/Utilities/DateTimeParser.cs:123— DateTimeParser.ParseTime 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.
EnumUtils.ParseEnum (cyclomatic 21) Src/Newtonsoft.Json/Utilities/EnumUtils.cs:259— EnumUtils.ParseEnum 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.
ParametersMatchComparer.Compare (cyclomatic 21) Src/Newtonsoft.Json/Utilities/MethodBinder.cs:199— ParametersMatchComparer.Compare 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.
JToken.ReadFrom (cyclomatic 20) Src/Newtonsoft.Json/Linq/JToken.cs:2197— JToken.ReadFrom 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.
JsonSerializerInternalReader.CreateValueInternal (cyclomatic 20) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:301— JsonSerializerInternalReader.CreateValueInternal 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.
MathUtils.IntLength (cyclomatic 20) Src/Newtonsoft.Json/Utilities/MathUtils.cs:34— MathUtils.IntLength 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.
BsonBinaryWriter.WriteTokenInternal (cyclomatic 19) Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs:72— BsonBinaryWriter.WriteTokenInternal has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
JsonSerializerInternalReader.PopulateMultidimensionalArray (cyclomatic 19) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:1501— JsonSerializerInternalReader.PopulateMultidimensionalArray 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.
JsonSerializerInternalReader.ResolvePropertyAndCreatorValues (cyclomatic 19) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:2242— JsonSerializerInternalReader.ResolvePropertyAndCreatorValues 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.
JsonSerializerInternalWriter.CheckForCircularReference (cyclomatic 19) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:306— JsonSerializerInternalWriter.CheckForCircularReference 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.
ConvertUtils.Int32TryParse (cyclomatic 19) Src/Newtonsoft.Json/Utilities/ConvertUtils.cs:694— ConvertUtils.Int32TryParse 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.
XmlNodeConverter.ReadJson (cyclomatic 18) Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs:1481— XmlNodeConverter.ReadJson 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.
JsonTextReader.ParsePostValueAsync (cyclomatic 18) Src/Newtonsoft.Json/JsonTextReader.Async.cs:112— JsonTextReader.ParsePostValueAsync 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.
JsonTextReader.ParsePostValue (cyclomatic 18) Src/Newtonsoft.Json/JsonTextReader.cs:1440— JsonTextReader.ParsePostValue 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.
JsonWriter.AutoCompleteAsync (cyclomatic 18) Src/Newtonsoft.Json/JsonWriter.Async.cs:54— JsonWriter.AutoCompleteAsync has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
JsonWriter.InternalWriteEndAsync (cyclomatic 18) Src/Newtonsoft.Json/JsonWriter.Async.cs:291— JsonWriter.InternalWriteEndAsync 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.
DefaultContractResolver.GetSerializableMembers (cyclomatic 18) Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs:228— DefaultContractResolver.GetSerializableMembers 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.
JsonTextReader.ParseCommentAsync (cyclomatic 17) Src/Newtonsoft.Json/JsonTextReader.Async.cs:660— JsonTextReader.ParseCommentAsync 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.
JsonTextReader.ParseComment (cyclomatic 17) Src/Newtonsoft.Json/JsonTextReader.cs:2263— JsonTextReader.ParseComment 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.
JPath.ParseExpression (cyclomatic 17) Src/Newtonsoft.Json/Linq/JsonPath/JPath.cs:488— JPath.ParseExpression 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.
JsonSerializerInternalReader.CreateList (cyclomatic 17) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:857— JsonSerializerInternalReader.CreateList 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.
JsonSerializerInternalReader.EndProcessProperty (cyclomatic 17) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:2597— JsonSerializerInternalReader.EndProcessProperty 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.
ConvertUtils.Int64TryParse (cyclomatic 17) Src/Newtonsoft.Json/Utilities/ConvertUtils.cs:788— ConvertUtils.Int64TryParse 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.
DateTimeParser.ParseZone (cyclomatic 17) Src/Newtonsoft.Json/Utilities/DateTimeParser.cs:175— DateTimeParser.ParseZone 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.
MethodBinder.FilterParameters (cyclomatic 17) Src/Newtonsoft.Json/Utilities/MethodBinder.cs:112— MethodBinder.FilterParameters 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.
JsonSerializer.SetupReader (cyclomatic 16) Src/Newtonsoft.Json/JsonSerializer.cs:918— JsonSerializer.SetupReader 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.
JsonTextReader.Read (cyclomatic 16) Src/Newtonsoft.Json/JsonTextReader.cs:414— JsonTextReader.Read 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.
JsonValidatingReader.WriteToken (cyclomatic 16) Src/Newtonsoft.Json/JsonValidatingReader.cs:617— JsonValidatingReader.WriteToken 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.
ArraySliceFilter.ExecuteFilter (cyclomatic 16) Src/Newtonsoft.Json/Linq/JsonPath/ArraySliceFilter.cs:14— ArraySliceFilter.ExecuteFilter 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.
JsonDictionaryContract.JsonDictionaryContract.ctor (cyclomatic 16) Src/Newtonsoft.Json/Serialization/JsonDictionaryContract.cs:116— JsonDictionaryContract.JsonDictionaryContract.ctor 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.
JsonSerializerInternalReader.ReadMetadataPropertiesToken (cyclomatic 16) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:611— JsonSerializerInternalReader.ReadMetadataPropertiesToken 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.
JsonSerializerInternalReader.ReadMetadataProperties (cyclomatic 16) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:700— JsonSerializerInternalReader.ReadMetadataProperties 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.
JsonSerializerInternalReader.PopulateList (cyclomatic 16) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:1653— JsonSerializerInternalReader.PopulateList 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.
BarePragmaDisable repeated across 44 files Src/Newtonsoft.Json.Tests/Benchmarks/DeserializeComparisonBenchmarks.cs:315— The identical BarePragmaDisable (`#pragma warning disable 618`) appears in 44 files (69 occurrences) — a single repo-wide policy (e.g. a Directory.Build.props decision or an idiomatic suppression), not 69 independent debts. Decide it once centrally rather than file-by-file. (Every occurrence still counts toward the score and metrics.)
JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters (cognitive 144) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:1987— JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters has cognitive complexity 144 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
ConvertUtils.DecimalTryParse (cognitive 123) Src/Newtonsoft.Json/Utilities/ConvertUtils.cs:1309— ConvertUtils.DecimalTryParse has cognitive complexity 123 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonTextReader.ParseReadNumber (cognitive 95) Src/Newtonsoft.Json/JsonTextReader.cs:1981— JsonTextReader.ParseReadNumber has cognitive complexity 95 (threshold 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.
JavaScriptUtils.WriteEscapedJavaScriptString (cognitive 89) Src/Newtonsoft.Json/Utilities/JavaScriptUtils.cs:147— JavaScriptUtils.WriteEscapedJavaScriptString has cognitive complexity 89 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
XmlNodeConverter.SerializeNode (cognitive 67) Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs:1295— XmlNodeConverter.SerializeNode has cognitive complexity 67 (threshold 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.
XmlNodeConverter.ReadAttributeElements (cognitive 65) Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs:1875— XmlNodeConverter.ReadAttributeElements has cognitive complexity 65 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonWriter.WriteValueAsync (cognitive 63) Src/Newtonsoft.Json/JsonWriter.Async.cs:1694— JsonWriter.WriteValueAsync has cognitive complexity 63 (threshold 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.
JsonWriter.WriteValue (cognitive 63) Src/Newtonsoft.Json/JsonWriter.cs:1478— JsonWriter.WriteValue has cognitive complexity 63 (threshold 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.
JsonSerializerInternalReader.PopulateObject (cognitive 59) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:2388— JsonSerializerInternalReader.PopulateObject has cognitive complexity 59 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JPath.ParseArrayIndexer (cognitive 55) Src/Newtonsoft.Json/Linq/JsonPath/JPath.cs:231— JPath.ParseArrayIndexer has cognitive complexity 55 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonSchemaBuilder.ResolveReferences (cognitive 54) Src/Newtonsoft.Json/Schema/JsonSchemaBuilder.cs:98— JsonSchemaBuilder.ResolveReferences has cognitive complexity 54 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonSerializerInternalReader.CreateObject (cognitive 54) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:435— JsonSerializerInternalReader.CreateObject has cognitive complexity 54 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonSerializerInternalReader.ResolvePropertyAndCreatorValues (cognitive 53) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:2242— JsonSerializerInternalReader.ResolvePropertyAndCreatorValues has cognitive complexity 53 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonSerializerInternalReader.PopulateMultidimensionalArray (cognitive 50) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:1501— JsonSerializerInternalReader.PopulateMultidimensionalArray has cognitive complexity 50 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonSerializerInternalReader.PopulateDictionary (cognitive 48) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:1376— JsonSerializerInternalReader.PopulateDictionary has cognitive complexity 48 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
ConvertUtils.TryConvertInternal (cognitive 48) Src/Newtonsoft.Json/Utilities/ConvertUtils.cs:420— ConvertUtils.TryConvertInternal has cognitive complexity 48 (threshold 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.
XmlNodeConverter.DeserializeNode (cognitive 47) Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs:2087— XmlNodeConverter.DeserializeNode has cognitive complexity 47 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
XmlNodeConverter.SerializeGroupedNodes (cognitive 46) Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs:1141— XmlNodeConverter.SerializeGroupedNodes has cognitive complexity 46 (threshold 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.
JsonTextReader.ReadStringIntoBufferAsync (cognitive 46) Src/Newtonsoft.Json/JsonTextReader.Async.cs:383— JsonTextReader.ReadStringIntoBufferAsync has cognitive complexity 46 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonTextReader.ReadStringIntoBuffer (cognitive 46) Src/Newtonsoft.Json/JsonTextReader.cs:1136— JsonTextReader.ReadStringIntoBuffer has cognitive complexity 46 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonSerializerInternalReader.CreateDynamic (cognitive 45) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:1859— JsonSerializerInternalReader.CreateDynamic has cognitive complexity 45 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonValidatingReader.WriteToken (cognitive 44) Src/Newtonsoft.Json/JsonValidatingReader.cs:617— JsonValidatingReader.WriteToken has cognitive complexity 44 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonSchemaGenerator.GenerateInternal (cognitive 44) Src/Newtonsoft.Json/Schema/JsonSchemaGenerator.cs:246— JsonSchemaGenerator.GenerateInternal has cognitive complexity 44 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonTextReader.ReadStringValueAsync (cognitive 43) Src/Newtonsoft.Json/JsonTextReader.Async.cs:1167— JsonTextReader.ReadStringValueAsync has cognitive complexity 43 (threshold 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.
JsonTextReader.ReadStringValue (cognitive 43) Src/Newtonsoft.Json/JsonTextReader.cs:603— JsonTextReader.ReadStringValue has cognitive complexity 43 (threshold 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.
JPath.ParsePath (cognitive 43) Src/Newtonsoft.Json/Linq/JsonPath/JPath.cs:93— JPath.ParsePath has cognitive complexity 43 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonSerializerInternalReader.ReadMetadataPropertiesToken (cognitive 43) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:611— JsonSerializerInternalReader.ReadMetadataPropertiesToken has cognitive complexity 43 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
ArraySliceFilter.ExecuteFilter (cognitive 42) Src/Newtonsoft.Json/Linq/JsonPath/ArraySliceFilter.cs:14— ArraySliceFilter.ExecuteFilter has cognitive complexity 42 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonSerializerInternalReader.ReadMetadataProperties (cognitive 41) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:700— JsonSerializerInternalReader.ReadMetadataProperties has cognitive complexity 41 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JavaScriptUtils.WriteDefinitelyEscapedJavaScriptStringWithoutDelimitersAsync (cognitive 41) Src/Newtonsoft.Json/Utilities/JavaScriptUtils.cs:437— JavaScriptUtils.WriteDefinitelyEscapedJavaScriptStringWithoutDelimitersAsync has cognitive complexity 41 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JValue.Compare (cognitive 39) Src/Newtonsoft.Json/Linq/JValue.cs:255— JValue.Compare has cognitive complexity 39 (threshold 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.
JsonTextReader.ParseCommentAsync (cognitive 38) Src/Newtonsoft.Json/JsonTextReader.Async.cs:660— JsonTextReader.ParseCommentAsync has cognitive complexity 38 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonTextReader.ParseComment (cognitive 38) Src/Newtonsoft.Json/JsonTextReader.cs:2263— JsonTextReader.ParseComment has cognitive complexity 38 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
MathUtils.IntLength (cognitive 38) Src/Newtonsoft.Json/Utilities/MathUtils.cs:34— MathUtils.IntLength has cognitive complexity 38 (threshold 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.
JPath.ParseExpression (cognitive 36) Src/Newtonsoft.Json/Linq/JsonPath/JPath.cs:488— JPath.ParseExpression has cognitive complexity 36 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
DefaultContractResolver.SetPropertySettingsFromAttributes (cognitive 36) Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs:1477— DefaultContractResolver.SetPropertySettingsFromAttributes has cognitive complexity 36 (threshold 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.
JsonSerializerInternalReader.EndProcessProperty (cognitive 35) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:2597— JsonSerializerInternalReader.EndProcessProperty has cognitive complexity 35 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonSerializerInternalWriter.SerializeDynamic (cognitive 35) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:934— JsonSerializerInternalWriter.SerializeDynamic has cognitive complexity 35 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
ReflectionUtils.GetChildPrivateProperties (cognitive 35) Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs:1021— ReflectionUtils.GetChildPrivateProperties has cognitive complexity 35 (threshold 15). Of this number, 33 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonTextReader.ReadAsBoolean (cognitive 34) Src/Newtonsoft.Json/JsonTextReader.cs:770— JsonTextReader.ReadAsBoolean has cognitive complexity 34 (threshold 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.
JContainer.MergeEnumerableContent (cognitive 34) Src/Newtonsoft.Json/Linq/JContainer.cs:1184— JContainer.MergeEnumerableContent has cognitive complexity 34 (threshold 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.
BooleanQueryExpression.MatchTokens (cognitive 34) Src/Newtonsoft.Json/Linq/JsonPath/QueryExpression.cs:145— BooleanQueryExpression.MatchTokens has cognitive complexity 34 (threshold 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.
DefaultContractResolver.GetSerializableMembers (cognitive 34) Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs:228— DefaultContractResolver.GetSerializableMembers has cognitive 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, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonSerializerInternalReader.CreateList (cognitive 34) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:857— JsonSerializerInternalReader.CreateList has cognitive complexity 34 (threshold 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.
JsonTextReader.ParseValue (cognitive 33) Src/Newtonsoft.Json/JsonTextReader.cs:1693— JsonTextReader.ParseValue has cognitive complexity 33 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JValue.Operation (cognitive 33) Src/Newtonsoft.Json/Linq/JValue.cs:421— JValue.Operation has cognitive complexity 33 (threshold 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.
DateTimeParser.ParseZone (cognitive 33) Src/Newtonsoft.Json/Utilities/DateTimeParser.cs:175— DateTimeParser.ParseZone has cognitive complexity 33 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonWriter.InternalWriteEndAsync (cognitive 32) Src/Newtonsoft.Json/JsonWriter.Async.cs:291— JsonWriter.InternalWriteEndAsync has cognitive complexity 32 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonArrayContract.JsonArrayContract.ctor (cognitive 32) Src/Newtonsoft.Json/Serialization/JsonArrayContract.cs:120— JsonArrayContract.JsonArrayContract.ctor has cognitive complexity 32 (threshold 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.
JsonSerializer.ApplySerializerSettings (cognitive 31) Src/Newtonsoft.Json/JsonSerializer.cs:653— JsonSerializer.ApplySerializerSettings has cognitive complexity 31 (threshold 15). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
JsonTextReader.ParseValueAsync (cognitive 31) Src/Newtonsoft.Json/JsonTextReader.Async.cs:252— JsonTextReader.ParseValueAsync has cognitive complexity 31 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
EnumUtils.ParseEnum (cognitive 31) Src/Newtonsoft.Json/Utilities/EnumUtils.cs:259— EnumUtils.ParseEnum has cognitive complexity 31 (threshold 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.
JsonTextReader.DoReadAsBooleanAsync (cognitive 30) Src/Newtonsoft.Json/JsonTextReader.Async.cs:1430— JsonTextReader.DoReadAsBooleanAsync has cognitive complexity 30 (threshold 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.
JsonTextReader.DoReadAsBytesAsync (cognitive 30) Src/Newtonsoft.Json/JsonTextReader.Async.cs:1566— JsonTextReader.DoReadAsBytesAsync has cognitive complexity 30 (threshold 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.
JsonTextReader.ReadAsBytes (cognitive 30) Src/Newtonsoft.Json/JsonTextReader.cs:497— JsonTextReader.ReadAsBytes has cognitive complexity 30 (threshold 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.
JsonSerializerInternalReader.PopulateList (cognitive 30) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:1653— JsonSerializerInternalReader.PopulateList has cognitive complexity 30 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
ConvertUtils.Int32TryParse (cognitive 30) Src/Newtonsoft.Json/Utilities/ConvertUtils.cs:694— ConvertUtils.Int32TryParse has cognitive complexity 30 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
ParametersMatchComparer.Compare (cognitive 30) Src/Newtonsoft.Json/Utilities/MethodBinder.cs:199— ParametersMatchComparer.Compare has cognitive complexity 30 (threshold 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.
JsonPropertyCollection.AddProperty (cognitive 29) Src/Newtonsoft.Json/Serialization/JsonPropertyCollection.cs:74— JsonPropertyCollection.AddProperty has cognitive complexity 29 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonSerializerInternalReader.EnsureType (cognitive 29) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:957— JsonSerializerInternalReader.EnsureType has cognitive complexity 29 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
DynamicReflectionDelegateFactory.GenerateCreateMethodCallIL (cognitive 29) Src/Newtonsoft.Json/Utilities/DynamicReflectionDelegateFactory.cs:76— DynamicReflectionDelegateFactory.GenerateCreateMethodCallIL has cognitive complexity 29 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
ConvertUtils.Int64TryParse (cognitive 28) Src/Newtonsoft.Json/Utilities/ConvertUtils.cs:788— ConvertUtils.Int64TryParse has cognitive complexity 28 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
BsonReader.ReadNormal (cognitive 27) Src/Newtonsoft.Json/Bson/BsonReader.cs:346— BsonReader.ReadNormal has cognitive complexity 27 (threshold 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.
JsonTextReader.ReadNumberValueAsync (cognitive 27) Src/Newtonsoft.Json/JsonTextReader.Async.cs:1303— JsonTextReader.ReadNumberValueAsync has cognitive complexity 27 (threshold 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.
JsonTextReader.ReadNumberValue (cognitive 27) Src/Newtonsoft.Json/JsonTextReader.cs:908— JsonTextReader.ReadNumberValue has cognitive complexity 27 (threshold 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.
JsonTextReader.ParseConstructor (cognitive 27) Src/Newtonsoft.Json/JsonTextReader.cs:1878— JsonTextReader.ParseConstructor has cognitive complexity 27 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JToken.RemoveAnnotations (cognitive 27) Src/Newtonsoft.Json/Linq/JToken.cs:2791— JToken.RemoveAnnotations has cognitive complexity 27 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
StringUtils.ToSeparatedCase (cognitive 27) Src/Newtonsoft.Json/Utilities/StringUtils.cs:218— StringUtils.ToSeparatedCase has cognitive complexity 27 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JContainer.ReadContentFromAsync (cognitive 26) Src/Newtonsoft.Json/Linq/JContainer.Async.cs:57— JContainer.ReadContentFromAsync has cognitive complexity 26 (threshold 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.
JContainer.ReadContentFrom (cognitive 26) Src/Newtonsoft.Json/Linq/JContainer.cs:796— JContainer.ReadContentFrom has cognitive complexity 26 (threshold 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.
JToken.RemoveAnnotations (cognitive 26) Src/Newtonsoft.Json/Linq/JToken.cs:2741— JToken.RemoveAnnotations has cognitive complexity 26 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JValue.WriteToAsync (cognitive 26) Src/Newtonsoft.Json/Linq/JValue.Async.cs:49— JValue.WriteToAsync has cognitive complexity 26 (threshold 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.
DefaultSerializationBinder.GetTypeFromTypeNameKey (cognitive 26) Src/Newtonsoft.Json/Serialization/DefaultSerializationBinder.cs:59— DefaultSerializationBinder.GetTypeFromTypeNameKey has cognitive complexity 26 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
MethodBinder.FilterParameters (cognitive 26) Src/Newtonsoft.Json/Utilities/MethodBinder.cs:112— MethodBinder.FilterParameters has cognitive complexity 26 (threshold 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.
JsonTextReader.ParseConstructorAsync (cognitive 25) Src/Newtonsoft.Json/JsonTextReader.Async.cs:861— JsonTextReader.ParseConstructorAsync has cognitive complexity 25 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonTextReader.ParseReadString (cognitive 25) Src/Newtonsoft.Json/JsonTextReader.cs:166— JsonTextReader.ParseReadString has cognitive complexity 25 (threshold 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.
JPath.TryParseValue (cognitive 25) Src/Newtonsoft.Json/Linq/JsonPath/JPath.cs:575— JPath.TryParseValue has cognitive complexity 25 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonSerializerInternalWriter.CalculatePropertyValues (cognitive 25) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:554— JsonSerializerInternalWriter.CalculatePropertyValues has cognitive complexity 25 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
DateTimeUtils.TryParseDateTimeOffset (cognitive 25) Src/Newtonsoft.Json/Utilities/DateTimeUtils.cs:453— DateTimeUtils.TryParseDateTimeOffset has cognitive complexity 25 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
ReflectionObject.Create (cognitive 25) Src/Newtonsoft.Json/Utilities/ReflectionObject.cs:93— ReflectionObject.Create has cognitive complexity 25 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonSerializer.SerializeInternal (cognitive 24) Src/Newtonsoft.Json/JsonSerializer.cs:1089— JsonSerializer.SerializeInternal has cognitive complexity 24 (threshold 15). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
JsonValidatingReader.ValidateInteger (cognitive 24) Src/Newtonsoft.Json/JsonValidatingReader.cs:787— JsonValidatingReader.ValidateInteger has cognitive complexity 24 (threshold 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.
JToken.ToObject (cognitive 24) Src/Newtonsoft.Json/Linq/JToken.cs:2015— JToken.ToObject has cognitive complexity 24 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JValue.WriteTo (cognitive 24) Src/Newtonsoft.Json/Linq/JValue.cs:730— JValue.WriteTo has cognitive complexity 24 (threshold 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.
ExpressionReflectionDelegateFactory.BuildMethodCall (cognitive 24) Src/Newtonsoft.Json/Utilities/ExpressionReflectionDelegateFactory.cs:94— ExpressionReflectionDelegateFactory.BuildMethodCall has cognitive complexity 24 (threshold 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.
DataTableConverter.CreateRow (cognitive 23) Src/Newtonsoft.Json/Converters/DataTableConverter.cs:139— DataTableConverter.CreateRow has cognitive complexity 23 (threshold 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.
JsonTextReader.ParsePostValueAsync (cognitive 23) Src/Newtonsoft.Json/JsonTextReader.Async.cs:112— JsonTextReader.ParsePostValueAsync has cognitive complexity 23 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonTextReader.ParsePostValue (cognitive 23) Src/Newtonsoft.Json/JsonTextReader.cs:1440— JsonTextReader.ParsePostValue has cognitive complexity 23 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonSchemaWriter.WriteSchema (cognitive 23) Src/Newtonsoft.Json/Schema/JsonSchemaWriter.cs:73— JsonSchemaWriter.WriteSchema has cognitive complexity 23 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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.
DefaultContractResolver.GetCallbackMethodsForType (cognitive 23) Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs:870— DefaultContractResolver.GetCallbackMethodsForType has cognitive complexity 23 (threshold 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.
JsonSerializerInternalWriter.SerializeObject (cognitive 23) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:476— JsonSerializerInternalWriter.SerializeObject has cognitive complexity 23 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonSerializer.SetupReader (cognitive 22) Src/Newtonsoft.Json/JsonSerializer.cs:918— JsonSerializer.SetupReader has cognitive complexity 22 (threshold 15). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DefaultContractResolver.CreateObjectContract (cognitive 22) Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs:343— DefaultContractResolver.CreateObjectContract has cognitive complexity 22 (threshold 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.
JsonSerializerInternalWriter.CheckForCircularReference (cognitive 22) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:306— JsonSerializerInternalWriter.CheckForCircularReference has cognitive complexity 22 (threshold 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.
IsoDateTimeConverter.ReadJson (cognitive 21) Src/Newtonsoft.Json/Converters/IsoDateTimeConverter.cs:121— IsoDateTimeConverter.ReadJson has cognitive complexity 21 (threshold 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.
JsonDictionaryContract.JsonDictionaryContract.ctor (cognitive 21) Src/Newtonsoft.Json/Serialization/JsonDictionaryContract.cs:116— JsonDictionaryContract.JsonDictionaryContract.ctor has cognitive complexity 21 (threshold 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.
JsonSerializerInternalReader.CalculatePropertyDetails (cognitive 21) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:1100— JsonSerializerInternalReader.CalculatePropertyDetails has cognitive complexity 21 (threshold 15). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. 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.
JsonSerializerInternalWriter.SerializeMultidimensionalArray (cognitive 21) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:792— JsonSerializerInternalWriter.SerializeMultidimensionalArray has cognitive complexity 21 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
DateTimeUtils.TryParseDateTimeOffset (cognitive 21) Src/Newtonsoft.Json/Utilities/DateTimeUtils.cs:417— DateTimeUtils.TryParseDateTimeOffset has cognitive complexity 21 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
DiscriminatedUnionConverter.ReadJson (cognitive 20) Src/Newtonsoft.Json/Converters/DiscriminatedUnionConverter.cs:172— DiscriminatedUnionConverter.ReadJson has cognitive complexity 20 (threshold 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.
XElementWrapper.HasImplicitNamespaceAttribute (cognitive 20) Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs:883— XElementWrapper.HasImplicitNamespaceAttribute has cognitive complexity 20 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonValidatingReader.ValidateCurrentToken (cognitive 20) Src/Newtonsoft.Json/JsonValidatingReader.cs:500— JsonValidatingReader.ValidateCurrentToken has cognitive complexity 20 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
ArrayIndexFilter.ExecuteFilter (cognitive 20) Src/Newtonsoft.Json/Linq/JsonPath/ArrayIndexFilter.cs:11— ArrayIndexFilter.ExecuteFilter has cognitive complexity 20 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
FieldFilter.ExecuteFilter (cognitive 20) Src/Newtonsoft.Json/Linq/JsonPath/FieldFilter.cs:16— FieldFilter.ExecuteFilter has cognitive complexity 20 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
ScanFilter.ExecuteFilter (cognitive 20) Src/Newtonsoft.Json/Linq/JsonPath/ScanFilter.cs:14— ScanFilter.ExecuteFilter has cognitive complexity 20 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
DefaultSerializationBinder.GetGenericTypeFromTypeName (cognitive 20) Src/Newtonsoft.Json/Serialization/DefaultSerializationBinder.cs:133— DefaultSerializationBinder.GetGenericTypeFromTypeName has cognitive complexity 20 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonSerializerInternalReader.Populate (cognitive 20) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:67— JsonSerializerInternalReader.Populate has cognitive complexity 20 (threshold 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.
JsonSerializerInternalReader.SetPropertyValue (cognitive 20) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:1030— JsonSerializerInternalReader.SetPropertyValue has cognitive complexity 20 (threshold 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.
JsonSerializerInternalReader.CreateNewList (cognitive 20) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:1238— JsonSerializerInternalReader.CreateNewList has cognitive complexity 20 (threshold 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.
DateTimeParser.ParseTime (cognitive 20) Src/Newtonsoft.Json/Utilities/DateTimeParser.cs:123— DateTimeParser.ParseTime has cognitive complexity 20 (threshold 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.
BsonReader.ReadString (cognitive 19) Src/Newtonsoft.Json/Bson/BsonReader.cs:589— BsonReader.ReadString has cognitive complexity 19 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonTextReader.PrepareBufferForReadData (cognitive 19) Src/Newtonsoft.Json/JsonTextReader.cs:281— JsonTextReader.PrepareBufferForReadData has cognitive complexity 19 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JToken.Annotation (cognitive 19) Src/Newtonsoft.Json/Linq/JToken.cs:2619— JToken.Annotation has cognitive complexity 19 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonSerializerInternalReader.Deserialize (cognitive 19) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs:144— JsonSerializerInternalReader.Deserialize has cognitive complexity 19 (threshold 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.
FieldMultipleFilter.ExecuteFilter (cognitive 18) Src/Newtonsoft.Json/Linq/JsonPath/FieldMultipleFilter.cs:21— FieldMultipleFilter.ExecuteFilter has cognitive complexity 18 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
ScanMultipleFilter.ExecuteFilter (cognitive 18) Src/Newtonsoft.Json/Linq/JsonPath/ScanMultipleFilter.cs:14— ScanMultipleFilter.ExecuteFilter has cognitive complexity 18 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JTokenWriter.WriteToken (cognitive 18) Src/Newtonsoft.Json/Linq/JTokenWriter.cs:498— JTokenWriter.WriteToken has cognitive complexity 18 (threshold 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.
JsonSerializerInternalWriter.SerializeDictionary (cognitive 18) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:1081— JsonSerializerInternalWriter.SerializeDictionary has cognitive complexity 18 (threshold 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.
JavaScriptUtils.TryGetDateFromConstructorJson (cognitive 18) Src/Newtonsoft.Json/Utilities/JavaScriptUtils.cs:572— JavaScriptUtils.TryGetDateFromConstructorJson has cognitive complexity 18 (threshold 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.
ReflectionUtils.GetFieldsAndProperties (cognitive 18) Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs:668— ReflectionUtils.GetFieldsAndProperties has cognitive complexity 18 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
ParametersMatchComparer.ChooseMorePreciseType (cognitive 18) Src/Newtonsoft.Json/Utilities/MethodBinder.cs:273— ParametersMatchComparer.ChooseMorePreciseType has cognitive complexity 18 (threshold 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.
XmlNodeConverter.PushParentNamespaces (cognitive 17) Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs:1033— XmlNodeConverter.PushParentNamespaces has cognitive complexity 17 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonTextReader.Read (cognitive 17) Src/Newtonsoft.Json/JsonTextReader.cs:414— JsonTextReader.Read has cognitive complexity 17 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonValidatingReader.ValidateFloat (cognitive 17) Src/Newtonsoft.Json/JsonValidatingReader.cs:878— JsonValidatingReader.ValidateFloat has cognitive complexity 17 (threshold 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.
Extensions.Values (cognitive 17) Src/Newtonsoft.Json/Linq/Extensions.cs:184— Extensions.Values has cognitive complexity 17 (threshold 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.
JsonSerializerInternalWriter.ShouldWriteType (cognitive 17) Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:1037— JsonSerializerInternalWriter.ShouldWriteType has cognitive complexity 17 (threshold 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.
JsonTypeReflector.GetAttribute (cognitive 17) Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs:385— JsonTypeReflector.GetAttribute has cognitive complexity 17 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
BsonReader.GetString (cognitive 16) Src/Newtonsoft.Json/Bson/BsonReader.cs:665— BsonReader.GetString has cognitive complexity 16 (threshold 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.
JsonTextReader.EatWhitespaceAsync (cognitive 16) Src/Newtonsoft.Json/JsonTextReader.Async.cs:758— JsonTextReader.EatWhitespaceAsync has cognitive complexity 16 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonTextReader.EatWhitespace (cognitive 16) Src/Newtonsoft.Json/JsonTextReader.cs:1835— JsonTextReader.EatWhitespace has cognitive complexity 16 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JsonWriter.AutoCompleteAsync (cognitive 16) Src/Newtonsoft.Json/JsonWriter.Async.cs:54— JsonWriter.AutoCompleteAsync has cognitive complexity 16 (threshold 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.
JPath.ParseQuotedField (cognitive 16) Src/Newtonsoft.Json/Linq/JsonPath/JPath.cs:823— JPath.ParseQuotedField has cognitive complexity 16 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
JValue.GetValueType (cognitive 16) Src/Newtonsoft.Json/Linq/JValue.cs:611— JValue.GetValueType has cognitive complexity 16 (threshold 15). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DefaultContractResolver.SetExtensionDataDelegates (cognitive 16) Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs:494— DefaultContractResolver.SetExtensionDataDelegates has cognitive complexity 16 (threshold 15). Of this number, 9 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.
DefaultContractResolver.GetImmutableConstructor (cognitive 16) Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs:632— DefaultContractResolver.GetImmutableConstructor has cognitive complexity 16 (threshold 15). To reduce it, flatten the nesting: invert conditions into early returns or guard clauses so the happy path stays at one level, and lift the deepest nested block into its own named function.
EnumUtils.InternalFlagsFormat (cognitive 16) Src/Newtonsoft.Json/Utilities/EnumUtils.cs:159— EnumUtils.InternalFlagsFormat has cognitive complexity 16 (threshold 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.
LLM evaluation failed — JSON parse error: Expected end of string, but instead reached end of data. Path: $.notable[4].suggestion | LineNumber: 0 | BytePositionInLine: 1008.
Unpinned build actions — CI references GitHub Actions by a floating ref (@main / @tag) rather than a pinned commit SHA, weakening build integrity. 3 floating ref(s) across 1 workflow file(s). Each floating ref is itemized at file:line by the SAST (D29) lens.
Duplicated block (22 lines × 2) Src/Newtonsoft.Json/JsonTextReader.cs:1523— Src/Newtonsoft.Json/JsonTextReader.cs:1523-1544 | Src/Newtonsoft.Json/JsonTextReader.cs:1694-1715 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Src/Newtonsoft.Json/JsonTextReader.cs:1523` it does not close everything it opens, so those 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) Src/Newtonsoft.Json/JsonTextReader.cs:619— Src/Newtonsoft.Json/JsonTextReader.cs:619-637 | Src/Newtonsoft.Json/JsonTextReader.cs:924-942 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Src/Newtonsoft.Json/JsonTextReader.cs:619` it begins part-way through the construct above it, so those 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 × 4) Src/Newtonsoft.Json/Linq/JValue.cs:444— Src/Newtonsoft.Json/Linq/JValue.cs:444-458 | Src/Newtonsoft.Json/Linq/JValue.cs:477-491 | Src/Newtonsoft.Json/Linq/JValue.cs:508-522 | Src/Newtonsoft.Json/Linq/JValue.cs:540-554 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Src/Newtonsoft.Json/Linq/JValue.cs:444` it does not close everything it opens, so those 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) Src/Newtonsoft.Json/Linq/JValue.cs:272— Src/Newtonsoft.Json/Linq/JValue.cs:272-286 | Src/Newtonsoft.Json/Linq/JValue.cs:297-311 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Src/Newtonsoft.Json/Linq/JValue.cs: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 transfer control out of the body holding them, 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) Src/Newtonsoft.Json/JsonReader.cs:288— Src/Newtonsoft.Json/JsonReader.cs:288-300 | Src/Newtonsoft.Json/JsonWriter.cs:209-221 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Src/Newtonsoft.Json/JsonReader.cs:288` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, 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) Src/Newtonsoft.Json/JsonTextReader.cs:2080— Src/Newtonsoft.Json/JsonTextReader.cs:2080-2091 | Src/Newtonsoft.Json/JsonTextReader.cs:2119-2130 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Src/Newtonsoft.Json/JsonTextReader.cs:2080` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) Src/Newtonsoft.Json/JsonTextReader.cs:2100— Src/Newtonsoft.Json/JsonTextReader.cs:2100-2109 | Src/Newtonsoft.Json/JsonTextReader.cs:2206-2215 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Src/Newtonsoft.Json/JsonTextReader.cs: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.
Duplicated block (7 lines × 2) Src/Newtonsoft.Json/Linq/JsonPath/QueryExpression.cs:254— Src/Newtonsoft.Json/Linq/JsonPath/QueryExpression.cs:254-260 | Src/Newtonsoft.Json/Linq/JsonPath/QueryExpression.cs:313-320 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Coverage not measured — analyzer environment — Coverage NOT MEASURED: the analyzer environment could not build/run the test suite (a target framework / SDK band or targeting pack the analyzer image doesn't carry). This is OUR limitation, not a defect in the repo — coverage is excluded from the score rather than counted as a near-zero. We track the analyzer-image gap so it can be closed; in the meantime, no coverage collector was found in your CI either, so there is no existing report to hand us — add a collector to your test run and commit (or publish into the working tree) its Cobertura/OpenCover/lcov output, and real coverage will be read.
Recommendation — 10 finding(s)
D11 · Test Reliability· Test runner surfaced no tests · ×1
Test runner surfaced no tests — Test reliability not scored — the test tier(s) ran but surfaced none of this repository's 25855 test method(s) to the runner, so flakiness couldn't be exercised. This is an analysis-environment limitation, not a finding about the tests.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 2 significant file(s) lose their only recent owner: Src/Newtonsoft.Json/Linq/JToken.cs, Src/Newtonsoft.Json/JsonValidatingReader.cs. Pair on, review, or document these before any departure.
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 (3 single-owned of 115 analysed files in total, counted over production source files of roughly 100 lines or more, excluding tests, vendored, generated and example/demo trees, largest first). They are anonymized user #2 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above.
Thin analysable surface across projects — 1 project(s) carry only a thin slice of real code (e.g. `Newtonsoft.Json.TestConsole(net46)` with 20 significant line(s)). The mean analysable-surface weight is 93 %, lowering Solution Shape by about 0.57 point(s). Consolidate thin projects or grow them into substantial, well-scoped assemblies.
D23 · Boundary Type-Coupling· Bounded contexts not declared · ×1
Bounded contexts not declared — At 60k LoC across 21 projects the codebase is large and multi-module, so explicit bounded contexts are needed. Name this codebase's bounded contexts (≥2 module groups, e.g. per subsystem) so cross-boundary type coupling can be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion — 1 of 4 project(s) overshoot their size bounds, lowering Project Cohesion to 5.0/10. The most over is `Newtonsoft.Json(net8.0)` (60765 LoC, 144 public types across 6 namespaces). Review these for cohesion — draw the boundary inside the assembly first (group each responsibility into its own namespace/folder and keep the cross-boundary members internal), since splitting a published assembly moves types between packages and breaks consumers.
D34 · Knowledge Freshness· Further orphaned files (smaller) · ×1
Further orphaned files (smaller) — 16 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than listed individually (19 orphaned of 166 analysed files in total, counted over production source files of roughly 100 lines or more, excluding tests, vendored, generated and example/demo trees, largest first).
No build provenance — No SLSA provenance generation or build attestation found in CI — nothing binds a released artifact to the build that produced it, so a consumer cannot tell your artifact from a substituted one. Your release already signs its artifacts, so this is the remaining step rather than a new pipeline: attestation records HOW the artifact was built, which a signature over the finished file does not. Emit one from whichever pipeline releases the artifact — `cosign attest` (keyless or with your release key) records the build inputs against the artifact digest and needs nothing forge-specific; publish the attestation as a release asset alongside it.
D36 · Supply-chain Provenance & Signing· No SBOM · ×1
No SBOM — No SBOM generation or committed SBOM found — produce one with what your ecosystem ships (`sbom-tool generate` (install it with `dotnet tool install --global Microsoft.Sbom.DotNetTool`) or `dotnet CycloneDX` over the solution, `syft` (or `anchore/sbom-action` in CI) over the source tree or released image). Publish it as a release asset (`*.spdx.json` / `*.cdx.json`) so consumers can see what they are installing.
D22 · Internal API Consistency· No exposed public API · ×1
No exposed public API — No intentionally-exposed types (IsPackable or .Contracts) to evaluate.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Terraform, Kubernetes/Helm, CloudFormation); nothing to scan.
trivy: not applicable — No JS/npm manifest or lockfile found outside build output (package.json, package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb); no JS dependencies to scan.
disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
0
—
Run 019fd1d1-503c-7f0f-a67d-ad390ed6fdc3 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 14 · Warnings: 318 · Recommendations: 10 · Info: 3 — Appendix A · all findings · full markdown report.
Generated by Watchdog — deterministic code-health analysis. 05-08-2026 @ 12:06 UTC.
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.