aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmllint
Commit message (Collapse)AuthorAgeFilesLines
* qmllint: Fix false unknown grouped property warningMaximilian Goldstein2021-02-122-0/+8
| | | | | | | | We seem to be checking grouped properties twice by endVisit(UiObjectBinding*) and endVisit(UiObjectDefinition*). So the UiObjectBinding variant is removed here as this gets run before all type information is available. Change-Id: Idfe23869792f787df6109cde3b6bc1d96cce3dc3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Warn about too many or mismatched signal parametersUlf Hermann2021-02-113-0/+33
| | | | | | | | | | It's easy to mess this up when you transform your signal handlers into functions. Task-number: QTBUG-89943 Pick-to: 6.1 Change-Id: If35be2f6828a0e19aada19abb41d8135b0c6ab45 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QML: Warn about variables being used before their declarationUlf Hermann2021-02-112-0/+13
| | | | | | | | | | | | | | | | | | This collides with injected signal parameters. qmlcachegen cannot tell those cases apart. [ChangeLog][QML][Important Behavior Changes] QML warns about JavaScript variables being used before their declaration now. This is almost always a mistake. It is particularly dangerous in the presence of injected signal parameters because qmlcachegen cannot identify a name collision between an injected signal parameter and a variable being used before its declaration. It therefore miscompiles such code. You can turn off the deprecation warning using the "qt.qml.compiler" logging category. Pick-to: 6.1 Task-number: QTBUG-89943 Change-Id: I8a9424ca8c6edd562402fe5c560ba7e8344b5585 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use QLibraryInfo::QmlImportsPath rather than Qml2ImportsPathUlf Hermann2021-02-091-2/+2
| | | | | | | | | The "2" is meaningless and there is a better name available now. Task-number: QTBUG-85064 Change-Id: I65d26b06712ed7dcf2825f16dffaa6060dd86985 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* qmllint: Fix segmentation faultMaximilian Goldstein2021-02-033-0/+22
| | | | | | Pick-to: 6.0 Change-Id: Ie04ad4221b25628687c2575facf90488b83d21bf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Allow for multiple extensions per objectUlf Hermann2021-02-014-0/+50
| | | | | | | | | | | | | | | | | | | Previously, the assumption was that each object could only have a single extension object. As proven by the new qqmllanguage test this is not the case. Each registered object in the type hierarchy can have its own extension. Therefore, adjust the algorithms that generate qmltypes and iterate the extension objects when analyzing them. This leads us to the realization that anonymous types can in fact meaningfully carry extensions and implement interfaces. Adapt qmltyperegistrar accordingly. For the test to compile, however, we need to realize that the class declaring interfaces needs to befriend all potential subclass's QmlInterface structs. Fix that, too. The rabbit hole went deep. Change-Id: Ia451897e927e03b95c3062e829edf1dfcd216613 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Return after importing a scriptUlf Hermann2021-01-263-0/+9
| | | | | | | | If we don't return there, the newly imported script is promptly overwritten by an invalid module. Change-Id: I788a7275e2c190a20c176da35f5c76ac9f6ad02b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Complain if member access check fails for namespaced typesUlf Hermann2021-01-262-0/+9
| | | | | | | | Before, we would prepend the namespace to the name, but then continue right away, never checking the new name. Change-Id: If90db7d33536fb4b549321c2d6b677040605b6f0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlJSTypeReader: Guard against empty JS filesUlf Hermann2021-01-263-0/+10
| | | | | Change-Id: Ie52ce15b7fa960ce84a6d17a21a0e307a38c726e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Fix auto-importing of qmltypes from same directoryUlf Hermann2021-01-213-0/+27
| | | | | | | Fixes: QTBUG-90513 Pick-to: 6.0 Change-Id: Ic39e72d6df20be30c61123a7f8091d70dbc2d924 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Remove exceptions for most unknown builtinsUlf Hermann2021-01-211-0/+2
| | | | | | | | | | | | All those types are properly defined in the qmltypes files now. We just need to search the enumerations the same way as methods and properties in order to find everything. Also, deduplicate the code that resolves properties, methods, and enums by using a common template for iterating the scopes. Change-Id: I0bf1423974d0ec8f602ecd0342522b3e981a8586 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Support extended typesUlf Hermann2021-01-201-2/+0
| | | | | | | Fixes: QTBUG-90448 Change-Id: I5fb6b3d9223ae95ca7e039c5b9139ed086052c29 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Skip failing testsFabian Kosmale2021-01-201-0/+2
| | | | | | | | And do not choke completely on extended. Task-number: QTBUG-90448 Change-Id: I4ac5742ec70f5ba1ed1403be444d9cc7229830c2 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Remove the qmake project filesFabian Kosmale2021-01-151-11/+0
| | | | | | | | | Remove all qmake project files, except for examples which are used to test that qmake continues to work. Change-Id: Ic4abb72dc2dcd75df7a797c56056b6b3c5fe62ac Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmllint: Check qmltypes files in import path for validityUlf Hermann2020-11-221-1/+22
| | | | | | | | Now that we have a module describing the qmltypes format, we can run qmllint on qmltypes files. Change-Id: I23339e52b5081ecb6a2c3b127078389a2b8faab0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Don't crash when importing ES modulesUlf Hermann2020-11-203-0/+11
| | | | | Change-Id: Ica93a3e3fb0eb99be1498f1fcb94b09c113272d7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tst_qmllint: Be more verbose when qmllint crashesUlf Hermann2020-11-171-0/+8
| | | | | | | Output the command line, exit status, exit code, stderr and stdout. Change-Id: I81a813bc44b7caf4c25d9097e8fbcbc3295ac6ec Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Introduce grouped scopesUlf Hermann2020-10-271-5/+3
| | | | | | | | This way we can analyze the left hand part of things like "anchors.fill: parent" in qmllint. Change-Id: I0f58312566c3d5062e0fb301c2bad908ab8b8cbb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Resolve aliases in nested objectsUlf Hermann2020-10-223-0/+25
| | | | | | | So far we've just ignored them. Change-Id: I2ca522ef825a341a3f4bf1c2a42fb0376180cdda Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Drop the metaobject revision from exportsUlf Hermann2020-10-192-2/+6
| | | | | | | | | Instead, output a warning if the revision doesn't match the version. We want to get rid of generic version/revision matching. To this end, add a way to retrieve the version from an export. Change-Id: Ie887103eba910f14e49faa684ac559cc72cab199 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Allow optional imports in qmldir filesUlf Hermann2020-10-083-0/+7
| | | | | | | | | | This is useful for modules that select their imports at runtime using qmlRegisterModuleImport(). We can list all possible variants as optional imports so that tools can see what types might be available. Task-number: QTBUG-87130 Change-Id: I8a37bdde79aef3619fd1f05e5ea6781d521afa88 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Be more verbose when tests failUlf Hermann2020-10-081-1/+1
| | | | | Change-Id: I9394dd721eac3e0b76fbedb6b2fca6f45da48383 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Support 5.x style composite types in qmltypes filesUlf Hermann2020-10-071-0/+1
| | | | | | | | | In Qt6 we don't want those anymore, but it's easy enough to support them for now. Task-number: QTBUG-87164 Change-Id: I2a6cd1dd99f772d132f71575c9c5f4538a3dd0f0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Read deprecated dependency specifications from qmltypes filesUlf Hermann2020-10-073-0/+5
| | | | | | | | And produce a warning when doing so. Task-number: QTBUG-87164 Change-Id: I75eab97a37af1268a310e88e3ac6a625127a7f62 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Use the declared typeinfos rather than the defaultUlf Hermann2020-10-075-1/+22
| | | | | | | | | | ... and produce a warning when encountering the default. This shows us that the qmake build omits some typeinfo entries from common modules. Add those. Change-Id: I1c7e87e8a54ef24a6076090e6051eb1c03c09b2a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Capitalize importer warningsUlf Hermann2020-10-071-1/+1
| | | | | | | Refactor the "prefixed message" mechanism into ColorOutput. Change-Id: Ie982e641771f3367406f48a8bcfd2bd3da122b16 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-10-061-3/+3
| | | | | | | | Modify special case locations to use the new API as well. Task-number: QTBUG-86815 Change-Id: I3b964e3baf0cc7040830156dac30358ea1152801 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* qmllint: Mark anchors3.qml as dirtyUlf Hermann2020-10-053-3/+7
| | | | | | | | | This is in fact invalid QML. The assignment shouldn't be accepted but qmllint cannot see that, yet. Change-Id: Ifcb2f01edaf10ada5ce4d762726c51af3b4f5087 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Fix updating of parent propertyUlf Hermann2020-10-023-0/+18
| | | | | | | | | | | We need to check for the baseTypeName, not for the internalName. Also, this is not really the scope's business but a property of how qmllint sets up its scopes. Task-number: QTBUG-87116 Change-Id: I8f0e558a4a5861164c6e85f90e3d88e469ea0769 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Evgeniy Dushistov <dushistov@mail.ru>
* qmllint: Ignore grouped properties againUlf Hermann2020-10-025-9/+67
| | | | | | | | | | We cannot handle those, yet. Add tests that prove correct grouped properties pass and incorrect ones are expected to fail at causing qmllint to fail for now. Task-number: QTBUG-87116 Change-Id: I0aeed15d262e2c6226e27d5d92890c5385a38936 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Consistently spell "Warning"Ulf Hermann2020-09-281-2/+2
| | | | | | | There was one place where it was written in lower case. Change-Id: Id953fa6c260502ab5bca8cfa061c817bb5a70581 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Make imports localUlf Hermann2020-09-282-0/+2
| | | | | | | | | Imports are not transitive. qmllint gets this wrong so far. Fixing it reveals two tests where we use types we haven't imported. Import the relevant modules. Change-Id: I45f3229468d54137f97d6b699f3a98a1349bc412 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* TypeDescriptionReader: Don't export C++ names as QML namesUlf Hermann2020-09-251-0/+1
| | | | | | | | | | | | | | This is just wrong. The types are not visible in QML under their C++ names. Indeed, this way we reveal a number of places where we confuse the names. Fix those in turn. Furthermore, one of the tests was incorrect. The qmltypes files did not contain an export entry for one of the types, and therefore the type was formally anonymous in QML. However, we did access it via its C++ name. Fix that by exporting the C++ name. Change-Id: I8dd96334076b90fb174daf5b285d622f96495f56 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Don't dump imported enums into the current scopeUlf Hermann2020-09-243-1/+21
| | | | | | | | | This bit of code has never fulfilled any discernable function. Enum access is done elsewhere. Add a test case to prove that access to enums from QtQml's plugins.qmltypes still works. Change-Id: I62fd6c1ec748c88205aa20367ee06d7a33502fa1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix additional warnings from usage of deprecated APIsVolker Hilsheimer2020-09-161-2/+2
| | | | | | | | | | Replace more QLibaryInfo::location with QLibraryInfo::path Replace old event accessors APIs, including relevant comments. Change-Id: Ie205fc93b6e1c0dfb3dca9100fbde417ab68fc9f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* qmllint: fix import java scripts from moduleEvgeniy A. Dushistov2020-08-225-0/+25
| | | | | | Fixes: QTBUG-86183 Change-Id: I4809cb5a408eb4e668f802cf0d7b7a872d1ed4b7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmllint: handle signals defined in qml fileEvgeniy A. Dushistov2020-08-192-0/+14
| | | | | | | | | 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>
* qmllint: Resolve enums from parent typesUlf Hermann2020-06-262-0/+8
| | | | | | | | Fixes: QTBUG-85185 Fixes: QTBUG-84036 Change-Id: If0989a85df93903fee6cb146a515cd362160ff49 Reviewed-by: Evgeniy Dushistov <dushistov@mail.ru> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Properly process qmldir imports and dependenciesUlf Hermann2020-06-245-0/+29
| | | | | | | | | | | | | | | | | | 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>
* qmllint: search methods and properties also in attached typeEvgeniy A. Dushistov2020-06-193-0/+31
| | | | | | | | | | | | | | I changed the strategy of traverse via related types. Before: traversal happens only via linked list type -> type->superClass After: traversal via binary tree formed by attachedType and superClass I use pre-order strategy, current type, then all attached types, then all super classes Fixes: QTBUG-84861 Change-Id: I4a8fce869bc541de6900514d29575174d2753f02 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: high level item can also be listEvgeniy A. Dushistov2020-06-183-0/+23
| | | | | | | Fixes: QTBUG-84300 Change-Id: I1a9db060cdeb7c4ec10deedab5141a06245a55b2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmllint: fix wrong warning about enum usageEvgeniy A. Dushistov2020-06-173-0/+20
| | | | | | | Fixes: QTBUG-83796 Change-Id: I635bbfd98cf7be8418b454626ba7725e92b71c2c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Fix evaluation of type assertionsUlf Hermann2020-05-201-1/+4
| | | | | | | | | | 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>
* Fix qmllint crashMaximilian Goldstein2020-05-062-0/+9
| | | | | | Fixes: QTBUG-83915 Change-Id: I26731ebcec6be46602b6acc7562c65b1c9f3e43a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: warn when passing a directory to -i optionMitch Curtis2020-05-061-4/+16
| | | | | | | | | It should be a file. Change-Id: I52f4ebcf8bdd8ddd1fedd66ceffe9a060139c1d9 Fixes: QTBUG-83861 Pick-to: 5.15 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Add flags for toggling warningsMaximilian Goldstein2020-04-301-1/+1
| | | | | | | | 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>
* qmllint: Show filename in addition to line and columnFabian Kosmale2020-04-241-12/+14
| | | | | | Fixes: QTBUG-83684 Change-Id: If15a9498ae223dccfbafe88b14453a4b180247d9 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Move qmllint's metatype support to tools/sharedUlf Hermann2020-04-011-1/+1
| | | | | | | | | We want to read qmltypes files and analyze scopes also from other tools. Furthermore, restructure the shared directory, so that each tool only includes what it needs. Change-Id: I96a2dcc8b1c5fac613592fb1867bf51fa5ef3a6e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-204-0/+10
|\ | | | | | | Change-Id: I6f320ea43b5837444226228c118e57c4bda8702a
| * qmllint: Break inheritance cyclesUlf Hermann2020-03-194-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | Previously we would run into infinite loops on those. Mind that qmllint will reject a file called Window.qml that imports QtQuick.Window and then instantiates a Window {}. Such a thing is bad style. Task-number: QTBUG-82817 Change-Id: I6db82ca1794c3020dcb7d7e837fe44f72bca5029 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>