Skip to content

Clazy

Categories:   Ανάπτυξη
Screenshot of Clazy
Το Clazy είναι ένα πρόσθετο μεταγλωττιστή clang το οποίο στέλνει προειδοποιήσεις σχετικές με τις βέλτιστες πρακτικές σε Qt.
Install on
Linux
This button only works with Discover and other AppStream application stores. You can also use your distribution’s package manager.

Εκδόσεις RSS

1.15 2025-06-12

This release fixes the following bugs:

  • install-event-filter: Fix crash when there is no child at the given depth. BUG: 464372
  • fully-qualified-moc-types: Fix enum/enum class not being evaluated. BUG: 423780
  • Fixed crash in qstring-comparison-to-implicit-char. BUG: 502458
  • Fixed crash when fully-qualified-moc-types encounters signals with expressions like "std::bitset<int(8)>"
  • Fixed crash in qvariant-template-instantiation

This release adds the following features:

  • New checks:
  • readlock-detaching
  • Update minimum Clang/LLVM to 19
  • `clazy-standalone --version` contains git version ( output of `git describe`) if it is not a tagged commit
  • Added missing methods to checks for detaching temporary/member lists or maps
1.14 2025-04-27

Clazy warnings for the following line can be disabled, for example: clazy:exclude-next-line=check1,check2

Support for compilation against Clang 20

increase verbosity of some warning messages

checks `function-args-by-value` and `function-args-by-ref`: add function name and parameter name to warning message

checks `unused-non-trivial-variable` and `non-pod-global-static`: add variable name to warning message

This release adds the following features:

  • New checks:
  • qbytearray-conversion-to-c-style
1.13 2024-12-28

This release adds the following features:

  • New Checks:
  • used-qunused-variable

This release fixes the following bugs:

  • qstring-arg check provides a fix-it
  • Fixed unused-non-trivial-variable to not warn when [[maybe_unused]] set
  • Fixed qstring-arg for upcoming Qt 6.9
  • Fixed fully-qualified-moc-types false positive for const modifiers of generic arguments
  • Silence false positive non-pod-global-static warning for QML module initialization
  • Fix function-args-by-value false positive that would cause compile error
  • in copy constructors, assignment operators and equal checks
  • False positives for `Q_EMIT(someSignal())` are now fixed
1.12 2024-06-30

This release adds the following features:

  • New Checks:
  • qt-keyword-emit
  • sanitize-inline-keyword
1.11 2022-01-21

This release adds the following features:

  • New Checks:
  • use-arrow-operator-instead-of-data
  • use-static-qregularexpression
  • unexpected-flag-enumerator-value
  • Removed inefficient-qlist check (Fixed in Qt6)
1.10 2021-07-20

This release fixes the following bugs:

  • Requires C++17
  • Bugfixes:
  • Fixed a -Wclazy-lambda-in-connect false-positive
  • Fixed crash in copyable-polymorphic when PCH was enabled
1.9 2021-01-10

This release fixes the following bugs:

  • Fixed clazy slowdown introduced in 1.8. I can be up to 4x faster now.
  • range-loop was split in range-loop-detach and range-loop-reference
  • Fixed -Wclazy-connect-non-signal false positives
1.8 2020-11-22

This release adds the following features:

  • New Checks:
  • qt6-qhash-signature
  • qt6-header-fixes
  • qt6-deprecated-api-fixes
  • use-chrono-in-qtimer
  • fixit for missing-qobject-macro
1.7 2020-06-29

This release adds the following features:

  • New Checks:
  • overloaded signal
  • invalid JNI signatures
  • qstring-comparison-to-implicit-char
  • qt6-qlatin1string-to-u
  • heap-allocated-small-trivial-type: less false-positives

This release fixes the following bugs:

  • connect-non-signal: Fix case where it didn't find the pmf
  • qstring-arg warns when using QLatin1String::arg(int), as it casts to QChar

Building clazy itself is 30% faster

1.6 2019-10-12

This release adds the following features:

  • New Checks:
  • heap-allocated-small-trivial-type
  • signal-with-return-value
  • qproperty-type-mismatch, contributed by Jean-Michaël Celerier

Removed level3. Moved all level3 checks to manual level. Doesn't make sense to enable all of them.

Each one must be carefully considered.

Minimum LLVM was bumped to 5.0

Clazy no longer rewrites files directly, to avoid races when parallel invocations change the same header.

Clazy now exports a yaml file with the replacements, to be applied with clang-apply-replacements.

The same way other clang tooling does it.

The way to enable code rewrite is now: -Xclang -plugin-arg-clazy -Xclang export-fixes for clang

or -export-fixes=somefile.yaml for clazy-standalone

All other fixit arguments and fixit env variables were removed

Thanks to Christian Gagneraud for contributing the fixit yaml exporter!

