Skip to main content

Safety & Static Analysis — Specifications

This page contains the formal feature specifications for the TrinovaQ Studio safety analysis subsystem (the "Error Doctor"). For usage instructions, see Static Analysis.


Overview

TrinovaQ Studio integrates static code analysis directly into the development loop. For C projects, analysis is performed using the bundled cppcheck tool with the MISRA C:2012 addon. For Rust projects, the Rust compiler's diagnostic system is used. All findings are presented in a unified Problems panel with direct source navigation and automotive risk mapping.


Analysis Feature Specifications

IDFeatureDescriptionAnalysis Engine
TRQ-SAF-001MISRA Safety ScoreA compliance percentage calculated from the number of static analysis findings. Decrements by 5 points per finding; minimum value is 0.cppcheck with MISRA C:2012 addon
TRQ-SAF-002RAM Usage EstimationHeuristic estimate of stack memory usage based on variable declarations found in source code. Used for dashboard visualization against target hardware limits.Source-level variable declaration analysis
TRQ-SAF-003Cyclomatic Complexity EstimateAn estimate of code complexity based on the count of branching constructs: if, for, while, case, catch, match, loop.Source-level keyword analysis
TRQ-SAF-004Rust Panic Risk DetectionIdentifies Rust code patterns that can cause unhandled runtime panics.Detection of .unwrap() and .expect() call patterns
TRQ-SAF-005Rust Unsafe Block DetectionIdentifies unsafe { } blocks that bypass Rust's memory safety guarantees.Detection of unsafe keyword blocks

Risk Classification

All static analysis findings are classified into automotive risk categories:

CategoryDescription
MEMORY_SAFETYBuffer overflows, uninitialized access, use-after-free patterns
CONCURRENCYRace conditions and shared-data access hazards
HARDWARE_SAFETYInterrupt latency and stack overflow risks
MISRA_COMPLIANCEViolations of specific MISRA C:2012 rules
UNDEFINED_BEHAVIORCode with undefined semantics per the C standard
CRYPTOGRAPHIC_INTEGRITYCryptographic usage issues
STYLECode quality and readability issues

Error Doctor — Automotive Risk Mapping

Detected IssueAutomotive RiskRecommended Action
Uninitialized variableCritical — Unpredictable ECU behavior or sudden resetInitialize all variables at declaration
Buffer overflowVulnerability — Potential code injection or system crashValidate all array indices against size bounds
Unsafe block (Rust)Memory Corruption — Bypasses borrow checker safety guaranteesDocument safety invariants; minimize unsafe blocks
Implicit function declarationRuntime Risk — Dangerous assumptions about return typesAdd #include headers or explicit function prototypes
Banned function usageSecurity — Risk of buffer overrunReplace with safe standard library alternatives

Safety Score Formula

Safety Score = max(100 - (finding_count × 5), 0)
Score RangeCompliance Level
90–100Excellent
70–89Good
50–69Moderate
0–49Critical

Non-Functional Requirements

IDRequirement
TRQ-SAF-NF-001Analysis must complete within 120 seconds for files up to 5,000 lines
TRQ-SAF-NF-002Only one scan can execute concurrently per project
TRQ-SAF-NF-003Memory consumption during analysis must not exceed 500 MB
TRQ-SAF-NF-004Scan results must include file path, line number, rule ID, severity, and description

Standards Compliance

StandardApplicability
MISRA C:2012Ruleset enforced by bundled cppcheck + MISRA addon
ISO 26262 Part 6Analysis satisfies software unit verification activity evidence
ISO 26262 Part 8Tool qualification evidence available via build manifests