编码标准和代码度量
MISRA、AUTOSAR、CERT 和 JSF 编码规则集,自定义编码规则,代码度量
要指定您要检查的编码标准,例如 MISRA C™:2012 或 AUTOSAR C++14,请使用编码标准选项。要在分析结果中查看代码复杂度度量,例如圈复杂度和主调函数或被调函数的数目,请使用代码度量选项。
Polyspace 选项
主题
快速入门
- 指定 Polyspace 分析选项
在 Polyspace® 用户界面、其他 IDE 或脚本中指定 Polyspace 分析选项。 - 检查并审查编码标准违规
使用 Polyspace Bug Finder 检查代码是否违反了 AUTOSAR C++14、CERT® C、CERT C++、CWE、MISRA C、MISRA® C++、JSF AV C++ 或 ISO-17961 标准。 - Enforce Naming Conventions for C/C++ Variables and Functions
Enforce naming conventions and other style guidelines on C/C++ code with 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.
MISRA 或 JSF 规则
- 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.
代码复杂度度量
- 使用 Polyspace 计算代码复杂度度量
对代码复杂度度量(例如圈复杂度和嵌套深度)强制施加限制。 - HIS 代码复杂度度量
查看 Polyspace 中支持的哪些代码复杂度度量是 Hersteller Initiative Software (HIS) 标准的一部分。
用户定义的编码标准
- Find Polyspace Bug Finder Checkers That Map to Coding Rules in User-Defined Coding Standard
Find Bug Finder checkers that can check for the coding rules in your user-defined coding rule standard. - 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.pschk
file.
修改检查项行为
- Modify Default Behavior of Bug Finder Checkers
Extend or constrain the default behavior of defect or coding standard checkers using Polyspace analysis options.
- Modify Bug Finder Checkers Through Code Behavior Specifications
- Flag Deprecated or Unsafe Functions, Keywords, or Macros Using Bug Finder Checkers
- Extend Bug Finder Checkers for Standard Library Functions to Custom Libraries
- Extend Bug Finder Checkers to Find Defects from Specific System Input Values
- Extend Concurrency Defect Checkers to Unsupported Multithreading Environments
- Extend Checkers for Initialization to Check Function Arguments Passed by Pointers
- Extend Data Race Checkers to Atomic Operations