This release fixes the following bugs:

  • Fixed regressions with LLVM 9.0
  • Fixit infrastructure was overhauled
1.5 2019-01-31

This release adds the following features:

  • New Checks:
  • ifndef-define-typo
  • lowercase-qml-type-name
  • qrequiredresult-candidates
  • New Fixits:
  • range-loop now supports adding missing refs or const-ref
  • range-loop now supports adding qAsConst()
  • function-args-by-ref now adding missing refs or const-ref (experimental)
  • Introduced CLAZY_FIXIT_SUFFIX env variable

Removed support for the obscure -DCLAZY_BUILD_UTILS_LIB to simplify the CMakeLists.txt

Renamed the clazy plugin from ClangLazy.so to ClazyPlugin.so

fully-qualified-moc-types now warns for slot/invokable return values too. They need to be fully qualified for QML.

This release fixes the following bug:

  • Fixed a crash (clang assert) in raw-environment-function
1.4 2018-09-23

This release adds the following features:

  • New Checks:
  • connect-by-name
  • skipped-base-method
  • qstring-varargs
  • fully-qualified-moc-types
  • qt-keywords, with fixit included
  • qhash-with-char-pointer-key
  • wrong-qevent-cast
  • static-pmf
  • raw-environment-function
  • empty-qstringliteral
  • auto-unexpected-qstringbuilder now also warns for lambdas returning QStringBuilder

performance optimizations

Added -header-filter=<regex> option to clazy-standalone. Only headers matching the regexp will

have warnings, besides the .cpp file from the translation unit, which is never filtered out.

Added -ignore-dirs=<regex> option to clazy-standalone, and its CLAZY_IGNORE_DIRS env variable equivalent.

Added CLAZY_HEADER_FILTER env variable which adds above functionality to both clazy and clazy-standalone

unused-non-trivial-variable got unused-non-trivial-variable-no-whitelist option

unused-non-trivial-variable got user-blacklist and user-whitelist support

container-inside-loop is now a manual check instead of level2

HiddenLevel was renamed to ManualLevel

connect-3arg-lambda now warns when passing a lambda to QTimer::singleShot() or QMenu::addAction()

without a context object

old-style-connect warns for QMenu::addAction() and QMessageBox::open() too now

1.3 2017-11-26

This release adds the following features:

  • New checks:
  • thread-with-slots
  • connect-3arg-lambda
  • qproperty-without-notify
  • virtual-signal
  • overridden-signal
  • qhash-namespace
  • const-signal-or-slot
  • lambda-unique-connection

missing-qobject-macro is now a level2 check, instead of level1. Because, people can omit Q_OBJECT intentionally.

Added -only-qt option, which will make clazy bailout early on non-Qt files. For this purpose, the definition of a Qt file is whenever -DQT_CORE_LIB is passed, which is usually the case in most build systems.

Added -qt-developer option, when building Qt with clazy it will honour specific guidelines for Qt, which are not many right now but the list will grow.

1.2 2017-07-08

This release adds the following features:

  • New checks:
  • install-event-filter
  • qcolor-from-literal
  • strict-iterators
  • connect-not-normalized

This release fixes the following bugs:

  • clazy-standalone executable. Allows to run clazy against a JSON compilation database instead of as a plugin. clang-tidy doesn't support loading external modules (https://github.com/llvm/llvm-project/issues/32086) so this is a good workaround.
  • qt-compat mode. Allows to disable Qt5 specific checks by passing -Xclang -plugin-arg-clazy -Xclang qt4-compat
  • returning-data-from-temporary now checks for temporary QByteArrays casting to char* when returned
  • returning-data-from-temporary now checks for assignment too, not only return statements
  • unused-non-trivial-variable now warns for unused QList, QVector and many more types
  • ASTMatchers based checks are now supported
  • clang 3.7 was dropped due to ASTMatchers source incompatibilities.
  • Use clazy v1.1 for clang >= 3.6 support
  • clazylib.so no longer gets built by default, only the plugin (ClangLazy.so) gets built. Pass -DCLAZY_BUILD_UTILS_LIB=ON to enable the utils library if you're developing tools using clazy's convenience functions, which you're probably not.
  • CLAZY_INSTALL_NO_HEADERS option was removed. Either install the utils library and headers or nothing at all. By default nothing is installed, except the plugin and man pages.
1.1 2017-02-20

This release adds the following features:

  • macOS and Windows support
  • New checks:
  • child-event-qobject-cast
  • ctor-missing-parent-argument
  • returning-data-from-temporary
  • qt-macros
  • base-class-event
  • connect-non-signal
  • incorrect-emit
  • tr-non-literal
  • Fixes against:
  • clang 4.0
  • Qt 5.9
  • Notes:
  • 60% performance improvement
  • Fixed many false positives
1.0 2016-09-12
0.0.1 2015-06-10
First release