Releases: github/codeql-coding-standards
Releases · github/codeql-coding-standards
v2.28.0
Release summary
- No new queries were added for this release
- The following changes have been made for this release:
A2-10-1
,RULE-5-3
-IdentifierHiding.ql
,IdentifierHidingC.ql
:- Address FN reported in #118. Rule was missing detection of functions. Additionally omitted class template instantiations.
- Fix FP for identifiers in nested namespaces.
M9-3-3
:MemberFunctionConstIfPossible.ql
:- Fix FP reported in 381. Omit member functions that return nonconst reference types.
A13-2-2
-BinaryOperatorAndBitwiseOperatorReturnAPrvalue.ql
:- Replaced the usage of getIdentityString() with toString() to avoid expensive computation to display the Operator names which were causing crashes on production code.
Supported versions
- The LGTM pack is not supported on any released version of LGTM without support from GitHub Professional Services.
- The Code Scanning pack is supported when:
- Using the CodeQL CLI version
2.14.6
in conjunction with a copy of the CodeQL standard library for C++ (github/codeql
) set to the tagcodeql-cli/v2.14.6
. - Using the CodeQL Action or CodeQL runner with the codeql-bundle-v2.14.6.
- Using the CodeQL CLI version
v2.27.1 [Certified]
This release of CodeQL Coding Standards is certified as a software tool suitable for use in safety-related development projects according to ISO26262:2018 for any ASIL.
Release summary
- No new queries were added for this release
- Add precompiled queries
Supported versions
- The LGTM pack is not supported on any released version of LGTM without support from GitHub Professional Services.
- The Code Scanning pack is supported when:
- Using the CodeQL CLI version
2.14.6
in conjunction with a copy of the CodeQL standard library for C++ (github/codeql
) set to the tagcodeql-cli/v2.14.6
. - Using the CodeQL Action or CodeQL runner with the codeql-bundle-v2.14.6.
- Using the CodeQL CLI version
v2.27.0
Release summary
- No new queries were added for this release
- The following changes have been made for this release:
A3-3-1
-ExternalLinkageNotDeclaredInHeaderFile.ql
:- Adjust the alert message to comply with the style guide.
CTR55-CPP
-DoNotUseAnAdditiveOperatorOnAnIterator.ql
:- Address reported FP in #374. Improve logic on valid end checks and size checks on iterators.
RULE-6-1
-BitFieldsShallOnlyBeDeclaredWithAnAppropriateType.ql
:- Address FP reported in #318. Add support for implementation specific bitfield types for Clang and Gcc.
Supported versions
- The LGTM pack is not supported on any released version of LGTM without support from GitHub Professional Services.
- The Code Scanning pack is supported when:
- Using the CodeQL CLI version
2.14.6
in conjunction with a copy of the CodeQL standard library for C++ (github/codeql
) set to the tagcodeql-cli/v2.14.6
. - Using the CodeQL Action or CodeQL runner with the codeql-bundle-v2.14.6.
- Using the CodeQL CLI version
v2.26.0
Release summary
- No new queries were added for this release
- The following changes have been made for this release:
A0-4-1
-FloatingPointImplementationShallComplyWithIeeeStandard.ql
:- May return more results due to improvements to underlying
getATypeUse
.
- May return more results due to improvements to underlying
A12-4-1
-DestructorOfABaseClassNotPublicVirtual.ql
:- Fix FP reported in #392. Improve base class detection for template classes.
- Update the alert message to prevent duplicate alerts for base classes that are both derived and abstract.
A12-8-6
-CopyAndMoveNotDeclaredProtected.ql
:- Fix FP reported in #392. Improve base class detection for template classes.
- Update the alert message to prevent duplicate alerts for base classes that are both derived and abstract.
A8-4-7
-InParametersForCheapToCopyTypesNotPassedByValue.ql
,InParametersForCheapToCopyTypesNotPassedByReference.ql
:- Fixes #89. Accidental floor rounding was applying to type size calculations.
Supported versions
- The LGTM pack is not supported on any released version of LGTM without support from GitHub Professional Services.
- The Code Scanning pack is supported when:
- Using the CodeQL CLI version
2.14.6
in conjunction with a copy of the CodeQL standard library for C++ (github/codeql
) set to the tagcodeql-cli/v2.14.6
. - Using the CodeQL Action or CodeQL runner with the codeql-bundle-v2.14.6.
- Using the CodeQL CLI version
v2.25.0
Release summary
-
New queries added for the following rule packages: Declarations, OrderOfEvaluation
-
The following changes have been made for this release:
M8-5-2
-AggregateLiteralEnhancements.qll
:- recognise aggregate literals initialized with parameters from variadic templates.
A7-1-5
- exclude auto variables initialized with an expression of non-fundamental type. Typically this occurs when using range based for loops with arrays of non-fundamental types. For example:void iterate(Foo values[]) { for (auto value : values) { // COMPLIANT (previously false positive) // ... } }
A0-1-1
- address a number of false positive issues:- Exclude compiler-generated variables, such as those generated for range-based for loops.
- Exclude variables in uninstantiated templates, for which we have no precise data on uses.
- Deviations should now be applied to the useless assignment instead of the variable itself.
A15-4-4
: remove false positives reported on uninsantiated templates.
A2-10-1
,RULE-5-3
:- Reduce false positives by considering point of declaration for local variables.
- Reduce false negatives by considering catch block parameters to be in scope in the catch block.
M6-5-5
:- Reduce false positives by no longer considering the taking of a const reference as a modification.
- Improve detection of non-local modification of loop iteration variables to reduce false positives.
A7-1-1
- no longer report parameters as contravening this rule. This is inline with the rule intent as described in the referenced C++ Core Guidelines rule CON.1, which states "To avoid confusion and lots of false positives, don’t enforce this rule for function parameters."A2-7-3
-UndocumentedUserDefinedType.ql
:- Excluding declarations in function scope. The rationale is that these declarations are not exposed outside the scope of the function.
M16-1-1
-DefinedPreProcessorOperatorGeneratedFromExpansionFound.ql
:- Optimize query to improve performance
- Improve detection of macros whose body contains the
defined
operator after the start of the macro (e.g.#define X Y || defined(Z)
). - Enable exclusions to be applied for this rule.
- The following queries have been updated to address issues with applying deviations:
A18-5-11
,A23-0-1
,A9-3-1
,M0-1-2
,M3-1-2
,M3-2-1
,M3-2-3
,M3-9-1
,M4-5-3
,M5-0-2
,M5-2-10
,A23-0-2
,CTR51-CPP
,STR52-CPP
-
A3-9-1
-VariableWidthIntegerTypesUsed.ql
:- Exclude the plain char type. Still includes
signed char
andunsigned char
. - Include CV-qualified variable width integer types.
- Exclude the plain char type. Still includes
-
A3-9-1
-VariableWidthPlainCharTypeUsed.ql
:- New query to support fine grained deviation support for the plain char type.
M5-3-3
-UnaryOperatorOverloaded.ql
: - Exclude binary user defined
operator&
from this rule.
M5-2-10
-IncrementAndDecrementOperatorsMixedWithOtherOperatorsInExpression.ql
: - only report use of the increment and decrement operations in conjunction with arithmetic operators, as specified by the rule. Notably we no longer report the expressions of the form
*p++
, which combine increment and dereferencing operations.
- New query to support fine grained deviation support for the plain char type.
A4-7-1
- exclude pointer increment and decrement operators from this rule.
A2-3-1
:cpp/autosar/invalid-character-in-string-literal
- Fixes #311. Exclude wide string literals and utf8 string literal.
RULE-7-3
:c/misra/lowercase-character-l-used-in-literal-suffix
- Exclude non integer literals. This removes a false positive triggered when analyzing C++ code containing the
false
literal.
- Fixes #311. Exclude wide string literals and utf8 string literal.
- Exceptions are no longer propagated from calls to
noexcept
functions, or calls functions with dynamic exception specifications where the exception is not permitted. This is consistent with the default behaviour specified in[expect.spec]
which indicates thatstd::terminate
is called. This has the following impact:A15-4-2
,ERR55-CPP
- reduce false positives fornoexcept
functions which call othernoexcept
function which may throw.A15-2-2
- reduce false positives for constructors which callnoexcept
functions.A15-4-5
- reduce false positives for checked exceptions that are thrown fromnoexcept
functions called by the original function.DCL57-CPP
- do not report exceptions thrown fromnoexcept
functions called by deallocation functions or destructors.A15-5-1
,M15-3-1
- do not report exceptions thrown fromnoexcept
functions called by special functions.
M9-3-3
-MemberFunctionConstIfPossible.ql
,MemberFunctionStaticIfPossible.ql
:- Fixes #413. Exclude deleted member functions.
A8-4-7
-InParametersForCheapToCopyTypesNotPassedByValue.ql
,InParametersForNotCheapToCopyTypesNotPassedByReference.ql
: - Fixes #397. Exclude user defined operators and move constructors.`
- Exclude parameters for instantiated templates because the declaration location of the function does not contain enough information about the type used in the instantiation to make an actionable alert.
A5-0-2
-NonBooleanIfStmt.qll
,NonBooleanIterationStmt.qll
: - Exclude compiler generated conditions.
A13-3-1
-FunctionThatContainsForwardingReferenceAsItsArgumentOverloaded.ql
: - Fixes #399. Exclude functions that have different number of parameters.
A4-7-1
:IntegerExpressionLeadToDataLoss.ql
- Fix #368: Incorrectly reporting
/=
as a cause for data loss. A8-4-8
-OutParametersUsed.ql
- Fixes #370 - Non-member user-defined assignment operator and stream insertion/extraction parameters that are required to be out parameters are excluded.
- Broadens the definition of out parameter by considering assignment and crement operators as modifications to an out parameter candidate.
FIO51-CPP
-CloseFilesWhenTheyAreNoLongerNeeded.ql
:- Broadened definition of
IStream
andOStream
types may result in reduced false negatives.
- Broadened definition of
A5-1-1
-LiteralValueUsedOutsideTypeInit.ql
:- Broadened definition of
IStream
types may result in reduced false positives because more file stream function calls may be detected as logging operations that will be excluded from the results.
A16-0-1
-PreProcessorShallOnlyBeUsedForCertainDirectivesPatterns.ql
:- Exclude all preprocessor elses and also consider elifs separately (ie do not affect valid ifs) but not valid if not meeting the same criteria as an ifdef etc.
A4-5-1
:EnumUsedInArithmeticContexts.ql
: - Address incorrect exclusion of the binary operator
&
. - Address incorrect inclusion of the unary operator
&
. - Fix FP reported in #366.
A7-1-2
-VariableMissingConstexpr.ql
: - Fix FP reported in #466. Addresses incorrect assumption that calls to
constexpr
functions are always compile-time evaluated.
M9-3-3
:MemberFunctionConstIfPossible.ql
: - Fix FP reported in 467. Excluding candidates in uninstantiated templates.
A7-1-1
-DeclarationUnmodifiedObjectMissingConstSpecifier.ql
- Fix FP reported in #372. Exclude compiler generated variables.
- Exclude all preprocessor elses and also consider elifs separately (ie do not affect valid ifs) but not valid if not meeting the same criteria as an ifdef etc.
- Broadened definition of
A2-10-4
-IdentifierNameOfStaticNonMemberObjectReusedInNamespace.ql
:- Fix FP reported in #385. Addresses incorrect detection of partially specialized template variables as conflicting reuses.
A18-0-1
-CLibraryFacilitiesNotAccessedThroughCPPLibraryHeaders.ql
:- Fix issue #7 - improve query logic to only match on exact standard library names (e.g., now excludes sys/header.h type headers from the results as those are not C standard libraries).
M7-3-6
-UsingDeclarationsUsedInHeaderFiles.ql
:M0-1-4
-SingleUseMemberPODVariable.ql
:- Address FP reported in #388. Include aggregrate initialization as a use of a member.
- Include indirect initialization of members. For example, casting a pointer to a buffer to a struct pointer.
- Reformat the alert message to adhere to the style-guide.
M0-1-3
-UnusedMemberVariable.ql
,UnusedGlobalOrNamespaceVariable.ql
:- Address FP reported in #384. Exclude variables with compile time values that may have been used as a template argument.
- Exclude uninstantiated template members.
- Reformat the alert message to adhere to the style-guide.
A5-1-1
-LiteralValueUsedOutsideTypeInit.ql
:- Address FP reported in #371. Exclude literals generated by uses of constexpr variables.
- Exclude literals used in class template instantiations.
- Update the alert message to adhere to the style-guide.
- Exclude boolean literals used as template arguments.
- Exclude
u
andU
prefixed char literals. - Exclude literals part of a class aggregate literal.
A4-7-1
-IntegerExpressionLeadToDataLoss.ql
:- Address reported FP in #396. Exclude shift operations guarded to prevent undefined behavior that could lead to dataloss.
INT34-C
-ExprShiftedbyNegativeOrGreaterPrecisionOperand.ql
:- Format the alert message according to the style-guide.
A5-0-2
-NonBooleanIterationCondition.ql
:- Address FP reported in #10. Exclude conditions in uninstantiated templates.
M5-3-1
-EachOperandOfTheOperatorTheLogicalAndOrTheLogicalOperatorsShallHaveTypeBool.ql
:- Adjust the alert message to comply with the style guide.
M5-14-1
- `RightHandOperandOfALogicalAndOperatorsContainSi...
v2.24.0
Release summary
- No new queries were added for this release
- The following changes have been made for this release:
A7-3-1
-HiddenInheritedNonOverridableMemberFunction.ql
:- Reduce duplication by reporting only a single location for each declaration of a problematic element.
- Reduce duplication when reporting the hidden function by reporting only one declaration entry.
- Improve performance by eliminating a number of bad join orders.
- Fix false positives where the using declaration occurred after the function declaration.
- Exclude special member functions, which cannot be inherited.
- Exclude private member functions, which cannot be inherited.
M5-0-20
,M5-0-21
,RULE-10-1
- exclude pointer assignment operators as bitwise operators.
- The release artifacts now include a certification kit used for ISO26262 certification.
M5-0-20
-BitwiseOperatorOperandsHaveDifferentUnderlyingType.ql
:- Use the Misra definition of underlying type.
Supported versions
- The LGTM pack is not supported on any released version of LGTM without support from GitHub Professional Services.
- The Code Scanning pack is supported when:
- Using the CodeQL CLI version
2.14.6
in conjunction with a copy of the CodeQL standard library for C++ (github/codeql
) set to the tagcodeql-cli/v2.14.6
. - Using the CodeQL Action or CodeQL runner with the codeql-bundle-v2.14.6.
- Using the CodeQL CLI version
v2.23.0
Release summary
- No new queries were added for this release
- The following changes have been made for this release:
A0-1-3
- Considered the following additional use cases while reporting a local function as "unused".- The address of a function is taken
- The operand of an expression in an unevaluated context
- Functions marked with [[maybe_unused]]
- Explicitly deleted functions e.g. =delete
- Use of any overload of a function in an overload set constitute a use of all members of the set. An overload set is a set of functions with the same name that differ in the number, type and/or qualifiers of their parameters, and, for the purpose of this query, are limited to functions which are declared in the same scope (namespace or class).
Supported versions
- The LGTM pack is not supported on any released version of LGTM without support from GitHub Professional Services.
- The Code Scanning pack is supported when:
- Using the CodeQL CLI version
2.13.5
in conjunction with a copy of the CodeQL standard library for C++ (github/codeql
) set to the tagcodeql-cli/v2.13.5
. - Using the CodeQL Action or CodeQL runner with the codeql-bundle-v2.13.5.
- Using the CodeQL CLI version
v2.22.0
Release summary
- No new queries were added for this release
- The following changes have been made for this release:
FIO32-C
-DoNotPerformFileOperationsOnDevices.ql
:- The query was updated to work with the latest version of the dataflow library.
A5-1-3
- Only consider lambdas that have zero arguments, since any lambda with non-zero arguments will have an explicit argument list.M0-1-3
- Consider constexpr variables used in template instantiations as "used".A8-4-13
- Address false positives caused by missing modelling of modifying operations for smart pointers for some standard libraries (such as libstdc++).
A20-8-1
/MEM56-CPP
- Address false negatives caused by lack of modelling of flow through smart pointers.
- Reduce flow paths through standard library headers to simplify results.
A18-1-4
- Address false positives caused by missing modelling of modifying operations for smart pointers for some standard libraries (such as libstdc++).
STR51-CPP
- Address false negatives caused by incomplete modelling of the
std::string::replace()
function.
- Address false negatives caused by incomplete modelling of the
A15-5-1
- Rephrase alert message for
noalert(false)
special functions to clarify that this permits exceptions. - Additional results for implicit
noexcept(true)
special functions highlighting that the specification should be made explicit.
- Rephrase alert message for
- Updated the supported CodeQL version to
2.12.7
. A15-2-2
- all results now include an associated exception flow path to avoid a CodeQL CLI bug in 2.12.7. This includes results where an exception is thrown directly in the constructor.
Supported versions
- The LGTM pack is not supported on any released version of LGTM without support from GitHub Professional Services.
- The Code Scanning pack is supported when:
- Using the CodeQL CLI version
2.12.7
in conjunction with a copy of the CodeQL standard library for C++ (github/codeql
) set to the tagcodeql-cli/v2.12.7
. - Using the CodeQL Action or CodeQL runner with the codeql-bundle-20230418.
- Using the CodeQL CLI version
v2.21.0
Release summary
- No new queries were added for this release
- The following changes have been made for this release:
- FIO32-C - DoNotPerformFileOperationsOnDevices.ql:
- The query was rewritten to no longer depend of the DefaultTaintTracking library, which will be deprecated.
- A7-1-5 - exclude compiler generated variables, such as those generated by for loops.
- M8-0-1 - exclude compiler generated variables, such as those generated by for loops.
- Updated the supported CodeQL version to 2.11.6.
- A number of rules had the wrong query ids attached for deviation purposes. This means they could not be deviated against using the correct ID, but could be incidentally suppressed when deviating a different rule. We have fixed this behavior for the following rules:
- RULE-11-4
- DIR-4-12
- RULE-21-6
- RULE-21-9
- MEM51-CPP
Supported versions
- The LGTM pack is not supported on any released version of LGTM without support from GitHub Professional Services.
- The Code Scanning pack is supported when:
- Using the CodeQL CLI version
2.11.6
in conjunction with a copy of the CodeQL standard library for C++ (github/codeql
) set to the tagcodeql-cli/v2.11.6
. - Using the CodeQL Action or CodeQL runner with the codeql-bundle-20221211.
- Using the CodeQL CLI version
v2.20.0
Release summary
- No new queries were added for this release
Supported versions
- The LGTM pack is not supported on any released version of LGTM without support from GitHub Professional Services.
- The Code Scanning pack is supported when:
- Using the CodeQL CLI version
2.10.5
in conjunction with a copy of the CodeQL standard library for C++ (github/codeql
) set to the tagcodeql-cli/v2.10.5
. - Using the CodeQL Action or CodeQL runner with the codeql-bundle-20220908.
- Using the CodeQL CLI version