> ## Documentation Index
> Fetch the complete documentation index at: https://docs.roboticks.io/llms.txt
> Use this file to discover all available pages before exploring further.

# LDRA

> Bring your LDRA Testbed license. Roboticks ingests MISRA, AUTOSAR-C++14, JSF, and coverage reports and links findings to requirements and tests in the matrix and evidence pack.

# LDRA

LDRA Testbed is the long-standing static-analysis and coverage tool for safety-critical C/C++/Ada. Roboticks ingests LDRA's reports — MISRA, AUTOSAR C++14, JSF AV, and coverage — and surfaces findings in the traceability matrix and evidence pack.

<Info>
  **v1 sync mode**: CLI push only. LDRA has no live API — the BYO connector adapter walks a local results folder of XML reports. Cloud sync is not technically possible for LDRA.

  **Tool-qualification preservation**: every LDRA-sourced evidence row is marked `qualified_artifact=true`. AI triage skips these rows entirely, and evidence packs store the raw XML byte-exact alongside the canonical view so DO-178C / ISO 26262 auditors can verify integrity.
</Info>

## Connector type and pricing

|              |                                                                 |
| ------------ | --------------------------------------------------------------- |
| Type         | BYO static-analysis connector                                   |
| Tier         | Team (3 BYO connectors included), Enterprise (bundled)          |
| Price        | **\$149 / connector / month** above the Team allowance          |
| LDRA license | **You bring it.** Roboticks ingests reports; we don't run LDRA. |

## What ingests

| Artifact                                     | Source command                                    | Lands in Roboticks as                 |
| -------------------------------------------- | ------------------------------------------------- | ------------------------------------- |
| MISRA C:2012 report                          | `tbreport.exe --type=misra-c-2012 --format=xml`   | `finding` (rule violations, per-file) |
| MISRA C++:2008 report                        | `tbreport.exe --type=misra-cpp-2008 --format=xml` | `finding`                             |
| AUTOSAR C++14 report                         | `tbreport.exe --type=autosar-cpp-14 --format=xml` | `finding`                             |
| JSF AV C++ report                            | `tbreport.exe --type=jsf-av --format=xml`         | `finding`                             |
| Coverage report (statement / branch / MC/DC) | `tbreport.exe --type=coverage --format=xml`       | `coverage` (per-source-file)          |
| Static metrics                               | `tbreport.exe --type=metrics --format=xml`        | `metric` (advisory)                   |

All reports surface in the platform's **Findings** view and embed in the per-release evidence pack.

## Wire it in (v1 CLI push)

<Steps>
  <Step title="Subscribe in Roboticks">
    **Settings → Integrations → Static analysis → LDRA → Subscribe**. The wizard walks you through installing rbtk in your CI (LDRA is CLI-push only; no cloud sync step).
  </Step>

  <Step title="Run LDRA in CI as usual">
    ```bash theme={null}
    tbrun --workspace ./build/ldra.lws --analyze
    mkdir -p ./build/ldra-reports/tbmisra/${BUILD_ID}/
    tbreport.exe --workspace ./build/ldra.lws --type=misra-c-2012 --format=xml \
      --output=./build/ldra-reports/tbmisra/${BUILD_ID}/report.xml
    mkdir -p ./build/ldra-reports/tbvision/${BUILD_ID}/
    tbreport.exe --workspace ./build/ldra.lws --type=coverage --format=xml \
      --output=./build/ldra-reports/tbvision/${BUILD_ID}/coverage.xml
    ```

    The folder layout matters — the adapter walks `tbmisra/<run_id>/report.xml` and `tbvision/<run_id>/coverage.xml` patterns.
  </Step>

  <Step title="Configure credentials">
    ```bash theme={null}
    rbtk connector configure ldra \
        --reports-dir=./build/ldra-reports \
        --qualification-kit-version=2024-Q4-TQSP \
        --tool-version=LDRA-2024-SP2 \
        --label=primary \
        --project-slug=flight-controller
    ```
  </Step>

  <Step title="Push reports to Roboticks">
    ```bash theme={null}
    rbtk connector sync ldra --label=primary
    ```

    The adapter emits MISRA violations, coverage summaries (statement / branch / MC/DC), and the tool-qualification kit reference as separate evidence rows. All marked `qualified_artifact=true`; AI triage skips them, evidence packs preserve them byte-exact.

    Requirement linkage: violation messages containing `@confirms REQ-XXX` patterns are auto-linked. For finer-grained mapping, use the file-path → requirement table in the Roboticks connector dashboard.
  </Step>
