Hauptinhalt

Konfigurieren von Codierregelprüfungen und Code-Metriken

R2026b
Aktivieren von MISRA™-, AUTOSAR-, CERT®- und JSF®-Codierregelsätzen, benutzerdefinierten Codierregeln und Code-Metriken

Mit Polyspace® Bug Finder™ können Sie auf Verstöße gegen Codierungsstandards prüfen und Code-Metriken berechnen.

Um auf Verstöße gegen Codierregeln zu prüfen, aktivieren Sie im Fenster „Checkers Selection“ einen Satz von Codierregeln und Defekten. Speichern Sie den aktivierten Satz von Checkern in einer Checker-Aktivierungsdatei (.xml) und verwenden Sie diese Aktivierungsdatei in den nachfolgenden Analysen. Siehe Checkers activation file (-checkers-activation-file).

Alternativ können Sie vorausgewählte Regelsätze aus einem bestimmten Codierungsstandard aktivieren. Aktivieren Sie beispielsweise die verbindlichen Regeln aus MISRA C™:2023 mithilfe der Option Check MISRA C:2023 (-misra-c-2023) mit dem Wert mandatory.

Sie können außerdem Code-Metriken auf Funktions-, Datei- und Projektebene berechnen, indem Sie die Option Calculate code metrics (-code-metrics) angeben. Diese Option berechnet einen Satz von Code-Metriken wie zyklomatische Komplexität, Kommentardichte oder die Anzahl von Rekursionen in Ihrem Projekt.

Polyspace-Optionen

alle erweitern

Use custom checkers fileSpecify that checkers must be specified using a checkers activation XML file. (Seit R2023b)
Checkers activation file (-checkers-activation-file)Activate custom combination of defects and coding rules for Polyspace Bug Finder analysis
Check MISRA C:2012 (-misra3)Check for violations of MISRA C:2012 rules and directives
Check MISRA C:2023 (-misra-c-2023)Check for violations of MISRA C:2023 rules and directives (Seit R2024a)
-misra-c-2025Check for violations of MISRA C:2025 rules and directives (Seit R2026b)
Effective boolean types (-boolean-types)Specify data types that coding rule checker must treat as effectively Boolean
Check SEI CERT-C (-cert-c)Check for violations of CERT C rules and recommendations
Check ISO/IEC TS 17961 (-iso-17961)Check for violations of ISO/IEC TS 17961 rules
Use generated code requirements for MISRA standards (-misra-agc-mode)Check for violations of MISRA C rules and directives that apply to generated code (Seit R2026b)
MISRA C++:2023 überprüfen (-misra-cpp-2023)Check for violations of MISRA C++:2023 rules and directives (Seit R2024b)
MISRA C++:2008 überprüfen (-misra-cpp)Check for violations of MISRA C++:2008 rules
JSF AV C++ überprüfen (-jsf-coding-rules)Check for violations of JSF C++ rules
AUTOSAR C++14 überprüfen (-autosar-cpp14)Check for violations of AUTOSAR C++ 14 rules
SEI CERT-C++ überprüfen (-cert-cpp)Check for violations of CERT C++ rules
Check CWE (-cwe)Check for weaknesses in your code that are enumerated in CWE (Seit R2023a)
Check custom rules (-custom-rules)Follow naming conventions for identifiers
Check Guidelines (-guidelines)Check for violations of Guidelines
Allowed pragmas (-allowed-pragmas)Specify pragma directives that are documented
Generate results for sources and (-generate-results-for)Specify files on which you want analysis results
Do not generate results for (-do-not-generate-results-for)Specify files on which you do not want analysis results
Use fast analysis mode for Bug Finder (-fast-analysis)Run analysis using faster local mode
-create-checkersCreate new checkers for Polyspace Bug Finder analysis (Seit R2023b)
Calculate code metrics (-code-metrics)Compute and display code complexity metrics
-start-level-from-oneStart counting the call level or nesting level from one.
-consider-switch-as-single-decisionCompute cyclomatic complexity assuming a switch-case statement to be a single decision point

Systembefehle

polyspace-catalog-bundler(System Command) Create user-defined Polyspace coding standards at the DOS or UNIX command line

Themen

Konfigurieren von Checkern

MISRA-Regeln

CWE

Benutzerdefinierte Codierungsstandards

Metriken zur Code-Komplexität

Polyspace-Anleitungen

Polyspace – Benutzerdefinierte Regeln

Verwandte Informationen