summaryrefslogtreecommitdiff
path: root/src/libs/qmljs/qmljscheck.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QmlJS: Allow disabling static analyzer messagesChristian Stenger2023-05-041-21/+59
| | | | | | | | | | Provide settings to define a customized set of enabled static analyzer messages. Fixes: QTCREATORBUG-29095 Change-Id: Id629e383dd9e3beeef98026759ac66716dc43d23 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Merge remote-tracking branch 'origin/10.0' into qds/devTim Jenßen2023-03-261-12/+18
|\ | | | | | | | | | | | | | | bigger conflicts resolved at: src/plugins/qmldesigner/CMakeLists.txt src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp Change-Id: I08e2a109d8e37cbd77225129854e9e633725bfc7
| * QmlJS: Tr::TrAlessandro Portale2023-02-011-4/+7
| | | | | | | | | | | | | | | | Excluding the Qml parser, which needs to remain in sync with it's copy in Qt. Change-Id: I22f475f265dd74687e3239c4d6916c777798a447 Reviewed-by: hjk <hjk@qt.io>
| * Remove GPL-3.0+ from license identifiersKai Köhne2023-01-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0, this applies only to a hypothetical newer version of GPL, that doesn't exist yet. If such a version emerges, we can still decide to relicense... While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only Change was done by running find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \; Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
| * qmljs: Remove foreach usageArtem Sokolovskii2022-12-211-7/+10
| | | | | | | | | | | | | | | | Task-number: QTCREATORBUG-27464 Change-Id: Ifdb8cf514dfe328e0a64bde1beff3e63a4b7fbc3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* | QmlJS: Allow string::arg() in ui.qml filesThomas Hartmann2023-02-071-3/+6
| | | | | | | | | | | | Task-number: QDS-9037 Change-Id: Ie91e745ae4d20e0fd96df1d767fc875475a0be7a Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
* | QmlJSCheck: Add missing commaThomas Hartmann2023-01-201-3/+16
|/ | | | | | Change-Id: I5f26cbe50ecb47c088bab8b9cdea49d0103352eb Reviewed-by: Burak Hancerli <burak.hancerli@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* Merge remote-tracking branch 'origin/8.0'Eike Ziller2022-09-191-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf src/libs/utils/fileutils.cpp src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp src/plugins/qmldesigner/designercore/include/abstractview.h src/plugins/qmldesigner/designercore/include/nodemetainfo.h src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp src/plugins/qmldesigner/designercore/model/model_p.h src/plugins/remotelinux/linuxdevice.cpp tests/auto/utils/fileutils/tst_fileutils.cpp Change-Id: I26a21e2523d3d725fdb8c548a531cdbdaeaeca20
| * QmlDesigner: Allow multiple StateGroups in .ui.qmlHenning Gruendl2022-09-131-1/+1
| | | | | | | | | | Change-Id: If7f626f196899ebd49e5f6393d8e3ef81447945c Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* | Use SPDX license identifiersLucie Gérard2022-08-261-24/+2
| | | | | | | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Task-number: QTBUG-67283 Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* | Merge remote-tracking branch 'origin/8.0'Eike Ziller2022-08-191-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reverts/comments out parts of 45f93a817a527e6dc81a8971dd2868b3da66cd84, which needs to be resolved in a follow-up commit. Conflicts: cmake/QtCreatorIDEBranding.cmake qbs/modules/qtc/qtc.qbs qtcreator_ide_branding.pri share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp src/plugins/clangcodemodel/clangmodelmanagersupport.cpp src/plugins/cmakeprojectmanager/cmakesettingspage.cpp src/plugins/python/pythoneditor.cpp src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp src/plugins/scxmleditor/common/colorsettings.cpp Change-Id: I7f0f7b7120e75a9fc3a8886bc57c17345cbb501b
| * QmlDesigner: Allow Timer in ui.qml filesThomas Hartmann2022-08-161-1/+1
| | | | | | | | | | | | Change-Id: I0fbf7270f8514b212fab5aae89d2def11d6b53bd Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* | qmljs: (QString -> Utils::FilePath)++Fawzi Mohamed2022-07-131-5/+5
|/ | | | | | | | | convert more QString containing paths to Utils::FilePath Change-Id: I1219d7d147993e48cfa641dc9bea72ab38c90f51 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* Merge remote-tracking branch 'origin/7.0'Eike Ziller2022-04-261-1/+3
|\ | | | | | | Change-Id: I3da1b663a570682201afbe644d6f9299019aae21
| * QmlJsCheck: Add more ids to negative listsThomas Hartmann2022-04-261-1/+3
| | | | | | | | | | | | | | | | Since those are QML keywords those ids can create all kind of unexpected side effects. Change-Id: I9ecb9b0559c57d59104aacedfca505b559de9685 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
| * qmljs: correctly handle js string templatesFawzi Mohamed2022-04-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | In most cases we do want to visit the expressions in a function template. Changing its accept0 would force those not wanting to visit it to iterate on the templates (currently a linked list), so we add a visit method explicitly visiting the expression in all the needed places. Fixes: QTCREATORBUG-21869 Change-Id: I47733544bfd32eec357810b97242608b8f7de572 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | Merge remote-tracking branch 'origin/7.0'Eike Ziller2022-04-221-1/+13
|\ \ | |/ | | | | Change-Id: I01ce83a2da66bb65af37c0ecc92372789cb85c01
| * QmlJS: Fix more invalid M325 casesChristian Stenger2022-04-221-1/+13
| | | | | | | | | | | | | | Fixes: QTCREATORBUG-27380 Change-Id: I76d1ef3d2f2a4cc9d930a006ecb3b564efea3fbc Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
* | Merge remote-tracking branch 'origin/7.0'Eike Ziller2022-03-281-1/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | Conflicts: cmake/QtCreatorIDEBranding.cmake qbs/modules/qtc/qtc.qbs qtcreator_ide_branding.pri src/plugins/studiowelcome/recentpresets.h src/plugins/studiowelcome/userpresets.h Change-Id: Ie573b945eb28347a36ee1b3582fbd6ab0c0f866c
| * QmlDesigner: Add invalid ids to QmlJSCheckThomas Hartmann2022-03-241-1/+2
| | | | | | | | | | | | | | Also improving document message for exceptions. Change-Id: I7878987ce73f5d4891ced3c702c7804b25b07eb3 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
* | qmljs: correctly handle js string templatesFawzi Mohamed2022-03-211-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In most cases we do want to visit the expressions in a function template. Changing its accept0 would force those not wanting to visit it to iterate on the templates (currently a linked list), so we add a visit method explicitly visiting the expression in all the needed places. Fixes: QTCREATORBUG-21869 Change-Id: I47733544bfd32eec357810b97242608b8f7de572 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
* | Merge remote-tracking branch 'origin/7.0'Eike Ziller2022-02-141-1/+13
|\ \ | |/ | | | | Change-Id: Iab67dffe64bee391bd921ed8832bb17b36ec861b
| * QmlJS: Soften strict equality check Pt IIIChristian Stenger2022-02-111-1/+13
| | | | | | | | | | | | | | | | | | | | Adapt to differences Qt5 vs Qt6. Fixes: QTCREATORBUG-25917 Change-Id: Ieee1cf0442016c62b82bd932dd62d0dc9a78bc26 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
* | QmlDesigner: Show error/warning for root referenceHenning Gruendl2022-02-071-0/+38
|/ | | | | | | | | | | | | Show an error when an alias property references the root item directly. Show a warning when an alias property references the root item in a hierarchy. Task-number: QDS-4380 Change-Id: I312fc0296e3bb2321a4d9e1113bd0cd4c1c0b8ed Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* QmlJsCheck: Allow new connection syntax in ConnectionsThomas Hartmann2021-12-021-1/+5
| | | | | | | Change-Id: Ibbef3f8e8230d727d3183fa1615e0f38373a3c7f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix some compiler warningsChristian Kandeler2021-11-221-0/+2
| | | | | Change-Id: I9128afcf56bd47cb6627012bb6b0d13395b432ac Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* QmlJS: Add error message for Component with multiple childrenThomas Hartmann2021-11-121-3/+24
| | | | | | | | | | | | | Component is only allowed to have a single child element, that will be the root element of the component. If there is no child at all we create a warning. Having no child is temporarily required. Change-Id: I5c0d9d9cdf1be106b20ed4f1134a973d58126498 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* QmlJS: Soften strict equality check Pt IIChristian Stenger2021-11-081-3/+5
| | | | | | | | | | | Disable strict equality check for undefined values as there are too many ways the code model just assumes "undefined" as the information would be present at runtime only or to avoid too complex evaluation. Task-number: QTCREATORBUG-25917 Change-Id: I7c6da04f52ba767c4ef5c21078dc14ac4de86687 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlJS: Soften strict equality checkChristian Stenger2021-10-151-1/+16
| | | | | | | | | | | | | Judging on the sense of a strict equality check depends on different aspects. As attached properties cannot be inspected easily and e.g. function calls cannot be evaluated as they may have different return values for different code paths we need to soften the check to avoid false positives. Fixes: QTCREATORBUG-25917 Change-Id: I121335a387eb235090346162df4703d3000b7426 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlDesigner: Add support for Component typeMiikka Heikkinen2021-10-051-1/+0
| | | | | | | | | Component type is added to Component Library and can be dragged to the scene. Items under the component are not shown in the scene. Fixes: QDS-5093 Change-Id: I0c80647e73124866a8b772022a761ca6cbb545a1 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* Merge remote-tracking branch 'origin/5.0' into 6.0Eike Ziller2021-10-051-1/+1
|\ | | | | | | Change-Id: I311d1128c6a299c1db8717a12b40393055a889bb
| * QmlDesigner: Allow resolvedUrl in ui.qml filesThomas Hartmann2021-09-301-1/+1
| | | | | | | | | | Change-Id: I220582466ffe62392b78419b9a2f6b83cf73f9af Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
* | Merge remote-tracking branch 'origin/5.0'hjk2021-07-211-8/+9
|\ \ | |/ | | | | Change-Id: I9409f35cb9d1bc2e57631d2bfa3a0931ff5dd259
| * QmlDesigner: Disallow ApplicationWindowThomas Hartmann2021-07-161-8/+9
| | | | | | | | | | | | | | | | | | | | | | ApplicationWindow is not properly working in the design mode and files using ApplicationWindow are usually not written with the design mode in mind. Task-number: QTCREATORBUG-25984 Task-number: QTCREATORBUG-25983 Change-Id: Ia30ec26e9078ca0a9c1da11970202983e15ce4c8 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* | QmlJSCheck: Add error for mixing translation functionsThomas Hartmann2021-07-201-0/+18
|/ | | | | | | Change-Id: I0f5fd2edf2d8bf13938d9e18eadada5c8c1b85f2 Reviewed-by: Tapani Mattila <tapani.mattila@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
* Revert "Revert "Merge remote-tracking branch 'origin/4.15'""Eike Ziller2021-05-071-1/+30
| | | | | | | | | | | This reverts commit f0a86d45104f585b7aeef07fcc68cea24061aedb. Reverting a merge doesn't "undo" it - the changes would be lost forever even with subsequent merges. So we need to revert the revert to get the changes. Change-Id: I65928f876f4dc886561bed17c4b2aa42b388c1e3 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* Revert "Merge remote-tracking branch 'origin/4.15'"Marco Bubke2021-05-061-30/+1
| | | | | | | | | This reverts commit 888ca0dd20ff647970fc85340e108cfa34d78c3a. Reason for revert: wrong patchset Change-Id: I1291789938601aaf606c59917ff938e3c24c78dd Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* Merge remote-tracking branch 'origin/4.15'Tim Jenssen2021-05-061-1/+30
|\ | | | | | | | | | | | | | | Conflicts: src/libs/sqlite/sqlitebasestatement.h src/plugins/qmldesigner/qmldesignerplugin.cpp Change-Id: I0fa0a8a7feffed24c0d2bc26eca86590f1156755
| * QmlJS: Restrict warnings of blocksChristian Stenger2021-05-051-1/+20
| | | | | | | | | | | | | | | | | | Warn only if the block contains a var statement as this is discouraged. Fixes: QTCREATORBUG-24214 Change-Id: Ib96c6723e82b6ddce0b7b63f23d3408f45ae7d58 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| * QmlJS: Fix checking for case and default blocksChristian Stenger2021-05-051-0/+10
| | | | | | | | | | | | | | | | | | | | case and default blocks inside a switch statement are just special statement lists which need proper handling to avoid wrong warnings regarding using standalone blocks. Task-number: QTCREATORBUG-24214 Change-Id: Ia682b13ed4df21c5831308193d5abaf5163bde59 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* | QmlJS: Suppress wrong warningChristian Stenger2021-05-061-2/+2
|/ | | | | | | | | When a type is created inside a file with the same name do not warn if the created type is namespaced. Fixes: QTCREATORBUG-24615 Change-Id: Icb2b1a9fd1a02ee222084b676ee818eed65a7c93 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QmlJsCheck: Do not allow print as idThomas Hartmann2021-04-161-28/+6
| | | | | | Task-number: QDS-4162 Change-Id: I425c75cd42c0842ead27a6c801c3a483284407ea Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* qmljs: add check for comparisons not depending on valuesFawzi Mohamed2021-02-031-0/+36
| | | | | | | | | | currently we mainly try to warn about primitive == null/undefined or primitive === non primitive. There are other that we could warn about null==null null==undefined, but I feel that they might be triggered too much by clean code. Change-Id: Id43d838d60a4e13f361be34e4bb38211777a081e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* qmljs: fix qmljscheckFawzi Mohamed2021-02-031-47/+35
| | | | | | | | | | | | | | | * fix ASTVariableReference::value: correctly get reference value type by using either initialiser of bindingTarget (broken since a codemodel update in 2018) * disable warning for casting in bool to null comparison (it does not cast, is always false) * fix property checks (where skipped without default of readonly) * remove non relevant checks (ErrInvalidPropertyType for lowercase now that custom value types are supported, and for properties called data) * updated import version Change-Id: I38407acf327d0f773b38dda4c02fb4d95a420851 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Make QmlJS(Tools) build with Qt5 & Qt6Eike Ziller2020-09-171-14/+14
| | | | | | | Port from QStringRef to QStringView Change-Id: I472d16f20e40ca52b8e5d481850a6bd8a1a38f3b Reviewed-by: hjk <hjk@qt.io>
* QmlJSCheck: Fix crashThomas Hartmann2020-09-141-1/+4
| | | | | | Task-number: QDS-2766 Change-Id: I4b0e81b8104ac35a286a318e87e95ea022ed66f6 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
* QmlJSCheck: Workaround for ListElementThomas Hartmann2020-09-031-1/+4
| | | | | | | | | | When editing QML there are false positives reported for ListElement. Task-number: QDS-2602 Task-number: QDS-2716 Change-Id: If3fc297d6609213448f8353e9406b3f0aaf65870 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
* qmljs: fix unreachable test for catch clauseFawzi Mohamed2020-08-031-2/+22
| | | | | | Change-Id: Ica1ff034b88f06849026957c8beed2cda77badcc Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Merge remote-tracking branch 'origin/qds-1.59' into 4.13Tim Jenssen2020-06-261-1/+0
|\ | | | | | | | | | | | | | | | | Conflicts: src/plugins/clangformat/clangformatplugin.cpp src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp src/plugins/qmldesigner/qmldesigner.qbs Change-Id: Ie4a0beeb9fd32ac9683f4e8769988a9c3f3e369a
| * qmldesigner: enable Transion in QmlUi filesTim Jenssen2020-06-261-1/+0
| | | | | | | | | | Change-Id: I2e35e8a2dc7b946297c70fd775bd3e3366295271 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>