6.2.12. Stylechecks¶
Checks regarding coding style, including Misra and other checks
Nested Rules
Checks for Autosar guidelines for the use of the C++14 language in critical and safety-related systems |
|
Checks for C# coding style |
|
Code-Quality-Management Stylechecks |
|
Checks for CUDA C++ programming language and CUDA libraries usage |
|
Checks for issues listed in the CWE - Common Weakness Enumeration |
|
SEI CERT Coding Standard Security Checks |
|
Checks for coding style issues |
|
Checks whether your code is affected by known errata in native compilers |
|
Static checks for possible runtime errors |
|
GeneralPurpose/Best practice checks |
|
Miscellaneous checks that are often parts of other rule sets |
|
Checks for Misra guidelines for the use of C/C++ in critical systems |
|
Rulegroups for programs using Qt |
|
Checks for Rust coding style |
|
ISO-TS-17961 C Secure Coding |
6.2.12.16. Options¶
Setting an option for this rule means setting the default for all nested rules.
This rule shares the following common options: exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Analysis-GlobalOptions
mixed_headers_are_c¶
mixed_headers_are_c : bool = False
node_sort_key¶
node_sort_key : typing.Callable[[bauhaus.ir.Node], bauhaus.axitertools.Comparable] | None = None
Most rules that report a list of "Secondary SLocs" will use this option to determine the sort order in which the secondary SLocs will be displayed in the dashboard. For some rules (e.g. MisraC2012Directive-4.5 "ambiguous identifier"), the first SLoc after sorting will be used as the primary source location. For these rules, this option can be used to influence the choice of primary source location.
The configured callback function will be called with a physical IR node, and should
return a Python object that is comparable with the return value of other invocations
of the callback: the configured callback will be used as key argument
to the Python sort() builtin.
If the callback returns equal return values for different nodes, only one source
location for each equivalency class will be displayed. Thus, typically the return
value should be a tuple including node.SLoc to avoid inadvertent
deduplication.
The default callback if this option is not configured will sort the source locations lexicographically.
Example rule_config.py:
import axivion.config
analysis = axivion.config.get_analysis()
def my_sort_key(node):
# Prefer definitions over declarations
if node.is_of_type('Definition'):
order = 0
else:
order = 1
# Return a tuple.
# For equal order, this continues to compare by source location as usual.
return order, node.SLoc
analysis['Stylechecks'].node_sort_key = my_sort_key