Warning, /sdk/clazy/docs/man/clazy.pod is written in an unsupported language. File is not indexed.

0001 =encoding utf8
0002 
0003 =head1 NAME
0004 
0005 clazy - a static source code analyzer for Qt5-based C++.
0006 
0007 =head1 SYNOPSIS
0008 
0009 clazy [option] [clang++-options]
0010 
0011 =head1 DESCRIPTION
0012 
0013 clazy scans C++/Qt source code looking for issues related to good coding practice with of Qt5.
0014 In typical use, during code compilation with clazy you will see any such warnings
0015 printed to the output normally as you would find any compiler warnings.
0016 
0017 clazy has the ability to "fix" the offending code in some cases.  See the B<CLAZY_FIXIT>
0018 environment variable description below for more information.
0019 
0020 =head1 OPTIONS
0021 
0022 =over 4
0023 
0024 =item B<--help>
0025 
0026 Print help message and exit.
0027 
0028 =item B<--version>
0029 
0030 Print version information and exit.
0031 
0032 =item B<--list>
0033 
0034 Print a list of all available checkers, arranged by level.
0035 
0036 =item B<--explain>
0037 
0038 Print explanations for all checkers.
0039 
0040 =item B<--explain> <regexp>
0041 
0042 Print explanations for the checkers matching the specified regular expression.
0043 
0044 =back
0045 
0046 Any of the options above will print the requested information and then exit.
0047 
0048 =over 4
0049 
0050 =item B<--qt4compat>
0051 
0052 This option runs clazy in Qt4 compatibility mode.
0053 Use this when your source code can build with Qt4 and Qt5 in order to easily
0054 suppress issues that cannot be fixed due to the requirement of the Qt4 API.
0055 
0056 This is a convenience option which is identical to directly passing:
0057   "-Xclang -plugin-arg-clazy -Xclang qt4-compat"
0058 
0059 =back
0060 
0061 =over 4
0062 
0063 =item B<--qtdeveloper>
0064 
0065 B<For Qt developers only.>  This option is special for running clazy on Qt itself.
0066 Will result in fewer false positives being reported in Qt code.
0067 
0068 This is a convenience option which is identical to directly passing:
0069   "-Xclang -plugin-arg-clazy -Xclang qt-developer"
0070 
0071 =back
0072 
0073 All other options are passed directly to clang++ and handled from there.
0074 
0075 See the clang manual for a list of the very large set of options available,
0076 but in normal operation you "compile" your code with clazy just as you
0077 would with clang.
0078 
0079 =head1 EXAMPLES
0080 
0081 =over 4
0082 
0083 =item Print a list of all available checkers, arranged by check level:
0084 
0085  % clazy --list
0086 
0087  List of available clazy checkers:
0088 
0089  Checks from level0. Very stable checks, 100% safe, no false-positives:
0090     connect-non-signal
0091     container-anti-pattern
0092     lambda-in-connect
0093     mutable-container-key
0094     qdatetime-utc
0095     qenums
0096     qfileinfo-exists
0097   ....
0098 
0099 =item Compile your CMake project with clazy default checkers:
0100 
0101  % cmake -DCMAKE_CXX_COMPILER=clazy <other_cmake_options>
0102  then make as normal
0103 
0104 =item Compile your CMake project with level2 checks only (non-Windows):
0105 
0106  % export CLAZY_CHECKS="level2"
0107  % cmake -DCMAKE_CXX_COMPILER=clazy <other_cmake_options>
0108  then make as normal
0109 
0110 =item Compile your qmake project with clazy default checkers:
0111 
0112  % qmake -spec linux-clang QMAKE_CXX=clazy <other_qmake_options>
0113  then make as normal
0114 
0115 =back
0116 
0117 =head1 IN-CODE DIRECTIVES
0118 
0119 clazy supports the following list of in-code directives:
0120 
0121 =over 4
0122 
0123 =item clazy:skip
0124 
0125  Exempt an entire file from all checks.
0126  No clazy tests will run on the file.
0127 
0128 =item clazy:excludeall=<name1[,name2,...,nameN]>
0129 
0130  Exempt the entire file from the specified checks.
0131  The clazy checks name1, etc will not be run on this file.
0132 
0133 =item clazy:exclude=<name1[,name2,...,nameN]>
0134 
0135  Exclude individual lines from specific checks.
0136  The clazy checks tests name1, etc. will not be run on the line where
0137  this directive is found.
0138 
0139 =back
0140 
0141 Don't include the 'clazy-' prefix.  For example, to disable the "qstring-allocations"
0142 check, you would write:
0143 
0144     // clazy:exclude=qstring-allocations
0145 
0146 and not
0147 
0148     // clazy:exclude=clazy-qstring-allocations
0149 
0150 Also note that these directives must be C++ style comments; C style comments are ignored.
0151 
0152 =head1 ENVIRONMENT
0153 
0154 B<CLAZY_CHECKS> - a comma-separated list of checkers or check-sets to run.
0155 By default, all checkers from the "level0" and "level1" check-sets will run.
0156 
0157 B<Examples:>
0158 
0159 =over 4
0160 
0161 =item 1. Enables the 2 checkers "unneeded-cast" and "virtual-call-ctor" only:
0162 
0163 % export CLAZY_CHECKS="unneeded-cast,virtual-call-ctor"
0164 
0165 =item 2. Enables all checks from the "level0" check-set, except for "qenums":
0166 
0167 % export CLAZY_CHECKS="level0,no-qenums"
0168 
0169 =item 3. Enables all checks from the "level0" check-set along with the "detaching-temporary" checker:
0170 
0171 % export CLAZY_CHECKS="level0,detaching-temporary"
0172 
0173 =back
0174 
0175 B<CLAZY_FIXIT> - some checkers are able to automatically re-write your source code whenever
0176 it encounters code it can "fix".  Enable this "fixit" feature by setting this variable
0177 to the name of the checker with a "fixit" capability.
0178 
0179 B<Examples:>
0180 
0181 =over 4
0182 
0183 =item 1. Fix qlatin1string allocations:
0184 
0185 % export CLAZY_FIXIT="fix-qlatin1string-allocations"
0186 
0187 =item 2. Fix old-style (simple cases) connect statements:
0188 
0189 % export CLAZY_FIXIT=fix-old-style-connect
0190 
0191 More documentation is provided when running clazy with the B<--explain> command line option.
0192 
0193 Also note that only 1 fixit checker can be run at a time.
0194 
0195 =back
0196 
0197 B<CLAZY_EXTRA_OPTIONS> - some checkers can adapt their behavior depending on the value
0198 of this environment variable.  More documentation is provided when running clazy with
0199 the B<--explain> command line option.
0200 
0201 B<CLAZY_NO_WERROR> - if this is variable is set, clazy will not treat warnings as errors,
0202 even if the -Werror compiler option is specified.  This is useful if you want to use -Werror
0203 only for the regular gcc/clang warnings but not for clazy warnings.
0204 
0205 B<CLAZY_CHECKS_AS_ERRORS> - comma-separated list of checks that will be promoted
0206 to compiler errors. Note that this does not enable the checks specified here.
0207 
0208 B<CLAZY_IGNORE_DIRS> - A regular expression for paths to exclude from processing.
0209 For example:
0210 
0211 % export CLAZY_IGNORE_DIRS=".*my_qt_folder.*"
0212 
0213 =head1 COPYRIGHT AND LICENSE
0214 
0215 Copyright (C) 2015-2017 Klaralvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>
0216 
0217 This library is free software; you can redistribute it and/or
0218 modify it under the terms of the GNU Lesser General Public
0219 License as published by the Free Software Foundation; either
0220 version 2.1 of the License, or (at your option) any later version.
0221 
0222 This library is distributed in the hope that it will be useful,
0223 but WITHOUT ANY WARRANTY; without even the implied warranty of
0224 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0225 Lesser General Public License for more details.
0226 
0227 You should have received a copy of the GNU Lesser General Public
0228 License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0229 
0230 =head1 SEE ALSO
0231 
0232  clang(1)
0233  https://www.kdab.com/use-static-analysis-improve-performance
0234 
0235 =head1 AUTHORS
0236 
0237  Sergio Martins <sergio.martins@kdab.com>
0238  Laurent Montel <laurent.montel@kdab.com>
0239  Allen Winter <allen.winter@kdab.com>
0240  Albert Astals Cid <aacid@kde.org>
0241  Aurélien Gâteau <agateau@kde.org>
0242  Kevin Funk <kevin.funk@kdab.com>
0243  Hannah von Reth <hannah.vonreth@kdab.com>
0244  Volker Krause <volker.krause@kdab.com>
0245  Christian Ehrlicher <Ch.Ehrlicher@gmx.de>
0246  Mathias Hasselmann <mathias.hasselmann@kdab.com>
0247 
0248 =cut