aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmllint
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-095-18/+18
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmlirbuilder_p.h src/qml/qml/qqmlpropertycachecreator_p.h src/qmltyperegistrar/qmltypesclassdescription.cpp src/qmltyperegistrar/qmltypesclassdescription.h src/qmltyperegistrar/qmltypescreator.cpp src/quick/items/qquicktext_p.h src/quick/util/qquickvaluetypes_p.h Change-Id: Ic209741592e7b85820bf3845722023a190ebc1c5
| * Use Qt::SplitBehavior in preference to QString::SplitBehaviorEdward Welbourne2020-03-021-1/+1
| | | | | | | | | | | | | | | | The Qt version was added in 5.14 "for use as eventual replacement for QString::SplitBehavior." Move another step cloaser to that goal. Change-Id: I3214ad6ccaca9dfd4a026589cabeb40cbf4a6298 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Restore offset/length in QQmlJS::DiagnosticMessageSimon Hausmann2020-03-024-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | This is needed in a few places outside of declarative, so this change restores the loc member in DiagnosticMessage and moves QQmlJS::AST::SourceLocation into common's QQmlJS namespace/directory. QQmlError is unaffected and retains only line/column. Amends d4d197d06279f9257647628f7e1ccc9ec763a6bb Change-Id: Ifb9d344228e3c6e9e26fc4fe112686f9336ea2b2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Use QTypeRevision for all versions and revisionsUlf Hermann2020-02-035-42/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In many places we carry major and minor versions or revisions that are loosely coupled to minor versions. As the Qt minor version resets now, we need to handle these things more systematically. In particular, we need to add a "major" part to revisions. QTypeRevision can express the current major/minor pairs more efficiently and can also be used to add a major version to revisions. This change does not change the semantics, yet, but only replaces the types. Change-Id: Ie58ba8114d7e4c6427f0f28716deee71995c0d24 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Make QtQml work with the latest changes in qtbaseLars Knoll2020-01-141-3/+3
|/ | | | | | | | | | | | Adjust the code to work with the new QString and QVector data structures that have inlined size and data pointers. Fix a large bunch of compiler warnings from QFlags. Update dependencies for qtbase and qtsvg Change-Id: Iba237aed90c140b822e0cf501b9fb7156ec27c2d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Consider failure to find imports an errorUlf Hermann2020-01-131-0/+1
| | | | | | | | There is no real reason to tolerate it. We can generate all qmltypes at build time, and if we can't find them, the results are likely to be off. Change-Id: Id935d76ac3ca6b601381b40a73d7fbacca342c4d Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Consider attached propertiesUlf Hermann2020-01-131-0/+10
| | | | | | | | | We cannot figure out who attached properties to what, therefore we consider any uppercase property we cannot locate as a potential attached property. Change-Id: I60508b9e4e038a51b87c56edf0796ac492aa3fa0 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: parse simple type assertionsUlf Hermann2020-01-134-9/+46
| | | | | Change-Id: Ic24018137d8f989686d4a8f927efb824453d114b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Assume "parent" property is always document parentUlf Hermann2020-01-133-0/+12
| | | | | | | | ... except if the document parent is Component. Then leave the type alone. Change-Id: Id7b2e6efdefe18a8d375967ddedcdf9e07a07946 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Resolve aliasesUlf Hermann2020-01-137-128/+272
| | | | | Change-Id: Ida53af9774dc72559395064169113d0ee1f47f24 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Analyze member accessUlf Hermann2020-01-136-77/+290
| | | | | | | | | We can analyze access to many field member expressions and figure out if the accessed members exist. There are limits to this, of course. Generic JavaScript values are out of scope here. Change-Id: Id2e7613e56f06555cc3a2ba1c51683d9ea0bb84b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: parse JS files for methodsUlf Hermann2020-01-102-140/+196
| | | | | Change-Id: I3888231ac82f9babd51e6332af3c5457bf3c9141 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Clean up access to m_exportedName2ScopeUlf Hermann2020-01-101-11/+12
| | | | | | | | Don't accidentally overwrite the anonymous scope, and clearly mark where we want to modify the scopes and where we just want to retrieve them. Change-Id: I801d378ccaea6eb2548875766a9d3141dcb9f5e5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Use QHash::insert(QHash)Liang Qi2019-12-161-5/+1
| | | | | | | This amends 4f6815b29003e140be5ac5763429a4bb256f5b9f. Change-Id: Icbe08d2c636969b40e7092b18c4bc2d21476944a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmllint: Avoid QHash::unite()Ulf Hermann2019-12-131-1/+5
| | | | | | | | As we don't have QHash::insert(QHash), yet, we have to iterate for now. Change-Id: I3deaf8c0fb53446bb9f125786d20ed89abe85c42 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* qmllint: Handle unversioned import statements in qmldir filesUlf Hermann2019-12-112-7/+19
| | | | | | | | The import statements in qmldir files are not required to have a version attached to them anymore. Change-Id: I925d5f965c73685874c23510cf2e569d1528d8c1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Read app.qmltypes files for extra type resolutionUlf Hermann2019-11-182-74/+113
| | | | | Change-Id: I7f19b39dd65063ae26b93bf1b40b0be0b0e15c6d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* qmllint: Remove special cases for Component, QtObject, and ConnectionsUlf Hermann2019-11-181-16/+0
| | | | | | | | | The plugins.qmltypes for QtQml have proper descriptions for those. They do have some interesting properties, after all. Change-Id: I7f0922dd14c66c64fe88b55087fd55cb992d33db Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: CleanupUlf Hermann2019-11-1816-1659/+1053
| | | | | | | | | | | | | | | | | qmllint needed to be refactored before we can add any new functionality: * Fix all the (C++) linter warnings * Remove pointless namespaces * Merge ScopeTree and FakeMetaObject into one class * Remove the "Fake" from class and variable names * Remove dead code * Add "We mean it" warnings everywhere * Unify #include style This also "accidentally" fixes the automatic matching of signal handlers in Connections elements to signals in their parent scopes. Change-Id: Idf8daae34dfd6c0ee00da28b017f921da3eba25c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-261-1/+1
|\ | | | | | | Change-Id: Iaa7dbbe9926d25cfb1b1c51e7013e58cb71d86b5
| * qmllint: fix typoFabian Kosmale2019-10-241-1/+1
| | | | | | | | | | Change-Id: I02a6f4dd1804251e0420f2fbc334ee9c38d3dc49 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | qmllint: Parse .mjs files as JavaScript rather than QMLUlf Hermann2019-10-151-2/+4
| | | | | | | | | | | | Change-Id: I80783289452300d4609a27f5b470ecdeeeca5e71 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | Remove QQmlJS::AST::UiImport::versionTokenUlf Hermann2019-10-101-9/+7
| | | | | | | | | | | | | | | | It was incorrectly parsed in case of "as Foo", and it was mostly unused. Change-Id: Ie833a8eb247108cb7bcd6ca3e6f3e5df614461cf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | qmllint: Parse variable declarations from PatternElementsUlf Hermann2019-10-012-0/+14
| | | | | | | | | | | | Change-Id: If8b4f5302cc1ee3a4193b354503b304534d7dfd9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Make qmllint read qmldir files and qmltypes files in app directoryUlf Hermann2019-09-252-17/+61
| | | | | | | | | | | | | | | | | | | | This makes it possible to resolve components which were either directly registered in the application or specified as composite types in qmldir files. Change-Id: I42482563f31ac780d6b37e62375d09d122c4a308 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | qmllint: Honor --silent argumentUlf Hermann2019-09-195-30/+28
| | | | | | | | | | | | Change-Id: Ie63654139aeb7bfd241be865f33c399c23e08cc3 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | qmllint: Accept arrays as enum descriptionsUlf Hermann2019-09-183-40/+28
| | | | | | | | | | | | | | | | We don't need the values and they are hard to determine statically. Change-Id: I3453e67a18b6d0212748795fd0ea0baaff61b522 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | qmllint: Take prefix into account when inserting namesUlf Hermann2019-08-301-1/+1
| | | | | | | | | | Change-Id: I2c13e8fc173e5e155d07a1bbf8547df65605ba10 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | qmllint: Consider methods from the current scope as valid IDsUlf Hermann2019-08-302-1/+2
| | | | | | | | | | Change-Id: I71e9e2d5b4623938605d7afbfc79ae5c7d4251fc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | qmllint: Handle the default import and .ui.qml filesUlf Hermann2019-08-302-14/+24
| | | | | | | | | | Change-Id: I9d86daa737d30ea0f76af431c59f44d59d4786e4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | qmllint: Warn about magic signal handlersUlf Hermann2019-08-303-20/+76
|/ | | | | | | | Those are typically part of Connections elements. We want to use functions instead. Change-Id: I08b65eae8b8a6ba95f7a3570f5465961abbb506e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* qmllint: Fix compiler warningJarkko Koivikko2019-08-191-2/+2
| | | | | | | | findunqualified.cpp(776) : warning C4172: returning address of local variable or temporary: dbg Change-Id: Ifce7ccdcce9ed629a2a9dd4759620d02804812b7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmllint: do not warn about the identifier of a catch statementFabian Kosmale2019-08-191-1/+2
| | | | | Change-Id: I2e679fe4fbebff7d8252da6ea69aed3cc9ffab41 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* qmllint: Fail on recursion depth errorsUlf Hermann2019-08-192-1/+7
| | | | | | Change-Id: I815f82ed8c005ed83ceecff6ce80106a9ad9b21d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* linter: Cover all supported JavaScript functionsFabian Kosmale2019-07-261-12/+13
| | | | | | | + qDebug/commented out code cleanup Change-Id: Id6a4410391eed2fbf6ff0dd7aaffa1de4d5b892c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* qmllint: Improve parent handlingFabian Kosmale2019-07-264-15/+19
| | | | | | | | | | | | | | | | | | - Do not warn about parent access in unknown components This avoids false positive warnings when an imported component could not be found (or when it actually was not imported). We still warn about the component which could not be found, so the user is still informed that something is not right. We also still emit a warning when we know the properties of a component, and parent is not one of them. - Do not recommend the use of parent to address the root components properties. For this to work, we would need to know whether the root component reparents its children or not. Moreover, id lookups are actually faster than parent lookups. Change-Id: I83d0e71e4bf20d34a3e6d836c2b123b2bf0d416e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* qmllint: Improve signal handler recommendationsFabian Kosmale2019-07-253-9/+25
| | | | | | | | | | | - Fix the case where multiple unqualified accesses would be mapped to the same signal (wrong in all but one cases), as the event parameter has the same name and we were using a QHash. Fixed by using QMultiHash and searching for the matching signal handler (by location) - Recommend arrow functions for single line event handlers Change-Id: I3cbb85fe0e49b454908ca03b4c86318ef02e364c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Extend linter to check for unqualified idsFabian Kosmale2019-07-1214-4/+3606
| | | | | | | | | | | | | | | | | | | | The linter has gained a new option (-U/--check-unqualified). If run with this option, it warns about occurrences of unqualified identifiers. Furthermore, it attempts to detect the reason for why the identifier can be used unqalified: - If the id originates from the root element, it suggests to qualify the access either with the root element's id, or with "parent" if applicable. - If the id is the parameter of a signal, it suggests to use functions in the handler, instead of relying on the signal parameters to be "magically" injected into scope. The linter does not attempt to handle with statements, but warns the user instead that they are a bad idea. Change-Id: I9aaf28c37595d84886a1071d49b86799b222a617 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Simplify errors and diagnosticsUlf Hermann2019-06-141-1/+1
| | | | | | | | | | | | | | | | We only need two classes to describe all possible diagnostics: * A low-level private POD DiagnosticMessage. This is easily copied and passed around internally. It doesn't need to adhere to a stable API and it doesn't carry any extra baggage. * The high-level public QQmlError with its stable interface. This can internally also use a DiagnosticMessage as storage. Change-Id: I52be88d9b5d9855a661b8032b01eedb43a0fb0b3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Split QV4::Value into a static and a dynamic partUlf Hermann2019-05-311-1/+1
| | | | | | | | The static part can be used for compilation and won't resolve managed objects. This allows us to remove all the remaining V4_BOOTSTRAP. Change-Id: Id2f6feb64c48beb2a407697881aea8c0d791a532 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Adjust QMAKE_TARGET_PRODUCT, QMAKE_TARGET_DESCRIPTIONKai Koehne2017-07-281-2/+1
| | | | | | | | | | The product should be Qt5 (the default). The QMAKE_TARGET_DESCRIPTION is actually less than a description but a beautified name, that is shown e.g. in the task manager, crash reporting tool etc. Make it title case, like most Windows applications do. Change-Id: I570aee2c2016e78fdb7a93c2d7a66b70fdcb0cff Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove custom setting of qmake VERSION field in toolsKai Koehne2017-07-281-6/+0
| | | | | | | | qt_tool.prf sets the VERSION to MODULE_VERSION by default. Also, qmake automatically makes it a quadruple for the .rc file metadata. Change-Id: Ie2d0f2022c4416ce824a6786eef4a8c461ed70f1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-02-241-0/+9
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4ssa.cpp src/quick/accessible/qaccessiblequickview_p.h src/quick/items/qquickmousearea.cpp src/quick/util/qquickanimatorjob.cpp tools/qmlplugindump/main.cpp Change-Id: I84474cf39895b9b757403971d2e9196e8c9d1809
| * Tools: Add product name, version and description to the .pro filesFriedemann Kleint2017-01-311-0/+9
| | | | | | | | | | | | | | | | This information will then be visible in Windows explorer. Change-Id: I9d2f936584308394b4e3246d57bed44083b3cbca Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2017-01-261-0/+11
|\| | | | | | | | | | | | | | | Conflicts: src/quick/util/qquickutilmodule.cpp tools/qmllint/main.cpp Change-Id: Ic2283f88c293ca7fc776de3e83eb4c7812309d8a
| * Fix build without features.commandlineparserTasuku Suzuki2017-01-251-0/+10
| | | | | | | | | | Change-Id: I3a23e53fc647f5257593e0aece7198eea430cf14 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | tools: replace 'foreach' with 'range for'Anton Kudryavtsev2016-08-221-4/+5
|/ | | | | | | | Catch rvalues to prevent detach()'ing. Change-Id: I7be159a405c994429c0eee10805bfe96fcf4c806 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Updated license headersJani Heikkinen2016-01-201-17/+12
| | | | | | | | | | | | From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some exceptions, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one (in those files which will be under GPL 3 with exceptions) Change-Id: I04760a0801837cfc516d1c7c02d4f503f6bb70b6 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.5' into devSimon Hausmann2015-06-041-5/+1
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jsruntime/qv4engine_p.h src/quick/items/qquickitemsmodule.cpp src/quick/items/qquicktext.cpp src/quick/util/qquickpixmapcache.cpp tests/auto/quick/qquickwindow/tst_qquickwindow.cpp Change-Id: I90ecaad6a4bfaa4f36149a7463f4d7141f4a516a
| * qmllint: Fix parsing js files with .import directivesSérgio Martins2015-05-091-5/+1
| | | | | | | | | | | | | | | | | | For .pragmas we removed them explicitly but the correct fix is to not use "qmlMode" when setting code in the lexer. Change-Id: I6ffc0ca9e7ebab09fbf91e647d292ff0a3a1fd7d Task-number: QTBUG-45916 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>