1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "CharPtrCast.hh"
#include "DisallowedDecls.hh"
#include "ForbiddenIncludes.hh"
#include "ForeignExceptions.hh"
#include "HasPrefixSuffix.hh"
#include "NeverAsync.hh"
#include "UnsafeCCalls.hh"
#include <clang-tidy/ClangTidyModule.h>
#include <clang-tidy/ClangTidyModuleRegistry.h>

namespace nix::clang_tidy {
using namespace clang;
using namespace clang::tidy;

class NixClangTidyChecks : public ClangTidyModule {
    public:
        void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
            CheckFactories.registerCheck<HasPrefixSuffixCheck>("lix-hasprefixsuffix");
            CheckFactories.registerCheck<CharPtrCastCheck>("lix-charptrcast");
            CheckFactories.registerCheck<NeverAsync>("lix-never-async");
            CheckFactories.registerCheck<DisallowedDeclsCheck>("lix-disallowed-decls");
            CheckFactories.registerCheck<ForeignExceptions>("lix-foreign-exceptions");
            CheckFactories.registerCheck<UnsafeCCalls>("lix-unsafe-c-calls");
            CheckFactories.registerCheck<ForbiddenIncludesCheck>(
                "lix-forbidden-includes");
        }
};

static ClangTidyModuleRegistry::Add<NixClangTidyChecks> X("lix-module", "Adds lix specific checks");
};