Skip to content

[clang-tidy] Move dedicated cert checks to other modules #157287

@vbvictor

Description

@vbvictor

The main goal is to move all implementations of checks in cert module into bugprone or other modules. (This is already done in the majority of cert checks)
Currently, there is a number of cert checks that are only contained in cert module:

#include "CommandProcessorCheck.h"
#include "DefaultOperatorNewAlignmentCheck.h"
#include "DontModifyStdNamespaceCheck.h"
#include "FloatLoopCounter.h"
#include "LimitedRandomnessCheck.h"
#include "MutatingCopyCheck.h"
#include "NonTrivialTypesLibcMemoryCallsCheck.h"
#include "ProperlySeededRandomGeneratorCheck.h"
#include "SetLongJmpCheck.h"
#include "StaticObjectExceptionCheck.h"
#include "StrToNumCheck.h"
#include "ThrownExceptionTypeCheck.h"
#include "VariadicFunctionDefCheck.h"

This is problematic because the user will be faced with meaningless names like this:

CheckFactories.registerCheck<FloatLoopCounter>("cert-flp30-c");

It's hard for the user to understand what cert-flp30-c means, so we should always have human-readable alternative to cert checks.
This is achieved by first creating a check in buprone or any other module and then making an alias to cert like this:

CheckFactories.registerCheck<bugprone::SuspiciousMemoryComparisonCheck>(
"cert-flp37-c");

Essentially, this renaming can give "free checks" because people tend to just disable cert checks, despite most of them are regular bugprone checks that can give benefits for everyone.

As an example of how this renaming can be done, please see #157285.

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions