Commit Graph

13 Commits

Author SHA1 Message Date
Evgeniy A. Dushistov a29eb1c152 qmllint: fix import java scripts from module
Fixes: QTBUG-86183
Change-Id: I4809cb5a408eb4e668f802cf0d7b7a872d1ed4b7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-08-22 15:36:44 +03:00
Ulf Hermann ddcd24a345 Improve the QML/JS type reader
Don't alternate between paths and URIs if we only need the URIs, and
don't rely on casting from ASCII to QString or QChar.

Change-Id: I4c206d5ff488939d5d2d78a3694d8eaf54ec5ec1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-08-20 11:55:48 +02:00
Evgeniy A. Dushistov 69be96b978 qmllint: handle signals defined in qml file
FindWarningVisitor for signal add property "signal" + "Changed",
so it was impossible find "singal" and "onSingal" names.

Fixes: QTBUG-83793
Change-Id: I5a62211f413f543fdb6bf00e0ab921561d7a9643
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-08-19 10:09:30 +03:00
Ulf Hermann 9a79791e79 Move functionality to read types from QML files out of qmllint
We want to re-use this in other tools.

Change-Id: I2a8cd104d54c1fa9b2898213b0b9e09719e42bca
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-08-13 14:00:59 +02:00
Ulf Hermann 437b04e6ec qmllint: Properly process qmldir imports and dependencies
We don't want to pick the dependencies from the qmltypes files. Rather,
parse them directly from the qmldir. Do process versions, too.

Also, import explicitly given qmltypes files only once, and don't expose
QML types from dependencies as actual types. Hide them behind an
inaccessible prefix.

For the inaccessible prefix to work, we need to import the C++ class
names without the prefix. The prefix doesn't make sense for C++ names
anyway.

In addition, properly process version-less imports.

Change-Id: If582ad271db35351d219332c319571a814628fe0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-06-24 18:28:20 +02:00
Ulf Hermann 36df81b3bc Discern between "auto" and versioned imports in qmldirs
You can now import the latest version, a specific version, or, "auto"
which is the same version as the parent module.

[ChangeLog][QtQml] You can now procedurally add module imports to
modules, using qmlRegisterModuleImport(). However, actual import
statements in qmldir files should be preferred wherever possible.

Fixes: QTBUG-84899
Change-Id: I3b32dd8b07a19d31b6538b9a6bb436840862f345
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-06-24 18:26:14 +02:00
Karsten Heimrich 1b10ce6a08 Port QtDeclarative from QStringRef to QStringView
Task-number: QTBUG-84319
Change-Id: I2dcfb8a2db98282c7a1acdad1e6f4f949f26df15
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-06-16 22:46:16 +02:00
Ulf Hermann 31ee1bc904 Deduplicate the import resolution algorithm
We will need it in various other places, too.

Change-Id: I61c55f88b66ab85448ae8fff125fe34108532fc4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-06-10 17:48:01 +02:00
Ulf Hermann 95ece56efa Fix Clang 10 warning about creating copies in range-for
We should not copy the loop variables.

Fixes: QTBUG-83989
Pick-to: 5.15
Change-Id: Ic94710a2c08aa19656c5e1853c40b10b203bca0e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-05-20 22:40:26 +02:00
Ulf Hermann 36ac9ab322 qmllint: Fix evaluation of type assertions
Previously, type assertions were ignored. The test case didn't fail
because simple type casts were automatically detected when the derived
objects were instantiated and assigned to base type properties.

Pick-to: 5.15
Change-Id: I437e77ff38b7d570451cf27ca84e9897b519413f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-05-20 16:19:27 +02:00
Maximilian Goldstein 45537009a8 Fix qmllint crash
Fixes: QTBUG-83915
Change-Id: I26731ebcec6be46602b6acc7562c65b1c9f3e43a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-05-06 13:58:08 +02:00
Mitch Curtis aa470fa92d qmllint: warn when passing a directory to -i option
It should be a file.

Change-Id: I52f4ebcf8bdd8ddd1fedd66ceffe9a060139c1d9
Fixes: QTBUG-83861
Pick-to: 5.15
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-05-06 13:46:27 +02:00
Maximilian Goldstein ac5c765f29 qmllint: Add flags for toggling warnings
Enables all warnings by default and makes it possible to toggle
individual ones using command line flags.

Change-Id: Ie55f32f646fd9422313977969f9f00b59ee9ad99
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-04-30 18:56:19 +02:00