Skip to content

Latest commit

 

History

History
57 lines (43 loc) · 2.05 KB

README.md

File metadata and controls

57 lines (43 loc) · 2.05 KB

C++lintaur

C++LinTaur is a toy linter that checks name for compliance to Google Style Guide

Overview

This is another one toy tool based on inimitable LLVM and CLang. In my project RecursiveASTVisitor is implemented. It walks through AST and looking for name declarations(which are represented with classes NameDecl, TypeDecl, FunctionDecl, etc). When linter meets an AST node of the type, it checks name of the Node for compliance to Google Style Guide. Surely, this tools does not support that convention completely. In order to lint everething and to refactor whatever, one should look at clang-tidy and clang-format.

Let's build the project. Run the following.

    mkdir -p build/release && cd build/release
    cmake ../.. -DCMAKE_BUILD_TYPE=Release
    cmake --build .

That is it. Now, it is possible to check names in source files. Run the linter in the same directory and then the tool will generate report. As could be expected, there is no any warning in name-checker.cc but there are 26 in example.cc.

    $ ./c++lintaur -p `pwd` ../../example.cc ../../name-checker.cc
    Entity's name "Static_Method" does not meet the requirements (function)
    In example.cc at line 17

    Entity's name "bad_bield" does not meet the requirements (field)
    In example.cc at line 23

    ..............................................................


    Entity's name "fst_var_" does not meet the requirements (variable)
    In example.cc at line 88

    Entity's name "snd_var_" does not meet the requirements (variable)
    In example.cc at line 89

    ===== Processed Stat example.cc =====
    Bad names found: 26
    ===== Processed Stat name-checker.cc =====
    Bad names found: 0

The project has natural requirements which are Clang & LLVM not older then 4.0.0.