Commit Graph

14 Commits

Author SHA1 Message Date
Maximilian Goldstein 1257890f2c quicklintplugin: Use std::array instead of an initializer list
Just to make codechecker happy.

Change-Id: I1abebee11cbf2207ffed88fdfebccd797ebdca07
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-17 16:38:17 +02:00
Maximilian Goldstein 2ebee301fd Reimplement PropertyPass to evaluate bindings
This change reimplements the PropertyPass to be based on bindings
rather than on just iterating over elements. This is a lot less
cost intensive than iterating over all properties regardless of
whether they are actually used. You may still achieve the same
thing with the more flexible element pass, just with the benefit
that you can choose what properties you want to iterate over
instead of iterating over all of them.

To demonstrate the passes usefulness the existing attached property
warnings are ported to use the binding pass and can now also warn
when an attached property is read or written in a context where
it's not supposed to be used.

Fixes: QTBUG-102860
Fixes: QTBUG-102418
Task-number: QTBUG-102859
Change-Id: Iea87a1b05b954429b8bf00fd27b60487940af679
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-16 18:22:45 +02:00
Maximilian Goldstein 78483744b4 QmlLintQuickPlugin: Warn about various SwipeDelegate issues
Implements anchor related and back/left/behind combination warnings.

Also adds a quality-of-life improvement in tst_qmllint where we print the
line when an expected message is missing.

Task-number: QTBUG-102277
Task-number: QTBUG-102859
Change-Id: I56068c75e3c6187845b079a6689debefa363a5e4
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-05-12 17:36:12 +02:00
Marc Mutz c9eebd2f0e Re-run includemocs (new script version)
Task-number: QTBUG-102948
Pick-to: 6.3 6.2 5.15
Change-Id: I5684ead7b19aa3e4afd2cca8f0662a01cedb2785
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-05-05 11:10:39 +02:00
Marc Mutz d9223459a3 Add more missing QT_{BEGIN,END}_NAMESPACE
Found by the includemoc script complaining.

Task-number: QTBUG-102948
Pick-to: 6.3 6.2 5.15
Change-Id: Ie3c133c7c44c0617c54bc821da7ea992328d0d03
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-05-04 22:34:16 +02:00
Maximilian Goldstein ee30dd815e qmllint: Warn about invalid anchor combinations across components
Previously we only warned when a component we were linting contained all
of the anchor properties causing a conflict. Now we also warn if the
combination is created across multiple components or files.

Also makes QQmlJSMetaPropertyBinding record undefined literals as they are
needed to tell whether a property has been reset somewhere in a type.

Task-number: QTBUG-102859
Change-Id: I04012848d0526cce6aea34036c6b2e0daf79cf9d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-03 15:25:11 +02:00
Volker Hilsheimer b181c4d988 Fix build, silence compiler warnings
We cannot iterate over the structured binding result of asKeyValueRange
by reference.

Change-Id: Icecc93a5e39261dd708dcc7f01f5710cc5f81c1f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-05-02 16:45:14 +02:00
Sona Kurazyan 2c9c1590e6 Replace uses of deprecated _qs with _s/QStringLiteral
Task-number: QTBUG-101408
Change-Id: Ic925751b73f52d8fa5add5cacc52d6dd6ea2dc27
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-04-29 09:47:43 +02:00
Maximilian Goldstein 7dd6fbb51a QmlLintQuickPlugin: Remove redundant anchors null warning
Previously we warned when an anchor was null again after already
displaying a generic warning about a type mismatch. This is redundant,
so let's stick with the generic one.

Change-Id: I8f43d279b712d728dc154f48286b8d5c0dac9976
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-04-28 15:55:03 +02:00
Maximilian Goldstein 3265013769 QmlLintQuickPlugin: Warn about attached types used in wrong elements
The engine will warn when various attached types are used in elements
where they are not supported.

This patch replicates this behavior in qmllint with the exception that
we cannot handle them being used in bindings right now.

Task-number: QTBUG-102277
Task-number: QTBUG-102859
Change-Id: Ic41c9338d8625c5185dbd658cc8987f3c00f18c3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2022-04-27 15:29:24 +02:00
Maximilian Goldstein 4b3e99b9a2 QmlLintQuickPlugin: Warn about disallowed positioning properties
When using Grid and Flow, children are not supposed to use anchors or
the x and y property. The same applies to the children of Layouts which
in addition should not set width or height.

This change adds the warnings when these properties are set improperly.

It also adds tests for the existing warning about the children
of Layout not being allowed to use anchors.

Task-number: QTBUG-102277
Task-number: QTBUG-102859
Change-Id: I83c553569cdba90c8841802090d4ef534583ecb8
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2022-04-27 15:29:24 +02:00
Maximilian Goldstein 6186dab608 QmlLintQuickPlugin: Warn about invalid anchors combinations
Includes more anchors related warnings that get usually get
shown at runtime.

Task-number: QTBUG-96737
Change-Id: I2a72d7fc9b23072f85d20fff558e39311e749e4c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-04-26 12:36:58 +02:00
Maximilian Goldstein 894b8a605e qmllint/Quick: Warn about customizing native QtQuick.Controls styles
Certain properties in native QtQuick.Controls styles may not be
overridden. This patch adds a pass to the Quick qmllint plugin to warn
when a user modifies them.

The pass also uses the fact that these types (except Control) don't
inherit from each other to skip over checking for additional types
once a matching type is found.

Fixes: QTBUG-96737
Task-number: QTBUG-102277
Change-Id: I02f696aae716de45014736651385b6607eed6d15
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-04-21 21:04:01 +02:00
Maximilian Goldstein 324b625f9f Turn the QtQuick qmllint plugin into a proper shared library
Previously it was just a static library that we linked qmllint against
now it's properly installed in the qmllint plugins folder and can be
utilized in the language server as well.

Fixes: QTBUG-102278
Change-Id: I4aec42d1e2ba113237ee5ba148085e69b7251506
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-04-11 14:12:09 +02:00