Configurar comprobaciones de reglas de codificación y métricas de código
R2026bPuede comprobar si hay infracciones de los estándares de codificación y calcular métricas de código con Polyspace® Bug Finder™.
Para comprobar si hay infracciones de las reglas de codificación, active un conjunto de reglas de codificación y defectos usando la ventana Checkers Selection. Guarde el conjunto de comprobadores activado en un archivo de activación de comprobadores (.xml) y, después, utilice el archivo de activación en análisis posteriores. Consulte Archivo de activación de comprobadores (-checkers-activation-file).
Como alternativa, puede activar conjuntos de reglas preseleccionados de un estándar de codificación específico. Por ejemplo, active las reglas obligatorias de MISRA C™:2023 utilizando la opción Comprobar MISRA C:2023 (-misra-c-2023) con el valor mandatory.
También puede calcular métricas de código en los niveles de función, archivo y proyecto especificando la opción Calcular métricas de código (-code-metrics). Esta opción calcula un conjunto de métricas de código como la complejidad ciclomática, la densidad de comentarios o el número de recursiones del proyecto.
Opciones de Polyspace
Comandos del sistema
polyspace-catalog-bundler | (System Command) Create user-defined Polyspace coding standards at the DOS or UNIX command line |
Temas
Configurar comprobadores
- Especificar las opciones de análisis de Polyspace
Especifique opciones de análisis de Polyspace en la interfaz de usuario de Polyspace, otros IDE o scripts. - 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.
Reglas MISRA
- 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.
Estándares de codificación definidos por el usuario
- 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.
Métricas de complejidad de código
- Compute Code Complexity Metrics Using Polyspace
Enforce limits on code complexity metrics such as cyclomatic complexity and depth of nesting. - Métricas HIS de complejidad de código
Consulte qué métricas de complejidad de código admitidas en Polyspace forman parte del estándar Hersteller Initiative Software (HIS).
Directrices de Polyspace
- 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.
Reglas personalizadas de Polyspace
- Enforce Naming Conventions for C/C++ Variables and Functions
Enforce naming conventions and other style guidelines on C/C++ code with Polyspace.