Skip to content

Core ​

The @aehrc/sdc-questionnaire-lint package, packages/core, holds the CLI, the library and the built-in sdc rules. It is made of the blocks below, and each one has a page: what it does, where its code is, and a diagram. How the linter works goes into more detail.

One lint run ​

When a stage cannot complete, for example on a bad config or when no Questionnaires are found, the run stops. Failures then reports the cause and exits with code 2.

Blocks ​

#BlockCodeWhat it does
1CLIcli/Reads the arguments, runs lint or explain, prints the result and sets the exit code
2Configconfig/Finds and checks the config file, then works out the file paths
3Plugins and rule setplugins/Checks the plugins and decides which rules run, at which severity
4Inputsinputs/Finds the compiled JSON files and reads the Questionnaires out of them and out of Bundles
5Expression discoveryanalysis/expression-sites.tsFinds every expression in a form and records what kind it is
6Expression parsinganalysis/fhirpath.tsReads FHIRPath and x-fhir-query: syntax errors, function calls and references
7Name analysisanalysis/document-analysis.tsWorks out which variables and linkIds exist, where they can be used and what depends on what
8Rule runnerrun/rules.tsRuns each rule on each form and checks every finding it returns
9Suppressions and fingerprintsrun/suppressions.tsGives each finding a stable ID, applies suppressions and reports the ones that no longer match anything
10Source mappingsource/Traces a finding in the compiled JSON back to a line and column in the FSH
11Report and formattersreport/Builds the counts, then prints the report as text, JSON, GitHub annotations or SARIF
12Failuresfailure.tsHandles a run that can't finish: the error codes, what goes to stderr and the failure output

Paths are relative to packages/core/src. The rules themselves, in rules/, are described in the rules library.