Skip to content

Files

Latest commit

7e8ba84 · Mar 13, 2025

History

History
1001 lines (1001 loc) · 158 KB

rules.csv

File metadata and controls

1001 lines (1001 loc) · 158 KB
1
LanguageStandardIDSupportableObligation levelEnforcement levelAllocated targetDescriptionSimilarPackageDifficultyJustification for querability level
2
cppAUTOSARA0-1-1YesRequiredAutomatedImplementationA project shall not contain instances of non-volatile variables being given values that are not subsequently used.M0-1-6DeadCodeMedium
3
cppAUTOSARA0-1-2YesRequiredAutomatedImplementationThe value returned by a function having a non-void return type that is not an overloaded operator shall be used.M0-1-7DeadCodeEasy
4
cppAUTOSARA0-1-3YesRequiredAutomatedImplementationEvery function defined in an anonymous namespace, or static function with internal linkage, or private member function shall be used.M0-1-10DeadCodeEasy
5
cppAUTOSARA0-1-4YesRequiredAutomatedImplementationThere shall be no unused named parameters in non-virtual functions.DeadCodeEasy
6
cppAUTOSARA0-1-5YesRequiredAutomatedImplementationThere shall be no unused named parameters in the set of parameters for a virtual function and all the functions that override it.DeadCodeEasy
7
cppAUTOSARA0-1-6YesAdvisoryAutomatedImplementationThere should be no unused type declarations.M0-1-5DeadCodeEasy
8
cppAUTOSARA0-4-1YesRequiredNon-AutomatedInfrastructure / ToolchainFloating-point implementation shall comply with IEEE 754 standard.ToolchainEasyFind certain pairs of types and platforms which are not IEEE 754 compatible.
9
cppAUTOSARA0-4-2YesRequiredAutomatedImplementationType long double shall not be used.BannedTypesEasy
10
cppAUTOSARA0-4-3YesRequiredAutomatedToolchainThe implementations in the chosen compiler shall strictly comply with the C++14 Language Standard.ToolchainEasyFind cases where -std=gnu++14 is used instead of -std=c++14. Note: this is currently only possible for compilations that do not use response files.
11
cppAUTOSARA0-4-4YesRequiredPartially AutomatedImplementationRange, domain and pole errors shall be checked when using math functions.TypeRangesHard
12
cppAUTOSARA1-1-1YesRequiredAutomatedImplementationAll code shall conform to ISO/IEC 14882:2014 - Programming Language C++ and shall not use deprecated features.ToolchainHardAppendix D of the Standard lists depreceated features. List is lengthy, but otherwise easy to write. This can also be compiler checked, so we should confirm that we also want this as a CodeQL check.
13
cppAUTOSARA1-1-2YesRequiredNon-AutomatedImplementation / ToolchainA warning level of the compilation process shall be set in compliance with project policies.ToolchainEasyNote: this is currently only possible for compilations that do not use response files.
14
cppAUTOSARA1-1-3YesRequiredNon-AutomatedToolchainAn optimization option that disregards strict standard compliance shall not be turned on in the chosen compiler.ToolchainEasyNote: this is currently only possible for compilations that do not use response files.
15
cppAUTOSARA1-2-1NoRequiredNon-AutomatedToolchainWhen using a compiler toolchain (including preprocessor, compiler itself, linker, C++ standard libraries) in safety-related software, the tool confidence level (TCL) shall be determined. In case of TCL2 or TCL3, the compiler shall undergo a 'Qualification of a software tool', as per ISO 26262-8.11.4.6 [6].Allocated target not covered by CodeQL
16
cppAUTOSARA1-4-1NoRequiredNon-AutomatedImplementation / VerificationCode metrics and their valid boundaries shall be defined and code shall comply with defined boundaries of code metrics.Allocated target not covered by CodeQL
17
cppAUTOSARA1-4-3NoAdvisoryAutomatedImplementationAll code should compile free of compiler warnings.This should be checked via the compiler output, rather than CodeQL, which adds unnecessary steps.
18
cppAUTOSARA10-0-1YesRequiredNon-AutomatedDesignPublic inheritance shall be used to implement 'is-a' relationship.InheritanceAuditReport a list of Inheritance relationships.
19
cppAUTOSARA10-0-2YesRequiredNon-AutomatedDesignMembership or non-public inheritance shall be used to implement 'has-a' relationship.InheritanceAuditReport a list of membership relationships.
20
cppAUTOSARA10-1-1YesRequiredAutomatedImplementationClass shall not be derived from more than one base class which is not an interface class.InheritanceEasy
21
cppAUTOSARA10-2-1YesRequiredAutomatedImplementationNon-virtual public or protected member functions shall not be redefined in derived classes.VirtualFunctionsEasy
22
cppAUTOSARA10-3-1YesRequiredAutomatedImplementationVirtual function declaration shall contain exactly one of the three specifiers: (1) virtual, (2) override, (3) final.VirtualFunctionsEasy
23
cppAUTOSARA10-3-2YesRequiredAutomatedImplementationEach overriding virtual function shall be declared with the override or final specifier.VirtualFunctionsEasy
24
cppAUTOSARA10-3-3YesRequiredAutomatedImplementationVirtual functions shall not be introduced in a final class.VirtualFunctionsEasy
25
cppAUTOSARA10-3-5YesRequiredAutomatedImplementationA user-defined assignment operator shall not be virtual.OperatorsEasy
26
cppAUTOSARA10-4-1YesAdvisoryNon-AutomatedDesignHierarchies should be based on interface classes.InheritanceAuditReport a list of hierarchies which don't use interfaces.
27
cppAUTOSARA11-0-1YesAdvisoryAutomatedImplementationA non-POD type should be defined as class.ClassesEasy
28
cppAUTOSARA11-0-2YesRequiredAutomatedImplementationA type defined as struct shall: (1) provide only public data members, (2) not provide any special member functions or methods, (3) not be a base of another struct or class, (4) not inherit from another struct or class.ClassesEasy
29
cppAUTOSARA11-3-1YesRequiredAutomatedImplementationFriend declarations shall not be used.cpp/jsf/av-rule-70BannedSyntaxEasy
30
cppAUTOSARA12-0-1YesRequiredAutomatedImplementationIf a class declares a copy or move operation, or a destructor, either via '=default', '=delete', or via a user-provided declaration, then all others of these five special member functions shall be declared as well.cpp/rule-of-threeClassesEasy
31
cppAUTOSARA12-0-2YesRequiredPartially AutomatedImplementationBitwise operations and operations that assume data representation in memory shall not be performed on objects.M5-0-21ExpressionsMedium
32
cppAUTOSARA12-1-1YesRequiredAutomatedImplementationConstructors shall explicitly initialize all virtual base classes, all direct non-virtual base classes and all non-static data members.M12-1-2InitializationMedium
33
cppAUTOSARA12-1-2YesRequiredAutomatedImplementationBoth NSDMI and a non-static member initializer in a constructor shall not be used in the same type.InitializationMedium
34
cppAUTOSARA12-1-3YesRequiredAutomatedImplementationIf all user-defined constructors of a class initialize data members with constant values that are the same across all constructors, then data members shall be initialized using NSDMI instead.InitializationMedium
35
cppAUTOSARA12-1-4YesRequiredAutomatedImplementationAll constructors that are callable with a single argument of fundamental type shall be declared explicit.InitializationEasy
36
cppAUTOSARA12-1-5YesRequiredPartially AutomatedImplementationCommon class initialization for non-constant members shall be done by a delegating constructor.InitializationMedium
37
cppAUTOSARA12-1-6YesRequiredAutomatedImplementationDerived classes that do not need further explicit initialization and require all the constructors from the base class shall use inheriting constructors.InitializationEasy
38
cppAUTOSARA12-4-1YesRequiredAutomatedImplementationDestructor of a base class shall be public virtual, public override or protected non-virtual.OOP52-CPPVirtualFunctionsEasy
39
cppAUTOSARA12-4-2YesAdvisoryAutomatedImplementationIf a public destructor of a class is non-virtual, then the class should be declared final.VirtualFunctionsEasy
40
cppAUTOSARA12-6-1YesRequiredAutomatedImplementationAll class data members that are initialized by the constructor shall be initialized using member initializers.ClassesEasy
41
cppAUTOSARA12-7-1YesRequiredAutomatedImplementationIf the behavior of a user-defined special member function is identical to implicitly defined special member function, then it shall be defined '=default' or be left undefined.ClassesEasy
42
cppAUTOSARA12-8-1YesRequiredAutomatedImplementationMove and copy constructors shall move and respectively copy base classes and data members of a class, without any side effects.M12-8-1SideEffects2Hard
43
cppAUTOSARA12-8-2YesAdvisoryAutomatedImplementationUser-defined copy and move assignment operators should use user-defined no-throw swap function.OperatorInvariantsEasy
44
cppAUTOSARA12-8-3YesRequiredPartially AutomatedImplementationMoved-from object shall not be read-accessed.EXP63-CPPMoveForwardImport
45
cppAUTOSARA12-8-4YesRequiredAutomatedImplementationMove constructor shall not initialize its class members and base classes using copy semantics.InitializationEasy
46
cppAUTOSARA12-8-5YesRequiredAutomatedImplementationA copy assignment and a move assignment operators shall handle self-assignment.OOP54-CPPOperatorInvariantsImport
47
cppAUTOSARA12-8-6YesRequiredAutomatedImplementationCopy and move constructors and copy assignment and move assignment operators shall be declared protected or defined '=delete' in base class.M12-8-2OperatorsEasy
48
cppAUTOSARA12-8-7YesAdvisoryAutomatedImplementationAssignment operators should be declared with the ref-qualifier &.OperatorsEasy
49
cppAUTOSARA13-1-2YesRequiredAutomatedImplementationUser defined suffixes of the user defined literal operators shall start with underscore followed by one or more letters.NamingEasy
50
cppAUTOSARA13-1-3YesRequiredAutomatedImplementationUser defined literals operators shall only perform conversion of passed parameters.SideEffects2Easy
51
cppAUTOSARA13-2-1YesRequiredAutomatedImplementationAn assignment operator shall return a reference to 'this'.cpp/assignment-does-not-return-thisOperatorInvariantsEasy
52
cppAUTOSARA13-2-2YesRequiredAutomatedImplementationA binary arithmetic operator and a bitwise operator shall return a 'prvalue'.OperatorInvariantsEasy
53
cppAUTOSARA13-2-3YesRequiredAutomatedImplementationA relational operator shall return a boolean value.OperatorsEasy
54
cppAUTOSARA13-3-1YesRequiredAutomatedImplementationA function that contains 'forwarding reference' as its argument shall not be overloaded.OperatorsEasy
55
cppAUTOSARA13-5-1YesRequiredAutomatedImplementationIf 'operator[]' is to be overloaded with a non-const version, const version shall also be implemented.OperatorsEasy
56
cppAUTOSARA13-5-2YesRequiredAutomatedImplementationAll user-defined conversion operators shall be defined explicit.OperatorsEasy
57
cppAUTOSARA13-5-3YesAdvisoryAutomatedImplementationUser-defined conversion operators should not be used.OperatorsEasy
58
cppAUTOSARA13-5-4YesRequiredAutomatedImplementationIf two opposite operators are defined, one shall be defined in terms of the other.OperatorInvariantsEasy
59
cppAUTOSARA13-5-5YesRequiredAutomatedImplementationComparison operators shall be non-member functions with identical parameter types and noexcept.OperatorsEasy
60
cppAUTOSARA13-6-1YesRequiredAutomatedImplementationDigit sequences separators ' shall only be used as follows: (1) for decimal, every 3 digits, (2) for hexadecimal, every 2 digits, (3) for binary, every 4 digits.LiteralsEasy
61
cppAUTOSARA14-1-1YesAdvisoryNon-AutomatedImplementationA template should check if a specific template argument is suitable for this template.TemplatesMediumLook for classes with default constructors or assignment operators, with a template field which is not copyable/moveable
62
cppAUTOSARA14-5-1YesRequiredAutomatedImplementationA template constructor shall not participate in overload resolution for a single argument of the enclosing class type.M14-5-2TemplatesEasy
63
cppAUTOSARA14-5-2YesAdvisoryPartially-AutomatedDesignClass members that are not dependent on template class parameters should be defined in a separate base class.ClassesEasy
64
cppAUTOSARA14-5-3YesAdvisoryAutomatedDesignA non-member generic operator shall only be declared in a namespace that does not contain class (struct) type, enum type or union type declarations.OperatorsEasy
65
cppAUTOSARA14-7-1YesRequiredAutomatedImplementationA type used as a template argument shall provide all members that are used by the template.M14-7-2TemplatesEasy
66
cppAUTOSARA14-7-2YesRequiredAutomatedImplementationTemplate specialization shall be declared in the same file (1) as the primary template (2) as a user-defined type, for which the specialization is declared.TemplatesEasy
67
cppAUTOSARA14-8-2YesRequiredAutomatedImplementationExplicit specializations of function templates shall not be used.M14-8-1TemplatesEasy
68
cppAUTOSARA15-0-1YesRequiredNon-AutomatedArchitecture / Design / ImplementationA function shall not exit with an exception if it is able to complete its task.Exceptions1AuditReport a list of functions which throw exceptions.
69
cppAUTOSARA15-0-2YesRequiredPartially AutomatedArchitecture / Design / ImplementationAt least the basic guarantee for exception safety shall be provided for all operations. In addition, each function may offer either the strong guarantee or the nothrow guaranteeERR56-CPPExceptionSafetyImport
70
cppAUTOSARA15-0-3YesRequiredNon-AutomatedImplementationException safety guarantee of a called function shall be considered.ExceptionSafetyHardThere are certain exception safety guarantees we can check, such as exceptions in constructor calls used in emplace (the example from the rule text).
71
cppAUTOSARA15-0-4YesRequiredNon-AutomatedArchitecture / Design / ImplementationUnchecked exceptions shall be used to represent errors from which the caller cannot reasonably be expected to recover.Exceptions1AuditReport a list of unchecked exceptions.
72
cppAUTOSARA15-0-5YesRequiredNon-AutomatedArchitecture / Design / ImplementationChecked exceptions shall be used to represent errors from which the caller can reasonably be expected to recover.Exceptions1AuditReport a list of checked exceptions.
73
cppAUTOSARA15-0-6NoRequiredNon-AutomatedVerification / ToolchainAn analysis shall be performed to analyze the failure modes of exceptionAllocated target not covered by CodeQL
74
cppAUTOSARA15-0-7NoRequiredPartially AutomatedVerification / ToolchainException handling mechanism shall guarantee a deterministic worst-case time execution time.Allocated target not covered by CodeQL
75
cppAUTOSARA15-0-8NoRequiredNon-AutomatedVerification / ToolchainA worst-case execution time (WCET) analysis shall be performed to determine maximum execution time constraints of the software, covering in particular the exceptions processing.Allocated target not covered by CodeQL
76
cppAUTOSARA15-1-1YesAdvisoryAutomatedImplementationOnly instances of types derived from std::exception should be thrown.Exceptions2Easy
77
cppAUTOSARA15-1-2YesRequiredAutomatedImplementationAn exception object shall not be a pointer.Exceptions1Easy
78
cppAUTOSARA15-1-3YesAdvisoryAutomatedImplementationAll thrown exceptions should be unique.Exceptions1Easy
79
cppAUTOSARA15-1-4YesRequiredPartially AutomatedImplementationIf a function exits with an exception, then before a throw, the function shall place all objects/resources that the function constructed in valid states or it shall delete them.ERR57-CPPExceptionSafetyEasy
80
cppAUTOSARA15-1-5YesRequiredNon-AutomatedImplementationExceptions shall not be thrown across execution boundaries.ERR59-CPPTrustBoundariesImportThe database holds information about which compiler binary was used for each compilation. This can be used to identify execution boundaries between compilation units.
81
cppAUTOSARA15-2-1YesRequiredAutomatedImplementationConstructors that are not noexcept shall not be invoked before program startup.ERR51-CPPExceptions1Medium
82
cppAUTOSARA15-2-2YesRequiredPartially AutomatedImplementationIf a constructor is not noexcept and the constructor cannot finish object initialization, then it shall deallocate the object's resources and it shall throw an exception.ERR57-CPPExceptions2Easy
83
cppAUTOSARA15-3-2NoRequiredNon-AutomatedImplementationIf a function throws an exception, it shall be handled when meaningful actions can be taken, otherwise it shall be propagated.Difficult to identify when meaningful action could be taken.
84
cppAUTOSARA15-3-3YesRequiredPartially-AutomatedImplementationMain function and a task main function shall catch at least: base class exceptions from all third-party libraries used, std::exception and all otherwise unhandled exceptions.M15-3-2Exceptions1Easy
85
cppAUTOSARA15-3-4YesRequiredNon-AutomatedImplementationCatch-all (ellipsis and std::exception) handlers shall be used only in (a) main, (b) task main functions, (c) in functions that are supposed to isolate independent components and (d) when calling third-party code that uses exceptions not according to AUTOSAR C++14 guidelines.Exceptions1MediumIdentify catch-all handlers which aren't in main, aren't in functions called by std::thread or similar, and aren't wrapping external function calls. We may require some heuristics to exclude other "isolation" cases.
86
cppAUTOSARA15-3-5YesRequiredAutomatedImplementationA class type exception shall be caught by reference or const reference.M15-3-5Exceptions2Easy
87
cppAUTOSARA15-4-1YesRequiredAutomatedImplementationDynamic exception-specification shall not be used.Exceptions1Easy
88
cppAUTOSARA15-4-2YesRequiredAutomatedImplementationIf a function is declared to be noexcept, noexcept(true) or noexcept(<true condition>), then it shall not exit with an exception.M15-5-2Exceptions1Medium
89
cppAUTOSARA15-4-3YesRequiredAutomatedImplementationThe noexcept specification of a function shall either be identical across all translation units, or identical or more restrictive between a virtual member function and an overrider.Exceptions2Easy
90
cppAUTOSARA15-4-4YesRequiredAutomatedImplementationA declaration of non-throwing function shall contain noexcept specification.Exceptions1Easy
91
cppAUTOSARA15-4-5YesRequiredAutomatedImplementationChecked exceptions that could be thrown from a function shall be specified together with the function declaration and they shall be identical in all function declarations and for all its overriders.Exceptions2Easy
92
cppAUTOSARA15-5-1YesRequiredAutomatedImplementationAll user-provided class destructors, deallocation functions, move constructors, move assignment operators and swap functions shall not exit with an exception. A noexcept exception specification shall be added to these functions as appropriate.M15-5-1Exceptions2Easy
93
cppAUTOSARA15-5-2YesRequiredPartially AutomatedImplementationProgram shall not be abruptly terminated. In particular, an implicit or explicit invocation of std::abort(), std::quick_exit(), std::_Exit(), std::terminate() shall not be done.ERR50-CPPExceptions1Easy
94
cppAUTOSARA15-5-3YesRequiredAutomatedImplementationThe std::terminate() function shall not be called implicitly.A15-5-2Exceptions1Medium
95
cppAUTOSARA16-0-1YesRequiredAutomatedImplementationThe pre-processor shall only be used for unconditional and conditional file inclusion and include guards, and using the following directives: (1) #ifndef, #ifdef, (3) #if, (4) #if defined, (5) #elif, (6) #else, (7) #define, (8) #endif, (9) #include.M16-2-1MacrosEasy
96
cppAUTOSARA16-2-1YesRequiredAutomatedImplementationThe ',", /*, //, \ characters shall not occur in a header file name or in #include directive.M16-2-4MacrosEasy
97
cppAUTOSARA16-2-2YesRequiredAutomatedImplementationThere shall be no unused include directives.cpp/dependency/useless-includeIncludesHardhttps://github.com/github/semmle-code/tree/main/packs/dependency/queries/semmlecode-cpp-queries/Dependency
98
cppAUTOSARA16-2-3NoRequiredNon-AutomatedImplementationAn include directive shall be added explicitly for every symbol used in a file.There is no automated way to identify which headers are intended to be imported for each symbol. For the standard library we could scrape the documentation to determine which symbol is supposed to come from which header but the expected value is low.
99
cppAUTOSARA16-6-1YesRequiredAutomatedImplementation#error directive shall not be used.MacrosEasy
100
cppAUTOSARA16-7-1YesRequiredAutomatedImplementationThe #pragma directive shall not be used.MacrosEasy
101
cppAUTOSARA17-0-1YesRequiredAutomatedImplementationReserved identifiers, macros and functions in the C++ standard library shall not be defined, redefined or undefined.M17-0-1BannedLibrariesMedium
102
cppAUTOSARA17-0-2NoRequiredNon-AutomatedImplementationAll project's code including used libraries (including standard and user-defined libraries) and any third-party user code shall conform to the AUTOSAR C++14 Coding Guidelines.Self-referential. This is, in practice, covered by the rest of the queries, so I don't think we would have a specific query for this.
103
cppAUTOSARA17-1-1YesRequiredNon-AutomatedImplementationUse of the C Standard Library shall be encapsulated and isolated.FunctionsMediumEnforce that functions which call cstd functions are only calling cstd functions.
104
cppAUTOSARA17-6-1YesRequiredAutomatedImplementationNon-standard entities shall not be added to standard namespaces.DCL58-CPPScopeImport
105
cppAUTOSARA18-0-1YesRequiredAutomatedImplementationThe C library facilities shall only be accessed through C++ library headers.M18-0-1BannedLibrariesEasy
106
cppAUTOSARA18-0-2YesRequiredAutomatedImplementationThe error state of a conversion from string to a numeric value shall be checked.M18-0-2TypeRangesMedium
107
cppAUTOSARA18-0-3YesRequiredAutomatedImplementationThe library <clocale> (locale.h) and the setlocale function shall not be used.BannedLibrariesEasy
108
cppAUTOSARA18-1-1YesRequiredAutomatedImplementationC-style arrays shall not be used.BannedSyntaxEasy
109
cppAUTOSARA18-1-2YesRequiredAutomatedImplementationThe std::vector<bool> specialization shall not be used.BannedTypesEasy
110
cppAUTOSARA18-1-3YesRequiredAutomatedImplementationThe std::auto_ptr type shall not be used.BannedTypesEasy
111
cppAUTOSARA18-1-4YesRequiredAutomatedImplementationA pointer pointing to an element of an array of objects shall not be passed to a smart pointer of single object type.PointersMedium
112
cppAUTOSARA18-1-6YesRequiredAutomatedImplementationAll std::hash specializations for user-defined types shall have a noexcept function call operator.OperatorInvariantsEasy
113
cppAUTOSARA18-5-1YesRequiredAutomatedImplementationFunctions malloc, calloc, realloc and free shall not be used.BannedFunctionsEasy
114
cppAUTOSARA18-5-10YesRequiredAutomatedImplementationPlacement new shall be used only with properly aligned pointers to sufficient storage capacity.MEM54-CPPAllocationsImport
115
cppAUTOSARA18-5-11YesRequiredAutomatedImplementationoperator new' and 'operator delete' shall be defined together.DCL54-CPPDeclarationsEasy
116
cppAUTOSARA18-5-2YesRequiredPartially AutomatedImplementationNon-placement new or delete expressions shall not be used.AllocationsHard
117
cppAUTOSARA18-5-3YesRequiredAutomatedImplementationThe form of the delete expression shall match the form of the new expression used to allocate the memory.cpp/new-free-mismatch?FreedVery Hard
118
cppAUTOSARA18-5-4YesRequiredAutomatedImplementationIf a project has sized or unsized version of operator 'delete' globally defined, then both sized and unsized versions shall be defined.DeclarationsEasy
119
cppAUTOSARA18-5-5YesRequiredPartially AutomatedToolchainMemory management functions shall ensure the following: (a) deterministic behavior resulting with the existence of worst-case execution time, (b) avoiding memory fragmentation, (c) avoid running out of memory, (d) 349 of 510 Document ID 839: AUTOSAR_RS_CPP14GuidelinesInvariantsHard
120
cppAUTOSARA18-5-6YesRequiredNon-AutomatedVerification / ToolchainAn analysis shall be performed to analyze the failure modes of dynamic memory management. In particular, the following failure modes shall be analyzed: (a) non-deterministic behavior resulting with nonexistence of worst-case execution time, (b) memory fragmentation, (c) running out of memory, (d) mismatched allocations and deallocations, (e) dependence on non-deterministic calls to kernel.AllocationsAuditProduce a list of allocations in the program.
121
cppAUTOSARA18-5-7NoRequiredNon-AutomatedImplementationIf non-realtime implementation of dynamic memory management functions is used in the project, then memory shall only be allocated and deallocated during non-realtime program phases.No specific ideas for implementing this.
122
cppAUTOSARA18-5-8YesRequiredPartially AutomatedImplementationObjects that do not outlive a function shall have automatic storage duration.AllocationsMedium
123
cppAUTOSARA18-5-9YesRequiredAutomatedImplementationCustom implementations of dynamic memory allocation and deallocation functions shall meet the semantic requirements specified in the corresponding 'Required behaviour' clause from the C++ Standard.MEM55-CPPAllocationsImport
124
cppAUTOSARA18-9-1YesRequiredAutomatedImplementationThe std::bind shall not be used.BannedFunctionsEasy
125
cppAUTOSARA18-9-2YesRequiredAutomatedImplementationForwarding values to other functions shall be done via: (1) std::move if the value is an rvalue reference, (2) std::forward if the value is forwarding reference.MoveForwardMedium
126
cppAUTOSARA18-9-3YesRequiredAutomatedImplementationThe std::move shall not be used on objects declared const or const&.MoveForwardEasy
127
cppAUTOSARA18-9-4YesRequiredAutomatedImplementationAn argument to std::forward shall not be subsequently used.MoveForwardMedium
128
cppAUTOSARA2-10-1YesRequiredAutomatedArchitecture / Design / ImplementationAn identifier declared in an inner scope shall not hide an identifier declared in an outer scope.M2-10-2NamingEasy
129
cppAUTOSARA2-10-4YesRequiredAutomatedImplementationThe identifier name of a non-member object with static storage duration or static function shall not be reused within a namespace.M2-10-5NamingEasy
130
cppAUTOSARA2-10-5YesAdvisoryAutomatedDesign / ImplementationAn identifier name of a function with static storage duration or a non-member object with external or internal linkage should not be reused.M2-10-5NamingEasy
131
cppAUTOSARA2-10-6YesRequiredAutomatedImplementationA class or enumeration name shall not be hidden by a variable, function or enumerator declaration in the same scope.M2-10-6NamingEasy
132
cppAUTOSARA2-11-1YesRequiredAutomatedDesign / ImplementationVolatile keyword shall not be used.cpp/jsf/av-rule-205BannedSyntaxEasy
133
cppAUTOSARA2-13-1YesRequiredAutomatedArchitecture / Design / ImplementationOnly those escape sequences that are defined in ISO/IEC 14882:2014 shall be used.M2-13-1LiteralsEasy
134
cppAUTOSARA2-13-2NoRequiredAutomatedImplementationString literals with different encoding prefixes shall not be concatenated.M2-13-5From the sample, it looks like this is compiler enforced.
135
cppAUTOSARA2-13-3YesRequiredAutomatedArchitecture / Design / ImplementationType wchar_t shall not be used.BannedTypesEasy
136
cppAUTOSARA2-13-4YesRequiredAutomatedArchitecture / Design / ImplementationString literals shall not be assigned to non-constant pointers.StringsEasy
137
cppAUTOSARA2-13-5YesAdvisoryAutomatedImplementationHexadecimal constants should be upper case.LiteralsEasy
138
cppAUTOSARA2-13-6YesRequiredAutomatedArchitecture / Design / ImplementationUniversal character names shall be used only inside character or string literals.NamingEasy
139
cppAUTOSARA2-3-1YesRequiredAutomatedArchitecture / Design / ImplementationOnly those characters specified in the C++ Language Standard basic source character set shall be used in the source code.NamingEasyWe can only provide partial coverage for this rule, because we have a semantic not syntactic model of the code.
140
cppAUTOSARA2-5-1NoRequiredAutomatedImplementationTrigraphs shall not be used.Trigraphs/digraphs are implemented by the preprocessor in a such a way that we may not have that information in our database. We could look for compiler flags here.
141
cppAUTOSARA2-5-2NoRequiredAutomatedImplementationDigraphs shall not be used.Trigraphs/digraphs are implemented by the preprocessor in a such a way that we may not have that information in our database. We could look for compiler flags here.
142
cppAUTOSARA2-7-1YesRequiredAutomatedImplementationThe character \ shall not occur as a last character of a C++ comment.CommentsEasy
143
cppAUTOSARA2-7-2YesRequiredNon-AutomatedImplementationSections of code shall not be 'commented out'.M2-7-2CommentsEasyWe can write a heuristic query that looks for code markers in comments.
144
cppAUTOSARA2-7-3YesRequiredAutomatedImplementationAll declarations of 'user-defined' types, static and non-static data members, functions and methods shall be preceded by documentation.CommentsEasy
145
cppAUTOSARA2-7-5NoRequiredNon-AutomatedImplementationComments shall not document any actions or sources (e.g. tables, figures, paragraphs, etc.) that are outside of the file.Difficult to ascertain programmatically
146
cppAUTOSARA2-8-1NoRequiredNon-AutomatedArchitecture / Design / ImplementationA header file name should reflect the logical entity for which it provides declarations.Difficult to ascertain programmatically
147
cppAUTOSARA2-8-2NoAdvisoryNon-AutomatedArchitecture / Design / ImplementationAn implementation file name should reflect the logical entity for which it provides definitions.Difficult to ascertain programmatically
148
cppAUTOSARA20-8-1YesRequiredAutomatedImplementationAn already-owned pointer value shall not be stored in an unrelated smart pointer.MEM56-CPPSmartPointers1Import
149
cppAUTOSARA20-8-2YesRequiredAutomatedImplementationA std::unique_ptr shall be used to represent exclusive ownership.SmartPointers1Hard
150
cppAUTOSARA20-8-3YesRequiredAutomatedImplementationA std::shared_ptr shall be used to represent shared ownership.SmartPointers1Hard
151
cppAUTOSARA20-8-4YesRequiredAutomatedImplementationA std::unique_ptr shall be used over std::shared_ptr if ownership sharing is not required.SmartPointers1Hard
152
cppAUTOSARA20-8-5YesRequiredAutomatedImplementationstd::make_unique shall be used to construct objects owned by std::unique_ptr.SmartPointers1Easy
153
cppAUTOSARA20-8-6YesRequiredAutomatedImplementationstd::make_shared shall be used to construct objects owned by std::shared_ptr.SmartPointers1Easy
154
cppAUTOSARA20-8-7YesRequiredNon-AutomatedImplementationA std::weak_ptr shall be used to represent temporary shared ownership.SmartPointers2HardWe can find some specific cases here: mutual assignment of two variables, for example.
155
cppAUTOSARA21-8-1YesRequiredAutomatedImplementationArguments to character-handling functions shall be representable as an unsigned char.STR37-CTypeRangesHard
156
cppAUTOSARA23-0-1YesRequiredAutomatedImplementationAn iterator shall not be implicitly converted to const_iterator.IteratorsEasy
157
cppAUTOSARA23-0-2YesRequiredAutomatedImplementationElements of a container shall only be accessed via valid references, iterators, and pointers.CTR51-CPPIteratorsImport
158
cppAUTOSARA25-1-1YesRequiredAutomatedImplementationNon-static data members or captured values of predicate function objects that are state related to this object's identity shall not be copied.CTR58-CPPSideEffects2Import
159
cppAUTOSARA25-4-1YesRequiredNon-AutomatedImplementationOrdering predicates used with associative containers and STL sorting and related algorithms shall adhere to a strict weak ordering relation.CTR57-CPPInvariantsImportHard to determine in general. Easiest is likely the irreflexivity clause (specifically using std::less_equal and similar library functions)
160
cppAUTOSARA26-5-1YesRequiredAutomatedImplementationPseudorandom numbers shall not be generated using std::rand().MSC50-CPPBannedFunctionsImport
161
cppAUTOSARA26-5-2YesRequiredAutomatedImplementationRandom number engines shall not be default-initialized.MSC51-CPPInitializationEasy
162
cppAUTOSARA27-0-1YesRequiredNon-AutomatedImplementationInputs from independent components shall be validated.TypeRangesMediumWe can perform some checking here assuming: we have annotations which determine the boundaries between components, and the appropriate checks that should be performed.
163
cppAUTOSARA27-0-2YesAdvisoryAutomatedImplementationA C-style string shall guarantee sufficient space for data and the null terminator.STR50-CPPStringsImport
164
cppAUTOSARA27-0-3YesRequiredAutomatedImplementationAlternate input and output operations on a file stream shall not be used without an intervening flush or positioning call.FIO50-CPPIOImport
165
cppAUTOSARA27-0-4YesRequiredAutomatedImplementationC-style strings shall not be used.StringsHard
166
cppAUTOSARA3-1-1YesRequiredAutomatedArchitecture / Design / ImplementationIt shall be possible to include any header file in multiple translation units without violating the One Definition Rule.M3-1-1IncludesEasy
167
cppAUTOSARA3-1-2YesRequiredAutomatedArchitecture / Design / ImplementationHeader files, that are defined locally in the project, shall have a file name extension of one of: ".h",".hpp" or ".hxx".cpp/jsf/av-rule-53IncludesEasy
168
cppAUTOSARA3-1-3YesAdvisoryAutomatedArchitecture / Design / ImplementationImplementation files, that are defined locally in the project, should have a file name extension of ".cpp".IncludesEasy
169
cppAUTOSARA3-1-4YesRequiredAutomatedDesign / ImplementationWhen an array with external linkage is declared, its size shall be stated explicitly.M3-1-3ScopeEasy
170
cppAUTOSARA3-1-5YesRequiredPartially-AutomatedDesignA function definition shall only be placed in a class definition if (1) the function is intended to be inlined (2) it is a member function template (3) it is a member function of a class template.ClassesMedium
171
cppAUTOSARA3-1-6YesAdvisoryAutomatedDesignTrivial accessor and mutator functions should be inlined.FunctionsEasy
172
cppAUTOSARA3-3-1YesRequiredAutomatedImplementationObjects or functions with external linkage (including members of named namespaces) shall be declared in a header file.M3-3-1IncludesEasy
173
cppAUTOSARA3-3-2YesRequiredAutomatedImplementationStatic and thread-local objects shall be constant-initialized.DCL56-CPPInitializationMedium
174
cppAUTOSARA3-8-1YesRequiredNon-AutomatedImplementationAn object shall not be accessed outside of its lifetime.EXP54-CPPFreedImportA replica of a CERT-CPP rule, there are numerous specific cases we can cover.
175
cppAUTOSARA3-9-1YesRequiredAutomatedImplementationFixed width integer types from <cstdint>, indicating the size and signedness, shall be used in place of the basic numerical types.M3-9-2DeclarationsEasy
176
cppAUTOSARA4-10-1YesRequiredAutomatedArchitecture / Design / ImplementationOnly nullptr literal shall be used as the null-pointer-constant.LiteralsEasy
177
cppAUTOSARA4-5-1YesRequiredAutomatedImplementationExpressions with type enum or enum class shall not be used as operands to built-in and overloaded operators other than the subscript operator [ ], the assignment operator =, the equality operators == and ! =, the unary & operator, and the relational operators <, <=, >, >=.M4-5-2ExpressionsEasy
178
cppAUTOSARA4-7-1YesRequiredAutomatedImplementationAn integer expression shall not lead to data loss.M5-0-6IntegerConversionVery Hard
179
cppAUTOSARA5-0-1YesRequiredAutomatedImplementationThe value of an expression shall be the same under any order of evaluation that the standard permits.M5-0-1OrderOfEvaluationHard
180
cppAUTOSARA5-0-2YesRequiredAutomatedImplementationThe condition of an if-statement and the condition of an iteration statement shall have type bool.M5-0-13ConditionalsEasy
181
cppAUTOSARA5-0-3YesRequiredAutomatedImplementationThe declaration of objects shall contain no more than two levels of pointer indirection.M5-0-19PointersEasy
182
cppAUTOSARA5-0-4YesRequiredAutomatedImplementationPointer arithmetic shall not be used with pointers to non-final classes.CTR56-CPPPointersEasy
183
cppAUTOSARA5-1-1YesRequiredPartially AutomatedImplementationLiteral values shall not be used apart from type initialization, otherwise symbolic names shall be used instead.LiteralsEasy
184
cppAUTOSARA5-1-2YesRequiredAutomatedImplementationVariables shall not be implicitly captured in a lambda expression.LambdasEasy
185
cppAUTOSARA5-1-3YesRequiredAutomatedImplementationParameter list (possibly empty) shall be included in every lambda expression.LambdasEasy
186
cppAUTOSARA5-1-4YesRequiredAutomatedImplementationA lambda expression object shall not outlive any of its reference-captured objects.EXP61-CPPLambdasImport
187
cppAUTOSARA5-1-6YesAdvisoryAutomatedImplementationReturn type of a non-void return type lambda expression should be explicitly specified.LambdasEasy
188
cppAUTOSARA5-1-7YesRequiredAutomatedImplementationA lambda shall not be an operand to decltype or typeid.LambdasEasy
189
cppAUTOSARA5-1-8YesAdvisoryAutomatedImplementationLambda expressions should not be defined inside another lambda expression.LambdasEasy
190
cppAUTOSARA5-1-9YesAdvisoryAutomatedImplementationIdentical unnamed lambda expressions shall be replaced with a named function or a named lambda expression.LambdasVery Hard
191
cppAUTOSARA5-10-1YesRequiredAutomatedImplementationA pointer to member virtual function shall only be tested for equality with null-pointer-constant.PointersMedium
192
cppAUTOSARA5-16-1YesRequiredAutomatedImplementationThe ternary conditional operator shall not be used as a sub-expression.BannedSyntaxEasy
193
cppAUTOSARA5-2-1YesAdvisoryAutomatedImplementationdynamic_cast should not be used.BannedSyntaxEasy
194
cppAUTOSARA5-2-2YesRequiredAutomatedImplementationTraditional C-style casts shall not be used.BannedSyntaxEasy
195
cppAUTOSARA5-2-3YesRequiredAutomatedImplementationA cast shall not remove any const or volatile qualification from the type of a pointer or reference.EXP55-CPPConstImport
196
cppAUTOSARA5-2-4YesRequiredAutomatedImplementationreinterpret_cast shall not be used.M5-2-7BannedSyntaxEasy
197
cppAUTOSARA5-2-5YesRequiredAutomatedImplementationAn array or container shall not be accessed beyond its range.CTR50-CPPOutOfBoundsImport
198
cppAUTOSARA5-2-6YesRequiredAutomatedImplementationThe operands of a logical && or || shall be parenthesized if the operands contain binary operators.M5-2-1OrderOfEvaluationEasy
199
cppAUTOSARA5-3-1YesRequiredNon-AutomatedImplementationEvaluation of the operand to the typeid operator shall not contain side effects.SideEffects1EasyWe will make use of a shared "side-effects" library for this query.
200
cppAUTOSARA5-3-2YesRequiredPartially AutomatedImplementationNull pointers shall not be dereferenced.NullVery Hard
201
cppAUTOSARA5-3-3YesRequiredAutomatedImplementationPointers to incomplete class types shall not be deleted.EXP57-CPPPointersEasy
202
cppAUTOSARA5-5-1YesRequiredAutomatedImplementationA pointer to member shall not access non-existent class members.OOP55-CPPPointersImport