Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QTCreator & Clang-Tidy : configuration file and command line



  • Hi,

    I use Clang-Tidy with QtCreator, I'm very happy with it, integration into QTCreator is very nice :)
    Today I use pre-selected checks but I want to change this point and I would like to have all checks to do from a file.
    I saw in the configuration window that we can use ".clang-tidy config file", but I can't find more information about it. In the documentation :

    "In the Clang-Tidy tab, select Select Checks to select the checks to perform, Use .clang-tidy Config File to read them from a Clang-Tidy configuration file, or Disable to disable them."
    

    How can I provide file path to my QT project ? with a variable ? with qmake configuration ?

    An other point : I would like to launch the clang-tidy test outside QTCreator (I have script to build my apps), is there a simple method to do that ? (I found a script from an other member of this forum, but he doesn't use clang and environment provided with QTCreator)

    Thanks for your help.


  • Lifetime Qt Champion

    Hi @GoblE,

    AFAIK that file has to be put in the root folder of your project.

    Regards



  • Hi @GoblE,
    AFAIK that file has to be put in the root folder of your project.
    Regards

    Ok, You're right, in fact I did a mistake while I tested it. Thanks.

    EDIT : I found documentation with more information about it :

    --config=<string>              -
                                       Specifies a configuration in YAML/JSON format:
                                         -config="{Checks: '*',
                                                   CheckOptions: [{key: x,
                                                                   value: y}]}"
                                       When the value is empty, clang-tidy will
                                       attempt to find a file named .clang-tidy for
                                       each source file in its parent directories.
    

    Unfortunately we can't be able to choose path of this file.

    Last point, have you an idea about this :

    I would like to launch the clang-tidy test outside QTCreator (I have script to build my apps), is there a simple method to do that ? (I found a script from an other member of this forum, but he doesn't use clang and environment provided with QTCreator)
    

    Thanks for your help.


Log in to reply