Public report of ohs-foundation/android-fhir, published 17 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 17 November 2026, 21:20 UTC · Survey ID cd_398d244ae64e4d4a85ca73d6bd2c8663
ohs-foundation/android-fhir
Measured 17 November 2026, 21:12 UTC, at code version 28a5034
Bus factor is not measured: No living knowledge left to concentrate.
CAI scoreAt risk
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A medium codebase: 58,555 lines of product code in 16 projects, tests not counted · Estimated rebuild effort: about 0.9 person-years · Weakest lens: Maturity, 38.3
Findings by how serious they are
19 critical356 serious956 minor
8 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
17 November 2026, 21:12 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
51of 51 dimensions measured by tools.
699of 1331 findings point to an exact file and line, so you can open each one in the code. The other 632 concern the repository as a whole, such as missing documentation.
51dimensions across 6 lenses, read from 58,555 lines of product code in 16 projects.
ohs-foundation/android-fhir is rated At risk because critical security findings are open, most of them in the build pipeline. Its score is held back because 270 files are no longer known to anyone active in the project and the project keeps no record of its design decisions. It scores 53.4 out of 100, which the At risk rating leaves unchanged.
Maturity, at 38.3, is the weakest lens and counts most in the score. The best first step is recording design decisions, worth about 13.8 points. Having someone learn and document the 270 files no active contributor knows is another step, worth about 13.1 points. Raising Maturity to 70 would lift the score to about 65.1.
Fourteen pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Four known security holes in the packages the code depends on can be used by attackers, and one automatic update takes new releases before a bad one can be spotted. Pinning each tool to an exact version, updating the vulnerable packages and setting a waiting period for automatic updates would close these risks.
The product code is 58,555 lines, about €130,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Maturity rose from 38.3 to 70, the lowest score rated Strong, the score would rise from 53.4 to about 65.1.
Code composition: what the lines of code are
Product code 43%Tests 57%
Rebuild cost: about €130,000 · Estimate
Cost to rebuild
€44,000 to €220,000, for 736 to 2,336 hours of work, about 0.9 person-years for 1 to 2 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.7 at a score of 53. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Medium: 58,555 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with project.pbxproj.
Raises the score by about 13.8 points · Low effort · ADR Quality
2
Record your significant design decisions.
Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Where the investment is most exposed · Value at risk
This code would cost about €130,000 to build again, about 0.9 person-years of work. Its weakest lens is Maturity, at 38.3 (Weak). Maturity is about how well the project explains and looks after itself, which decides whether a new developer, or a new supplier, can take over. Because the weakest lens counts most in the score, work on Maturity also moves the score most.
Based on: the rebuild estimate · the Maturity grade · how much each lens counts
What to do: Start with the Maturity actions in Top priorities.
If you do one thing first · First action
Resolve the 1 No ADRs found finding(s) in ADR Quality. Of all the actions in this report, it raises the score most for the work it takes: about 13.8 points for low effort, because it clears the 1 ADR Quality findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 7.5 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 2% to 5% on every change. The history of the code shows how much it changes: about 56,299 lines over the last 90 days, which is about 228,324 lines a year. At that pace, the extra work comes to an estimated 11.4 to 76.1 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture — module dependency graph
Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.
Architecture: which parts of the code depend on which
The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.
186 modules, with 271 dependencies between them. 5 loops run through 35 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 146 more are left out to keep it readable.
Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
datacapture.contrib.views.barcode.mlkit.md.camera uses datacapture.contrib.views.barcode.mlkit.md, so a change to datacapture.contrib.views.barcode.mlkit.md can break datacapture.contrib.views.barcode.mlkit.md.camera, while a change to datacapture.contrib.views.barcode.mlkit.md.camera can't break datacapture.contrib.views.barcode.mlkit.md.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
9→33 datacapture.fhirpath uses datacapturepart of a loop✕
Connections
1 pair of types, where a type in datacapture.fhirpath uses a type in datacapture.
datacapture.fhirpath uses datacapture, so a change to datacapture can break datacapture.fhirpath, while a change to datacapture.fhirpath can't break datacapture.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
db.impl.entities uses db.impl.entities.LocalChangeEntity, so a change to db.impl.entities.LocalChangeEntity can break db.impl.entities, while a change to db.impl.entities can't break db.impl.entities.LocalChangeEntity.
Position
Below the diagonal: db.impl.entities uses a module listed above it, which is the healthy direction.
db.impl.entities uses index.entities, so a change to index.entities can break db.impl.entities, while a change to db.impl.entities can't break index.entities.
Position
Below the diagonal: db.impl.entities uses a module listed above it, which is the healthy direction.
search uses com.google.android.fhir, so a change to com.google.android.fhir can break search, while a change to search can't break com.google.android.fhir.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
workflow.activity.phase.Phase uses workflow.activity.phase, so a change to workflow.activity.phase can break workflow.activity.phase.Phase, while a change to workflow.activity.phase.Phase can't break workflow.activity.phase.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
datacapture.contrib.views.barcode.mlkit.md uses datacapture.contrib.views.barcode.mlkit.md.camera, so a change to datacapture.contrib.views.barcode.mlkit.md.camera can break datacapture.contrib.views.barcode.mlkit.md, while a change to datacapture.contrib.views.barcode.mlkit.md can't break datacapture.contrib.views.barcode.mlkit.md.camera.
Position
Below the diagonal: datacapture.contrib.views.barcode.mlkit.md uses a module listed above it, which is the healthy direction.
datacapture.enablement uses datacapture.fhirpath, so a change to datacapture.fhirpath can break datacapture.enablement, while a change to datacapture.enablement can't break datacapture.fhirpath.
Position
Below the diagonal: datacapture.enablement uses a module listed above it, which is the healthy direction.
16→33 datacapture.enablement uses datacapturepart of a loop✕
Connections
1 pair of types, where a type in datacapture.enablement uses a type in datacapture.
datacapture.enablement uses datacapture, so a change to datacapture can break datacapture.enablement, while a change to datacapture.enablement can't break datacapture.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
db.impl.dao uses db.impl.entities.LocalChangeEntity, so a change to db.impl.entities.LocalChangeEntity can break db.impl.dao, while a change to db.impl.dao can't break db.impl.entities.LocalChangeEntity.
Position
Below the diagonal: db.impl.dao uses a module listed above it, which is the healthy direction.
db.impl.dao uses com.google.android.fhir, so a change to com.google.android.fhir can break db.impl.dao, while a change to db.impl.dao can't break com.google.android.fhir.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
workflow.activity.phase uses workflow.activity.phase.Phase, so a change to workflow.activity.phase.Phase can break workflow.activity.phase, while a change to workflow.activity.phase can't break workflow.activity.phase.Phase.
Position
Below the diagonal: workflow.activity.phase uses a module listed above it, which is the healthy direction.
datacapture.validation uses datacapture.fhirpath, so a change to datacapture.fhirpath can break datacapture.validation, while a change to datacapture.validation can't break datacapture.fhirpath.
Position
Below the diagonal: datacapture.validation uses a module listed above it, which is the healthy direction.
datacapture.validation uses datacapture.enablement, so a change to datacapture.enablement can break datacapture.validation, while a change to datacapture.validation can't break datacapture.enablement.
Position
Below the diagonal: datacapture.validation uses a module listed above it, which is the healthy direction.
19→33 datacapture.validation uses datacapturepart of a loop✕
Connections
1 pair of types, where a type in datacapture.validation uses a type in datacapture.
datacapture.validation uses datacapture, so a change to datacapture can break datacapture.validation, while a change to datacapture.validation can't break datacapture.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
workflow.activity uses workflow.activity.resource.event, so a change to workflow.activity.resource.event can break workflow.activity, while a change to workflow.activity can't break workflow.activity.resource.event.
Position
Below the diagonal: workflow.activity uses a module listed above it, which is the healthy direction.
workflow.activity uses workflow.activity.resource.request, so a change to workflow.activity.resource.request can break workflow.activity, while a change to workflow.activity can't break workflow.activity.resource.request.
Position
Below the diagonal: workflow.activity uses a module listed above it, which is the healthy direction.
workflow.activity uses workflow.activity.phase, so a change to workflow.activity.phase can break workflow.activity, while a change to workflow.activity can't break workflow.activity.phase.
Position
Below the diagonal: workflow.activity uses a module listed above it, which is the healthy direction.
workflow.activity.phase.event.PerformPhase uses workflow.activity.resource.event, so a change to workflow.activity.resource.event can break workflow.activity.phase.event.PerformPhase, while a change to workflow.activity.phase.event.PerformPhase can't break workflow.activity.resource.event.
Position
Below the diagonal: workflow.activity.phase.event.PerformPhase uses a module listed above it, which is the healthy direction.
workflow.activity.phase.event.PerformPhase uses workflow.activity.resource.request, so a change to workflow.activity.resource.request can break workflow.activity.phase.event.PerformPhase, while a change to workflow.activity.phase.event.PerformPhase can't break workflow.activity.resource.request.
Position
Below the diagonal: workflow.activity.phase.event.PerformPhase uses a module listed above it, which is the healthy direction.
workflow.activity.phase.event.PerformPhase uses workflow.activity.phase.Phase, so a change to workflow.activity.phase.Phase can break workflow.activity.phase.event.PerformPhase, while a change to workflow.activity.phase.event.PerformPhase can't break workflow.activity.phase.Phase.
Position
Below the diagonal: workflow.activity.phase.event.PerformPhase uses a module listed above it, which is the healthy direction.
workflow.activity.phase.event.PerformPhase uses workflow.activity.phase, so a change to workflow.activity.phase can break workflow.activity.phase.event.PerformPhase, while a change to workflow.activity.phase.event.PerformPhase can't break workflow.activity.phase.
Position
Below the diagonal: workflow.activity.phase.event.PerformPhase uses a module listed above it, which is the healthy direction.
datacapture.views uses datacapture.validation, so a change to datacapture.validation can break datacapture.views, while a change to datacapture.views can't break datacapture.validation.
Position
Below the diagonal: datacapture.views uses a module listed above it, which is the healthy direction.
sync.upload.patch uses com.google.android.fhir, so a change to com.google.android.fhir can break sync.upload.patch, while a change to sync.upload.patch can't break com.google.android.fhir.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
datacapture.QuestionnaireAdapterItem uses datacapture.views, so a change to datacapture.views can break datacapture.QuestionnaireAdapterItem, while a change to datacapture.QuestionnaireAdapterItem can't break datacapture.views.
Position
Below the diagonal: datacapture.QuestionnaireAdapterItem uses a module listed above it, which is the healthy direction.
25→33 datacapture.QuestionnaireAdapterItem uses datacapturepart of a loop✕
Connections
7 pairs of types, where a type in datacapture.QuestionnaireAdapterItem uses a type in datacapture.
datacapture.QuestionnaireAdapterItem uses datacapture, so a change to datacapture can break datacapture.QuestionnaireAdapterItem, while a change to datacapture.QuestionnaireAdapterItem can't break datacapture.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
datacapture.extensions uses datacapture.validation, so a change to datacapture.validation can break datacapture.extensions, while a change to datacapture.extensions can't break datacapture.validation.
Position
Below the diagonal: datacapture.extensions uses a module listed above it, which is the healthy direction.
datacapture.extensions uses datacapture.views, so a change to datacapture.views can break datacapture.extensions, while a change to datacapture.extensions can't break datacapture.views.
Position
Below the diagonal: datacapture.extensions uses a module listed above it, which is the healthy direction.
26→33 datacapture.extensions uses datacapturepart of a loop✕
Connections
1 pair of types, where a type in datacapture.extensions uses a type in datacapture.
datacapture.extensions uses datacapture, so a change to datacapture can break datacapture.extensions, while a change to datacapture.extensions can't break datacapture.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
sync.upload.request uses sync.upload.patch, so a change to sync.upload.patch can break sync.upload.request, while a change to sync.upload.request can't break sync.upload.patch.
Position
Below the diagonal: sync.upload.request uses a module listed above it, which is the healthy direction.
27→35 sync.upload.request uses com.google.android.fhirpart of a loop✕
Connections
4 pairs of types, where a type in sync.upload.request uses a type in com.google.android.fhir.
sync.upload.request uses com.google.android.fhir, so a change to com.google.android.fhir can break sync.upload.request, while a change to sync.upload.request can't break com.google.android.fhir.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
datacapture.views.components uses datacapture.validation, so a change to datacapture.validation can break datacapture.views.components, while a change to datacapture.views.components can't break datacapture.validation.
Position
Below the diagonal: datacapture.views.components uses a module listed above it, which is the healthy direction.
datacapture.views.components uses datacapture.views, so a change to datacapture.views can break datacapture.views.components, while a change to datacapture.views.components can't break datacapture.views.
Position
Below the diagonal: datacapture.views.components uses a module listed above it, which is the healthy direction.
datacapture.views.components uses datacapture.QuestionnaireAdapterItem, so a change to datacapture.QuestionnaireAdapterItem can break datacapture.views.components, while a change to datacapture.views.components can't break datacapture.QuestionnaireAdapterItem.
Position
Below the diagonal: datacapture.views.components uses a module listed above it, which is the healthy direction.
datacapture.views.components uses datacapture.extensions, so a change to datacapture.extensions can break datacapture.views.components, while a change to datacapture.views.components can't break datacapture.extensions.
Position
Below the diagonal: datacapture.views.components uses a module listed above it, which is the healthy direction.
28→33 datacapture.views.components uses datacapturepart of a loop✕
Connections
2 pairs of types, where a type in datacapture.views.components uses a type in datacapture.
datacapture.views.components uses datacapture, so a change to datacapture can break datacapture.views.components, while a change to datacapture.views.components can't break datacapture.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
datacapture.views.compose uses datacapture.validation, so a change to datacapture.validation can break datacapture.views.compose, while a change to datacapture.views.compose can't break datacapture.validation.
Position
Below the diagonal: datacapture.views.compose uses a module listed above it, which is the healthy direction.
datacapture.views.compose uses datacapture.views, so a change to datacapture.views can break datacapture.views.compose, while a change to datacapture.views.compose can't break datacapture.views.
Position
Below the diagonal: datacapture.views.compose uses a module listed above it, which is the healthy direction.
datacapture.views.compose uses datacapture.QuestionnaireAdapterItem, so a change to datacapture.QuestionnaireAdapterItem can break datacapture.views.compose, while a change to datacapture.views.compose can't break datacapture.QuestionnaireAdapterItem.
Position
Below the diagonal: datacapture.views.compose uses a module listed above it, which is the healthy direction.
datacapture.views.compose uses datacapture.extensions, so a change to datacapture.extensions can break datacapture.views.compose, while a change to datacapture.views.compose can't break datacapture.extensions.
Position
Below the diagonal: datacapture.views.compose uses a module listed above it, which is the healthy direction.
29→31 datacapture.views.compose uses datacapture.views.factoriespart of a loop✕
Connections
2 pairs of types, where a type in datacapture.views.compose uses a type in datacapture.views.factories.
datacapture.views.compose uses datacapture.views.factories, so a change to datacapture.views.factories can break datacapture.views.compose, while a change to datacapture.views.compose can't break datacapture.views.factories.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
29→33 datacapture.views.compose uses datacapturepart of a loop✕
Connections
2 pairs of types, where a type in datacapture.views.compose uses a type in datacapture.
datacapture.views.compose uses datacapture, so a change to datacapture can break datacapture.views.compose, while a change to datacapture.views.compose can't break datacapture.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
sync.upload uses sync.upload.patch, so a change to sync.upload.patch can break sync.upload, while a change to sync.upload can't break sync.upload.patch.
Position
Below the diagonal: sync.upload uses a module listed above it, which is the healthy direction.
sync.upload uses sync.upload.request, so a change to sync.upload.request can break sync.upload, while a change to sync.upload can't break sync.upload.request.
Position
Below the diagonal: sync.upload uses a module listed above it, which is the healthy direction.
sync.upload uses com.google.android.fhir, so a change to com.google.android.fhir can break sync.upload, while a change to sync.upload can't break com.google.android.fhir.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
datacapture.views.factories uses datacapture.validation, so a change to datacapture.validation can break datacapture.views.factories, while a change to datacapture.views.factories can't break datacapture.validation.
Position
Below the diagonal: datacapture.views.factories uses a module listed above it, which is the healthy direction.
datacapture.views.factories uses datacapture.views, so a change to datacapture.views can break datacapture.views.factories, while a change to datacapture.views.factories can't break datacapture.views.
Position
Below the diagonal: datacapture.views.factories uses a module listed above it, which is the healthy direction.
datacapture.views.factories uses datacapture.views.components, so a change to datacapture.views.components can break datacapture.views.factories, while a change to datacapture.views.factories can't break datacapture.views.components.
Position
Below the diagonal: datacapture.views.factories uses a module listed above it, which is the healthy direction.
datacapture.views.factories uses datacapture.views.compose, so a change to datacapture.views.compose can break datacapture.views.factories, while a change to datacapture.views.factories can't break datacapture.views.compose.
Position
Below the diagonal: datacapture.views.factories uses a module listed above it, which is the healthy direction.
31→33 datacapture.views.factories uses datacapturepart of a loop✕
Connections
1 pair of types, where a type in datacapture.views.factories uses a type in datacapture.
datacapture.views.factories uses datacapture, so a change to datacapture can break datacapture.views.factories, while a change to datacapture.views.factories can't break datacapture.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
datacapture uses datacapture.fhirpath, so a change to datacapture.fhirpath can break datacapture, while a change to datacapture can't break datacapture.fhirpath.
Position
Below the diagonal: datacapture uses a module listed above it, which is the healthy direction.
datacapture uses datacapture.enablement, so a change to datacapture.enablement can break datacapture, while a change to datacapture can't break datacapture.enablement.
Position
Below the diagonal: datacapture uses a module listed above it, which is the healthy direction.
datacapture uses datacapture.validation, so a change to datacapture.validation can break datacapture, while a change to datacapture can't break datacapture.validation.
Position
Below the diagonal: datacapture uses a module listed above it, which is the healthy direction.
datacapture uses datacapture.views, so a change to datacapture.views can break datacapture, while a change to datacapture can't break datacapture.views.
Position
Below the diagonal: datacapture uses a module listed above it, which is the healthy direction.
datacapture uses datacapture.QuestionnaireAdapterItem, so a change to datacapture.QuestionnaireAdapterItem can break datacapture, while a change to datacapture can't break datacapture.QuestionnaireAdapterItem.
Position
Below the diagonal: datacapture uses a module listed above it, which is the healthy direction.
datacapture uses datacapture.extensions, so a change to datacapture.extensions can break datacapture, while a change to datacapture can't break datacapture.extensions.
Position
Below the diagonal: datacapture uses a module listed above it, which is the healthy direction.
datacapture uses datacapture.views.factories, so a change to datacapture.views.factories can break datacapture, while a change to datacapture can't break datacapture.views.factories.
Position
Below the diagonal: datacapture uses a module listed above it, which is the healthy direction.
sync.remote uses sync.upload.request, so a change to sync.upload.request can break sync.remote, while a change to sync.remote can't break sync.upload.request.
Position
Below the diagonal: sync.remote uses a module listed above it, which is the healthy direction.
com.google.android.fhir uses index, so a change to index can break com.google.android.fhir, while a change to com.google.android.fhir can't break index.
Position
Below the diagonal: com.google.android.fhir uses a module listed above it, which is the healthy direction.
com.google.android.fhir uses search, so a change to search can break com.google.android.fhir, while a change to com.google.android.fhir can't break search.
Position
Below the diagonal: com.google.android.fhir uses a module listed above it, which is the healthy direction.
com.google.android.fhir uses sync.upload, so a change to sync.upload can break com.google.android.fhir, while a change to com.google.android.fhir can't break sync.upload.
Position
Below the diagonal: com.google.android.fhir uses a module listed above it, which is the healthy direction.
com.google.android.fhir uses sync.remote, so a change to sync.remote can break com.google.android.fhir, while a change to com.google.android.fhir can't break sync.remote.
Position
Below the diagonal: com.google.android.fhir uses a module listed above it, which is the healthy direction.
catalog uses catalog.ComponentListViewModel, so a change to catalog.ComponentListViewModel can break catalog, while a change to catalog can't break catalog.ComponentListViewModel.
Position
Below the diagonal: catalog uses a module listed above it, which is the healthy direction.
catalog uses com.google.android.fhir, so a change to com.google.android.fhir can break catalog, while a change to catalog can't break com.google.android.fhir.
Position
Below the diagonal: catalog uses a module listed above it, which is the healthy direction.
db.impl uses db.impl.entities.LocalChangeEntity, so a change to db.impl.entities.LocalChangeEntity can break db.impl, while a change to db.impl can't break db.impl.entities.LocalChangeEntity.
Position
Below the diagonal: db.impl uses a module listed above it, which is the healthy direction.
db.impl uses com.google.android.fhir, so a change to com.google.android.fhir can break db.impl, while a change to db.impl can't break com.google.android.fhir.
Position
Below the diagonal: db.impl uses a module listed above it, which is the healthy direction.
testing uses com.google.android.fhir, so a change to com.google.android.fhir can break testing, while a change to testing can't break com.google.android.fhir.
Position
Below the diagonal: testing uses a module listed above it, which is the healthy direction.
workflow uses com.google.android.fhir, so a change to com.google.android.fhir can break workflow, while a change to workflow can't break com.google.android.fhir.
Position
Below the diagonal: workflow uses a module listed above it, which is the healthy direction.
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A05:2025 — Injection
15
High / Critical
A03:2025 — Software Supply Chain Failures
15
High / Critical
Roadmap
Top priorities: Resolve the 1 No ADRs found finding(s) in ADR Quality — start with project.pbxproj; Resolve the 270 Orphaned file finding(s) in Knowledge Freshness — start with build.gradle.kts (11), QuestionnaireFragment.kt (2), ExpressionEvaluator.kt (2); Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with project.pbxproj.
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Resolve the 2 REDACTED finding(s) charged to Static Analysis (SAST) — the other 12 are reported here at file:line but scored by D36 (supply-chain provenance), which charges them once.
Make sure a person approves each release. The release job names an environment, but its approval rules live in the code host's settings, where we can't see them. Check that a reviewer must approve each release, or publish releases as drafts first, so a bad build can be stopped before anyone downloads it.
Every finding carries one of four grades. Three say how serious it is. The fourth says this
survey could not settle it — and it is a grade, not a gap.
Critical — 19
A definite problem that already costs you something and drags the score down: a
missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here
tends to cause failures elsewhere.
Serious — 356
Likely wrong, but not failing yet. It degrades
the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to
carry for two years either.
Minor — 956
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 8
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 51 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.
Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.
What we checked — 51 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, 699 of 1331 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D12 Dependency Hygiene — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Currency was graded against Maven Central, but whether an artifact is DEPRECATED is not: Maven Central publishes no deprecation marker, exactly as rubygems.org does not. Whether one is UNMAINTAINED is not graded either — no registry publishes a maintenance status, and release age does not stand in for one. Two of this dimension's four signals are therefore unread on a Gradle tree, and its score reflects currency alone.
D13 Secret Scanning — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Secret Scanning couldn't be assessed within its 5-minute budget on a solution this large — not included in this run.
D16 Bus Factor — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. All 273 significant source file(s) were last meaningfully changed so long ago that no living knowledge remains — nothing since has been substantial enough to re-establish ownership (a broad, mechanical sweep that touches many files shallowly does not count, and neither does no activity at all). There is no concentration to measure, so the bus factor is not scored. This is not a clean bill: nobody currently holds working knowledge of this code (see D34 Knowledge Freshness). Counted over 273 of the 495 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
D19 Documentation Quality — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is an ADMISSION gap, not an environment fault: it declares a published package (workflow-testing/build.gradle.kts), but no published-package marker D22 reads admitted any project here. D22 DOES collect the public API of every language in this tree, and admits a project only when its manifest makes that ecosystem's publication act in a form the marker recognises — so what is missing is not a collector but an admission rule for the publication act this repository makes, if it makes one. The remedy is a better discriminator for that marker — not a collector, and no change to the scan image can close it. The marker's rules are measured to refuse applications, so one refused repository is the rule working as calibrated; several are the evidence that it is too strict.
D24 Comment Value — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `catalog/src/main/java/com/google/android/fhir/catalog/LayoutListViewModel.kt`, `contrib/barcode/src/main/java/com/google/android/fhir/datacapture/contrib/views/barcode/mlkit/md/Utils.kt`, `contrib/locationwidget/src/main/java/com/google/android/fhir/datacapture/contrib/views/locationwidget/CurrentLocationDialogFragment.kt`, `datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt`, `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/DataCaptureConfig.kt`, … (+64 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
C2 Access Controls — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java source only, and this repository's Kotlin is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby, Scala and Rust source only, and this repository's Kotlin is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
P5 DR & Backup — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
S1 Web-Security Posture — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
X10 Duplicated predicate — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 8 further occurrence(s) are not listed individually; the score already reflects all 48.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D8 Code Coverage: Coverage is measured by building and running the test suite inside our isolated image — the target repo is never modified, and nothing on your systems runs. So coverage exists only when the suite builds and runs within the inline time budget; one that needs external services, can't build, or exceeds the budget yields no coverage (D8 then degrades to not-measured, not a low score). Line coverage also says nothing about assertion quality.
D11 Test Reliability: Flakiness is inferred from history/markers — we run the suite once (for coverage), not the repeated runs under varied conditions that reveal nondeterminism, so a flaky test never recorded as failing is invisible here.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
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.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
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.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
6 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was FhirValueComparatorsKt.equalsFhirValue at 41. A further 7 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 QuestionnaireListsKt.getQuestionnaireItemViewFactory at 20 — they are counted neither in the figure above nor in this dimension's score. 4 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireLists.kt (QuestionnaireListsKt.getQuestionnaireItemViewFactory at 20), datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireLists.kt (QuestionnaireListsKt.getQuestionnaireItemViewHolderFactory at 20), datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt (QuestionnaireResponseValidator.checkQuestionnaireResponseAnswerItemType at 17), datacapture/src/main/java/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt (QuestionnaireResponseValidator.checkQuestionnaireResponseAnswerItemType at 16). They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.
Bring the 1 body over 30 down to 30 or less in Cyclomatic Complexity — start with FhirValueComparatorsKt.equalsFhirValue (cyclomatic 41). — Refactoring it lifts Cyclomatic Complexity from 8.5 to about 8.8/10.
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.
+ 7 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 15 bodies over 15 down to 15 or less in Cognitive Complexity — start with QuestionnaireViewModel.getQuestionnaireState (cognitive 45), QuestionnaireViewModel.getQuestionnaireState (cognitive 45), OptionDialogSelectKt.OptionDialogSelect (cognitive 32). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 15 together lifts Cognitive Complexity from 7.7 to about 10.0/10, projected with the scoring formula itself and assuming each lands exactly at 15.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes9.3 / 10Stronggated by 14 serious findings✓ 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 9 MethodTooLong finding(s) in God Classes — start with QuestionnaireViewModel.kt (4), OptionDialogSelect.kt, DateTimeViewFactory.kt. — One of this dimension's main actionable groups (9 warning-level).
Resolve the 3 FileTooLong finding(s) in God Classes — start with QuestionnaireViewModel.kt (2), MoreQuestionnaireItemComponents.kt. — One of this dimension's main actionable groups (3 warning-level).
Resolve the 2 ClassTooLong finding(s) in God Classes — start with QuestionnaireViewModel.kt (2). — One of this dimension's main actionable groups (2 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D4 · Code Duplication4.3 / 10Weak✓ Tool-verified
What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.
122 duplicated block group(s) detected. 14.2 % of the production lines (8,289 of 58,555) are in a reported copy. A further 101 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 11 of the 223 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.
Edited copy of a member (13 corresponding lines) · ×6datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.android.kt:45
Edited copy of a member (11 corresponding lines) · ×6datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/RequiredValidator.kt:29
+ 110 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 11 Duplicated block (10 lines × 2) finding(s) in Code Duplication — start with MoreQuestionnaireItems.kt (2), DropDownItem.kt (2), RepeatedGroupHeaderItem.kt. — One of this dimension's main actionable groups (11 warning-level).
Resolve the 7 Duplicated block (12 lines × 2) finding(s) in Code Duplication — start with QuestionnaireCancelDialogFragment.kt, DropDownItem.kt, DateViewFactory.kt. — One of this dimension's main actionable groups (7 warning-level).
Resolve the 6 Edited copy of a member (13 corresponding lines) finding(s) in Code Duplication — start with LocalDateTimeFormatter.android.kt, ResourceDao.kt, MoreQuestionnaireItems.kt. — One of this dimension's main actionable groups (6 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling9.0 / 10Stronggated by 2 serious findings✓ 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.
16 production modules (Gradle), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; edges a convention plugin adds from buildSrc or build-logic are not visible there; 2 module(s) off the main sequence, with abstractness counted on 14 of the 16 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).
Off the main sequence: .:datacapture · ×2
What to do
Resolve the 2 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (2 warning-level).
Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 4 Low cohesion finding(s) in Cohesion (LCOM4) — start with SearchDsl.kt, MainActivity.kt, FhirEngineRepository.kt. — One of this dimension's main actionable groups (4 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D8 · Code Coverage5.0 / 10Adequate✓ Tool-verified
What it measures: How much of the code is actually exercised by tests.
Method: Coverage from the analyzer's own run of the suite, computed per-file with structured exclusions for generated, trivial, and glue code. A coverage report found in the repository is never read. When the suite can't be built/run in-image, coverage is reported NOT-MEASURED (excluded from the score) with the precondition to make it measurable — never a LoC-ratio proxy folded in as if measured. Deterministic.
Line coverage 0.0% — 13 file(s) below 50%. Measured from the Java/Kotlin suite (repository root, Gradle: the JaCoCo agent on the 3 run(s) test reliability made). Taken over 3 runs of the suite: a line counts as covered only when every run executed it.
Resolve the 13 Low coverage finding(s) in Code Coverage — start with Dependencies.kt, FirebaseTestLabConfig.kt, JacocoConfig.kt. — One of this dimension's main actionable groups (13 warning-level).
Detailed fixes: d8_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D11 · Test Reliability10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the tests pass reliably, with no flakiness.
Method: Suite re-run N times within tiered wall-clock budgets (unit to e2e); tests failing non-deterministically across runs flagged; guarded tests retried when #if guards detected.
What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.
This repository's Gradle dependency graph was RESOLVED BY A BUILD, across every subproject rather than the root alone: 1038 artifact(s) resolved, 682 of them gradable against Maven Central, and 619 behind a shipped release. Where a version was requested and a different one won conflict resolution, the RESOLVED version is what is graded — grading the request would recommend an upgrade already applied. Known CVEs in the same graph are a separate question again, reported under D30.
Outdated (compile): com.google.guava:guava · ×619
Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 56 declared JVM dependency artifact(s) use a banned license. Licences were resolved from the POMs Maven Central publishes, over the coordinates this repository's 25 Maven/Gradle manifest(s) declare with a version resolvable from the manifest itself — the same declaration-site closure this analysis reads for dependency currency. The JVM has no lockfile a checkout is guaranteed to carry, so this is deliberately NOT the transitive closure. 1 of them resolve to no licence at all on Central, even through their parent POMs; that is missing data, not a violation, and none of them is charged. A further 64 coordinate(s) are not published to Maven Central — another repository (Google's Maven hosts androidx), a SNAPSHOT, or a private artifact — so their licences are not readable from here and they are outside this verdict.
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: 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.
52 deducted task-comment markers across 58555 LoC (0.1/KLoC) → score 9.8. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
Resolve the 52 TodoComment finding(s) in Explicit Debt — start with IGInputStreamStructureRepository.kt (15), MoreQuestionnaireItems.kt (5), MoreQuestionnaireItemComponents.kt (4). — One of this dimension's main actionable groups (52 warning-level).
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
No ADRs foundsdc-kmp-demo-iosApp/iosApp.xcodeproj/project.pbxproj:1
What to do
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with project.pbxproj. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d20_recommendation.md · top locations in Appendix A, every location in findings.md.
3 of 14 build units (Gradle) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion · ×3engine/build.gradle.kts:1
What to do
Resolve the 3 Projects may be oversized for their cohesion finding(s) in Project Cohesion — start with build.gradle.kts (3). — One of this dimension's main actionable groups (3 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: Secret scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
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).
15 finding(s): 0 critical, 15 high, 0 medium, 0 low. 12 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 7 file(s) — `codelabs/datacapture/gradlew` (line 177), `codelabs/engine/gradlew` (line 72, line 177), `datacapture/src/main/java/com/google/android/fhir/datacapture/views/HeaderView.kt` (line 103), `engine/src/main/java/com/google/android/fhir/FhirEngine.kt` (line 127), `engine/src/main/java/com/google/android/fhir/sync/Sync.kt` (line 180, line 215, line 299, …), … (+2 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them.
REDACTED
REDACTED
What to do
Resolve the 2 REDACTED finding(s) charged to Static Analysis (SAST) — the other 12 are reported here at file:line but scored by D36 (supply-chain provenance), which charges them once. — One of this dimension's main actionable groups (14 issue-level, 2 of them charged here).
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
Resolve the 2 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
Resolve the 1 Critical vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
273 of 273 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt. Counted over 273 of the 495 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Most significant orphaned file · ×3datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1
Dormant codebase
What to do
Resolve the 270 Orphaned file finding(s) in Knowledge Freshness — start with build.gradle.kts (11), QuestionnaireFragment.kt (2), ExpressionEvaluator.kt (2). — One of this dimension's main actionable groups (270 recommendation-level).
Resolve the 3 Most significant orphaned file finding(s) in Knowledge Freshness — start with QuestionnaireViewModel.kt (2), MoreQuestionnaireItemComponents.kt. — One of this dimension's main actionable groups (3 recommendation-level).
Resolve the 1 Dormant codebase 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. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
Resolve the 8 Change coupling finding(s) in Change Coupling — start with MoreLocalDates.kt (2), QuestionnaireViewModel.kt (2), Dependencies.kt. — One of this dimension's main actionable groups (8 warning-level).
Resolve the 1 Change coupling clique finding(s) in Change Coupling — start with FhirEngineImpl.kt. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
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 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 20 platform declaration(s) and 127 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.
`Database` declares 24 abstract methods: `insert`, `insertRemote`, `update`, `updateVersionIdAndLastUpdated`, `updateResourcePostSync`, `select`, `selectEntity`, `insertSyncedResources`, `delete`, `search`, `searchForwardReferencedResources`, `searchReverseReferencedResources`, `count`, `getAllLocalChanges`, `getAllChangesForEarliestChangedResource`, `getLocalChangesCount`, `deleteUpdates`, `updateResourceAndReferences`, `withTransaction`, `close`, `clearDatabase`, `getLocalChanges`, `purge`, `getLocalChangeResourceReferences`. Counted over its public functions with no body, once per name; default-bodied functions and properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — engine/src/main/java/com/google/android/fhir/db/Database.kt:32
`ResourceDao` declares 18 abstract methods: `insertResource`, `insertStringIndex`, `insertReferenceIndex`, `insertCodeIndex`, `insertQuantityIndex`, `insertUriIndex`, `insertDateIndex`, `insertDateTimeIndex`, `insertNumberIndex`, `insertPositionIndex`, `updateRemoteVersionIdAndLastUpdate`, `deleteResource`, `getResource`, `getResourceEntity`, `getResources`, `getForwardReferencedResources`, `getReverseReferencedResources`, `countResources`. Counted over its public functions with no body, once per name; default-bodied functions and properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — engine/src/main/java/com/google/android/fhir/db/impl/dao/ResourceDao.kt:55
What to do
Split fat interfaces into focused role-interfaces so clients depend only on what they use.
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.
Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
The root README is 92 words, against a bar of 120. Of the three newcomer-critical sections this check looks for by heading, in the README and in the repository documents it links, it found no a build/run or getting-started section, no a testing section, no an architecture or project-map section. Sections are matched on HEADING text only, so material written under a heading this check does not recognise — or with no heading at all — is not seen and this row may understate what the document covers. — README.md:1
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.
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
No C4/Structurizr/PlantUML/Mermaid/Graphviz/D2 diagram, no drawn diagram named for the architecture, no file named `architecture` or `design` in any markup this check reads, and nothing in the README, docs or contributor guides that announces the shape — no `## Architecture` heading, no "architecture overview"/"high-level design" phrasing, no "the architecture is …" introduction, no guided code tour. A shape laid out in prose that never names itself as the architecture is not visible to this check, and neither is one kept outside the repository, so this row reports the absence of a re-findable shape document — not evidence that nobody wrote the shape down.
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Add a C4 context/container diagram (Structurizr, PlantUML or Mermaid) or an architecture.md overview.
Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
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 & versioning9.8 / 10Exemplary✓ Tool-verified
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; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
1 public type in `com.google.android.fhir.db.impl.DatabaseImpl` is marked as implementation by its own namespace, folder or name: `Companion` (engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt:448, `impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt:448
2 public types in `com.google.android.fhir.db.impl` are marked as implementation by their own namespace, folder or name: `JsonUtilsKt` (engine/src/main/java/com/google/android/fhir/db/impl/JsonUtils.kt:1, `impl`), `ResourceDatabaseKt` (engine/src/main/java/com/google/android/fhir/db/impl/ResourceDatabase.kt:1, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — engine/src/main/java/com/google/android/fhir/db/impl/JsonUtils.kt:1
2 public types in `com.google.android.fhir.db.impl.dao.LocalChangeDao` are marked as implementation by their own namespace, folder or name: `InvalidLocalChangeException` (engine/src/main/java/com/google/android/fhir/db/impl/dao/LocalChangeDao.kt:523, `impl`), `Companion` (engine/src/main/java/com/google/android/fhir/db/impl/dao/LocalChangeDao.kt:525, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — engine/src/main/java/com/google/android/fhir/db/impl/dao/LocalChangeDao.kt:523
1 public type in `com.google.android.fhir.db.impl.dao` is marked as implementation by its own namespace, folder or name: `LocalChangeDaoKt` (engine/src/main/java/com/google/android/fhir/db/impl/dao/LocalChangeDao.kt:1, `impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — engine/src/main/java/com/google/android/fhir/db/impl/dao/LocalChangeDao.kt:1
1 public type in `com.google.android.fhir.db.impl.entities.LocalChangeEntity` is marked as implementation by its own namespace, folder or name: `Type` (engine/src/main/java/com/google/android/fhir/db/impl/entities/LocalChangeEntity.kt:76, `impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers. — engine/src/main/java/com/google/android/fhir/db/impl/entities/LocalChangeEntity.kt:76
4 public types in `com.google.android.fhir.db.impl.entities.LocalChangeEntity.Type` are marked as implementation by their own namespace, folder or name: `INSERT` (engine/src/main/java/com/google/android/fhir/db/impl/entities/LocalChangeEntity.kt:77, `impl`), `UPDATE` (engine/src/main/java/com/google/android/fhir/db/impl/entities/LocalChangeEntity.kt:78, `impl`), `DELETE` (engine/src/main/java/com/google/android/fhir/db/impl/entities/LocalChangeEntity.kt:79, `impl`), `Companion` (engine/src/main/java/com/google/android/fhir/db/impl/entities/LocalChangeEntity.kt:82, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers. — engine/src/main/java/com/google/android/fhir/db/impl/entities/LocalChangeEntity.kt:77
What to do
Hide `com.google.android.fhir.db.impl.DatabaseImpl` (`Companion`) (Kotlin: `internal`): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `com.google.android.fhir.db.impl` (`JsonUtilsKt`, `ResourceDatabaseKt`) (Kotlin: `internal`): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `com.google.android.fhir.db.impl.dao.LocalChangeDao` (`InvalidLocalChangeException`, `Companion`) (Kotlin: `internal`): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `com.google.android.fhir.db.impl.dao` (`LocalChangeDaoKt`) (Kotlin: `internal`): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `com.google.android.fhir.db.impl.entities.LocalChangeEntity` (`Type`) (Kotlin: `internal`): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Hide `com.google.android.fhir.db.impl.entities.LocalChangeEntity.Type` (`INSERT`, `UPDATE`, `DELETE`, `Companion`) (Kotlin: `internal`): its own namespace, folder or name already says it is implementation, and hidden it can change without breaking a consumer.
Do you agree with this assessment?
P2 · Observability5.0 / 10Adequate✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
Only 1/3 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `sdc-kmp-demo`, `sdc-kmp-demo-iosApp`.
What to do
Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
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.
`REDACTED` schedules updates, but no `package-ecosystem` entry covers `npm`, `pip`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entries to the `updates:` list. — REDACTED:4
What to do
Dependabot is configured but does not watch `npm`, `pip` — add those `package-ecosystem` entries to .github/dependabot.yml so those dependencies get the same automatic update and advisory pressure as the ones it already covers.
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.
What to do
Make sure a person approves each release. The release job names an environment, but its approval rules live in the code host's settings, where we can't see them. Check that a reviewer must approve each release, or publish releases as drafts first, so a bad build can be stopped before anyone downloads it.
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 code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.
Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.
Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.
Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.
Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.
Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X17 · Uncapped recursion over a caller-supplied document2.0 / 10Critical✓ Tool-verified
Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.
Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.
`replaceJsonValue` is public and takes `jsonObject: JSONObject` from its caller, and it calls itself at line 53 with a piece of `jsonObject` — the function is not `tailrec`, so every call is a real frame — and nowhere in `replaceJsonValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. On the JVM's default 1 MB thread stack a recursive walk throws `StackOverflowError` from about 500–2,000 levels on a cold first call and 6,000–17,000 once warmed up (OpenJDK 21 and 25; Android's threads are smaller). kotlinx.serialization's `parseToJsonElement` accepts nested arrays to any depth and Android's built-in `org.json` sets no limit, while Jackson 2.15+ stops at 1,000 — on a cold JVM past the point the walk fails; Gson 2.12+ and Moshi stop at 255. `StackOverflowError` is an `Error`, not an `Exception`: a `catch (e: Exception)` around the call does not stop it, and on Android an uncaught one ends the process. Thread a depth argument through `replaceJsonValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack or a `DeepRecursiveFunction`. — engine/src/main/java/com/google/android/fhir/db/impl/JsonUtils.kt:53
`replaceJsonValue` is public and takes `jsonArray: JSONArray` from its caller, and it calls itself at line 72 with a piece of `jsonArray` — the function is not `tailrec`, so every call is a real frame — and nowhere in `replaceJsonValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. On the JVM's default 1 MB thread stack a recursive walk throws `StackOverflowError` from about 500–2,000 levels on a cold first call and 6,000–17,000 once warmed up (OpenJDK 21 and 25; Android's threads are smaller). kotlinx.serialization's `parseToJsonElement` accepts nested arrays to any depth and Android's built-in `org.json` sets no limit, while Jackson 2.15+ stops at 1,000 — on a cold JVM past the point the walk fails; Gson 2.12+ and Moshi stop at 255. `StackOverflowError` is an `Error`, not an `Exception`: a `catch (e: Exception)` around the call does not stop it, and on Android an uncaught one ends the process. Thread a depth argument through `replaceJsonValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack or a `DeepRecursiveFunction`. — engine/src/main/java/com/google/android/fhir/db/impl/JsonUtils.kt:72
`extractAllValuesWithKey` is public and takes `jsonObject: JSONObject` from its caller, and it calls itself at line 105 with a piece of `jsonObject` — the function is not `tailrec`, so every call is a real frame — and nowhere in `extractAllValuesWithKey` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. On the JVM's default 1 MB thread stack a recursive walk throws `StackOverflowError` from about 500–2,000 levels on a cold first call and 6,000–17,000 once warmed up (OpenJDK 21 and 25; Android's threads are smaller). kotlinx.serialization's `parseToJsonElement` accepts nested arrays to any depth and Android's built-in `org.json` sets no limit, while Jackson 2.15+ stops at 1,000 — on a cold JVM past the point the walk fails; Gson 2.12+ and Moshi stop at 255. `StackOverflowError` is an `Error`, not an `Exception`: a `catch (e: Exception)` around the call does not stop it, and on Android an uncaught one ends the process. Thread a depth argument through `extractAllValuesWithKey` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack or a `DeepRecursiveFunction`. — engine/src/main/java/com/google/android/fhir/db/impl/JsonUtils.kt:105
`extractAllValuesWithKey` is public and takes `jArray: JSONArray` from its caller, and it calls itself at line 125 with a piece of `jArray` — the function is not `tailrec`, so every call is a real frame — and nowhere in `extractAllValuesWithKey` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. On the JVM's default 1 MB thread stack a recursive walk throws `StackOverflowError` from about 500–2,000 levels on a cold first call and 6,000–17,000 once warmed up (OpenJDK 21 and 25; Android's threads are smaller). kotlinx.serialization's `parseToJsonElement` accepts nested arrays to any depth and Android's built-in `org.json` sets no limit, while Jackson 2.15+ stops at 1,000 — on a cold JVM past the point the walk fails; Gson 2.12+ and Moshi stop at 255. `StackOverflowError` is an `Error`, not an `Exception`: a `catch (e: Exception)` around the call does not stop it, and on Android an uncaught one ends the process. Thread a depth argument through `extractAllValuesWithKey` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack or a `DeepRecursiveFunction`. — engine/src/main/java/com/google/android/fhir/db/impl/JsonUtils.kt:125
What to do
Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.
Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether suspend functions that make a cancellable request accept or pass on the coroutine's cancellation (adoption curve).
Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.
Only 0/1 suspend functions that make a cancellable request (Ktor, OkHttp newCall, URL streams) accept the coroutine's cancellation or pass one on, so a request keeps running after whatever wanted it has given up — a screen navigated away from, a disposed widget, a superseded search. In a suspend function, make the request with a call that suspends — Ktor, OkHttp's `executeAsync()`, or a `suspendCancellableCoroutine` that cancels the `Call` — not a blocking `execute()`: `withContext(Dispatchers.IO)` moves the call off the caller's thread but does not make it cancellable; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
`downloadPackage` suspends, but makes its request with `newCall(…).execute()`, which blocks: its caller's cancellation cannot reach the request, so it runs to its end after whatever wanted it has given up — `withContext(Dispatchers.IO)` moves it off the caller's thread and does not change that. Make the request with a call that suspends: Ktor, OkHttp's `executeAsync()`, or a `suspendCancellableCoroutine` over `enqueue` that cancels the `Call` in `invokeOnCancellation`. — knowledge/src/main/java/com/google/android/fhir/knowledge/npm/OkHttpNpmPackageDownloader.kt:41
What to do
Thread the coroutine's cancellation through suspend functions that make requests, so the work stops when its caller gives up.
Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.
Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.
Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.
Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether an enhanced `for` leaves the collection it is walking alone — a body that adds to or removes from the very collection the loop is iterating invalidates the fail-fast iterator it is holding, so the next `next()` throws `ConcurrentModificationException` and the remaining elements are never seen. Whether a `for (x in c)` or `c.forEach { … }` leaves the collection it is walking alone — a `mutableListOf`/`ArrayList`, `mutableMapOf`/`HashMap` or `mutableSetOf`/`HashSet` is a `java.util` collection on the JVM and is walked by its own fail-fast iterator, so a body that adds to or removes from the very collection the loop is walking makes the next step throw `ConcurrentModificationException` and the remaining elements are never seen.
Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
`catch (e: java.lang.Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×2) — workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/PlanDefinition.kt:183, workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/PlanDefinition.kt:234
`catch (_: Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.kt:59
`catch (e: Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — contrib/barcode/src/main/java/com/google/android/fhir/datacapture/contrib/views/barcode/mlkit/md/settings/PreferenceUtils.kt:83
What to do
Swallowed exception (caught, then discarded)
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether Kotlin's null safety is not undermined by not-null assertions — `String` cannot hold null and `String?` must be checked before use in every Kotlin module, and each `!!` is a run-time `NullPointerException` the author has told the compiler cannot happen.
Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.
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.
Unscored — 3 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
AXR1 Runtime accessibility (rendered) — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 1 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 63 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC1 Text alternatives — Frontend below the scale floor (8 DOM element(s) < 25) — too little surface to assess accessibility.
AC2 Forms & labels — Frontend below the scale floor (8 DOM element(s) < 25) — too little surface to assess accessibility.
AC3 Page structure — Frontend below the scale floor (8 DOM element(s) < 25) — too little surface to assess accessibility.
AC4 Keyboard semantics — Frontend below the scale floor (8 DOM element(s) < 25) — too little surface to assess accessibility.
AC5 ARIA correctness — Frontend below the scale floor (8 DOM element(s) < 25) — too little surface to assess accessibility.
AC6 Visual & motion safety — Frontend below the scale floor (8 DOM element(s) < 25) — too little surface to assess accessibility.
AX1 Captive dependencies — Not applicable: this repository's Java imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's Kotlin imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's Swift imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No class in this Java code is a Spring, JSR-330 or CDI singleton bean. No class in this Kotlin code is a Spring, JSR-330 or CDI singleton bean. No Swift request handler (a Vapor, Hummingbird, Kitura, Swifter or Perfect route handler, as a method or a registered closure) is declared, so no state is shared between request threads.
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
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 a persisted data model — no PII-named field (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a Room, JPA or MongoDB entity, an Exposed or Ktorm table, or in a SQL CREATE TABLE or ALTER TABLE — and no database or data-store client (Room, Exposed, SQLDelight, Realm, JPA, JDBC, MongoDB, Firebase, …) imported either, so this repository keeps no data at rest for these controls to protect.
C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C3 Audit Trail — No personal data detected in a persisted data model — no PII-named column (email, first_name, date_of_birth, phone_number, …) or stored credential on a Room, JPA or MongoDB entity, an Exposed or Ktorm table, or a SQL CREATE TABLE or ALTER TABLE — and no database or data-store client (Room, Exposed, SQLDelight, Realm, JPA, JDBC, MongoDB, Firebase, …) imported either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a store configured outside this repository, for instance), the trail belongs to wherever that data is stored.
C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a Room, JPA or MongoDB entity, an Exposed or Ktorm table, or in a SQL CREATE TABLE or ALTER TABLE — and no database or data-store client (Room, Exposed, SQLDelight, Realm, JPA, JDBC, MongoDB, Firebase, …) imported either, so this repository keeps no personal data whose lifetime a retention limit would bound.
C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a Room, JPA or MongoDB entity, an Exposed or Ktorm table, or in a SQL CREATE TABLE or ALTER TABLE — and no database or data-store client (Room, Exposed, SQLDelight, Realm, JPA, JDBC, MongoDB, Firebase, …) imported either, so this repository keeps no personal data for a data subject to erase, export or consent over.
D10 Test Quality — ~77664 lines of test source are present (.kt) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
D13 Secret Scanning — Secret Scanning not included (time budget)
D16 Bus Factor — dormant codebase — no living knowledge left to concentrate
D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
D19 Documentation Quality — D19 withholds "Documentation: empty section": 1 candidate(s) were measured and not published.
D21 Naming Consistency — D21 withholds its case and prefix conventions rows: 4 candidate(s) found and not reported.
D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only — this repository's production source is .java, .kt, .swift, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D25 ADR Conformance — no ADRs to check
D27 Navigability — symbol resolution incomplete — navigability not assessed
D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
D32 Data Compliance (PII/GDPR) — 69 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
DM1 Domain Modelling — applicable but not scored (2 of 3 signals for this style — below the bar we score at): 160 value object(s); 5 domain event(s); its domain events are published by services or handlers — no domain entity raises one
ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and this analysis resolves a call's owner only where the receiver's type is written down in the source. Reported as guidance rather than measured
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
M4 Documentation accuracy — Not applicable: the 52 current-state document(s) make no claim of a kind M4 checks. 22 claim(s) of kinds M4 does not check were not checked (path 12, command argument 3, environment variable 7); M4 checks only links and versions and artefact counts.
P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the JVM source, so there is no service whose uptime a failing dependency could take down
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — coverage data present for 13 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X20 Mistyped argument guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X28 Index access outside its own emptiness guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X29 Per-element action decided by a fixed element — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X4 Structured logging — This check asks whether log calls keep a message's values apart from its text, which needs a logger that can carry them as fields. This repository's Kotlin was read, and it logs through none that an assembled message defeats: Android's `Log` and Timber, java.util.logging and log4j-api-kotlin take one finished message (as log4net does in C#), or it makes no call through a named logger at all. Calls made through SLF4J, log4j 2 or kotlin-logging (`LoggerFactory.getLogger`, `KotlinLogging.logger {}`) would be judged.
X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
TodoComment workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/IGInputStreamStructureRepository.kt:78— // TODO: what the heck is the path separator? — 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 workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/IGInputStreamStructureRepository.kt:239— // TODO Auto-generated method stub — 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 workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/IGInputStreamStructureRepository.kt:247— // TODO Auto-generated method stub — 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 workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/IGInputStreamStructureRepository.kt:319— // TODO Auto-generated method stub — 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 workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/IGInputStreamStructureRepository.kt:327— // TODO Auto-generated method stub — 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 workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/IGInputStreamStructureRepository.kt:332— // TODO Auto-generated method stub — 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 workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/IGInputStreamStructureRepository.kt:342— // TODO Auto-generated method stub — 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 workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/IGInputStreamStructureRepository.kt:351— // TODO Auto-generated method stub — 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 workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/IGInputStreamStructureRepository.kt:362— // TODO Auto-generated method stub — 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 workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/IGInputStreamStructureRepository.kt:372— // TODO Auto-generated method stub — 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 workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/IGInputStreamStructureRepository.kt:383— // TODO Auto-generated method stub — 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 workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/IGInputStreamStructureRepository.kt:393— // TODO Auto-generated method stub — 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 workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/IGInputStreamStructureRepository.kt:402— // TODO Auto-generated method stub — 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 workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/IGInputStreamStructureRepository.kt:412— // TODO Auto-generated method stub — 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 workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/IGInputStreamStructureRepository.kt:422— // TODO Auto-generated method stub — 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 workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/Loadable.kt:56— // TODO: Turn this into a task that generates .contents.txt automatically: ls > contents.txt — 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 workflow/src/main/java/com/google/android/fhir/workflow/activity/phase/request/BaseRequestPhase.kt:40— // TODO : Maybe this should return a copy of the resource so that if the user does any changes to — 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 workflow/src/main/java/com/google/android/fhir/workflow/activity/phase/request/BaseRequestPhase.kt:68— // TODO Add some basic checks to make sure e is update event and not a completely different — 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 workflow/src/main/java/com/google/android/fhir/workflow/activity/phase/event/PerformPhase.kt:56— // TODO Add some basic checks to make sure e is update event and not a completely different — 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 knowledge/src/main/java/com/google/android/fhir/knowledge/KnowledgeManager.kt:107— // TODO(ktarasenko) copy files to the safe space? — 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 knowledge/src/main/java/com/google/android/fhir/knowledge/db/dao/KnowledgeDao.kt:47— // TODO(ktarasenko) compare the substantive part of the old and new resource and thrown an — 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 engine/src/main/java/com/google/android/fhir/DateProvider.kt:27— // TODO possibly provide more customization options — 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 engine/src/main/java/com/google/android/fhir/MoreResources.kt:59— // TODO: remove this once a fix has been found for the CQL engine on Android. — 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 engine/src/main/java/com/google/android/fhir/sync/FhirSynchronizer.kt:71— // todo: emit this properly instead of using datastore? — 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 engine/src/main/java/com/google/android/fhir/sync/upload/patch/PerResourcePatchGenerator.kt:59— // TODO (maybe this should throw exception when two entities don't have the same versionID) — 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.
Duplicated block (10 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItems.kt:846— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItems.kt:846-855 | datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItemComponents.kt:898-907 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (10 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:101— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:101-110 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:228-237 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:101` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/RepeatedGroupHeaderItem.kt:70— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/RepeatedGroupHeaderItem.kt:70-79 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/RepeatedGroupHeaderItem.kt:63-72 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/RepeatedGroupHeaderItem.kt:70` 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) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/QuantityViewFactory.kt:121— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/QuantityViewFactory.kt:121-130 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/QuantityViewHolderFactory.kt:117-126 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/QuantityViewFactory.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/QuantityViewHolderFactory.kt` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/QuantityViewFactory.kt:121` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `EditTextFieldItem` names `com.google.android.fhir.datacapture.views.components.EditTextFieldItem` in one and `com.google.android.fhir.datacapture.views.compose.EditTextFieldItem` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (10 lines × 2) datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DropDownItem.kt:91— datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DropDownItem.kt:91-100 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DropDownItem.kt:212-221 — both copies are in the same file, so extract the 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 `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DropDownItem.kt:91` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/AutoCompleteViewHolderFactory.kt:88— datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/AutoCompleteViewHolderFactory.kt:88-97 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/SliderViewHolderFactory.kt:73-82 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/AutoCompleteViewHolderFactory.kt:88` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) document/src/main/java/com.google.android.fhir.document/RetrofitSHLService.kt:78— document/src/main/java/com.google.android.fhir.document/RetrofitSHLService.kt:78-87 | engine/src/main/java/com/google/android/fhir/sync/remote/RetrofitHttpService.kt:84-93 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `document/src/main/java/com.google.android.fhir.document/RetrofitSHLService.kt:78` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:158— engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:158-167 | engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:221-230 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:158` 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) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItems.kt:817— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItems.kt:817-826 | datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItemComponents.kt:869-878 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItems.kt:817` 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) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:457— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:457-466 | datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:473-482 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:457` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `Expression` names `com.google.fhir.model.r4.Expression` in one and `org.hl7.fhir.r4.model.Expression` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (10 lines × 2) datacapture-kmp/src/jsMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.js.kt:54— datacapture-kmp/src/jsMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.js.kt:54-63 | datacapture-kmp/src/wasmJsMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.wasmJs.kt:55-64 — before extracting anything, compare `datacapture-kmp/src/jsMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.js.kt` and `datacapture-kmp/src/wasmJsMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.wasmJs.kt` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
MethodTooLong: OptionDialogSelectKt.OptionDialogSelect datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/OptionDialogSelect.kt:65— MethodTooLong — OptionDialogSelect runs 170 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 70 over it, 1.70× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DateTimeViewFactory.Content datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateTimeViewFactory.kt:71— MethodTooLong — Content runs 125 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 25 over it, 1.25× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: QuestionnaireFragment.onViewCreated datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireFragment.kt:99— MethodTooLong — onViewCreated runs 120 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 20 over it, 1.20× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: QuestionnaireViewModel.getQuestionnaireAdapterItems datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:878— MethodTooLong — getQuestionnaireAdapterItems runs 119 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 19 over it, 1.19× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: QuestionnaireViewModel.getQuestionnaireAdapterItems datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:987— MethodTooLong — getQuestionnaireAdapterItems runs 118 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 18 over it, 1.18× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DateViewFactory.Content datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt:67— MethodTooLong — Content runs 110 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 10 over it, 1.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: QuestionnaireViewModel.getQuestionnaireState datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:822— MethodTooLong — getQuestionnaireState runs 105 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 5 over it, 1.05× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: QuestionnaireViewModel.getQuestionnaireState datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:713— MethodTooLong — getQuestionnaireState runs 105 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 5 over it, 1.05× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: AttachmentViewFactory.Content datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/AttachmentViewFactory.kt:104— MethodTooLong — Content runs 101 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1 over it, 1.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
Change coupling: MoreLocalDates.kt ↔ DatePickerViewHolderFactory.kt datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreLocalDates.kt:1— `datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreLocalDates.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DatePickerViewHolderFactory.kt` change together 80% of the time (8 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `963ed1b9` Migrate DateViewFactory to compose (#2879); `409b45fe` Refactor the code for the DatePickerView (#1880); `2052a5fa` Automatically add date separator between day month year (#1822) (at that commit the files were still `datacapture/src/main/java/com/google/android/fhir/datacapture/utilities/MoreLocalDates.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/QuestionnaireItemDatePickerViewHolderFactory.kt`) — run `git show` on any of them.
Change coupling: Dependencies.kt ↔ LicenseeConfig.kt buildSrc/src/main/kotlin/Dependencies.kt:1— `buildSrc/src/main/kotlin/Dependencies.kt` and `buildSrc/src/main/kotlin/LicenseeConfig.kt` change together 73% of the time (8 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `9bd76c83` Update clinical reasoning dependencies (#2637); `4169a8dc` Support location widget to get current location (#2341); `ab27ca05` Migrates engine to HAPI 6.8 while forcing Workflow to stay on 6.0 (#2… — run `git show` on any of them.
Change coupling: MoreLocalDates.kt ↔ DateTimePickerViewHolderFactory.kt datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreLocalDates.kt:1— `datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreLocalDates.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DateTimePickerViewHolderFactory.kt` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `963ed1b9` Migrate DateViewFactory to compose (#2879); `409b45fe` Refactor the code for the DatePickerView (#1880); `2052a5fa` Automatically add date separator between day month year (#1822) (at that commit the files were still `datacapture/src/main/java/com/google/android/fhir/datacapture/utilities/MoreLocalDates.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/QuestionnaireItemDateTimePickerViewHolderFactory.kt`) — run `git show` on any of them.
Change coupling: QuestionnaireViewModel.kt ↔ QuestionnaireResponseValidator.kt datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1— `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt` change together 58% of the time (7 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `df463c74` Pack repeated groups even if there is only one group in the response …; `3da3bef8` enable when expression can access variable (#2132); `256ab759` Pack repeated groups into answers (#1936) — run `git show` on any of them.
Change coupling: DatabaseImpl.kt ↔ ResourceIndices.kt engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt:1— `engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt` and `engine/src/main/java/com/google/android/fhir/index/ResourceIndices.kt` change together 57% of the time (8 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `1a23a8a9` Start saving local lastUpdated to resources for search operations. (#…; `553c6f82` Deduplicate patients record. (#583); `b590b96d` Create index for near,location (at that commit the files were still `core/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt` and `core/src/main/java/com/google/android/fhir/index/ResourceIndices.kt`) — run `git show` on any of them.
Change coupling: Plugins.kt ↔ Sdk.kt buildSrc/src/main/kotlin/Plugins.kt:1— `buildSrc/src/main/kotlin/Plugins.kt` and `buildSrc/src/main/kotlin/Sdk.kt` change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `9440c546` Migrate to kotlin v2 compiler (#2816); `a36e7a69` Update gradle to 8.8 and AGP to 8.5.0 (#2575); `e11c65f0` simple refactoring — run `git show` on any of them.
Change coupling: QuestionnaireViewModel.kt ↔ GroupViewHolderFactory.kt datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1— `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/GroupViewHolderFactory.kt` change together 53% of the time (9 of the 17 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `2e06cb26` Only copy nested items to childless answers (#2600); `541f69d8` repeated group style. (#2571); `10165589` Repeated Group Headers (#1994) — run `git show` on any of them.
Change coupling: LocalChangeDao.kt ↔ ResourceDao.kt engine/src/main/java/com/google/android/fhir/db/impl/dao/LocalChangeDao.kt:1— `engine/src/main/java/com/google/android/fhir/db/impl/dao/LocalChangeDao.kt` and `engine/src/main/java/com/google/android/fhir/db/impl/dao/ResourceDao.kt` change together 52% of the time (13 of the 25 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 13 shared commits counted here, the most recent 3 are `17029eb9` Refactor usages of Json Parser for thread safety (#2749); `8301d62b` Resource consolidation after using the AllChangesSquashedBundlePost u…; `0e91a64b` Resource consolidation for resources created with POST (#2217) — run `git show` on any of them.
Duplicated block (12 lines × 2) datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireCancelDialogFragment.kt:29— datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireCancelDialogFragment.kt:29-40 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireCancelDialogFragment.kt:29-40 — before extracting anything, compare `datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireCancelDialogFragment.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireCancelDialogFragment.kt` as WHOLE FILES: 94% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:173— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:173-184 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DropDownItem.kt:160-171 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DropDownItem.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 99 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:173` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt:260— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt:260-271 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DatePickerViewHolderFactory.kt:233-244 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DatePickerViewHolderFactory.kt` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (12 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/RadioGroupViewFactory.kt:60— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/RadioGroupViewFactory.kt:60-71 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/RadioGroupViewHolderFactory.kt:61-76 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/SliderViewFactory.kt:95— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/SliderViewFactory.kt:95-106 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/SliderViewHolderFactory.kt:79-90 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/SliderViewFactory.kt:95` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `Header` names `com.google.android.fhir.datacapture.views.components.Header` in one and `com.google.android.fhir.datacapture.views.compose.Header` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (12 lines × 2) datacapture/src/main/java/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:113— datacapture/src/main/java/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:113-124 | datacapture/src/main/java/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:246-257 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture/src/main/java/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:113` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:120— engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:120-131 | engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:183-194 — both copies are in the same file, so extract the 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 `engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:120` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×6
Edited copy of a member (13 corresponding lines) datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.android.kt:45— datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.android.kt:45-62 | datacapture-kmp/src/desktopMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.desktop.kt:38-50 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) engine/src/main/java/com/google/android/fhir/db/impl/dao/ResourceDao.kt:67— engine/src/main/java/com/google/android/fhir/db/impl/dao/ResourceDao.kt:67-82 | engine/src/main/java/com/google/android/fhir/db/impl/dao/ResourceDao.kt:107-119 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItems.kt:1011— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItems.kt:1011-1023 | datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItemComponents.kt:1059-1071 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) demo/src/main/java/com/google/android/fhir/demo/PatientDetailsFragment.kt:101— demo/src/main/java/com/google/android/fhir/demo/PatientDetailsFragment.kt:101-114 | catalog/src/main/java/com/google/android/fhir/catalog/DemoQuestionnaireFragment.kt:105-117 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:569— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:569-581 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:496-509 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt:142— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt:142-154 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt:159-171 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×6
Edited copy of a member (11 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/RequiredValidator.kt:29— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/RequiredValidator.kt:29-42 | datacapture/src/main/java/com/google/android/fhir/datacapture/validation/RequiredValidator.kt:29-39 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/DataCapture.android.kt:25— datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/DataCapture.android.kt:25-35 | datacapture/src/main/java/com/google/android/fhir/datacapture/DataCapture.kt:29-39 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:686— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:686-696 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:611-621 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:161— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:161-171 | datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:174-185 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt:104— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt:104-117 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt:122-132 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) demo/src/main/java/com/google/android/fhir/demo/ScreenerViewModel.kt:208— demo/src/main/java/com/google/android/fhir/demo/ScreenerViewModel.kt:208-218 | demo/src/main/java/com/google/android/fhir/demo/ScreenerViewModel.kt:224-234 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (9 lines × 2) datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.android.kt:50— datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.android.kt:50-62 | datacapture-kmp/src/desktopMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.desktop.kt:42-50 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.android.kt:50` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (9 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewFactory.kt:127— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewFactory.kt:127-135 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewFactory.kt:147-155 — both copies are in the same file, so extract the 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 `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewFactory.kt:127` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/RadioGroupViewFactory.kt:107— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/RadioGroupViewFactory.kt:107-115 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/RadioGroupViewFactory.kt:127-135 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/RadioGroupViewFactory.kt:107` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 2) datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/ChoiceCheckbox.kt:95— datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/ChoiceCheckbox.kt:95-103 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/ChoiceRadioButton.kt:94-102 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/ChoiceCheckbox.kt:95` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) engine/src/main/java/com/google/android/fhir/sync/Sync.kt:296— engine/src/main/java/com/google/android/fhir/sync/Sync.kt:296-304 | engine/src/main/java/com/google/android/fhir/sync/Sync.kt:341-349 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) workflow/src/main/java/com/google/android/fhir/workflow/activity/phase/request/OrderPhase.kt:97— workflow/src/main/java/com/google/android/fhir/workflow/activity/phase/request/OrderPhase.kt:97-106 | workflow/src/main/java/com/google/android/fhir/workflow/activity/phase/request/PlanPhase.kt:96-104 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (32 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:62— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:62-93 | datacapture/src/main/java/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:67-98 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:62` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `Questionnaire` names `com.google.fhir.model.r4.Questionnaire` in one and `org.hl7.fhir.r4.model.Questionnaire` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (32 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewFactory.kt:82— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewFactory.kt:82-113 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/RadioGroupViewFactory.kt:78-109 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewFactory.kt` and `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/RadioGroupViewFactory.kt` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewFactory.kt:82` 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 (32 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateTimeViewFactory.kt:143— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateTimeViewFactory.kt:143-174 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt:132-163 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateTimeViewFactory.kt` and `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (32 lines × 2) datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewHolderFactory.kt:76— datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewHolderFactory.kt:76-107 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/RadioGroupViewHolderFactory.kt:85-116 — before extracting anything, compare `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewHolderFactory.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/RadioGroupViewHolderFactory.kt` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewHolderFactory.kt:76` 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 (32 lines × 2) engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:479— engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:479-510 | engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:525-556 — both copies are in the same file, so extract the 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 `engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:479` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:584— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:584-596 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:512-524 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:584` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) datacapture-kmp/src/jsMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.js.kt:40— datacapture-kmp/src/jsMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.js.kt:40-52 | datacapture-kmp/src/wasmJsMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.wasmJs.kt:41-53 — before extracting anything, compare `datacapture-kmp/src/jsMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.js.kt` and `datacapture-kmp/src/wasmJsMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.wasmJs.kt` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (13 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/EditTextFieldItem.kt:60— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/EditTextFieldItem.kt:60-72 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/EditTextFieldItem.kt:56-68 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/EditTextFieldItem.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/EditTextFieldItem.kt` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/EditTextFieldItem.kt:156— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/EditTextFieldItem.kt:156-168 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/EditTextFieldItem.kt:152-164 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/EditTextFieldItem.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/EditTextFieldItem.kt` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (13 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/PageNavigationItem.kt:123— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/PageNavigationItem.kt:123-135 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/PageNavigationView.kt:122-134 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/PageNavigationItem.kt:123` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/expressions/EnabledAnswerOptionsEvaluator.kt:196— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/expressions/EnabledAnswerOptionsEvaluator.kt:196-206 | datacapture/src/main/java/com/google/android/fhir/datacapture/expressions/EnabledAnswerOptionsEvaluator.kt:200-210 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/expressions/EnabledAnswerOptionsEvaluator.kt:196` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/AttachmentViewFactory.kt:264— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/AttachmentViewFactory.kt:264-274 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/AttachmentViewFactory.kt:309-319 — both copies are in the same file, so extract the 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 `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/AttachmentViewFactory.kt:264` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewFactory.kt:125— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewFactory.kt:125-135 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewHolderFactory.kt:119-129 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewFactory.kt:125` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewHolderFactory.kt:141— datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewHolderFactory.kt:141-151 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewHolderFactory.kt:163-173 — both copies are in the same file, so extract the 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 `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewHolderFactory.kt:141` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:106— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:106-116 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:237-247 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:106` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication· Edited copy of a member (28 corresponding lines) · ×4
Edited copy of a member (28 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:713— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:713-757 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:771-798 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) datacapture/src/main/java/com/google/android/fhir/datacapture/contrib/views/PhoneNumberViewHolderFactory.kt:32— datacapture/src/main/java/com/google/android/fhir/datacapture/contrib/views/PhoneNumberViewHolderFactory.kt:32-59 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/EditTextStringDelegateFactory.kt:34-65 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireLists.kt:388— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireLists.kt:388-415 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireLists.kt:285-312 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) demo/src/main/java/com/google/android/fhir/demo/PatientListViewModel.kt:86— demo/src/main/java/com/google/android/fhir/demo/PatientListViewModel.kt:86-113 | demo/src/main/java/com/google/android/fhir/demo/PatientListViewModel.kt:197-229 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×4
Edited copy of a member (17 corresponding lines) engine/src/main/java/com/google/android/fhir/sync/Sync.kt:232— engine/src/main/java/com/google/android/fhir/sync/Sync.kt:232-248 | engine/src/main/java/com/google/android/fhir/sync/Sync.kt:255-278 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) catalog/src/main/java/com/google/android/fhir/catalog/ComponentListFragment.kt:92— catalog/src/main/java/com/google/android/fhir/catalog/ComponentListFragment.kt:92-115 | catalog/src/main/java/com/google/android/fhir/catalog/LayoutListFragment.kt:72-88 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1260— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1260-1276 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1131-1147 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) demo/src/main/java/com/google/android/fhir/demo/CrudOperationViewModel.kt:61— demo/src/main/java/com/google/android/fhir/demo/CrudOperationViewModel.kt:61-77 | demo/src/main/java/com/google/android/fhir/demo/CrudOperationViewModel.kt:85-101 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (9 corresponding lines) · ×4
Edited copy of a member (9 corresponding lines) datacapture-kmp/src/desktopMain/kotlin/com/google/android/fhir/datacapture/AttachmentMediaHandler.desktop.kt:62— datacapture-kmp/src/desktopMain/kotlin/com/google/android/fhir/datacapture/AttachmentMediaHandler.desktop.kt:62-70 | datacapture-kmp/src/iosMain/kotlin/com/google/android/fhir/datacapture/AttachmentMediaHandler.ios.kt:111-119 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:804— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:804-812 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:695-703 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) demo/src/main/java/com/google/android/fhir/demo/EditPatientFragment.kt:84— demo/src/main/java/com/google/android/fhir/demo/EditPatientFragment.kt:84-97 | demo/src/main/java/com/google/android/fhir/demo/ScreenerFragment.kt:79-87 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) demo/src/main/java/com/google/android/fhir/demo/EditPatientViewModel.kt:104— demo/src/main/java/com/google/android/fhir/demo/EditPatientViewModel.kt:104-114 | demo/src/main/java/com/google/android/fhir/demo/ScreenerViewModel.kt:133-141 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (24 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:83— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:83-106 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DropDownItem.kt:73-96 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DropDownItem.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 99 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:83` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (24 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:210— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:210-233 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DropDownItem.kt:194-217 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DropDownItem.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 99 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:210` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (24 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:253— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:253-276 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DropDownItem.kt:237-260 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DropDownItem.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 99 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:253` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (24 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/Header.kt:104— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/Header.kt:104-127 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/Header.kt:91-114 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/Header.kt:104` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23 lines × 2) contrib/locationwidget/src/main/java/com/google/android/fhir/datacapture/contrib/views/locationwidget/CurrentLocationDialogFragment.kt:45— contrib/locationwidget/src/main/java/com/google/android/fhir/datacapture/contrib/views/locationwidget/CurrentLocationDialogFragment.kt:45-67 | contrib/locationwidget/src/main/java/com/google/android/fhir/datacapture/contrib/views/locationwidget/CurrentLocationDialogFragment.kt:76-99 — both copies are in the same file, so extract the 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 `contrib/locationwidget/src/main/java/com/google/android/fhir/datacapture/contrib/views/locationwidget/CurrentLocationDialogFragment.kt:45` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (23 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:993— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:993-1015 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:884-906 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:993` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:907` calls `getApplication` and `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1016` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (23 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1283— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1283-1305 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1154-1176 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (23 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/QuantityViewFactory.kt:160— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/QuantityViewFactory.kt:160-182 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/QuantityViewHolderFactory.kt:163-185 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/QuantityViewFactory.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/QuantityViewHolderFactory.kt` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/QuantityViewFactory.kt:160` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `BigDecimal` names `com.ionspin.kotlin.bignum.decimal.BigDecimal` in one and `java.math.BigDecimal` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (19 lines × 2) datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt:56— datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt:56-74 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt:57-75 — before extracting anything, compare `datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt` as WHOLE FILES: 84% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (19 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/MultiAutoCompleteTextItem.kt:174— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/MultiAutoCompleteTextItem.kt:174-192 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/MultiAutoCompleteTextItem.kt:171-189 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/MultiAutoCompleteTextItem.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/MultiAutoCompleteTextItem.kt` as WHOLE FILES: 88% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/MultiAutoCompleteTextItem.kt:174` 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 (19 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/SliderItem.kt:44— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/SliderItem.kt:44-62 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/SliderItem.kt:42-60 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/SliderItem.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/SliderItem.kt` as WHOLE FILES: 88% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (19 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:238— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:238-256 | datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:257-275 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:238` 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 (17 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:272— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:272-288 | datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:291-307 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (17 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/PageNavigationItem.kt:63— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/PageNavigationItem.kt:63-79 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/PageNavigationView.kt:62-78 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/PageNavigationItem.kt:63` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (17 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DropDownViewFactory.kt:110— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DropDownViewFactory.kt:110-126 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DropDownViewHolderFactory.kt:116-132 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DropDownViewFactory.kt:110` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: `AutoCompleteDropDownItem` names `com.google.android.fhir.datacapture.views.components.AutoCompleteDropDownItem` in one and `com.google.android.fhir.datacapture.views.compose.AutoCompleteDropDownItem` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (17 lines × 2) datacapture-kmp/src/jsMain/kotlin/com/google/android/fhir/datacapture/AttachmentMediaHandler.js.kt:39— datacapture-kmp/src/jsMain/kotlin/com/google/android/fhir/datacapture/AttachmentMediaHandler.js.kt:39-55 | datacapture-kmp/src/wasmJsMain/kotlin/com/google/android/fhir/datacapture/AttachmentMediaHandler.wasmJs.kt:39-55 — before extracting anything, compare `datacapture-kmp/src/jsMain/kotlin/com/google/android/fhir/datacapture/AttachmentMediaHandler.js.kt` and `datacapture-kmp/src/wasmJsMain/kotlin/com/google/android/fhir/datacapture/AttachmentMediaHandler.wasmJs.kt` as WHOLE FILES: 96% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (6 lines × 2) catalog/src/main/java/com/google/android/fhir/catalog/BehaviorsRecyclerViewAdapter.kt:45— catalog/src/main/java/com/google/android/fhir/catalog/BehaviorsRecyclerViewAdapter.kt:45-50 | catalog/src/main/java/com/google/android/fhir/catalog/LayoutsRecyclerViewAdapter.kt:44-49 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt:236— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt:236-241 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt:264-269 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) demo/src/main/java/com/google/android/fhir/demo/data/TimestampBasedDownloadWorkManagerImpl.kt:145— demo/src/main/java/com/google/android/fhir/demo/data/TimestampBasedDownloadWorkManagerImpl.kt:145-150 | engine/src/main/java/com/google/android/fhir/Util.kt:39-44 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/enablement/FhirValueComparators.kt:49— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/enablement/FhirValueComparators.kt:49-54 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/enablement/FhirValueComparators.kt:109-114 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/enablement/FhirValueComparators.kt:48` calls `asBoolean` and `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/enablement/FhirValueComparators.kt:108` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Low cohesion: Search (LCOM4 8) engine/src/main/java/com/google/android/fhir/search/SearchDsl.kt:44— Search's methods fall into 8 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 8 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: MainActivity (LCOM4 7) catalog/src/main/java/com/google/android/fhir/catalog/MainActivity.kt:34— MainActivity's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: FhirEngineRepository (LCOM4 7) workflow/src/main/java/com/google/android/fhir/workflow/repositories/FhirEngineRepository.kt:40— FhirEngineRepository's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: KnowledgeRepository (LCOM4 7) workflow/src/main/java/com/google/android/fhir/workflow/repositories/KnowledgeRepository.kt:36— KnowledgeRepository's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
X17 · Uncapped recursion over a caller-supplied document· Recursive walk over a caller-supplied document has no depth cap · ×4
Recursive walk over a caller-supplied document has no depth cap engine/src/main/java/com/google/android/fhir/db/impl/JsonUtils.kt:53— `replaceJsonValue` is public and takes `jsonObject: JSONObject` from its caller, and it calls itself at line 53 with a piece of `jsonObject` — the function is not `tailrec`, so every call is a real frame — and nowhere in `replaceJsonValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. On the JVM's default 1 MB thread stack a recursive walk throws `StackOverflowError` from about 500–2,000 levels on a cold first call and 6,000–17,000 once warmed up (OpenJDK 21 and 25; Android's threads are smaller). kotlinx.serialization's `parseToJsonElement` accepts nested arrays to any depth and Android's built-in `org.json` sets no limit, while Jackson 2.15+ stops at 1,000 — on a cold JVM past the point the walk fails; Gson 2.12+ and Moshi stop at 255. `StackOverflowError` is an `Error`, not an `Exception`: a `catch (e: Exception)` around the call does not stop it, and on Android an uncaught one ends the process. Thread a depth argument through `replaceJsonValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack or a `DeepRecursiveFunction`.
Recursive walk over a caller-supplied document has no depth cap engine/src/main/java/com/google/android/fhir/db/impl/JsonUtils.kt:72— `replaceJsonValue` is public and takes `jsonArray: JSONArray` from its caller, and it calls itself at line 72 with a piece of `jsonArray` — the function is not `tailrec`, so every call is a real frame — and nowhere in `replaceJsonValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. On the JVM's default 1 MB thread stack a recursive walk throws `StackOverflowError` from about 500–2,000 levels on a cold first call and 6,000–17,000 once warmed up (OpenJDK 21 and 25; Android's threads are smaller). kotlinx.serialization's `parseToJsonElement` accepts nested arrays to any depth and Android's built-in `org.json` sets no limit, while Jackson 2.15+ stops at 1,000 — on a cold JVM past the point the walk fails; Gson 2.12+ and Moshi stop at 255. `StackOverflowError` is an `Error`, not an `Exception`: a `catch (e: Exception)` around the call does not stop it, and on Android an uncaught one ends the process. Thread a depth argument through `replaceJsonValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack or a `DeepRecursiveFunction`.
Recursive walk over a caller-supplied document has no depth cap engine/src/main/java/com/google/android/fhir/db/impl/JsonUtils.kt:105— `extractAllValuesWithKey` is public and takes `jsonObject: JSONObject` from its caller, and it calls itself at line 105 with a piece of `jsonObject` — the function is not `tailrec`, so every call is a real frame — and nowhere in `extractAllValuesWithKey` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. On the JVM's default 1 MB thread stack a recursive walk throws `StackOverflowError` from about 500–2,000 levels on a cold first call and 6,000–17,000 once warmed up (OpenJDK 21 and 25; Android's threads are smaller). kotlinx.serialization's `parseToJsonElement` accepts nested arrays to any depth and Android's built-in `org.json` sets no limit, while Jackson 2.15+ stops at 1,000 — on a cold JVM past the point the walk fails; Gson 2.12+ and Moshi stop at 255. `StackOverflowError` is an `Error`, not an `Exception`: a `catch (e: Exception)` around the call does not stop it, and on Android an uncaught one ends the process. Thread a depth argument through `extractAllValuesWithKey` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack or a `DeepRecursiveFunction`.
Recursive walk over a caller-supplied document has no depth cap engine/src/main/java/com/google/android/fhir/db/impl/JsonUtils.kt:125— `extractAllValuesWithKey` is public and takes `jArray: JSONArray` from its caller, and it calls itself at line 125 with a piece of `jArray` — the function is not `tailrec`, so every call is a real frame — and nowhere in `extractAllValuesWithKey` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. On the JVM's default 1 MB thread stack a recursive walk throws `StackOverflowError` from about 500–2,000 levels on a cold first call and 6,000–17,000 once warmed up (OpenJDK 21 and 25; Android's threads are smaller). kotlinx.serialization's `parseToJsonElement` accepts nested arrays to any depth and Android's built-in `org.json` sets no limit, while Jackson 2.15+ stops at 1,000 — on a cold JVM past the point the walk fails; Gson 2.12+ and Moshi stop at 255. `StackOverflowError` is an `Error`, not an `Exception`: a `catch (e: Exception)` around the call does not stop it, and on Android an uncaught one ends the process. Thread a depth argument through `extractAllValuesWithKey` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack or a `DeepRecursiveFunction`.
Swallowed exception (caught, then discarded) workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/PlanDefinition.kt:183— `catch (e: java.lang.Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/PlanDefinition.kt:234— `catch (e: java.lang.Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.kt:59— `catch (_: Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) contrib/barcode/src/main/java/com/google/android/fhir/datacapture/contrib/views/barcode/mlkit/md/settings/PreferenceUtils.kt:83— `catch (e: Exception)` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
FileTooLong: datacapture/QuestionnaireViewModel.kt datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt— FileTooLong — 815 significant lines (blank, comment-only and punctuation-only lines excluded), about 86% of them inside a single declaration: QuestionnaireViewModel (105-1316). The bar is 500 significant lines; this is 315 over it, 1.63× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: datacapture/QuestionnaireViewModel.kt datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt— FileTooLong — 709 significant lines (blank, comment-only and punctuation-only lines excluded), about 87% of them inside a single declaration: QuestionnaireViewModel (88-1177). The bar is 500 significant lines; this is 209 over it, 1.42× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: extensions/MoreQuestionnaireItemComponents.kt datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItemComponents.kt— FileTooLong — 523 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 23 over it, 1.05× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×3
Members sharing a duplicated core (4 members, 50+ identical tokens) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/ChoiceCheckbox.kt:54— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/ChoiceCheckbox.kt:54-132 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/ChoiceRadioButton.kt:53-125 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/ChoiceCheckbox.kt:55-134 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/ChoiceRadioButton.kt:54-127 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt:80— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt:80-208 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/TimeFieldItem.kt:67-146 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DatePickerItem.kt:78-205 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/TimePickerItem.kt:63-141 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateTimeViewFactory.kt:71— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateTimeViewFactory.kt:71-241 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt:67-220 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DatePickerViewHolderFactory.kt:61-218 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DateTimePickerViewHolderFactory.kt:70-253 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×3
Edited copy of a member (22 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:335— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:335-356 | datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:354-375 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/AttachmentMediaHandler.android.kt:71— datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/AttachmentMediaHandler.android.kt:71-92 | datacapture-kmp/src/iosMain/kotlin/com/google/android/fhir/datacapture/AttachmentMediaHandler.ios.kt:81-104 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/expressions/EnabledAnswerOptionsEvaluator.kt:90— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/expressions/EnabledAnswerOptionsEvaluator.kt:90-111 | datacapture/src/main/java/com/google/android/fhir/datacapture/expressions/EnabledAnswerOptionsEvaluator.kt:99-124 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (16 corresponding lines) · ×3
Edited copy of a member (16 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/GroupViewFactory.kt:37— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/GroupViewFactory.kt:37-52 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/GroupViewHolderFactory.kt:37-57 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/AnswerExtensionConstraintValidator.kt:48— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/AnswerExtensionConstraintValidator.kt:48-63 | datacapture/src/main/java/com/google/android/fhir/datacapture/validation/AnswerExtensionConstraintValidator.kt:53-71 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) demo/src/main/java/com/google/android/fhir/demo/PatientDetailsViewModel.kt:155— demo/src/main/java/com/google/android/fhir/demo/PatientDetailsViewModel.kt:155-171 | demo/src/main/java/com/google/android/fhir/demo/PatientDetailsViewModel.kt:173-188 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (21 corresponding lines) · ×3
Edited copy of a member (21 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:257— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:257-278 | datacapture/src/main/java/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:266-286 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) engine/src/main/java/com/google/android/fhir/sync/upload/request/TransactionBundleGenerator.kt:121— engine/src/main/java/com/google/android/fhir/sync/upload/request/TransactionBundleGenerator.kt:121-141 | engine/src/main/java/com/google/android/fhir/sync/upload/request/UrlRequestGenerator.kt:81-101 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) workflow/src/main/java/com/google/android/fhir/workflow/activity/phase/request/OrderPhase.kt:56— workflow/src/main/java/com/google/android/fhir/workflow/activity/phase/request/OrderPhase.kt:56-76 | workflow/src/main/java/com/google/android/fhir/workflow/activity/phase/request/PlanPhase.kt:53-75 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (8 corresponding lines) · ×3
Edited copy of a member (8 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt:220— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt:220-227 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt:246-255 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) datacapture-kmp/src/jsMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.js.kt:69— datacapture-kmp/src/jsMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.js.kt:69-76 | datacapture-kmp/src/wasmJsMain/kotlin/com/google/android/fhir/datacapture/LocalDateTimeFormatter.wasmJs.kt:70-79 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) catalog/src/main/java/com/google/android/fhir/catalog/ComponentListFragment.kt:47— catalog/src/main/java/com/google/android/fhir/catalog/ComponentListFragment.kt:47-56 | catalog/src/main/java/com/google/android/fhir/catalog/LayoutListFragment.kt:54-61 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×3
Edited copy of a member (10 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/ErrorText.kt:30— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/ErrorText.kt:30-39 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/ErrorText.kt:29-38 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) workflow/src/main/java/com/google/android/fhir/workflow/activity/resource/event/CPGEventResource.kt:113— workflow/src/main/java/com/google/android/fhir/workflow/activity/resource/event/CPGEventResource.kt:113-122 | workflow/src/main/java/com/google/android/fhir/workflow/activity/resource/event/EventStatusCodeMapper.kt:42-54 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) demo/src/main/java/com/google/android/fhir/demo/AddPatientFragment.kt:113— demo/src/main/java/com/google/android/fhir/demo/AddPatientFragment.kt:113-122 | demo/src/main/java/com/google/android/fhir/demo/ScreenerFragment.kt:122-133 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (41 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/EditTextFieldItem.kt:86— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/EditTextFieldItem.kt:86-126 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/EditTextFieldItem.kt:82-122 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/EditTextFieldItem.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/EditTextFieldItem.kt` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 67 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/EditTextFieldItem.kt:86` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (41 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:87— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:87-127 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/OptionDialogSelect.kt:75-115 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/OptionDialogSelect.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 163 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:87` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (41 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/TimeFieldItem.kt:72— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/TimeFieldItem.kt:72-112 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/TimePickerItem.kt:67-107 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/TimeFieldItem.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/TimePickerItem.kt` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 77 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/TimeFieldItem.kt:72` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/TimeFieldItem.kt:70` calls `getLocalDateTimeFormatter` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/TimePickerItem.kt:66` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (25 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:420— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:420-444 | datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:435-459 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `questionnaireItem` to `Questionnaire.Item` in one and `QuestionnaireItemComponent` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (25 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/TimeFieldItem.kt:115— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/TimeFieldItem.kt:115-139 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/TimePickerItem.kt:110-134 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/TimeFieldItem.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/TimePickerItem.kt` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 77 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/TimeFieldItem.kt:115` 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 (25 lines × 2) datacapture/src/main/java/com/google/android/fhir/datacapture/contrib/views/PhoneNumberViewHolderFactory.kt:34— datacapture/src/main/java/com/google/android/fhir/datacapture/contrib/views/PhoneNumberViewHolderFactory.kt:34-58 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/EditTextStringDelegateFactory.kt:39-63 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/EditTextStringDelegateFactory.kt:39` 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 (22 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:603— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:603-624 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:531-552 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:603` 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 (22 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:828— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:828-849 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:719-740 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:828` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt:168— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt:168-189 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DatePickerItem.kt:165-186 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DatePickerItem.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt:168` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) codelabs/engine/app/src/main/java/com/google/android/fhir/codelabs/engine/PatientListFragment.kt:129— codelabs/engine/app/src/main/java/com/google/android/fhir/codelabs/engine/PatientListFragment.kt:129-143 | demo/src/main/java/com/google/android/fhir/demo/PatientListFragment.kt:120-134 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `demo/src/main/java/com/google/android/fhir/demo/PatientListFragment.kt:135` calls `setHasOptionsMenu` and `codelabs/engine/app/src/main/java/com/google/android/fhir/codelabs/engine/PatientListFragment.kt:144` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (15 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:113— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:113-127 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DropDownItem.kt:103-117 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DropDownItem.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 99 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:113` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:626— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:626-640 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:554-568 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (14 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewFactory.kt:55— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewFactory.kt:55-68 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/RadioGroupViewFactory.kt:55-68 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewFactory.kt:55` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) engine/src/main/java/com/google/android/fhir/sync/Sync.kt:235— engine/src/main/java/com/google/android/fhir/sync/Sync.kt:235-248 | engine/src/main/java/com/google/android/fhir/sync/Sync.kt:265-278 — both copies are in the same file, so extract the 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 `engine/src/main/java/com/google/android/fhir/sync/Sync.kt:235` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (14 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/expressions/EnabledAnswerOptionsEvaluator.kt:239— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/expressions/EnabledAnswerOptionsEvaluator.kt:239-252 | datacapture/src/main/java/com/google/android/fhir/datacapture/expressions/EnabledAnswerOptionsEvaluator.kt:248-262 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/expressions/EnabledAnswerOptionsEvaluator.kt:239` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:147— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:147-153 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/OptionDialogSelect.kt:135-141 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/OptionDialogSelect.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 163 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:147` 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) engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:111— engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:111-117 | engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:174-180 — both copies are in the same file, so extract the 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 `engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:111` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt:258— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt:258-264 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DatePickerItem.kt:255-261 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DatePickerItem.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
QuestionnaireViewModel.getQuestionnaireState (cyclomatic 28) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:822— QuestionnaireViewModel.getQuestionnaireState has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
QuestionnaireViewModel.getQuestionnaireState (cyclomatic 28) datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:713— QuestionnaireViewModel.getQuestionnaireState has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
OptionDialogSelectKt.OptionDialogSelect (cyclomatic 25) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:78— OptionDialogSelectKt.OptionDialogSelect has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OptionDialogSelectKt.OptionDialogSelect (cyclomatic 25) datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/OptionDialogSelect.kt:65— OptionDialogSelectKt.OptionDialogSelect has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
QuestionnaireViewModel.getQuestionnaireState (cognitive 45) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:822— QuestionnaireViewModel.getQuestionnaireState has cognitive complexity 45 (threshold 15). Drivers by points: if/else 26 (31 pts), boolean chains 12, match/switch 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
QuestionnaireViewModel.getQuestionnaireState (cognitive 45) datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:713— QuestionnaireViewModel.getQuestionnaireState has cognitive complexity 45 (threshold 15). Drivers by points: if/else 26 (31 pts), boolean chains 12, match/switch 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
OptionDialogSelectKt.OptionDialogSelect (cognitive 32) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:78— OptionDialogSelectKt.OptionDialogSelect has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 9, match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OptionDialogSelectKt.OptionDialogSelect (cognitive 32) datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/OptionDialogSelect.kt:65— OptionDialogSelectKt.OptionDialogSelect has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 9, match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
QuestionnaireViewModel.getQuestionnaireAdapterItems (cognitive 18) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:987— QuestionnaireViewModel.getQuestionnaireAdapterItems has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
QuestionnaireViewModel.getQuestionnaireAdapterItems (cognitive 18) datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:878— QuestionnaireViewModel.getQuestionnaireAdapterItems has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ClassTooLong: QuestionnaireViewModel datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:105— ClassTooLong — 704 significant lines (blank, comment-only and punctuation-only lines excluded), 25 methods. The bar is 400 significant lines; this is 304 over it, 1.76× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: QuestionnaireViewModel datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:88— ClassTooLong — 615 significant lines (blank, comment-only and punctuation-only lines excluded), 24 methods. The bar is 400 significant lines; this is 215 over it, 1.54× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication· Edited copy of a member (54 corresponding lines) · ×2
Edited copy of a member (54 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/EditTextFieldItem.kt:85— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/EditTextFieldItem.kt:85-138 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/EditTextFieldItem.kt:81-134 — These two members are one piece of code written twice and then edited apart: 54 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (54 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:74— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:74-127 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DropDownItem.kt:64-117 — These two members are one piece of code written twice and then edited apart: 54 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (36 corresponding lines) · ×2
Edited copy of a member (36 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/RepeatedGroupHeaderItem.kt:55— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/RepeatedGroupHeaderItem.kt:55-91 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/RepeatedGroupHeaderItem.kt:49-84 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (36 corresponding lines) datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/EditTextDecimalViewHolderFactory.kt:31— datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/EditTextDecimalViewHolderFactory.kt:31-66 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/EditTextIntegerViewHolderFactory.kt:35-75 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (25 corresponding lines) · ×2
Edited copy of a member (25 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireLists.kt:360— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireLists.kt:360-384 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireLists.kt:251-281 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) engine/src/main/java/com/google/android/fhir/db/impl/JsonUtils.kt:39— engine/src/main/java/com/google/android/fhir/db/impl/JsonUtils.kt:39-63 | engine/src/main/java/com/google/android/fhir/db/impl/JsonUtils.kt:90-116 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (37 corresponding lines) · ×2
Edited copy of a member (37 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/Header.kt:143— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/Header.kt:143-179 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/Header.kt:130-169 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (37 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:61— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:61-97 | datacapture/src/main/java/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:66-103 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (30 corresponding lines) · ×2
Edited copy of a member (30 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/expressions/EnabledAnswerOptionsEvaluator.kt:230— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/expressions/EnabledAnswerOptionsEvaluator.kt:230-259 | datacapture/src/main/java/com/google/android/fhir/datacapture/expressions/EnabledAnswerOptionsEvaluator.kt:235-270 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreQuestionnaires.kt:207— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreQuestionnaires.kt:207-236 | datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreQuestionnaires.kt:201-230 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×2
Edited copy of a member (27 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/enablement/EnablementEvaluator.kt:234— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/enablement/EnablementEvaluator.kt:234-260 | datacapture/src/main/java/com/google/android/fhir/datacapture/enablement/EnablementEvaluator.kt:224-250 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) contrib/locationwidget/src/main/java/com/google/android/fhir/datacapture/contrib/views/locationwidget/CurrentLocationDialogFragment.kt:41— contrib/locationwidget/src/main/java/com/google/android/fhir/datacapture/contrib/views/locationwidget/CurrentLocationDialogFragment.kt:41-67 | contrib/locationwidget/src/main/java/com/google/android/fhir/datacapture/contrib/views/locationwidget/CurrentLocationDialogFragment.kt:70-99 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (18 corresponding lines) · ×2
Edited copy of a member (18 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:583— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:583-600 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:511-528 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:179— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:179-196 | datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:193-216 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×2
Edited copy of a member (20 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:307— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:307-326 | datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:326-345 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:135— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:135-157 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DropDownItem.kt:125-144 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×2
Edited copy of a member (15 corresponding lines) datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt:139— datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt:139-153 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt:135-150 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/PlanDefinition.kt:287— workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/PlanDefinition.kt:287-301 | workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/PlanDefinition.kt:348-362 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×2
Edited copy of a member (14 corresponding lines) engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt:238— engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt:238-251 | engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt:255-268 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt:156— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt:156-169 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt:173-186 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (12 corresponding lines) · ×2
Edited copy of a member (12 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:220— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:220-231 | datacapture/src/main/java/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:229-240 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) demo/src/main/java/com/google/android/fhir/demo/PatientDetailsViewModel.kt:205— demo/src/main/java/com/google/android/fhir/demo/PatientDetailsViewModel.kt:205-216 | demo/src/main/java/com/google/android/fhir/demo/PatientDetailsViewModel.kt:218-231 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (80 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt:86— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt:86-165 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DatePickerItem.kt:83-162 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DatePickerItem.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt:86` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt:84` calls `getLocalDateTimeFormatter` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DatePickerItem.kt:81` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (80 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/MultiAutoCompleteTextItem.kt:87— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/MultiAutoCompleteTextItem.kt:87-166 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/MultiAutoCompleteTextItem.kt:84-163 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/MultiAutoCompleteTextItem.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/MultiAutoCompleteTextItem.kt` as WHOLE FILES: 88% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/MultiAutoCompleteTextItem.kt:87` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18–19 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/Header.kt:146— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/Header.kt:146-163 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/Header.kt:135-153 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/Header.kt:146` 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 (18–19 lines × 2) datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewHolderFactory.kt:53— datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewHolderFactory.kt:53-71 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/RadioGroupViewHolderFactory.kt:53-70 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewHolderFactory.kt:53` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (18 lines × 3) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewFactory.kt:90— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewFactory.kt:90-107 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewFactory.kt:106-123 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/RadioGroupViewFactory.kt:86-103 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewFactory.kt` and `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/RadioGroupViewFactory.kt` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewFactory.kt:90` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18 lines × 3) datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewHolderFactory.kt:84— datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewHolderFactory.kt:84-101 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewHolderFactory.kt:120-137 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/RadioGroupViewHolderFactory.kt:93-110 — before extracting anything, compare `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewHolderFactory.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/RadioGroupViewHolderFactory.kt` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewHolderFactory.kt:84` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14–16 lines × 2) datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireFragment.kt:150— datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireFragment.kt:150-163 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireFragment.kt:249-264 — before extracting anything, compare `datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireFragment.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireFragment.kt` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireFragment.kt:150` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (14–16 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/ChoiceCheckbox.kt:100— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/ChoiceCheckbox.kt:100-115 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/ChoiceCheckbox.kt:101-114 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/ChoiceCheckbox.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/ChoiceCheckbox.kt` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/ChoiceCheckbox.kt:100` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (16 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/TimePickerDialog.kt:60— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/TimePickerDialog.kt:60-75 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/TimePickerDialog.kt:53-68 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/TimePickerDialog.kt:60` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (16 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:120— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:120-135 | datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:127-142 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 87 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `items` to `List<Questionnaire.Item>` in one and `List<QuestionnaireItemComponent>` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (10–11 lines × 2) datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireFragment.kt:112— datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireFragment.kt:112-122 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireFragment.kt:111-120 — before extracting anything, compare `datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireFragment.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireFragment.kt` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireFragment.kt:112` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10–11 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/AttachmentViewFactory.kt:340— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/AttachmentViewFactory.kt:340-350 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/AttachmentViewHolderFactory.kt:422-431 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/AttachmentViewFactory.kt:340` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Off the main sequence: .:datacapture — .:datacapture: abstractness 0.11, instability 0.00, distance 0.89 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Off the main sequence: .:engine — .:engine: abstractness 0.14, instability 0.00, distance 0.86 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
AXR1 · Runtime accessibility (rendered)· WCAG 2.5.5 reproducibly failed on a screen of the running app · ×1
WCAG 2.5.5 reproducibly failed on a screen of the running app — Accessibility-tree rule(s) android-target-size-enhanced failed on: /FrameLayout[0]/LinearLayout[0]/FrameLayout[0]/LinearLayout[0]/FrameLayout[0]/ViewGroup[0]/FrameLayout[1]/FrameLayout[0]/GridView[0]/CardView[7], /FrameLayout[0]/LinearLayout[0]/FrameLayout[0]/LinearLayout[0]/FrameLayout[0]/ViewGroup[0]/FrameLayout[1]/FrameLayout[0]/GridView[0]/CardView[8], /FrameLayout[0]/LinearLayout[0]/FrameLayout[0]/LinearLayout[0]/FrameLayout[0]/ViewGroup[0]/ViewGroup[0]/LinearLayoutCompat[1]/ImageView[0]. Read from the Android accessibility tree on an emulator (advisory — not scored); fix and re-scan to verify it clears.
FhirValueComparatorsKt.equalsFhirValue (cyclomatic 41) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/enablement/FhirValueComparators.kt:39— FhirValueComparatorsKt.equalsFhirValue has cyclomatic complexity 41 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This file is where this pass's cyclomatic complexity CONCENTRATES: datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/enablement/FhirValueComparators.kt holds 2 of the 6 methods over the threshold — including the worst — and 36 of the 82 points over it (44%), 2.8× the next-largest file (datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt at 13). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
FhirValueComparatorsKt.compareFhirValue (cyclomatic 25) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/enablement/FhirValueComparators.kt:101— FhirValueComparatorsKt.compareFhirValue has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This file is where this pass's cyclomatic complexity CONCENTRATES: datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/enablement/FhirValueComparators.kt holds 2 of the 6 methods over the threshold — including the worst — and 36 of the 82 points over it (44%), 2.8× the next-largest file (datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt at 13). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
QuestionnaireListsKt.QuestionnaireReviewItem (cognitive 24) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireLists.kt:180— QuestionnaireListsKt.QuestionnaireReviewItem has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 2, match/switch 1 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
FhirValueComparatorsKt.compareFhirValue (cognitive 23) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/enablement/FhirValueComparators.kt:101— FhirValueComparatorsKt.compareFhirValue has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (20 pts), match/switch 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FhirValueComparatorsKt.equalsFhirValue (cognitive 22) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/enablement/FhirValueComparators.kt:39— FhirValueComparatorsKt.equalsFhirValue has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 13, if/else 6, match/switch 2 (3 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
ResourceMapper.populateQuestionnaireResponseItem (cognitive 21) datacapture/src/main/java/com/google/android/fhir/datacapture/mapping/ResourceMapper.kt:254— ResourceMapper.populateQuestionnaireResponseItem has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
QuestionnaireFragment.onViewCreated (cognitive 20) datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireFragment.kt:99— QuestionnaireFragment.onViewCreated has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (17 pts), match/switch 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DateFieldItemKt.DateFieldItem (cognitive 17) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt:68— DateFieldItemKt.DateFieldItem has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DatePickerItemKt.DatePickerItem (cognitive 17) datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DatePickerItem.kt:66— DatePickerItemKt.DatePickerItem has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CameraSource.selectSizePair (cognitive 17) contrib/barcode/src/main/java/com/google/android/fhir/datacapture/contrib/views/barcode/mlkit/md/camera/CameraSource.kt:452— CameraSource.selectSizePair has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IGInputStreamStructureRepository.search (cognitive 16) workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/IGInputStreamStructureRepository.kt:259— IGInputStreamStructureRepository.search has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (5 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Change coupling clique: FhirEngineImpl.kt, Config.kt, FhirSyncWorker.kt engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt— 3 files — `engine/src/main/java/com/google/android/fhir/impl/FhirEngineImpl.kt`, `engine/src/main/java/com/google/android/fhir/sync/Config.kt`, `engine/src/main/java/com/google/android/fhir/sync/FhirSyncWorker.kt` — all change together with no explicit dependency: a fully-connected co-change clique, not 3 separate couplings. They share one concern (thin parallel siblings over a common abstraction), so extract the shared part into ONE unit and the whole clique's coupling clears at once — you do not need to break each pair individually.
Near-duplicate member pair (157 shared lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:991— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:991-1176 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:882-1069 — These two members are variants of one another: 157 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (142 shared lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:86— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:86-322 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/OptionDialogSelect.kt:74-310 — These two members are variants of one another: 142 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (136 shared lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:822— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:822-965 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:713-856 — These two members are variants of one another: 136 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (60 shared lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:172— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DropDownItem.kt:172-276 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DropDownItem.kt:159-260 — These two members are variants of one another: 60 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (34 shared lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/QuantityViewFactory.kt:64— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/QuantityViewFactory.kt:64-143 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/QuantityViewHolderFactory.kt:64-219 — These two members are variants of one another: 34 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (29 shared lines) engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:109— engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:109-167 | engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:171-230 — These two members are variants of one another: 29 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (140 corresponding lines) · ×1
Edited copy of a member (140 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/AttachmentViewFactory.kt:104— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/AttachmentViewFactory.kt:104-243 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/AttachmentViewHolderFactory.kt:92-237 — These two members are one piece of code written twice and then edited apart: 140 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (121 corresponding lines) · ×1
Edited copy of a member (121 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/MultiAutoCompleteTextItem.kt:72— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/MultiAutoCompleteTextItem.kt:72-192 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/MultiAutoCompleteTextItem.kt:69-189 — These two members are one piece of code written twice and then edited apart: 121 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (113 corresponding lines) · ×1
Edited copy of a member (113 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewFactory.kt:54— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewFactory.kt:54-166 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewHolderFactory.kt:53-185 — These two members are one piece of code written twice and then edited apart: 113 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (103 corresponding lines) · ×1
Edited copy of a member (103 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewFactory.kt:56— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewFactory.kt:56-158 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewHolderFactory.kt:51-153 — These two members are one piece of code written twice and then edited apart: 103 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (119 corresponding lines) · ×1
Edited copy of a member (119 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DialogSelectViewFactory.kt:70— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DialogSelectViewFactory.kt:70-196 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DialogSelectViewHolderFactory.kt:64-182 — These two members are one piece of code written twice and then edited apart: 119 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (93 corresponding lines) · ×1
Edited copy of a member (93 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/RadioGroupViewFactory.kt:54— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/RadioGroupViewFactory.kt:54-146 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/RadioGroupViewHolderFactory.kt:53-152 — These two members are one piece of code written twice and then edited apart: 93 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (97 corresponding lines) · ×1
Edited copy of a member (97 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/AutoCompleteViewFactory.kt:44— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/AutoCompleteViewFactory.kt:44-140 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/AutoCompleteViewHolderFactory.kt:47-164 — These two members are one piece of code written twice and then edited apart: 97 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (60 corresponding lines) · ×1
Edited copy of a member (60 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/SliderViewFactory.kt:53— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/SliderViewFactory.kt:53-118 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/SliderViewHolderFactory.kt:47-106 — These two members are one piece of code written twice and then edited apart: 60 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (59 corresponding lines) · ×1
Edited copy of a member (59 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/PageNavigationItem.kt:55— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/PageNavigationItem.kt:55-115 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/PageNavigationView.kt:56-114 — These two members are one piece of code written twice and then edited apart: 59 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (56 corresponding lines) · ×1
Edited copy of a member (56 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/RepeatedGroupAddButtonItem.kt:51— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/RepeatedGroupAddButtonItem.kt:51-106 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/RepeatedGroupAddItem.kt:48-103 — These two members are one piece of code written twice and then edited apart: 56 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (69 corresponding lines) · ×1
Edited copy of a member (69 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/TimePickerDialog.kt:59— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/TimePickerDialog.kt:59-127 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/TimePickerDialog.kt:52-120 — These two members are one piece of code written twice and then edited apart: 69 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (44 corresponding lines) · ×1
Edited copy of a member (44 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/EditTextViewFactoryDelegate.kt:56— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/EditTextViewFactoryDelegate.kt:56-99 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/EditTextViewHolderDelegate.kt:54-99 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (42 corresponding lines) · ×1
Edited copy of a member (42 corresponding lines) engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:469— engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:469-510 | engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:515-556 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (35 corresponding lines) · ×1
Edited copy of a member (35 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/AttachmentViewFactory.kt:252— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/AttachmentViewFactory.kt:252-286 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/AttachmentViewFactory.kt:297-332 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 37+ corresponding lines) · ×1
Edited copies of one member (3 members, 37+ corresponding lines) workflow/src/main/java/com/google/android/fhir/workflow/activity/phase/event/PerformPhase.kt:178— workflow/src/main/java/com/google/android/fhir/workflow/activity/phase/event/PerformPhase.kt:178-214 | workflow/src/main/java/com/google/android/fhir/workflow/activity/phase/request/OrderPhase.kt:87-129 | workflow/src/main/java/com/google/android/fhir/workflow/activity/phase/request/PlanPhase.kt:86-127 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 37 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (33 corresponding lines) · ×1
Edited copy of a member (33 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:481— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:481-517 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:428-460 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (50 corresponding lines) · ×1
Edited copy of a member (50 corresponding lines) workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/PlanDefinition.kt:171— workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/PlanDefinition.kt:171-220 | workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/PlanDefinition.kt:222-271 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (40 corresponding lines) · ×1
Edited copy of a member (40 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/enablement/EnablementEvaluator.kt:131— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/enablement/EnablementEvaluator.kt:131-177 | datacapture/src/main/java/com/google/android/fhir/datacapture/enablement/EnablementEvaluator.kt:134-173 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (45 corresponding lines) · ×1
Edited copy of a member (45 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:144— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:144-188 | datacapture/src/main/java/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:153-197 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (24 corresponding lines) · ×1
Edited copy of a member (24 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1214— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1214-1253 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1101-1124 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (32 corresponding lines) · ×1
Edited copy of a member (32 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/expressions/EnabledAnswerOptionsEvaluator.kt:194— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/expressions/EnabledAnswerOptionsEvaluator.kt:194-225 | datacapture/src/main/java/com/google/android/fhir/datacapture/expressions/EnabledAnswerOptionsEvaluator.kt:198-229 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×1
Edited copy of a member (29 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseItemValidator.kt:50— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseItemValidator.kt:50-78 | datacapture/src/main/java/com/google/android/fhir/datacapture/validation/QuestionnaireResponseItemValidator.kt:52-83 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (34 corresponding lines) · ×1
Edited copy of a member (34 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreLocalDates.kt:36— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreLocalDates.kt:36-69 | datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreLocalDates.kt:51-84 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 17+ corresponding lines) · ×1
Edited copies of one member (4 members, 17+ corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:105— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:105-136 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:236-252 | datacapture/src/main/java/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:112-144 | datacapture/src/main/java/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:245-261 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (26 corresponding lines) · ×1
Edited copy of a member (26 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:370— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:370-397 | datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:390-415 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (7 corresponding lines) · ×1
Edited copy of a member (7 corresponding lines) catalog/src/main/java/com/google/android/fhir/catalog/DemoQuestionnaireFragment.kt:124— catalog/src/main/java/com/google/android/fhir/catalog/DemoQuestionnaireFragment.kt:124-130 | catalog/src/main/java/com/google/android/fhir/catalog/QuestionnaireResponseFragment.kt:67-76 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 4+ corresponding lines) · ×1
Edited copies of one member (4 members, 4+ corresponding lines) workflow/src/main/java/com/google/android/fhir/workflow/activity/resource/event/CPGCommunicationEvent.kt:30— workflow/src/main/java/com/google/android/fhir/workflow/activity/resource/event/CPGCommunicationEvent.kt:30-33 | workflow/src/main/java/com/google/android/fhir/workflow/activity/resource/event/CPGMedicationDispenseEvent.kt:31-35 | workflow/src/main/java/com/google/android/fhir/workflow/activity/resource/request/CPGCommunicationRequest.kt:46-50 | workflow/src/main/java/com/google/android/fhir/workflow/activity/resource/request/CPGMedicationRequest.kt:33-37 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (1 corresponding lines) · ×1
Edited copy of a member (1 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireResponseItemAnswerComponents.kt:22— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireResponseItemAnswerComponents.kt:22-22 | datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireResponseItemAnswerComponents.kt:24-25 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (5 corresponding lines) · ×1
Edited copy of a member (5 corresponding lines) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt:248— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt:248-255 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/TimeViewFactory.kt:128-132 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (104–106 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1071— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1071-1176 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:966-1069 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1071` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (83 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:851— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:851-933 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:742-824 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:851` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (51 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:202— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:202-252 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/OptionDialogSelect.kt:190-240 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/OptionDialogSelect.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 163 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:202` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (43 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:155— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:155-197 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/OptionDialogSelect.kt:143-185 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/OptionDialogSelect.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 163 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:155` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (35 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireLists.kt:92— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireLists.kt:92-126 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireLists.kt:79-113 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireLists.kt:92` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (34 lines × 4) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/ChoiceCheckbox.kt:55— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/ChoiceCheckbox.kt:55-88 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/ChoiceRadioButton.kt:54-87 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/ChoiceCheckbox.kt:56-89 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/ChoiceRadioButton.kt:55-88 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/ChoiceCheckbox.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/ChoiceCheckbox.kt` as WHOLE FILES: 83% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/ChoiceCheckbox.kt:55` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (31 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:935— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:935-965 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:826-856 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:935` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (29–30 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1034— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1034-1062 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:921-950 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 368 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1034` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (30 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt:218— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt:218-247 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DatePickerItem.kt:215-244 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DatePickerItem.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (28 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/TimePickerDialog.kt:80— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/TimePickerDialog.kt:80-107 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/TimePickerDialog.kt:73-100 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/TimePickerDialog.kt:80` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (27 lines × 2) datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt:78— datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt:78-104 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt:79-105 — before extracting anything, compare `datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt` as WHOLE FILES: 84% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt:107` calls `toSpanned`, `fromHtml` and `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt:107` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (26 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/AutoCompleteViewFactory.kt:77— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/AutoCompleteViewFactory.kt:77-102 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/AutoCompleteViewHolderFactory.kt:94-119 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/AutoCompleteViewFactory.kt:77` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `Header` names `com.google.android.fhir.datacapture.views.components.Header` in one and `com.google.android.fhir.datacapture.views.compose.Header` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (17–22 lines × 2) datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DatePickerViewHolderFactory.kt:92— datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DatePickerViewHolderFactory.kt:92-108 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DateTimePickerViewHolderFactory.kt:116-137 — before extracting anything, compare `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DatePickerViewHolderFactory.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DateTimePickerViewHolderFactory.kt` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DateTimePickerViewHolderFactory.kt:116` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (21 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:333— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:333-353 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/OptionDialogSelect.kt:321-341 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/OptionDialogSelect.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 163 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (19–20 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateTimeViewFactory.kt:110— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateTimeViewFactory.kt:110-129 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt:107-125 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateTimeViewFactory.kt` and `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateTimeViewFactory.kt:110` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (20 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DialogSelectViewFactory.kt:145— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DialogSelectViewFactory.kt:145-164 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DialogSelectViewHolderFactory.kt:128-147 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DialogSelectViewFactory.kt:145` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `OptionDialogSelect` names `com.google.android.fhir.datacapture.views.components.OptionDialogSelect` in one and `com.google.android.fhir.datacapture.views.compose.OptionDialogSelect` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (11–17 lines × 2) datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireFragment.kt:169— datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireFragment.kt:169-179 | datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireFragment.kt:266-282 — before extracting anything, compare `datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireFragment.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireFragment.kt` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireFragment.kt:169` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (12–17 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewFactory.kt:60— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewFactory.kt:60-71 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/CheckBoxGroupViewHolderFactory.kt:61-77 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (15–16 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateTimeViewFactory.kt:80— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateTimeViewFactory.kt:80-95 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt:86-100 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateTimeViewFactory.kt` and `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateTimeViewFactory.kt:80` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 4) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewFactory.kt:96— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewFactory.kt:96-109 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/RadioGroupViewFactory.kt:92-105 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewHolderFactory.kt:90-103 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/RadioGroupViewHolderFactory.kt:99-112 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewFactory.kt` and `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/RadioGroupViewFactory.kt` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 64 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/BooleanChoiceViewFactory.kt:96` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `Header` names `com.google.android.fhir.datacapture.views.components.Header` in one and `com.google.android.fhir.datacapture.views.compose.Header` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (12–14 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/QuantityViewFactory.kt:74— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/QuantityViewFactory.kt:74-87 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/QuantityViewHolderFactory.kt:75-86 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/QuantityViewFactory.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/QuantityViewHolderFactory.kt` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/QuantityViewHolderFactory.kt:74` calls `remember`, `unitDropDownOptions` and `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/QuantityViewFactory.kt:73` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13–14 lines × 2) datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DatePickerViewHolderFactory.kt:72— datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DatePickerViewHolderFactory.kt:72-84 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DateTimePickerViewHolderFactory.kt:83-96 — before extracting anything, compare `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DatePickerViewHolderFactory.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DateTimePickerViewHolderFactory.kt` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 49 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DateTimePickerViewHolderFactory.kt:81` calls `remember`, `getLocalizedDatePattern` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DatePickerViewHolderFactory.kt:70` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 4) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateTimeViewFactory.kt:79— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateTimeViewFactory.kt:79-91 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt:85-97 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DatePickerViewHolderFactory.kt:71-83 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DateTimePickerViewHolderFactory.kt:82-94 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateTimeViewFactory.kt` and `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 81 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: `DateInputFormat` names `com.google.android.fhir.datacapture.views.components.DateInputFormat` in one and `com.google.android.fhir.datacapture.views.compose.DateInputFormat` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DateTimePickerViewHolderFactory.kt:81` calls `remember`, `getLocalizedDatePattern` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DatePickerViewHolderFactory.kt:70` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12–13 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt:121— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt:121-132 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DatePickerViewHolderFactory.kt:103-115 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DatePickerViewHolderFactory.kt` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt:121` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note first that the copies are not typed on the same thing: `DateInput` names `com.google.android.fhir.datacapture.views.components.DateInput` in one and `com.google.android.fhir.datacapture.views.compose.DateInput` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (10–13 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/GroupViewFactory.kt:43— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/GroupViewFactory.kt:43-52 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/GroupViewHolderFactory.kt:44-56 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/GroupViewFactory.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/GroupViewHolderFactory.kt` as WHOLE FILES: 88% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/GroupViewFactory.kt:43` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `ErrorText` names `com.google.android.fhir.datacapture.views.components.ErrorText` in one and `com.google.android.fhir.datacapture.views.compose.ErrorText` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (11–12 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/QuantityViewFactory.kt:95— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/QuantityViewFactory.kt:95-105 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/QuantityViewHolderFactory.kt:90-101 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/QuantityViewFactory.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/QuantityViewHolderFactory.kt` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 59 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/QuantityViewFactory.kt:95` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. Note first that the copies are not typed on the same thing: `EditTextFieldState` names `com.google.android.fhir.datacapture.views.components.EditTextFieldState` in one and `com.google.android.fhir.datacapture.views.compose.EditTextFieldState` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (9–11 lines × 4) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt:155— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt:155-163 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/TimeFieldItem.kt:96-106 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DatePickerItem.kt:152-160 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/TimePickerItem.kt:91-101 — before extracting anything, compare `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt` and `datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DatePickerItem.kt` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 150 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt:155` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/RadioGroupViewHolderFactory.kt:114— datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/RadioGroupViewHolderFactory.kt:114-121 | datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/RadioGroupViewHolderFactory.kt:133-140 — both copies are in the same file, so extract the 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 `datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/RadioGroupViewHolderFactory.kt:114` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (23–25 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:731— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:731-755 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:776-798 — both copies are in the same file, so extract the 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 `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:731` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireResponseItemComponents.kt:30— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireResponseItemComponents.kt:30-34 | datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireResponseItemComponents.kt:34-38 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireResponseItemComponents.kt:30` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 4) datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/MaxDecimalPlacesValidator.kt:56— datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/MaxDecimalPlacesValidator.kt:56-60 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/MaxValueValidator.kt:46-50 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/MinLengthValidator.kt:57-61 | datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/MinValueValidator.kt:46-50 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/MaxDecimalPlacesValidator.kt:56` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 3) workflow/src/main/java/com/google/android/fhir/workflow/repositories/KnowledgeRepository.kt:120— workflow/src/main/java/com/google/android/fhir/workflow/repositories/KnowledgeRepository.kt:120-124 | workflow/src/main/java/com/google/android/fhir/workflow/repositories/KnowledgeRepository.kt:125-129 | workflow/src/main/java/com/google/android/fhir/workflow/repositories/KnowledgeRepository.kt:130-134 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `workflow/src/main/java/com/google/android/fhir/workflow/repositories/KnowledgeRepository.kt:120` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication· Edited copies of one member (3 members, 19+ corresponding lines) · ×1
Edited copies of one member (3 members, 19+ corresponding lines) workflow_demo/src/main/java/com/google/android/fhir/workflow/demo/ui/main/ActivityHandler.kt:29— workflow_demo/src/main/java/com/google/android/fhir/workflow/demo/ui/main/ActivityHandler.kt:29-48 | workflow_demo/src/main/java/com/google/android/fhir/workflow/demo/ui/main/ActivityHandler.kt:50-69 | workflow_demo/src/main/java/com/google/android/fhir/workflow/demo/ui/main/ActivityHandler.kt:71-89 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 6+ corresponding lines) · ×1
Edited copies of one member (4 members, 6+ corresponding lines) demo/src/main/java/com/google/android/fhir/demo/AddPatientFragment.kt:73— demo/src/main/java/com/google/android/fhir/demo/AddPatientFragment.kt:73-78 | demo/src/main/java/com/google/android/fhir/demo/CrudOperationFragment.kt:92-97 | demo/src/main/java/com/google/android/fhir/demo/PeriodicSyncFragment.kt:65-70 | demo/src/main/java/com/google/android/fhir/demo/SyncFragment.kt:72-77 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
Duplicated block (9 lines × 5) demo/src/main/java/com/google/android/fhir/demo/AddPatientFragment.kt:63— demo/src/main/java/com/google/android/fhir/demo/AddPatientFragment.kt:63-71 | demo/src/main/java/com/google/android/fhir/demo/CrudOperationFragment.kt:82-90 | demo/src/main/java/com/google/android/fhir/demo/PatientListFragment.kt:143-151 | demo/src/main/java/com/google/android/fhir/demo/PeriodicSyncFragment.kt:55-63 | demo/src/main/java/com/google/android/fhir/demo/SyncFragment.kt:62-70 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once.
X2 · Cancellation propagation· Suspend function with a blocking request · ×1
Suspend function with a blocking request: downloadPackage knowledge/src/main/java/com/google/android/fhir/knowledge/npm/OkHttpNpmPackageDownloader.kt:41— `downloadPackage` suspends, but makes its request with `newCall(…).execute()`, which blocks: its caller's cancellation cannot reach the request, so it runs to its end after whatever wanted it has given up — `withContext(Dispatchers.IO)` moves it off the caller's thread and does not change that. Make the request with a call that suspends: Ktor, OkHttp's `executeAsync()`, or a `suspendCancellableCoroutine` over `enqueue` that cancels the `Call` in `invokeOnCancellation`.
Orphaned file datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItems.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file datacapture/src/main/java/com/google/android/fhir/datacapture/mapping/ResourceMapper.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireFragment.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file engine/src/main/java/com/google/android/fhir/search/MoreSearch.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/AttachmentViewHolderFactory.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file contrib/barcode/src/main/java/com/google/android/fhir/datacapture/contrib/views/barcode/mlkit/md/camera/CameraSource.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file engine/src/main/java/com/google/android/fhir/db/impl/dao/LocalChangeDao.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireLists.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file workflow/src/main/java/com/google/android/fhir/workflow/activity/ActivityFlow.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/AttachmentViewFactory.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file datacapture/src/main/java/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/IGInputStreamStructureRepository.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file engine/src/main/java/com/google/android/fhir/sync/Sync.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireLists.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file engine/benchmarks/app/src/main/java/com/google/android/fhir/engine/benchmarks/app/SearchApiViewModel.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file engine/src/main/java/com/google/android/fhir/db/impl/dao/ResourceDao.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/OptionDialogSelect.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireFragment.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file engine/src/main/java/com/google/android/fhir/index/ResourceIndexer.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file knowledge/src/main/java/com/google/android/fhir/knowledge/KnowledgeManager.kt:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt:119— `!dateInputFormat.delimiterExistsInPattern || isDeletion` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DatePickerItem.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/MultiAutoCompleteTextItem.kt:115— `!expanded && autoCompleteText.text.isNotBlank()` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/MultiAutoCompleteTextItem.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/MultiAutoCompleteTextItem.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/Header.kt:149— `!hintLocalizedText.isNullOrBlank() || isHelpButtonVisible || isHelpCardOpen` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/Header.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/Header.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/EditTextFieldItem.kt:95— `!isFocused && textFieldValue.text != inputText` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/EditTextFieldItem.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/EditTextFieldItem.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:829— `!isReadOnly && !isInReviewModeFlow.value && questionnaire.isPaginated` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateTimeViewFactory.kt:139— `!itemReadOnly && questionnaireItemViewItemDate != null` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateTimeViewFactory.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DateTimePickerViewHolderFactory.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreItemViews.kt:39— `!questionnaireViewItem.questionnaireItem.required && questionnaireViewItem.questionViewTextConfiguration.showOptionalText` appears character-identically in 2 files — datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreItemViews.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/views/HeaderView.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt:262— `(minDateMillis == null || utcTimeMillis >= minDateMillis) && (maxDateMillis == null || utcTimeMillis <= maxDateMillis)` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DatePickerViewHolderFactory.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt:268— `(minDateMillis == null || year >= getYear(minDateMillis)) && (maxDateMillis == null || year <= getYear(maxDateMillis))` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/DateViewFactory.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/DatePickerViewHolderFactory.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/EditTextIntegerViewFactory.kt:35— `answer.isNullOrEmpty() && draftAnswer.isNullOrEmpty()` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/factories/EditTextIntegerViewFactory.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/views/factories/EditTextIntegerViewHolderFactory.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItems.kt:948— `answerOption.isEmpty() || initial.isEmpty() || initialExpression != null` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItems.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItemComponents.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt:64— `arguments == null || requireArguments().getBoolean(EXTRA_SHOW_SUBMIT_ANYWAY_BUTTON, true)` appears character-identically in 2 files — datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt:261— `ch.isDigit() || (ch == delimiter && index in delimiterIndex)` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/DateFieldItem.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/DatePickerItem.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:129— `current.isReferencedBy(dependent) && dependent.isReferencedBy(current)` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireLists.kt:94— `displayMode is DisplayMode.EditMode && !displayMode.pagination.isPaginated` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireLists.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireLists.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/Header.kt:108— `displayValidationResult && validationResult is Invalid` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/Header.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/Header.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/enablement/EnablementEvaluator.kt:137— `enableWhenList.isEmpty() && enableWhenExpression == null` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/enablement/EnablementEvaluator.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/enablement/EnablementEvaluator.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt:165— `ind == index || option == optionSelectRow` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/views/components/OptionDialogSelect.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/views/compose/OptionDialogSelect.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1358— `it.index < currentPageIndex && it.enabled && !it.hidden` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:589— `it.index < currentPageIndexFlow.value!! && it.enabled && !it.hidden` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1361— `it.index > currentPageIndex && it.enabled && !it.hidden` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:609— `it.index > currentPageIndexFlow.value!! && it.enabled && !it.hidden` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:726— `it.linkId == questionnaireItem.linkId && !modifiedQuestionnaireResponseItemSet.contains(it)` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt:241— `it.name == expression.name && it.expression == expression.expression` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItems.kt:209— `it.url == EXTENSION_ITEM_CONTROL_URL || it.url == EXTENSION_ITEM_CONTROL_URL_ANDROID_FHIR` appears character-identically in 2 files — datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItems.kt, datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItemComponents.kt. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
+ 15 more in this group — see findings.md.
P10 · Library API & versioning· Implementation type on the public API · ×6
Implementation type on the public API engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt:448— 1 public type in `com.google.android.fhir.db.impl.DatabaseImpl` is marked as implementation by its own namespace, folder or name: `Companion` (engine/src/main/java/com/google/android/fhir/db/impl/DatabaseImpl.kt:448, `impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
Implementation type on the public API engine/src/main/java/com/google/android/fhir/db/impl/JsonUtils.kt:1— 2 public types in `com.google.android.fhir.db.impl` are marked as implementation by their own namespace, folder or name: `JsonUtilsKt` (engine/src/main/java/com/google/android/fhir/db/impl/JsonUtils.kt:1, `impl`), `ResourceDatabaseKt` (engine/src/main/java/com/google/android/fhir/db/impl/ResourceDatabase.kt:1, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
Implementation type on the public API engine/src/main/java/com/google/android/fhir/db/impl/dao/LocalChangeDao.kt:523— 2 public types in `com.google.android.fhir.db.impl.dao.LocalChangeDao` are marked as implementation by their own namespace, folder or name: `InvalidLocalChangeException` (engine/src/main/java/com/google/android/fhir/db/impl/dao/LocalChangeDao.kt:523, `impl`), `Companion` (engine/src/main/java/com/google/android/fhir/db/impl/dao/LocalChangeDao.kt:525, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
Implementation type on the public API engine/src/main/java/com/google/android/fhir/db/impl/dao/LocalChangeDao.kt:1— 1 public type in `com.google.android.fhir.db.impl.dao` is marked as implementation by its own namespace, folder or name: `LocalChangeDaoKt` (engine/src/main/java/com/google/android/fhir/db/impl/dao/LocalChangeDao.kt:1, `impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
Implementation type on the public API engine/src/main/java/com/google/android/fhir/db/impl/entities/LocalChangeEntity.kt:76— 1 public type in `com.google.android.fhir.db.impl.entities.LocalChangeEntity` is marked as implementation by its own namespace, folder or name: `Type` (engine/src/main/java/com/google/android/fhir/db/impl/entities/LocalChangeEntity.kt:76, `impl`). While it is public, every consumer of the library can bind to it, so changing it is a breaking change for those consumers.
Implementation type on the public API engine/src/main/java/com/google/android/fhir/db/impl/entities/LocalChangeEntity.kt:77— 4 public types in `com.google.android.fhir.db.impl.entities.LocalChangeEntity.Type` are marked as implementation by their own namespace, folder or name: `INSERT` (engine/src/main/java/com/google/android/fhir/db/impl/entities/LocalChangeEntity.kt:77, `impl`), `UPDATE` (engine/src/main/java/com/google/android/fhir/db/impl/entities/LocalChangeEntity.kt:78, `impl`), `DELETE` (engine/src/main/java/com/google/android/fhir/db/impl/entities/LocalChangeEntity.kt:79, `impl`), `Companion` (engine/src/main/java/com/google/android/fhir/db/impl/entities/LocalChangeEntity.kt:82, `impl`). While they are public, every consumer of the library can bind to them, so changing them is a breaking change for those consumers.
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×3
Projects may be oversized for their cohesion engine/build.gradle.kts:1— `engine` (10769 LoC, 298 module-visible types across 18 directories) overshoots its size bounds. 3 of 14 build unit(s) (Gradle) overshoot their size bounds, lowering Project Cohesion to 5.7/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
Projects may be oversized for their cohesion datacapture/build.gradle.kts:1— `datacapture` (14284 LoC, 225 module-visible types across 11 directories) overshoots its size bounds. 3 of 14 build unit(s) (Gradle) overshoot their size bounds, lowering Project Cohesion to 5.7/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
Projects may be oversized for their cohesion datacapture-kmp/build.gradle.kts:1— `datacapture-kmp` (14262 LoC, 250 module-visible types across 15 directories) overshoots its size bounds. 3 of 14 build unit(s) (Gradle) overshoot their size bounds, lowering Project Cohesion to 5.7/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D34 · Knowledge Freshness· Most significant orphaned file · ×3
Most significant orphaned file datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1— One of the orphaned files carrying the most lost knowledge — ranked by size weighted by the file's role in the codebase, the same weighting behind the score above, so core code outranks equally large plumbing. A reasonable place to start a read-through before the aggregate risk above bites.
Most significant orphaned file datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt:1— One of the orphaned files carrying the most lost knowledge — ranked by size weighted by the file's role in the codebase, the same weighting behind the score above, so core code outranks equally large plumbing. A reasonable place to start a read-through before the aggregate risk above bites.
Most significant orphaned file datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItemComponents.kt:1— One of the orphaned files carrying the most lost knowledge — ranked by size weighted by the file's role in the codebase, the same weighting behind the score above, so core code outranks equally large plumbing. A reasonable place to start a read-through before the aggregate risk above bites.
Fat interface: Database (24 abstract methods) engine/src/main/java/com/google/android/fhir/db/Database.kt:32— `Database` declares 24 abstract methods: `insert`, `insertRemote`, `update`, `updateVersionIdAndLastUpdated`, `updateResourcePostSync`, `select`, `selectEntity`, `insertSyncedResources`, `delete`, `search`, `searchForwardReferencedResources`, `searchReverseReferencedResources`, `count`, `getAllLocalChanges`, `getAllChangesForEarliestChangedResource`, `getLocalChangesCount`, `deleteUpdates`, `updateResourceAndReferences`, `withTransaction`, `close`, `clearDatabase`, `getLocalChanges`, `purge`, `getLocalChangeResourceReferences`. Counted over its public functions with no body, once per name; default-bodied functions and properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: ResourceDao (18 abstract methods) engine/src/main/java/com/google/android/fhir/db/impl/dao/ResourceDao.kt:55— `ResourceDao` declares 18 abstract methods: `insertResource`, `insertStringIndex`, `insertReferenceIndex`, `insertCodeIndex`, `insertQuantityIndex`, `insertUriIndex`, `insertDateIndex`, `insertDateTimeIndex`, `insertNumberIndex`, `insertPositionIndex`, `updateRemoteVersionIdAndLastUpdate`, `deleteResource`, `getResource`, `getResourceEntity`, `getResources`, `getForwardReferencedResources`, `getReverseReferencedResources`, `countResources`. Counted over its public functions with no body, once per name; default-bodied functions and properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
No ADRs found sdc-kmp-demo-iosApp/iosApp.xcodeproj/project.pbxproj:1— No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`. ADRs are expected here because `sdc-kmp-demo-iosApp/iosApp.xcodeproj/project.pbxproj` makes this repository a deployable product (line 1).
Dormant codebase — 273 of 273 significant files have no living knowledge — the codebase as a whole is dormant, not 273 separate risks. Counted over 273 of the 495 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over. Re-engage owners or document before change.
Thin README README.md:1— The root README is 92 words, against a bar of 120. Of the three newcomer-critical sections this check looks for by heading, in the README and in the repository documents it links, it found no a build/run or getting-started section, no a testing section, no an architecture or project-map section. Sections are matched on HEADING text only, so material written under a heading this check does not recognise — or with no heading at all — is not seen and this row may understate what the document covers.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
M2 · Architecture documentation· No architecture diagram/doc · ×1
No architecture diagram/doc — No C4/Structurizr/PlantUML/Mermaid/Graphviz/D2 diagram, no drawn diagram named for the architecture, no file named `architecture` or `design` in any markup this check reads, and nothing in the README, docs or contributor guides that announces the shape — no `## Architecture` heading, no "architecture overview"/"high-level design" phrasing, no "the architecture is …" introduction, no guided code tour. A shape laid out in prose that never names itself as the architecture is not visible to this check, and neither is one kept outside the repository, so this row reports the absence of a re-findable shape document — not evidence that nobody wrote the shape down.
Logging is not universal — Only 1/3 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `sdc-kmp-demo`, `sdc-kmp-demo-iosApp`.
P3 · Security & performance tooling· Dependabot does not watch npm/pip · ×1
Dependabot does not watch npm/pip REDACTED:4— `REDACTED` schedules updates, but no `package-ecosystem` entry covers `npm`, `pip`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entries to the `updates:` list.
No changelog — 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.)
X2 · Cancellation propagation· Not all suspend functions that make a request accept the coroutine's cancellation · ×1
Not all suspend functions that make a request accept the coroutine's cancellation — Only 0/1 suspend functions that make a cancellable request (Ktor, OkHttp newCall, URL streams) accept the coroutine's cancellation or pass one on, so a request keeps running after whatever wanted it has given up — a screen navigated away from, a disposed widget, a superseded search. In a suspend function, make the request with a call that suspends — Ktor, OkHttp's `executeAsync()`, or a `suspendCancellableCoroutine` that cancels the `Call` — not a blocking `execute()`: `withContext(Dispatchers.IO)` moves the call off the caller's thread but does not make it cancellable; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
Silent fallback default in catch contrib/barcode/src/main/java/com/google/android/fhir/datacapture/contrib/views/barcode/mlkit/md/Utils.kt:64— `getRequiredPermissions` swallows every exception into `arrayOf()` — a data error becomes a silent behavior change with no trail. Log the failure or let it propagate. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment in the catch or in the KDoc, and the row stops firing.
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 69 file(s) — `catalog/src/main/java/com/google/android/fhir/catalog/LayoutListViewModel.kt`, `contrib/barcode/src/main/java/com/google/android/fhir/datacapture/contrib/views/barcode/mlkit/md/Utils.kt`, `contrib/locationwidget/src/main/java/com/google/android/fhir/datacapture/contrib/views/locationwidget/CurrentLocationDialogFragment.kt`, `datacapture-kmp/src/androidMain/kotlin/com/google/android/fhir/datacapture/QuestionnaireValidationErrorMessageDialogFragment.kt`, `datacapture-kmp/src/commonMain/kotlin/com/google/android/fhir/datacapture/DataCaptureConfig.kt`, … (+64 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.
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.
Run 01a1eb5a-d884-7ec6-9321-a5e4efabbffd · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 19 · Warnings: 356 · Recommendations: 337 · Info: 619 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 17-11-2026 @ 21:12 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.