Appearance
sdc/unused-declaration
warning Reports a variable that no expression references.What it checks
Looks for a variable that no other expression references: no %name in an expression on its item or a descendant item, or in a {{…}} fragment of a query there, resolves to it. A reference to a declaration of the same name on a descendant item uses that declaration instead, and a reference from the variable’s own expression is not a use. Only variables are reported: an itemPopulationContext, another named expression, a launchContext or an extractAllocateId has a purpose without being referenced.
Example
%weight is declared on item "BMI" (bmi), but no expression references it, so its value is never used.
fsh
Instance: unused-declaration-unreferenced
InstanceOf: Questionnaire
Usage: #example
* status = #draft
* item[0].linkId = "bmi"
* item[=].type = #string
* item[=].text = "BMI"
* item[=].extension.url = "http://hl7.org/fhir/StructureDefinition/variable"
* item[=].extension.valueExpression.name = "weight"
* item[=].extension.valueExpression.language = #text/fhirpath
* item[=].extension.valueExpression.expression = "70"