aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmllint
Commit message (Collapse)AuthorAgeFilesLines
* QmlCompiler: Allow more convenient access to enums in QQmlJSScopeUlf Hermann2020-11-121-2/+2
| | | | | Change-Id: Ibac4dd7641a89b686bee63cf974b2257a35631a2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Check identifiers before giving up in case of previous errorsUlf Hermann2020-10-271-4/+2
| | | | | | | | The identifier check might yet yield more information. Change-Id: I96f700acf257736fea7e9c2023b9e8797f702f7c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
* QmlCompiler: Add JS scopes for script bindingsUlf Hermann2020-10-271-3/+5
| | | | | | | | This is necessary to identify the available QML and JS scopes for the binding, and to add any identifiers found there. Change-Id: Ic966e7817ccd1fdc064dd433d16fa6c42c9110cc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Introduce grouped scopesUlf Hermann2020-10-272-0/+35
| | | | | | | | 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>
* QmlCompiler: Properly discern between inherited and own namesUlf Hermann2020-10-222-43/+48
| | | | | | | | | | | Previously, we would mix them up on importExportedNames(), which was also misnamed. Now we keep them in their proper place in the scope hierarchy, so that we can identify which scope a property came from. Exceptions are the qmllint-specific treatment of parent properties and Connections elements. Change-Id: I7c012388b16c83439d6f2de2e83fac0da4940d30 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: fix typoUlf Hermann2020-10-221-1/+1
| | | | | | Change-Id: Ia661141095a865191945f41bad91429ef952e16c Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Remove dead codeUlf Hermann2020-10-211-3/+0
| | | | | Change-Id: I5898402604fe29731dc518d42a441ff852706af3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Compile with Clang11Lars Knoll2020-10-211-0/+4
| | | | | Change-Id: I9f3a4a6b6c7a2fbfca0a572209f398a23c26b37b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Pass source location to all scopes from QML filesUlf Hermann2020-10-151-2/+2
| | | | | Change-Id: Ic0aeb152acb0d90d15cc48a55c0ad5b15a60a6eb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Further unify findwarnings.cpp and qqmljsimportvisitor.cppUlf Hermann2020-10-152-248/+58
| | | | | | | | Most of the logic in findwarnings.cpp applies also to imported files and should live in the base class. Change-Id: I65f326f50a8bfab0dff4b5b31f7bee7300b20704 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Unify QQmlJSImportVisitor and FindWarningsVisitorUlf Hermann2020-10-154-184/+21
| | | | | | | | | They are both pretty much doing the same thing, except that the import visitor is not as thorough. We need the full analysis in QtQmlCompiler, so we successively move the code over. Change-Id: If7fb47f88165fd8b61f4ccc408ccfbb7dad533e6 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Defer resolution of types read from QML filesUlf Hermann2020-10-152-6/+6
| | | | | | | | | | When importing a directory we most likely don't need all of the files in the directory. Therefore we now parse them only when they are accessed. This speeds up the execution and will allow us to process imports recursively without running into infinite recursion. Change-Id: I0c79313de792249e6bb86144b5014a7787dbdc5b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Unify the printing of diagnosticsUlf Hermann2020-10-152-30/+63
| | | | | | | | We can use QQmlJS::DiagnosticMessage to carry message, type, and location. Change-Id: I3868bc8035b4da13efad0d1b7d2f8dfeff1ef234 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Don't register the component we're just parsing as importUlf Hermann2020-10-141-4/+0
| | | | | | | | | I can't think of a scenario where this actually makes sense and none of the autotests exercise it. Change-Id: I6361d38e02f1cdac60ee5a4e1b8287491c3b05e6 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Capitalize importer warningsUlf Hermann2020-10-074-52/+59
| | | | | | | 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-062-2/+2
| | | | | | | | 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>
* QmlCompiler: Split importFileOrDirectory() in twoUlf Hermann2020-10-061-5/+10
| | | | | | | | | | | importing a file and importing a directory are really quite different things and the code paths inside the function were completely separate. We also don't have to create a map of ImportedTypes if we are only going to return a single one. Change-Id: Ifbb0caa70e9272dfde2d9f1cf5ed1b102e02f5cc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Move ScopeType and JavaScriptIdentifier into QQmlJSScopeUlf Hermann2020-10-053-36/+44
| | | | | | | | They don't begin with 'Q' and they are not very useful outside of QQmlJSScope. Change-Id: I3363ac4d29be7a9cb5c9f7f3af1727c99e886825 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Rename TypeDescriptionReaderUlf Hermann2020-10-052-2/+2
| | | | | | | The names should begin with a common prefix. Change-Id: Ibd832ebe7a778c7af8ee3b75253e04491ded28be Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Rename QmlJSTypeReaderUlf Hermann2020-10-051-1/+1
| | | | | | | Add an extra 'Q' for consistency. Change-Id: I81324f3b6e4d26a29f3bcc40b03abfa137292ea0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Rename QmlJSImporterUlf Hermann2020-10-052-6/+6
| | | | | | | Add an extra 'Q' for consistency. Change-Id: Idd34e0c898c9a7ac70b1ec3856a8af6829ec6fb7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Rename ImportedMembersVisitorUlf Hermann2020-10-051-1/+0
| | | | | | | The class names should start with a common prefix. Change-Id: I645ef476f8493d38c2f4c5241d4a2903543f09e8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Rename metatypes_p.hUlf Hermann2020-10-053-11/+11
| | | | | | | Those are specific to QML/JS. Change-Id: I45a5d4eb6c53bd5ca4026e042af83c4afaa4953c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlCompiler: Rename ScopeTree to QQmlJSScopeUlf Hermann2020-10-054-34/+34
| | | | | | | That is a better name. Change-Id: I34a6867692a236dd16ed8e3a68866f994eab02d2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Long live libQtQmlCompiler!Ulf Hermann2020-10-056-30/+14
| | | | | | | | Move all the code from tools/shared into src/qmlcompiler and build a static library from it so that we can re-use it in external tools. Change-Id: I7c8d8e59063dc7c711f4072f103a01095e6f5997 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Remove member access chains from ScopeTreeUlf Hermann2020-10-024-11/+28
| | | | | | | | | What we need there is a proper type inference. This should be added separately. For now, keep the member access chains local in qmllint and don't pollute ScopeTree with them. Change-Id: I9f50aa4e54b285bd93e7bd4cd17797509df0c168 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Remove ScopeTree::m_unmatchedSignalHandlersUlf Hermann2020-10-023-23/+23
| | | | | | | | Rather, immediately output the warnings when we encounter them. Change-Id: I4bd1a5491a47cb0232bfdd4e325f8f122593aa39 Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Unify injected and "normal" JavaScript identifiersUlf Hermann2020-10-024-57/+103
| | | | | | | | The specifics of how to warn about the injected identifiers are moved out of ScopeTree as that is not related to the structure of the scopes. Change-Id: I26418c3fa492da8339abf045a4034a8464b7bbb8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Remove ComponentVersionUlf Hermann2020-10-022-2/+0
| | | | | | | QTypeRevision does all we need there. Change-Id: Ib27ae2d58167a7a45fac31262a45e387d047af89 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Remove ScopeTree::isVisualRootScope()Ulf Hermann2020-10-021-2/+8
| | | | | | | | This is not a property of the ScopeTree itself, but rather a property of how qmllint sets up its scopes. Change-Id: Ifb7c0f1f841046a6ae68e246fbd706f67bedb2af Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Remove C++ types from the importer interfaceUlf Hermann2020-10-022-20/+20
| | | | | | | | We don't use them anymore. Now we can also make all the ScopeTrees const again as we don't need to modify them anymore after importing. Change-Id: I3ece767f4f62f06cb0640f1f191eb8d98400717c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Don't use C++ names of QML typesUlf Hermann2020-10-022-42/+23
| | | | | | | | | The C++ names are an implementation detail of the importer, and qmllint has no business messing with them. All the types are supplied as ScopeTree by the importer now. Change-Id: I3ef2b5da1dc19f95c7f2a5d80fa1297ba10bef8f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Remove exportedQmlNames from import resultsUlf Hermann2020-10-022-21/+21
| | | | | | | We don't need to expose them anymore. Change-Id: Ibb25f688459972f718f9a051fbb7265c7e5b5f92 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Uncruftify the importing of base qmltypesUlf Hermann2020-10-023-20/+37
| | | | | | | | | | | | | | builtins.qmltypes are imported separately now. Any other bare qmltypes files without qmldir should be specified explicitly. If none are specified, qmllint looks in the current directory for qmltypes files, not in all possible import paths. This is still somewhat weird, but admittedly it's handy for qmltypes files generated for application binaries. For the same reason, we unconditionally include the current directory in the list of default import paths. Previously this was done if no explicit qmltypes files were specified, which makes little sense. Change-Id: Iaa56f8b40b3ec3045f55928251d7efea5616d23b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tools: Remove QmlJSImporter::m_currentDirUlf Hermann2020-10-021-5/+8
| | | | | | | | It was only used to make paths passed to importFileOrDirectory absolute. We can do that before passing them. Change-Id: I0798d38080596fc6eb314259e81702b81a7743dd Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Move the import handling code out of qmllintUlf Hermann2020-10-026-342/+9
| | | | | | | We want to re-use this logic in other places. Change-Id: I63cbee86a83265ddd241a4fae9ce8c48f38b5f18 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Fix updating of parent propertyUlf Hermann2020-10-021-1/+13
| | | | | | | | | | | 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-021-4/+3
| | | | | | | | | | 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-1/+1
| | | | | | | 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-99/+136
| | | | | | | | | 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>
* qmllint: Use a hash for scripts read from qmldir filesUlf Hermann2020-09-252-5/+5
| | | | | | | You cannot use the same name multiple times anyway (for now) Change-Id: I957340273772a1c5cf0a9da840a305bc8b311e95 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* TypeDescriptionReader: Don't export C++ names as QML namesUlf Hermann2020-09-254-39/+61
| | | | | | | | | | | | | | 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: Split available names into exported, imported, C++ namesUlf Hermann2020-09-254-44/+79
| | | | | | | | | | exported names are the names a component intends to export. imported names are the names the importing component sees, possibly adding a prefix. C++ names are only used in qmltypes files for non-composite types. Change-Id: I843e34f07a026a06931ed76d72a3cce98e3e5552 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QQmlDirParser: Treat dependencies like importsUlf Hermann2020-09-252-3/+3
| | | | | | | In particular, allow auto and latest versions. Change-Id: I4a6b26112950d066ae2d8a37dc0e9fa1dec24724 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* ScopeTree: Remove the "name" propertyUlf Hermann2020-09-252-5/+6
| | | | | | | It was rarely used and only caused confusion. Use internalName instead. Change-Id: I196b1d77db04a2cb6e3cd0447d34ce9bae0b9cd5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Clarify the meaning of the various names a scope can haveUlf Hermann2020-09-252-7/+7
| | | | | | | ... and notice that they are misused everywhere. Change-Id: I2254993dc5d11e967e7e83c6f0efb37fa17744be Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Keep scopes mutable until all the imports are resolvedUlf Hermann2020-09-252-10/+10
| | | | | Change-Id: I48601019d0e200eae9d52c3a9db45913cdd9d0f8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Move import handling code into separate classUlf Hermann2020-09-252-64/+126
| | | | | | | | This still messes up the association between scopes and imports, but at least it encapsulates the issue better. Change-Id: I67239495e61ee10d18e6c4b3e837560a42650710 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Don't dump imported enums into the current scopeUlf Hermann2020-09-241-4/+0
| | | | | | | | | 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-1/+1
| | | | | | | | Replace QLibaryInfo::location with QLibraryInfo::path, and remove usage of Qt::AA_EnableHighDpiScaling, which doesn't have any effect anymore. Change-Id: I347e8a83e0f4c2b4405f2512e569ad3234f05a98 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>