Net Possibility Multiplier

    cmake_check

    0.2.0 • Public • Published

    NPM

    Build status Known Vulnerabilities

    cmake_check

    Cmake_check is a linter for the CMake language. It takes a set of user-defined rules and reports violations for CMakeLists.txt files and CMake modules.

    Quick Start ▲

    Step 1: Download cmake_check (several methods, see below).

    Step 2: Open a terminal (cmd.exe on Windows).

    Step 3: Invoke cmake_check to check your CMake files or directories. The executable name differs depending on whether you use the development source version (cmake_check), a Windows executable (cake_check-win.exe) or , a Linux executable (cmake-check-linux). On this page, cmake_check is the generic term used to refer to any of these.

    a file

    prompt> cmake_heck -c config.json -i CMakeLists.txt -v
    info: Checking CMakeLists.txt
    CMakeLists(10).txt (66) : warning Whitelist: calls to some_custom_function are not allowed by whitelist
    info: Checked 1 files
    info: 0 files are clean
    info: 1 files have 2 warnings
    info: 0 files are ignored
    info: took {"durationMs":28}
    

    a directory

    prompt> cmake_heck -c config.json -i project_folder -v
    info: Checking files in project_folder
    project_folder/libFoo/CMakeLists.txt (66) : warning Whitelist: calls to some_custom_function are not allowed by whitelist
    project_folder/libBar/CMakeLists.txt (50) : warning Whitelist: calls to some_other_custom_function are not allowed by whitelist
    ...
    info: Checked 769 files
    info: 186 files are clean
    info: 583 files have 1566 warnings
    info: 0 files are ignored
    info: took {"durationMs":2270}
    

    Overview ▲

    Cmake_check is a linter for the CMake language. It takes a set of user-defined rules and reports violations for CMakeLists.txt files and CMake modules. CMake_check is a command line application suitable for continuous integration checks. This is especially useful for large source trees with hundreds of CMake files. Cmake_check can be used to enforce a certain coding style or project/company guidelines. It is written in TypeScript and runs on every platform where node.js is available.

    Features are:

    • recursive check of all CMake files in a given directory
    • allows combination of checks to form custom rules
    • a rule may consist of any number of checks
    • provides warning output (msbuild format) that can be used by the jenkins warnings plugin

    Available checks:

    • require commands to exist (or not exist)
    • allow white-listed commands only (to limit the use of custom functions)

    Planned checks:

    • require a specific command order
    • constraints on specific command arguments
    • constraints on paths (e.g. no ..)
    • comment checks
    • maximum line length
    • indentation checks

    Binaries ▲

    Each release comes with a set of Linux and Windows binaries.

    NPM ▲

    Install NodeJS (version > 8.11).

    npm install -g cmake_check`

    Versioning ▲

    Cmake_check uses semantic versioning.

    Basic Usage ▲

    The basic use is:

    cmake_check -c <config file> -i <input folder or file>

    All CMake files in the given input folders are analyzed with the given configuration. All warnings are written to stdout.

    For more information and further available options call cmake_check -h.

    Configuration ▲

    An example configuration is available. It describes some of the modern CMake rules.

    Documentation for all config options is under construction.

    How It Works ▲

    Cmake_check uses a parser-generator and a grammar to create a parser of the CMake language. All CMakeLists.txt files from input are parsed to a structured object. All configured checks are executed on that object. Failed checks are printed as warnings.

    Limitations

    • the language parser will fail on CMakeLists.txt files that do not conform to the CMake language
      • these errors are reported by CMake itself, a successful run of CMake on the input files is a precondition for cmake_check

    Features under development ▲

    See the development board for issues that are in work.

    Install

    npm i cmake_check

    DownloadsWeekly Downloads

    12

    Version

    0.2.0

    License

    MIT

    Unpacked Size

    65.2 kB

    Total Files

    31

    Last publish

    Collaborators

    • dael