codeql-coding-standards
codeql-coding-standards copied to clipboard
Replace the dataflow library with the new dataflow library
Description
Affected files for which the relevant test output will need to be checked:
- [ ] c/cert/src/rules/ARR37-C/DoNotUsePointerArithmeticOnNonArrayObjectPointers.ql
- [ ] c/cert/src/rules/ARR39-C/DoNotAddOrSubtractAScaledIntegerToAPointer.ql
- [ ] c/cert/src/rules/CON30-C/CleanUpThreadSpecificStorage.ql
- [ ] c/cert/src/rules/CON34-C/AppropriateThreadObjectStorageDurations.ql
- [ ] c/cert/src/rules/CON34-C/ThreadObjectStorageDurationsNotInitialized.ql
- [ ] c/cert/src/rules/DCL30-C/AppropriateStorageDurationsFunctionReturn.ql
- [ ] c/cert/src/rules/ERR30-C/FunctionCallBeforeErrnoCheck.ql
- [ ] c/cert/src/rules/EXP30-C/DependenceOnOrderOfFunctionArgumentsForSideEffects.ql
- [ ] c/cert/src/rules/EXP36-C/DoNotCastPointerToMoreStrictlyAlignedPointerType.ql
- [ ] c/cert/src/rules/EXP37-C/DoNotCallFunctionPointerWithIncompatibleType.ql
- [ ] c/cert/src/rules/EXP39-C/DoNotAccessVariableViaPointerOfIncompatibleType.ql
- [ ] c/cert/src/rules/EXP40-C/DoNotModifyConstantObjects.ql
- [ ] c/cert/src/rules/EXP43-C/RestrictPointerReferencesOverlappingObject.ql
- [ ] c/cert/src/rules/FIO37-C/SuccessfulFgetsOrFgetwsMayReturnAnEmptyString.ql
- [ ] c/cert/src/rules/FIO44-C/OnlyUseValuesForFsetposThatAreReturnedFromFgetpos.ql
- [ ] c/cert/src/rules/FIO45-C/ToctouRaceConditionsWhileAccessingFiles.ql
- [ ] c/cert/src/rules/MEM35-C/InsufficientMemoryAllocatedForObject.ql
- [ ] c/cert/src/rules/MEM36-C/DoNotModifyAlignmentOfMemoryWithRealloc.ql
- [ ] c/cert/src/rules/MSC33-C/DoNotPassInvalidDataToTheAsctimeFunction.ql
- [ ] c/cert/src/rules/MSC39-C/DoNotCallVaArgOnAVaListThatHasAnIndeterminateValue.ql
- [ ] c/cert/src/rules/SIG30-C/CallOnlyAsyncSafeFunctionsWithinSignalHandlers.ql
- [ ] c/cert/src/rules/SIG35-C/DoNotReturnFromAComputationalExceptionHandler.ql
- [ ] c/cert/src/rules/STR30-C/DoNotAttemptToModifyStringLiterals.ql
- [ ] c/cert/src/rules/STR31-C/StringsHasSufficientSpaceForTheNullTerminator.ql
- [ ] c/cert/src/rules/STR32-C/NonNullTerminatedToFunctionThatExpectsAString.ql
- [ ] c/common/src/codingstandards/c/Errno.qll
- [ ] c/common/src/codingstandards/c/OutOfBounds.qll
- [ ] c/common/src/codingstandards/c/Signal.qll
- [ ] c/misra/src/rules/RULE-17-5/ArrayFunctionArgumentNumberOfElements.ql
- [ ] c/misra/src/rules/RULE-17-7/ValueReturnedByAFunctionNotUsed.ql
- [ ] c/misra/src/rules/RULE-19-1/ObjectCopiedToAnOverlappingObject.ql
- [ ] c/misra/src/rules/RULE-21-14/MemcmpUsedToCompareNullTerminatedStrings.ql
- [ ] c/misra/src/rules/RULE-22-3/FileOpenForReadAndWriteOnDifferentStreams.ql
- [ ] c/misra/src/rules/RULE-22-4/AttemptToWriteToAReadOnlyStream.ql
- [ ] cpp/autosar/src/rules/A13-1-3/UserDefinedLiteralsOperatorsShallOnlyPerformConversionOfPassedParameters.ql
- [ ] cpp/autosar/src/rules/A13-2-1/AssignmentOperatorReturnThis.ql
- [ ] cpp/autosar/src/rules/A15-1-3/ThrownExceptionsShouldBeUnique.ql
- [ ] cpp/autosar/src/rules/A15-2-2/ConstructorErrorLeavesObjectInInvalidState.ql
- [ ] cpp/autosar/src/rules/A18-1-4/PointerToAnElementOfAnArrayPassedToASmartPointer.ql
- [ ] cpp/autosar/src/rules/A18-5-2/DoNotUseNonPlacementNew.ql
- [ ] cpp/autosar/src/rules/A18-5-8/UnnecessaryUseOfDynamicStorage.ql
- [ ] cpp/autosar/src/rules/A18-9-4/ArgumentToForwardSubsequentlyUsed.ql
- [ ] cpp/autosar/src/rules/A20-8-4/SharedPointerUsedWithNoOwnershipSharing.ql
- [ ] cpp/autosar/src/rules/A27-0-4/CStyleStringsUsed.ql
- [ ] cpp/autosar/src/rules/A5-0-4/PointerArithmeticUsedWithPointersToNonFinalClasses.ql
- [ ] cpp/autosar/src/rules/A5-1-7/LambdaPassedToDecltype.ql
- [ ] cpp/autosar/src/rules/A5-1-7/LambdaPassedToTypeid.ql
- [ ] cpp/autosar/src/rules/A7-5-1/InvalidFunctionReturnType.ql
- [ ] cpp/autosar/src/rules/A8-4-11/SmartPointerAsParameterWithoutLifetimeSemantics.ql
- [ ] cpp/autosar/src/rules/A8-4-12/UniquePtrPassedToFunctionWithImproperSemantics.ql
- [ ] cpp/autosar/src/rules/A8-4-4/FunctionReturnMultipleValueCondition.ql
- [ ] cpp/autosar/src/rules/A9-3-1/ReturnsNonConstRawPointersOrReferencesToPrivateOrProtectedData.ql
- [ ] cpp/autosar/src/rules/M0-3-2/FunctionErroneousReturnValueNotTested.ql
- [ ] cpp/autosar/src/rules/M3-9-3/UnderlyingBitRepresentationsOfFloatingPointValuesUsed.ql
- [ ] cpp/autosar/src/rules/M5-0-17/PointerSubtractionOnDifferentArrays.ql
- [ ] cpp/autosar/src/rules/M5-2-2/PointerToAVirtualBaseClassCastToAPointer.ql
- [ ] cpp/autosar/src/rules/M9-3-1/ConstMemberFunctionReturnsNonConstPointer.ql
- [ ] cpp/cert/src/rules/CTR52-CPP/GuaranteeGenericCppLibraryFunctionsDoNotOverflow.ql
- [ ] cpp/cert/src/rules/CTR56-CPP/DoNotUsePointerArithmeticOnPolymorphicObjects.ql
- [ ] cpp/cert/src/rules/EXP50-CPP/DoNotDependOnTheOrderOfEvaluationForSideEffectsInFunctionCallsAsFunctionArguments.ql
- [ ] cpp/cert/src/rules/EXP51-CPP/DoNotDeleteAnArrayThroughAPointerOfTheIncorrectType.ql
- [ ] cpp/cert/src/rules/MEM52-CPP/DetectAndHandleMemoryAllocationErrors.ql
- [ ] cpp/cert/src/rules/MEM53-CPP/ManuallyManagedLifetime.qll
- [ ] cpp/cert/src/rules/MEM53-CPP/MissingConstructorCallForManuallyManagedObject.ql
- [ ] cpp/cert/src/rules/MEM53-CPP/MissingDestructorCallForManuallyManagedObject.ql
- [ ] cpp/cert/src/rules/MSC51-CPP/BadlySeededRandomNumberGenerator.ql
- [ ] cpp/common/src/codingstandards/cpp/AccessPath.qll
- [ ] cpp/common/src/codingstandards/cpp/Allocations.qll
- [ ] cpp/common/src/codingstandards/cpp/Concurrency.qll
- [ ] cpp/common/src/codingstandards/cpp/ConstHelpers.qll
- [ ] cpp/common/src/codingstandards/cpp/FgetsErrorManagement.qll
- [ ] cpp/common/src/codingstandards/cpp/Iterators.qll
- [ ] cpp/common/src/codingstandards/cpp/Nullness.qll
- [ ] cpp/common/src/codingstandards/cpp/Overflow.qll
- [ ] cpp/common/src/codingstandards/cpp/ReadErrorsAndEOF.qll
- [ ] cpp/common/src/codingstandards/cpp/SideEffect.qll
- [ ] cpp/common/src/codingstandards/cpp/SmartPointers.qll
- [ ] cpp/common/src/codingstandards/cpp/allocations/PlacementNew.qll
- [ ] cpp/common/src/codingstandards/cpp/lifetimes/lifetimeprofile/LifetimeProfile.qll
- [ ] cpp/common/src/codingstandards/cpp/resources/ResourceManagement.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/accessofnonexistingmemberthroughpointertomember/AccessOfNonExistingMemberThroughPointerToMember.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/accessofundefinedmemberthroughnullpointer/AccessOfUndefinedMemberThroughNullPointer.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/accessofundefinedmemberthroughuninitializedstaticpointer/AccessOfUndefinedMemberThroughUninitializedStaticPointer.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/basicstringmaynotbenullterminated/BasicStringMayNotBeNullTerminated.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/constlikereturnvalue/ConstLikeReturnValue.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/containeraccesswithoutrangecheck/ContainerAccessWithoutRangeCheck.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/danglingcapturewhenmovinglambdaobject/DanglingCaptureWhenMovingLambdaObject.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/danglingcapturewhenreturninglambdaobject/DanglingCaptureWhenReturningLambdaObject.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/donotaccessaclosedfile/DoNotAccessAClosedFile.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/donotallowamutextogooutofscopewhilelocked/DoNotAllowAMutexToGoOutOfScopeWhileLocked.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/donotdestroyamutexwhileitislocked/DoNotDestroyAMutexWhileItIsLocked.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/donotpassaliasedpointertorestrictqualifiedparamshared/DoNotPassAliasedPointerToRestrictQualifiedParamShared.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/donotsubtractpointersaddressingdifferentarrays/DoNotSubtractPointersAddressingDifferentArrays.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/donotusepointerarithmetictoaddressdifferentarrays/DoNotUsePointerArithmeticToAddressDifferentArrays.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/donotuserelationaloperatorswithdifferingarrays/DoNotUseRelationalOperatorsWithDifferingArrays.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/invalidatedenvstringpointers/InvalidatedEnvStringPointers.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/invalidatedenvstringpointerswarn/InvalidatedEnvStringPointersWarn.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/iofstreammissingpositioning/IOFstreamMissingPositioning.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/movedfromobjectsunspecifiedstate/MovedFromObjectsUnspecifiedState.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/nonconstantformat/NonConstantFormat.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/onlyfreememoryallocateddynamicallyshared/OnlyFreeMemoryAllocatedDynamicallyShared.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/ownedpointervaluestoredinunrelatedsmartpointer/OwnedPointerValueStoredInUnrelatedSmartPointer.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/placementnewinsufficientstorage/PlacementNewInsufficientStorage.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/placementnewnotproperlyaligned/PlacementNewNotProperlyAligned.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/stringnumberconversionmissingerrorcheck/StringNumberConversionMissingErrorCheck.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/throwingoperatornewreturnsnull/ThrowingOperatorNewReturnsNull.qll
- [ ] cpp/common/src/codingstandards/cpp/rules/useonlyarrayindexingforpointerarithmetic/UseOnlyArrayIndexingForPointerArithmetic.qll
- [ ] cpp/common/src/codingstandards/cpp/standardlibrary/FileStreams.qll
- [ ] cpp/common/src/codingstandards/cpp/trustboundary/UninitializedField.qll
- [ ] cpp/common/test/deviations/deviation_permits_basic_test/UnusedReturnValue.ql
- [ ] cpp/common/test/deviations/deviations_basic_test/UnusedReturnValue.ql
- [ ] cpp/common/test/deviations/deviations_report_deviated/UnusedReturnValue.ql
Change request type
- [ ] Release or process automation (GitHub workflows, internal scripts)
- [ ] Internal documentation
- [ ] External documentation
- [ ] Query files (
.ql,.qll,.qlsor unit tests) - [ ] External scripts (analysis report or other code shipped as part of a release)
Rules with added or modified queries
- [ ] No rules added
- [ ] Queries have been added for the following rules:
- rule number here
- [ ] Queries have been modified for the following rules:
- rule number here
Release change checklist
A change note (development_handbook.md#change-notes) is required for any pull request which modifies:
- The structure or layout of the release artifacts.
- The evaluation performance (memory, execution time) of an existing query.
- The results of an existing query in any circumstance.
If you are only adding new rule queries, a change note is not required.
Author: Is a change note required?
- [ ] Yes
- [ ] No
🚨🚨🚨 Reviewer: Confirm that format of shared queries (not the .qll file, the .ql file that imports it) is valid by running them within VS Code.
- [ ] Confirmed
Reviewer: Confirm that either a change note is not required or the change note is required and has been added.
- [ ] Confirmed
Query development review checklist
For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:
Author
- [ ] Have all the relevant rule package description files been checked in?
- [ ] Have you verified that the metadata properties of each new query is set appropriately?
- [ ] Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
- [ ] Are the alert messages properly formatted and consistent with the style guide?
- [ ] Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process. - [ ] Does the query have an appropriate level of in-query comments/documentation?
- [ ] Have you considered/identified possible edge cases?
- [ ] Does the query not reinvent features in the standard library?
- [ ] Can the query be simplified further (not golfed!)
Reviewer
- [ ] Have all the relevant rule package description files been checked in?
- [ ] Have you verified that the metadata properties of each new query is set appropriately?
- [ ] Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
- [ ] Are the alert messages properly formatted and consistent with the style guide?
- [ ] Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process. - [ ] Does the query have an appropriate level of in-query comments/documentation?
- [ ] Have you considered/identified possible edge cases?
- [ ] Does the query not reinvent features in the standard library?
- [ ] Can the query be simplified further (not golfed!)