// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
    \page creator-cppcheck.html
    \previouspage creator-how-tos.html

    \ingroup creator-how-to-analyze

    \title Detect errors in C++ code with Cppcheck

    Enable the experimental Cppcheck plugin to view diagnostics that are
    generated by the Cppcheck tool in the C++ editor.

    Cppcheck is automatically run on open files. To select the files to
    check in the currently active project, go to \uicontrol Analyze >
    \uicontrol Cppcheck.

    \section1 Analyze selected files

    \list 1
        \li Go to \uicontrol Analyze > \uicontrol Cppcheck.
            \image qtcreator-cppcheck-run-configuration.png {Cppcheck run configuration}
        \li In uicontrol Binary, enter the path to the Cppcheck executable file.
        \li In \uicontrol Checks, select the checks to perform.
            \note By default, Cppcheck uses multiple threads to perform checks.
            Select \uicontrol {Unused functions} to turn off the default
            behavior.
        \li In \uicontrol {Custom arguments}, enter additional
            arguments for running Cppcheck. The arguments might be shadowed
            by automatically generated ones. To avoid possible conflicts in
            configuration, select \uicontrol {Show raw output} and check the
            final arguments.
        \li In \uicontrol {Ignored file patterns}, enter a filter
            for ignoring files that match the pattern (wildcard). You can enter
            multiple patterns separated by commas. Even though Cppcheck is not
            run on files that match the patterns, they might be
            implicitly checked if other files include them.
        \li Select \uicontrol {Inconclusive errors} to also mark possible false
            positives.
        \li Select \uicontrol {Check all define combinations} to
            check all define combinations. This can significantly
            slow down analysis, but might help to find more issues.
        \li Select \uicontrol {Add include paths} to pass the
            current project's include paths to Cppcheck. This
            slows down checks on big projects, but can help Cppcheck to find
            missing includes.
        \li Select \uicontrol {Calculate additional arguments} to
            calculate additional arguments based on current project's settings
            (such as the language used and standard version) and pass them to
            Cppcheck.
        \li Select the files to run Cppcheck on.
        \li Select \uicontrol Analyze.
    \endlist

    \QC runs Cppcheck on the selected files and displays results via text
    marks or annotations.

    To specify the settings above for the automatically run checks,
    go to \preferences > \uicontrol Analyzer
    > \uicontrol Cppcheck.

    \sa {Enable and disable plugins}, {Analyze}{How To: Analyze},
    {Analyzing Code}, {Analyzers}
*/
