aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md191
1 files changed, 105 insertions, 86 deletions
diff --git a/README.md b/README.md
index b9d55a26..232d629e 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-clazy v1.3
+clazy v1.4
===========
clazy is a compiler plugin which allows clang to understand Qt semantics. You get more than 50 Qt related compiler warnings, ranging from unneeded memory allocations to misusage of API, including fix-its for automatic refactoring.
@@ -13,7 +13,7 @@ Table of contents
* [Build and install clang](#build-and-install-clang)
* [Build clazy](#build-clazy)
* [Windows](#windows)
- * [Pre-built msvc2015 clang and clazy binaries](#pre-built-msvc2015-clang-and-clazy-binaries)
+ * [3rdparty pre-built msvc2015 clang and clazy binaries](#3rdparty-pre-built-msvc2015-clang-and-clazy-binaries)
* [Build and install clang](#build-and-install-clang-1)
* [Build clazy](#build-clazy-1)
* [macOS with MacPorts](#macos-with-macports)
@@ -27,7 +27,7 @@ Table of contents
* [Selecting which checks to enable](#selecting-which-checks-to-enable)
* [Example via env variable](#example-via-env-variable)
* [Example via compiler argument](#example-via-compiler-argument)
- * [clang-standalone and JSON database support](#clang-standalone-and-json-database-support)
+ * [clazy-standalone and JSON database support](#clazy-standalone-and-json-database-support)
* [Enabling Fixits](#enabling-fixits)
* [Troubleshooting](#troubleshooting)
* [Qt4 compatibility mode](#qt4-compatibility-mode)
@@ -55,8 +55,8 @@ You can get clazy from:
- Other distros: Check llvm/clang build docs.
### Build and install clang
-clang and LLVM >= 3.8 are required.
-Use clazy v1.1 if you need 3.7 support.
+clang and LLVM >= 3.9 are required.
+Use clazy v1.1 if you need 3.7 support, or v1.3 for 3.8 support.
If your distro provides clang then you can skip this step.
@@ -142,13 +142,13 @@ $ sudo port select --set clang mp-clang-3.9
The recommended way is to build clazy yourself, but alternatively you can try user recipes, such as:
```
-$ brew install haraldf/kf5/clazy
+$ brew install kde-mac/kde/clazy
```
for stable branch, or for master:
```
-$ brew install haraldf/kf5/clazy --HEAD
+$ brew install kde-mac/kde/clazy --HEAD
```
As these are not verified or tested by the clazy developers please don't report bugs to us.
@@ -173,7 +173,7 @@ $ brew install --with-clang llvm
# Setting up your project to build with clazy
Note: Wherever `clazy` it mentioned, replace with `clazy-cl.bat` if you're on Windows.
-Note: If you prefer running clazy over a JSON compilation database instead of using it as a plugin, jump to [clazy-standalone](#clang-standalone-and-json-database-support).
+Note: If you prefer running clazy over a JSON compilation database instead of using it as a plugin, jump to [clazy-standalone](#clazy-standalone-and-json-database-support).
You should now have the clazy command available to you, in `<prefix>/bin/`.
Compile your programs with it instead of clang++/g++.
@@ -205,83 +205,100 @@ Read on if you want to enable/disable which checks are run.
# List of checks
There are many checks and they are divided in levels:
-- level0: Very stable checks, 99.99% safe, no false-positives
-- level1: Similar to level0, but sometimes (rarely) there might be some false-positives
-- level2: Sometimes has false-positives (20-30%).
-- level3: Not always correct, possibly very noisy, might require a knowledgeable developer to review, might have a very big rate of false-positives, might have bugs.
+- level0: Very stable checks, 99.99% safe, mostly no false-positives, very desirable
+- level1: The default level. Very similar to level 0, slightly more false-positives but very few.
+- level2: Also very few false-positives, but contains noisy checks which not everyone agree should be default.
+- level3: Contains checks with high rate of false-positives.
+- manual: Checks here need to be enabled explicitly, as they don't belong to any level. Checks here are very stable and have very few false-positives.
clazy runs all checks from level1 by default.
-- Checks from level0:
- - [connect-non-signal](src/checks/level0/README-connect-non-signal.md)
- - [connect-not-normalized](src/checks/level0/README-connect-not-normalized.md)
- - [container-anti-pattern](src/checks/level0/README-container-anti-pattern.md)
- - [lambda-in-connect](src/checks/level0/README-lambda-in-connect.md)
- - [lambda-unique-connection](src/checks/level0/README-lambda-unique-connection.md)
- - [mutable-container-key](src/checks/level0/README-mutable-container-key.md)
- - [qcolor-from-literal](src/checks/level0/README-qcolor-from-literal.md)
- - [qdatetime-utc](src/checks/level0/README-qdatetime-utc.md) (fix-qdatetime-utc)
- - [qenums](src/checks/level0/README-qenums.md)
- - [qfileinfo-exists](src/checks/level0/README-qfileinfo-exists.md)
- - [qgetenv](src/checks/level0/README-qgetenv.md) (fix-qgetenv)
- - [qmap-with-pointer-key](src/checks/level0/README-qmap-with-pointer-key.md)
- - [qstring-arg](src/checks/level0/README-qstring-arg.md)
- - [qstring-insensitive-allocation](src/checks/level0/README-qstring-insensitive-allocation.md)
- - [qstring-ref](src/checks/level0/README-qstring-ref.md) (fix-missing-qstringref)
- - [qt-macros](src/checks/level0/README-qt-macros.md)
- - [qvariant-template-instantiation](src/checks/level0/README-qvariant-template-instantiation.md)
- - [strict-iterators](src/checks/level0/README-strict-iterators.md)
- - [temporary-iterator](src/checks/level0/README-temporary-iterator.md)
- - [unused-non-trivial-variable](src/checks/level0/README-unused-non-trivial-variable.md)
- - [writing-to-temporary](src/checks/level0/README-writing-to-temporary.md)
- - [wrong-qglobalstatic](src/checks/level0/README-wrong-qglobalstatic.md)
-
-- Checks from level1:
- - [auto-unexpected-qstringbuilder](src/checks/level1/README-auto-unexpected-qstringbuilder.md) (fix-auto-unexpected-qstringbuilder)
- - [child-event-qobject-cast](src/checks/level1/README-child-event-qobject-cast.md)
- - [connect-3arg-lambda](src/checks/level1/README-connect-3arg-lambda.md)
- - [const-signal-or-slot](src/checks/level1/README-const-signal-or-slot.md)
- - [detaching-temporary](src/checks/level1/README-detaching-temporary.md)
- - [foreach](src/checks/level1/README-foreach.md)
- - [incorrect-emit](src/checks/level1/README-incorrect-emit.md)
- - [inefficient-qlist-soft](src/checks/level1/README-inefficient-qlist-soft.md)
- - [install-event-filter](src/checks/level1/README-install-event-filter.md)
- - [non-pod-global-static](src/checks/level1/README-non-pod-global-static.md)
- - [overridden-signal](src/checks/level1/README-overridden-signal.md)
- - [post-event](src/checks/level1/README-post-event.md)
- - [qdeleteall](src/checks/level1/README-qdeleteall.md)
- - [qhash-namespace](src/checks/level1/README-qhash-namespace.md)
- - [qlatin1string-non-ascii](src/checks/level1/README-qlatin1string-non-ascii.md)
- - [qproperty-without-notify](src/checks/level1/README-qproperty-without-notify.md)
- - [qstring-left](src/checks/level1/README-qstring-left.md)
- - [range-loop](src/checks/level1/README-range-loop.md)
- - [returning-data-from-temporary](src/checks/level1/README-returning-data-from-temporary.md)
- - [rule-of-two-soft](src/checks/level1/README-rule-of-two-soft.md)
- - [virtual-signal](src/checks/level1/README-virtual-signal.md)
-
-- Checks from level2:
- - [base-class-event](src/checks/level2/README-base-class-event.md)
- - [container-inside-loop](src/checks/level2/README-container-inside-loop.md)
- - [copyable-polymorphic](src/checks/level2/README-copyable-polymorphic.md)
- - [ctor-missing-parent-argument](src/checks/level2/README-ctor-missing-parent-argument.md)
- - [function-args-by-ref](src/checks/level2/README-function-args-by-ref.md)
- - [function-args-by-value](src/checks/level2/README-function-args-by-value.md)
- - [global-const-char-pointer](src/checks/level2/README-global-const-char-pointer.md)
- - [implicit-casts](src/checks/level2/README-implicit-casts.md)
- - [missing-qobject-macro](src/checks/level2/README-missing-qobject-macro.md)
- - [missing-typeinfo](src/checks/level2/README-missing-typeinfo.md)
- - [old-style-connect](src/checks/level2/README-old-style-connect.md) (fix-old-style-connect)
- - [qstring-allocations](src/checks/level2/README-qstring-allocations.md) (fix-qlatin1string-allocations,fix-fromLatin1_fromUtf8-allocations,fix-fromCharPtrAllocations)
- - [reserve-candidates](src/checks/level2/README-reserve-candidates.md)
- - [returning-void-expression](src/checks/level2/README-returning-void-expression.md)
- - [rule-of-three](src/checks/level2/README-rule-of-three.md)
- - [virtual-call-ctor](src/checks/level2/README-virtual-call-ctor.md)
-
-- Checks from level3:
- - [assert-with-side-effects](src/checks/level3/README-assert-with-side-effects.md)
- - [bogus-dynamic-cast](src/checks/level3/README-bogus-dynamic-cast.md)
- - [detaching-member](src/checks/level3/README-detaching-member.md)
- - [thread-with-slots](src/checks/level3/README-thread-with-slots.md)
+- Checks from Manual Level:
+ - [container-inside-loop](docs/checks/README-container-inside-loop.md)
+ - [inefficient-qlist](docs/checks/README-inefficient-qlist.md)
+ - [isempty-vs-count](docs/checks/README-isempty-vs-count.md)
+ - [qhash-with-char-pointer-key](docs/checks/README-qhash-with-char-pointer-key.md)
+ - [qstring-varargs](docs/checks/README-qstring-varargs.md)
+ - [qt-keywords](docs/checks/README-qt-keywords.md) (fix-qt-keywords)
+ - [qt4-qstring-from-array](docs/checks/README-qt4-qstring-from-array.md) (fix-qt4-qstring-from-array)
+ - [raw-environment-function](docs/checks/README-raw-environment-function.md)
+ - [tr-non-literal](docs/checks/README-tr-non-literal.md)
+
+- Checks from Level 0:
+ - [connect-by-name](docs/checks/README-connect-by-name.md)
+ - [connect-non-signal](docs/checks/README-connect-non-signal.md)
+ - [connect-not-normalized](docs/checks/README-connect-not-normalized.md)
+ - [container-anti-pattern](docs/checks/README-container-anti-pattern.md)
+ - [empty-qstringliteral](docs/checks/README-empty-qstringliteral.md)
+ - [fully-qualified-moc-types](docs/checks/README-fully-qualified-moc-types.md)
+ - [lambda-in-connect](docs/checks/README-lambda-in-connect.md)
+ - [lambda-unique-connection](docs/checks/README-lambda-unique-connection.md)
+ - [mutable-container-key](docs/checks/README-mutable-container-key.md)
+ - [qcolor-from-literal](docs/checks/README-qcolor-from-literal.md)
+ - [qdatetime-utc](docs/checks/README-qdatetime-utc.md) (fix-qdatetime-utc)
+ - [qenums](docs/checks/README-qenums.md)
+ - [qfileinfo-exists](docs/checks/README-qfileinfo-exists.md)
+ - [qgetenv](docs/checks/README-qgetenv.md) (fix-qgetenv)
+ - [qmap-with-pointer-key](docs/checks/README-qmap-with-pointer-key.md)
+ - [qstring-arg](docs/checks/README-qstring-arg.md)
+ - [qstring-insensitive-allocation](docs/checks/README-qstring-insensitive-allocation.md)
+ - [qstring-ref](docs/checks/README-qstring-ref.md) (fix-missing-qstringref)
+ - [qt-macros](docs/checks/README-qt-macros.md)
+ - [qvariant-template-instantiation](docs/checks/README-qvariant-template-instantiation.md)
+ - [strict-iterators](docs/checks/README-strict-iterators.md)
+ - [temporary-iterator](docs/checks/README-temporary-iterator.md)
+ - [unused-non-trivial-variable](docs/checks/README-unused-non-trivial-variable.md)
+ - [writing-to-temporary](docs/checks/README-writing-to-temporary.md)
+ - [wrong-qevent-cast](docs/checks/README-wrong-qevent-cast.md)
+ - [wrong-qglobalstatic](docs/checks/README-wrong-qglobalstatic.md)
+
+- Checks from Level 1:
+ - [auto-unexpected-qstringbuilder](docs/checks/README-auto-unexpected-qstringbuilder.md) (fix-auto-unexpected-qstringbuilder)
+ - [child-event-qobject-cast](docs/checks/README-child-event-qobject-cast.md)
+ - [connect-3arg-lambda](docs/checks/README-connect-3arg-lambda.md)
+ - [const-signal-or-slot](docs/checks/README-const-signal-or-slot.md)
+ - [detaching-temporary](docs/checks/README-detaching-temporary.md)
+ - [foreach](docs/checks/README-foreach.md)
+ - [incorrect-emit](docs/checks/README-incorrect-emit.md)
+ - [inefficient-qlist-soft](docs/checks/README-inefficient-qlist-soft.md)
+ - [install-event-filter](docs/checks/README-install-event-filter.md)
+ - [non-pod-global-static](docs/checks/README-non-pod-global-static.md)
+ - [overridden-signal](docs/checks/README-overridden-signal.md)
+ - [post-event](docs/checks/README-post-event.md)
+ - [qdeleteall](docs/checks/README-qdeleteall.md)
+ - [qhash-namespace](docs/checks/README-qhash-namespace.md)
+ - [qlatin1string-non-ascii](docs/checks/README-qlatin1string-non-ascii.md)
+ - [qproperty-without-notify](docs/checks/README-qproperty-without-notify.md)
+ - [qstring-left](docs/checks/README-qstring-left.md)
+ - [range-loop](docs/checks/README-range-loop.md)
+ - [returning-data-from-temporary](docs/checks/README-returning-data-from-temporary.md)
+ - [rule-of-two-soft](docs/checks/README-rule-of-two-soft.md)
+ - [skipped-base-method](docs/checks/README-skipped-base-method.md)
+ - [virtual-signal](docs/checks/README-virtual-signal.md)
+
+- Checks from Level 2:
+ - [base-class-event](docs/checks/README-base-class-event.md)
+ - [copyable-polymorphic](docs/checks/README-copyable-polymorphic.md)
+ - [ctor-missing-parent-argument](docs/checks/README-ctor-missing-parent-argument.md)
+ - [function-args-by-ref](docs/checks/README-function-args-by-ref.md)
+ - [function-args-by-value](docs/checks/README-function-args-by-value.md)
+ - [global-const-char-pointer](docs/checks/README-global-const-char-pointer.md)
+ - [implicit-casts](docs/checks/README-implicit-casts.md)
+ - [missing-qobject-macro](docs/checks/README-missing-qobject-macro.md)
+ - [missing-typeinfo](docs/checks/README-missing-typeinfo.md)
+ - [old-style-connect](docs/checks/README-old-style-connect.md) (fix-old-style-connect)
+ - [qstring-allocations](docs/checks/README-qstring-allocations.md) (fix-qlatin1string-allocations,fix-fromLatin1_fromUtf8-allocations,fix-fromCharPtrAllocations)
+ - [returning-void-expression](docs/checks/README-returning-void-expression.md)
+ - [rule-of-three](docs/checks/README-rule-of-three.md)
+ - [static-pmf](docs/checks/README-static-pmf.md)
+ - [virtual-call-ctor](docs/checks/README-virtual-call-ctor.md)
+
+- Checks from Level 3:
+ - [assert-with-side-effects](docs/checks/README-assert-with-side-effects.md)
+ - [detaching-member](docs/checks/README-detaching-member.md)
+ - [reserve-candidates](docs/checks/README-reserve-candidates.md)
+ - [thread-with-slots](docs/checks/README-thread-with-slots.md)
+ - [unneeded-cast](docs/checks/README-unneeded-cast.md)
# Selecting which checks to enable
@@ -292,7 +309,7 @@ You can disable checks by prefixing with `no-`, in case you don't want all check
## Example via env variable
```
-export CLAZY_CHECKS="bogus-dynamic-cast,qmap-with-key-pointer,virtual-call-ctor" # Enables only these 3 checks
+export CLAZY_CHECKS="unneeded-cast,qmap-with-key-pointer,virtual-call-ctor" # Enables only these 3 checks
export CLAZY_CHECKS="level0,no-qenums" # Enables all checks from level0, except for qenums
export CLAZY_CHECKS="level0,detaching-temporary" # Enables all from level0 and also detaching-temporary
```
@@ -300,7 +317,7 @@ export CLAZY_CHECKS="level0,detaching-temporary" # Enables all from level0 and a
`clazy -Xclang -plugin-arg-clang-lazy -Xclang level0,detaching-temporary`
Don't forget to re-run cmake/qmake/etc if you altered the c++ flags to specify flags.
-# clang-standalone and JSON database support
+# clazy-standalone and JSON database support
The `clazy-standalone` binary allows you to run clazy over a compilation database JSON file, in the same
way you would use `clang-tidy` or other clang tooling. This way you don't need to build your application,
@@ -391,10 +408,12 @@ and rebuild.
# Reducing warning noise
-If you think you found a false-positive, file a bug report.
+If you think you found a false-positive, file a bug report. But do make sure to test first without icecc/distcc enabled.
If you want to suppress warnings from headers of Qt or 3rd party code, include them with `-isystem` instead of `-I`.
+Alternatively you can set the CLAZY_HEADER_FILTER env variable to a regexp matching the path where you want warnings.
+
You can also suppress individual warnings by file or by line by inserting comments:
- To disable clazy in a specific source file, insert this comment, anywhere in the file:
@@ -438,7 +457,7 @@ and thanks to:
# Contributing patches
-New features go to master and bug fixes go to 1.3 branch.
+New features go to master and bug fixes go to the 1.4 branch.
The prefered way to contributing is by using KDE's phabricator, see:
- <https://community.kde.org/Infrastructure/Phabricator>
- <https://phabricator.kde.org/differential/>