Konfigurieren von Codierregelprüfungen und Code-Metriken
R2026bMit 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
Systembefehle
polyspace-catalog-bundler | (System Command) Create user-defined Polyspace coding standards at the DOS or UNIX command line |
Themen
Konfigurieren von Checkern
- Festlegen der Polyspace-Analyseoptionen
Festlegen der Polyspace-Analyseoptionen in der Polyspace-Benutzeroberfläche, in anderen IDEs oder in Skripten - Check for and Review Coding Standard Violations
Check for violations of AUTOSAR C++14, CERT C, CERT C++, CWE, MISRA C, MISRA C++, JSF AV C++, or ISO-17961 standards with Polyspace Bug Finder. - Prepare Checkers Configuration for Polyspace Bug Finder Analysis
Deploy common checkers configuration to enforce uniform standards, mix defect and coding rule checkers. - Create New Checkers Activation File Without Polyspace User Interface
When Polyspace user interface is unavailable, configure checkers by creating a checkers activation file in a text editor.
MISRA-Regeln
- Avoid Violations of MISRA C Rules 8.x
Avoid conflicting declarations or unintended modification of variables. - Coding Rule Subsets Checked Early in Analysis
Adjust your coding rules checking for a faster analysis.
CWE
- Polyspace Support of CWE Rules and Categories
Lookup the CWE rules and categories supported by Polyspace. - Mapping Between CWE-658 or CWE-659 and Polyspace Bug Finder Defect Checkers
See how Polyspace defect checkers are related to the subset of CWE™ standards, CWE-658 and CWE-659.
Benutzerdefinierte Codierungsstandards
- Create User-Defined Coding Standard by Using Polyspace Query Language
Create new user defined defects and use these defects along with existing bug Finder checkers to create a user-defined coding standard in a sharable
.pschkfile. - Create User-Defined Coding Standard by Using Polyspace Bug Finder Checkers
Map Bug Finder checkers to coding rules in a user-defined coding standard in a sharable.pschkfile.
Metriken zur Code-Komplexität
- Compute Code Complexity Metrics Using Polyspace
Enforce limits on code complexity metrics such as cyclomatic complexity and depth of nesting. - HIS-Metriken zur Code-Komplexität
Hier sehen Sie, welche der in Polyspace unterstützten Code-Komplexitätsmetriken Teil des Standards der Hersteller Initiative Software (HIS) sind.
Polyspace-Anleitungen
- Reduce Software Complexity by Using Polyspace Checkers
Enable and configure the software complexity checkers to identify issues that make your code difficult to read, understand, and debug.
Polyspace – Benutzerdefinierte Regeln
- Enforce Naming Conventions for C/C++ Variables and Functions
Enforce naming conventions and other style guidelines on C/C++ code with Polyspace.