aboutsummaryrefslogtreecommitdiffstats
path: root/tools/shared
Commit message (Collapse)AuthorAgeFilesLines
* qmllint: Add support for loading options from settingsMaximilian Goldstein2021-05-272-0/+206
| | | | | | | | | | | | | | | | | This change adds support for a reading a simple settings file (.qmllint.ini) to set log levels and various other options. The settings file applies on a per-directory basis so linting files in two subdirectories with different settings will use their respective settings files. If the directory of the linted file does not contain any settings we search through all parent directories. This is implemented in a way that qmlformat can also utilize the settings file code. This makes qmllint more useful for larger projects that might want different settings for different parts of their QML code. It also allows for better integration in CI checks and pre-commit hooks. [ChangeLog][General][qmllint] Adds the ability to set linting options via a settings file rather than using command line parameters. Use --write-defaults to generate a template with default values for editing. Use --ignore-settings to disable this feature Change-Id: I94e4a47916b5dfd16c3a69efdba3858235cab738 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Long live libQtQmlCompiler!Ulf Hermann2020-10-0516-2739/+0
| | | | | | | | 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-022-29/+0
| | | | | | | | | 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-022-14/+0
| | | | | | | | 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-022-30/+39
| | | | | | | | 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-028-164/+28
| | | | | | | QTypeRevision does all we need there. Change-Id: Ib27ae2d58167a7a45fac31262a45e387d047af89 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Remove ScopeTree::isVisualRootScope()Ulf Hermann2020-10-022-14/+0
| | | | | | | | 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-024-29/+31
| | | | | | | | 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-0/+4
| | | | | | | | | 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/+11
| | | | | | | 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-022-29/+18
| | | | | | | | | | | | | | 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-022-6/+1
| | | | | | | | 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-023-0/+422
| | | | | | | 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-022-10/+0
| | | | | | | | | | | 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: Make imports localUlf Hermann2020-09-282-0/+31
| | | | | | | | | 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-252-3/+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>
* ScopeTree: Remove the "name" propertyUlf Hermann2020-09-253-18/+19
| | | | | | | 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-253-14/+18
| | | | | | | ... 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-3/+3
| | | | | Change-Id: I48601019d0e200eae9d52c3a9db45913cdd9d0f8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* ScopeTree: Add provisions for supplying types to methodsUlf Hermann2020-09-252-9/+44
| | | | | | | | | We want to proactively fill in all the types when constructing the ScopeTree so that we don't have to carry an undue number of imports around. Change-Id: I209d88568434c36073c11216dcd052babe5e3dae Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmllint: Mark scopes read from QML files as compositeUlf Hermann2020-09-251-0/+1
| | | | | Change-Id: I3e46a62595bfc05cdf9ee4233a27cd744b080ab9 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Improve the QML/JS type readerUlf Hermann2020-08-203-5/+5
| | | | | | | | 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>
* Move functionality to read types from QML files out of qmllintUlf Hermann2020-08-135-0/+445
| | | | | | | We want to re-use this in other tools. Change-Id: I2a8cd104d54c1fa9b2898213b0b9e09719e42bca Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Port QtDeclarative from QStringRef to QStringViewKarsten Heimrich2020-06-161-2/+2
| | | | | | | | 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>
* Preserve access semantics in qmltypesUlf Hermann2020-05-182-9/+37
| | | | | | | | gadget types are accessed with value semantics, object types are accessed with reference semantics, and namespaces are not accessed. Change-Id: I5eb8f132d729416f28bf94e651f877fc4a9a5c77 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-172-1/+13
|\ | | | | | | | | | | | | | | Conflicts: src/qmltyperegistrar/qmltypesclassdescription.cpp src/quick/items/qquickrendertarget.h Change-Id: I9e24d2252a35b8e74af89ad72af796df658167ca
* | ScopeTree: Make methods a QMultiHashUlf Hermann2020-04-151-3/+3
| | | | | | | | | | | | | | You can have multiple overloads with the same name. Change-Id: Ifffcc634e96b41f99152092b72b61dad64713b23 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Tools: Add forgotten access methodUlf Hermann2020-04-071-0/+1
| | | | | | | | | | | | Change-Id: I9307a6243fdc5bc4f4d43321b41c172082298839 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | qmllint: Consistently use shared pointers for ScopeTreeUlf Hermann2020-04-014-39/+59
| | | | | | | | | | | | | | | | | | | | ScopeTree keeps a weak pointer to its parent scope and strong shared pointers to its children. Avoid passing bare pointers around, so that we cannot create multiple shared pointers independently from the same bare pointer. Change-Id: Id0faece550b1878363004d843a8fa5c1164794ae Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | TypeDescriptionReader: Read file name from qmltypesUlf Hermann2020-04-012-1/+7
| | | | | | | | | | Change-Id: Iec295b87da413a2b6c741f3d3313c54caf055fd8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Move qmllint's metatype support to tools/sharedUlf Hermann2020-04-018-4/+1463
|/ | | | | | | | | 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>
* Move qmltyperegistrar into srcUlf Hermann2019-11-081-2/+8
| | | | | | | | | We want it to be available early in the build process. qmltyperegistrar will be required to build qml, quick, and various imports. Change-Id: I15b827cd4b322a2bcea2780eeedb8dbe132aa59a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-10-263-0/+227
|\ | | | | | | Change-Id: Iaa7dbbe9926d25cfb1b1c51e7013e58cb71d86b5
| * Add support for scanning qrc files in qmlimportscannerAndy Shaw2019-10-243-0/+227
| | | | | | | | | | | This reuses the ResourceFileMapper and extends it slightly to return full paths on request. Subsequently, this is moved into a shared directory inside tools. Fixes: QTBUG-55259 Change-Id: Ice5fc68d03b767a4185742e182556ab4290bd28d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Add support for semi-automatic QML type registrationsUlf Hermann2019-10-142-0/+257
We can use the new moc JSON output to collect all meta-objects at build time and, for those that include QML element registration meta-data, generate code that automatically registers these types with QML. This eliminates the need to call qmlRegisterType manually. For now this generates free-standing functions (per module) that need to be called manually. This is intended as an intermediate step. Task-number: QTBUG-68796 Change-Id: Ib414eef9757344feee488ebc7388f957b975347f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>