</Steps>

## CI recipe

```yaml theme={null}
# .github/workflows/ldra.yml
name: LDRA
on: { push: { branches: [main] }, pull_request: {} }

jobs:
  ldra:
    runs-on: [self-hosted, ldra-licensed]   # LDRA licenses are per-machine
    permissions: { id-token: write, contents: read }
    steps:
      - uses: actions/checkout@v4

      - name: Run LDRA
        run: |
          tbrun --workspace ./build/ldra.lws --analyze
          tbreport.exe --workspace ./build/ldra.lws \
            --type=misra-c-2012 --format=xml --output=ldra-misra.xml
          tbreport.exe --workspace ./build/ldra.lws \
            --type=coverage --format=xml --output=ldra-coverage.xml

      - run: pipx install roboticks-cli
      - run: rbtk auth oidc-from-github

      - name: Upload findings
        run: |
          rbtk findings upload \
            --tool ldra \
            --label branch=${{ github.ref_name }} \
            ldra-misra.xml ldra-coverage.xml
```

`self-hosted, ldra-licensed` is a GitHub Actions runner label — only machines with an LDRA license accept the job. In Roboticks, mirror this with a runner pool label so corresponding test runs pick the same hosts:

```yaml theme={null}
# .roboticks/test.yaml
requires:
  pool_labels: [ldra-licensed]
```

## Where findings appear

After upload:

* **Traceability matrix** — findings tied to source files annotated with `@confirms("REQ-...")` link to the matching requirement column. The cell shows a finding badge.
* **Requirement detail** — `REQ-001` view lists associated findings under **Static analysis findings (LDRA)**.
* **Release evidence pack** — per-release packs include an LDRA Findings appendix (PDF) and the raw LDRA XML reports in the ZIP.
* **PR Check Run** — a `Roboticks · LDRA` Check Run shows a delta vs the prior PR (new findings, resolved findings).

## Severity mapping

| LDRA classification | Roboticks severity |
| ------------------- | ------------------ |
| Mandatory           | `critical`         |
| Required            | `error`            |
| Advisory            | `warning`          |
| Disapplied          | suppressed         |

Configure per-project at **Settings → Findings → Severity mapping**.

## Deviations

LDRA supports formal **deviation records** for justified rule violations. Roboticks ingests them from the LDRA `--type=deviations` report and surfaces them in the finding's detail view. Deviations marked `Approved` in LDRA suppress the corresponding finding from gating logic; they remain visible.

```bash theme={null}
tbreport.exe --workspace ./build/ldra.lws \
  --type=deviations --format=xml --output=ldra-deviations.xml

rbtk findings upload --tool ldra ldra-deviations.xml
```

## Gating

You can fail a PR Check Run if new LDRA findings exceed a threshold:

```yaml theme={null}
# .roboticks/findings-policy.yaml
ldra:
  block_pr_if:
    new_critical: > 0
    new_error:    > 5
    coverage_loss: > 2.0%   # delta in branch coverage vs base ref
```

The Roboticks Check Run reports the result; combine with GitHub's required-status-check setting if you want a hard merge block.

## Troubleshooting

<AccordionGroup>
  <Accordion title="`Unsupported LDRA report format`">
    Roboticks targets the XML format from LDRA Testbed 9.7+. Older versions emit HTML — upgrade LDRA or post-process with `xsltproc`.
  </Accordion>

  <Accordion title="Findings don't link to a requirement">
    Findings link to requirements via the file/function being analysed, matched to test files annotated with `@confirms`. If a file isn't covered by any `@confirms`-annotated test, the finding shows up under **Unlinked findings**.
  </Accordion>

  <Accordion title="LDRA host is offline / license check fails">
    LDRA licenses are typically host-locked. If `tbrun` fails on license, no findings are produced — the CI job fails, and the previous run's findings remain authoritative in Roboticks.
  </Accordion>
</AccordionGroup>

## Next

<CardGroup cols={2}>
  <Card title="Polyspace" icon="microscope" href="/integrations/polyspace">
    MathWorks Code Prover and Bug Finder.
  </Card>

  <Card title="OSS scanners" icon="shield-check" href="/integrations/oss-scanners">
    cppcheck and clang-tidy ship bundled.
  </Card>
</CardGroup>
