summaryrefslogtreecommitdiff
path: root/src/libs/qmljs/qmljscheck.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QmlJS: Add warning if we use a Qt Quick 1 code model for Qt Quick 2Thomas Hartmann2013-11-141-2/+24
| | | | | | | | | In some cases we use a Qt Quick 1 code model for a file with Qt Quick 2 imports. This patch adds a warning for this, since auto completion is incomplete. Change-Id: I60888fd269c02f38da097104f5ecc982dd65573a Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
* Rename "[Mm]ethod(s)" to "[Ff]unction(s)"Nikolai Kosjar2013-10-101-1/+1
| | | | | | | | | | | Only methods as programming functions are affected. Besides renaming some actions like "Switch Between Function Declaration/Definition" this mostly touches (api) code comments. This is a follow-up patch to commit 872bfb7. Change-Id: Icb65e8d73b59a022f8885b14df497169543a3b92 Reviewed-by: hjk <hjk121@nokiamail.com>
* Reduce usage of QStringRef::toString() in QmlJS/QmlJSTools.Friedemann Kleint2013-08-291-3/+4
| | | | | Change-Id: I9db2a0b21bf430d6f450e1e860a0c2a02272536f Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
* qmljs: add vector*d, quaternion, and matrix4x4 to code modelFawzi Mohamed2013-08-221-0/+8
| | | | | | | | | | Added vector2d vector4d, quaternion and matrix4x4 to basic types and extended completions related to them in the code model. Task-number: QTCREATORBUG-9929 Change-Id: Iafdbdf5792f640e8eb29d866a372542ee07159a5 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Clean headers in QmlJs.Friedemann Kleint2013-04-041-3/+0
| | | | | | | | Ran script to remove inludes on a trial-and-error basis and manually corrected it (Parser excluded). Change-Id: I5ec6e1076430009bb72094411b2c3386f8bea548 Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
* Merge remote-tracking branch 'origin/2.6'Oswald Buddenhagen2013-01-311-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/autotoolsprojectmanager/AutotoolsProjectManager.pluginspec.in src/plugins/debugger/qtmessageloghandler.cpp src/plugins/debugger/qtmessagelogwindow.cpp src/plugins/madde/maemodeployconfigurationwidget.cpp src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp src/plugins/qmldesigner/designercore/include/widgetqueryview.h src/plugins/qmldesigner/designercore/metainfo/metainfoparser.cpp src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.cpp src/plugins/qmldesigner/designercore/model/modelnodecontextmenu.h src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp src/plugins/qnx/bardescriptormagicmatcher.h src/plugins/qt4projectmanager/profilekeywords.cpp src/plugins/remotelinux/deployablefilesperprofile.cpp src/plugins/remotelinux/deployablefilesperprofile.h src/plugins/remotelinux/deploymentinfo.cpp src/plugins/remotelinux/deploymentsettingsassistant.cpp src/plugins/remotelinux/profilesupdatedialog.cpp tests/auto/icheckbuild/ichecklib.cpp tests/auto/icheckbuild/parsemanager.cpp tests/auto/icheckbuild/parsemanager.h Change-Id: Ie465a578446a089e1c502d1cb1096e84ca058104
| * Incremented year in copyright infov2.6.2Robert Loehning2013-01-291-1/+1
| | | | | | | | | | Change-Id: Ic6a9ff0359625021ebc061d22db6811814534205 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* | Remove braces for single lines of conditionsOrgad Shaneh2013-01-081-26/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #!/usr/bin/env ruby Dir.glob('**/*.cpp') { |file| # skip ast (excluding paste, astpath, and canv'ast'imer) next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i s = File.read(file) next if s.include?('qlalr') orig = s.dup s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m| res = $& if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces res else res.gsub!('} else', 'else') res.gsub!(/\n +} *\n/m, "\n") res.gsub(/ *{$/, '') end } s.gsub!(/ *$/, '') File.open(file, 'wb').write(s) if s != orig } Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc Reviewed-by: hjk <qthjk@ovi.com>
* | Fix: build failure for qmljscheck an qmljscodeformatterDavid Schulz2012-11-281-2/+2
| | | | | | | | | | Change-Id: Iba9686506d971f92e525361e93d648dc940fe2d2 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* | QmlJS: Compile with QT_NO_CAST_FROM_ASCIIOrgad Shaneh2012-11-281-2/+2
| | | | | | | | | | | | Change-Id: I0c5654a978f47a4db5428936fd44633f21394830 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
* | QmlJSEditor: crash fixThomas Hartmann2012-10-101-2/+1
| | | | | | | | | | | | | | | | The typeStack has to stay in sync and initializers for properties do not have a type. Change-Id: I49f7d1679d083c994fd692a1c36e33ba7fce17ff Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* | Merge remote-tracking branch 'origin/2.6'Eike Ziller2012-10-051-21/+20
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: share/qtcreator/qml/qmlpuppet/commands/endpuppetcommand.cpp share/qtcreator/qml/qmlpuppet/commands/endpuppetcommand.h src/plugins/debugger/qtmessageloghandler.cpp src/plugins/debugger/qtmessageloghandler.h src/plugins/debugger/qtmessagelogwindow.cpp src/plugins/madde/maemodeployconfigurationwidget.cpp src/plugins/madde/maemodeployconfigurationwidget.h src/plugins/remotelinux/deployablefilesperprofile.cpp src/plugins/remotelinux/deployablefilesperprofile.h src/plugins/remotelinux/deploymentinfo.cpp src/plugins/remotelinux/deploymentinfo.h src/plugins/remotelinux/deploymentsettingsassistant.cpp src/plugins/remotelinux/profilesupdatedialog.cpp src/plugins/remotelinux/remotelinuxdeploymentdatamodel.h tests/auto/icheckbuild/ichecklib.cpp tests/auto/icheckbuild/ichecklib_global.h tests/auto/icheckbuild/parsemanager.cpp tests/auto/icheckbuild/parsemanager.h tests/manual/ssh/tunnel/tunnel.h Change-Id: I04d7761df6bd936ad00e0547974284c967d39580
| * Adjust license headershjk2012-10-051-21/+20
| | | | | | | | | | Change-Id: Ice592c6de9951ee3b2c4cb52ed0bb3b6770e0825 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
* | QmlJS.Check: Warnings for qml code not supported by Qt Quick DesignerThomas Hartmann2012-09-171-7/+131
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds several warnings for qml code not supported by Qt Quick Designer. * WarnImperativeCodeNotEditableInVisualDesigner: This warns about imperative code affecting a visual property. e.g.: "x = 10;" * WarnUnsupportedTypeInVisualDesigner: This warns about types which are currently not supported. * WarnReferenceToParentItemNotSupportedByDesigner: This warns about things like: "width: parent.width" in the root item. * WarnUndefinedValueForDesigner: This warns about visual properties that cannot be evaluated in the local context. e.g.: "x: somethingNotDefinedInTheLocalContext.x" * WarnStatesOnlyInRootItemForDesigner: This warns about states not defined in the root item. All the Qt Quick designer related warnings are disabled by default in Check. Change-Id: If31a8199fb95dc8bf6ac613634a2e442e436e267 Reviewed-by: Christian Kamm <kamm@incasoftware.de>
* Remove some unused member variablesTobias Hunger2012-08-221-1/+0
| | | | | Change-Id: I4b1bcfe8da32bd48c601d1efdb7c3aac1d39cbce Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
* Contact -> qt-project.orgEike Ziller2012-07-191-3/+1
| | | | | Change-Id: I7134d7de30bcf9f9dcfad42520dd45ee083a852d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Compile after qt5/qtbase commit 75a0c7f9Bradley T. Hughes2012-04-301-1/+1
| | | | | | | | | | | Commit 75a0c7f9b52cde47f20fdc1b89e1264d60350848 in qt5/qtbase changed some QRegExp methods to be non-const (they were previously const). This change makes Qt Creator compile again. Change-Id: Ibc98c678126c3b3189df7fcc043463b940951445 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
* Removed module names from #include directives.Erik Verbruggen2012-02-151-4/+4
| | | | | | | | Getting the #include directives ready for Qt5. This includes the new-project wizards. Change-Id: Ia9261f1e8faec06b9285b694d2b7e9a095978d2b Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
* Long live the king!hjk2012-01-261-1/+1
| | | | | Change-Id: I2b72b34c0cfeafc8bdbaf49b83ff723544f2b6e2 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
* QmlJS checks: Disable warnings about expression statements in bindings.Christian Kamm2011-12-021-14/+11
| | | | | Change-Id: Ic3aca50bec93ec3b810dbda2f9b57eefb966bbdf Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* QmlJS checks: Don't warn for fallthrough on the last clause.Christian Kamm2011-11-291-6/+3
| | | | | Change-Id: Ica84ced241eafd82cededa65d2e90f855e448f89 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* QmlJS checks: Accept 'fallthrough' comment to terminate case blocks.Christian Kamm2011-11-291-9/+40
| | | | | Change-Id: Icf71416e8aa892089b0918529b94f4cd6a1db5a3 Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
* QmlJS check: Extend "don't use var" performance warning.Christian Kamm2011-11-221-2/+13
| | | | | | | | | | * now also recognizes color, rect, point, size, vector3d * to do detect these correctly, set the return types on a number of builtin Qt.* functions * add test Change-Id: Ieaeb73be208af2d47e1bb4fa1485dc876705ee20 Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
* Merge remote-tracking branch 'origin/2.4'Eike Ziller2011-11-111-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/libs/qmljs/qmljsinterpreter.cpp src/libs/qmljs/qmljsinterpreter.h src/plugins/debugger/qml/scriptconsole.cpp src/plugins/git/gitplugin.cpp src/plugins/qmlprofiler/canvas/qdeclarativetiledcanvas.cpp src/plugins/qmlprofiler/canvas/qdeclarativetiledcanvas_p.h Change-Id: Iad59c8d87c72a21c79c047e374c0ab689998af39
| * all: s/info@qt.nokia.com/qt-info@nokia.com/hjk2011-11-031-2/+2
| | | | | | | | | | Change-Id: If18afb5d4665924e7d9250dccbc60a65e6daa75e Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
* | QmlJS checks: Fix // @disable-check at beginning of line.Christian Kamm2011-11-081-1/+1
| | | | | | | | | | Change-Id: Iae9b9f499d3c2c6b3e3cc1be93e2b62508363aec Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
* | QmlJS checks: Add @enable-all-checks annotation.Christian Kamm2011-10-311-2/+8
| | | | | | | | | | | | | | | | | | | | It enables all checks, even those that we deem to annoying to be enabled by default. Also fix a bug where some disabled checks had the wrong severity. Change-Id: Id434ad62dabafac979ee2304a85d368b9ea98fa4 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
* | QmlJS checks: Change suppression annotation to @disable-check.Christian Kamm2011-10-311-1/+1
| | | | | | | | | | Change-Id: I913cd757c4f8339a518c947569c5ba651153f1c1 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
* | Merge remote-tracking branch 'origin/2.4'Eike Ziller2011-10-281-2/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | Conflicts: qtcreator.pri src/libs/qmljs/qmljscheck.cpp src/plugins/debugger/gdb/gdbengine.cpp src/plugins/debugger/gdb/remotegdbserveradapter.cpp src/plugins/plugins.pro src/plugins/projectexplorer/buildmanager.cpp src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp Change-Id: Id2dcebf95b94dc46c1d85908ba1d1378aaf362ac
| * QmlJS checks: Make 'unintentional empty block' warning less annoying.Christian Kamm2011-10-241-2/+1
| | | | | | | | | | | | | | Already fixed differently in master. Change-Id: I92f7665166b2b1ca4f3d4598825b04f3f19d4772 Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
* | QmlJS checks: Warn about extra message suppressions.Christian Kamm2011-10-211-18/+61
| | | | | | | | | | | | Reviewed-by: Fawzi Mohamed Change-Id: I4038cd863ba80c1719417cd03b755b047f7d8b5e Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
* | QmlJS checks: Suppression of static analysis messages.Christian Kamm2011-10-191-1/+33
| | | | | | | | | | | | | | | | * Use '// @disable M123' to suppress * Add quick fix to add these comments Change-Id: I499f5a6004148afbb346218c6fb01c9ca77b9f73 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* | QmlJS checks: Add hint about not using var/variant property types.Christian Kamm2011-10-191-12/+29
| | | | | | | | | | Change-Id: I79c5c4db78eb96eda7c6f5d543bb5063d5670968 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* | QmlJS: Introduce UnknownValue.Christian Kamm2011-10-181-7/+7
| | | | | | | | | | | | | | To distinguish known-to-be-undefined from a genuinely unknown value. Change-Id: I606b4ea4d726f94553400b8950d3c0a4e76564a8 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
* | QmlJS checks: Limit warning about unintentional empty blocks.Christian Kamm2011-10-181-2/+3
| | | | | | | | | | | | | | | | | | | | | | width: { } should not trigger a warning. We now only warn if { and } are on the same line. Change-Id: I45fa846ff63d0a83de782c412212165845c07e72 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
* | QmlJS: Add more value_casts.Christian Kamm2011-10-121-4/+4
| | | | | | | | | | | | | | | | | | | | And switch all existing dynamic_casts to value_casts. Change-Id: I93b89358e4802080f40b332074c64f4e91a2bc4c Reviewed-on: http://codereview.qt-project.org/6311 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
* | QmlJS checks: Allow calling some builtin constructors as functions.Christian Kamm2011-10-121-1/+6
| | | | | | | | | | | | | | | | | | | | String, Boolean, Number and Object perform type conversion. Date returns the current date. Change-Id: I51e5bcbb0fa85ceb30b3ee3749f96c3e3b12ca21 Reviewed-on: http://codereview.qt-project.org/6043 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
* | QmlJS checks: Hint about extra parentheses.Christian Kamm2011-10-121-0/+32
| | | | | | | | | | | | | | | | | | Migrated from QtChecker. Change-Id: I85f7dd039ac858b103dfe0af257f66031540c5de Reviewed-on: http://codereview.qt-project.org/5969 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
* | QmlJS checks: Disable some checks when imports failed.Christian Kamm2011-10-121-20/+30
| | | | | | | | | | | | | | | | | | The important error in this case is on the import. Change-Id: I3a547ca7ac44a89aba6819ea80ec52185071408a Reviewed-on: http://codereview.qt-project.org/5879 Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com> Sanity-Review: Christian Kamm <christian.d.kamm@nokia.com>
* | QmlJS checks: Add hint about not using multiple statements per line.Christian Kamm2011-10-101-0/+27
| | | | | | | | | | | | | | | | | | Migrated from QtChecker. Change-Id: Ia76067a5f0e443a61a7b78ca9081f5a1bb51b471 Reviewed-on: http://codereview.qt-project.org/5861 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
* | QmlJS checks: Add warning about 'eval'.Christian Kamm2011-10-101-0/+2
| | | | | | | | | | | | | | | | | | Migrated from QtChecker. Change-Id: I4b3e8993c7b9f697497d2199b24bf49379dbc1b4 Reviewed-on: http://codereview.qt-project.org/5860 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
* | QmlJS checks: Warn when using some builtin constructors.Christian Kamm2011-10-101-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | Number, String, Array, Object, Function and Boolean should not be used. Migrated from QtChecker. Change-Id: I8aee41f12389196ed49c44e26eb04d3fac040a2b Reviewed-on: http://codereview.qt-project.org/5859 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
* | QmlJS checks: Add confusing +/- check.Christian Kamm2011-10-101-0/+29
| | | | | | | | | | | | | | | | | | Migrated from QtChecker. Change-Id: I06115152f979f9abfa9cbdf4a3e2e63a51ea7284 Reviewed-on: http://codereview.qt-project.org/5858 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com> Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* | QmlJS checks: Add check for spacing around binary operators.Christian Kamm2011-10-101-4/+15
| | | | | | | | | | | | | | | | | | Adapted from QtChecker. Change-Id: I434582314e6431c56c9628a5a642bbfb032dfc2f Reviewed-on: http://codereview.qt-project.org/5857 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com> Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* | QmlJS checks: Add Hint about anonymous function formatting.Christian Kamm2011-10-101-0/+10
| | | | | | | | | | | | | | | | | | Migrated from QtChecker. Change-Id: I0178cc189d1c98b51e1aeb43db7421ba8c43fc7e Reviewed-on: http://codereview.qt-project.org/5856 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com> Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* | QmlJS checks: Add severity and unique id to messages.Christian Kamm2011-10-101-192/+175
| | | | | | | | | | | | | | Change-Id: I2cded26524c3f64152107e65d740658e3003ffac Reviewed-on: http://codereview.qt-project.org/5790 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
* | QmlJS: Move commonly used functions to qmlutils.h.Christian Kamm2011-10-101-89/+3
| | | | | | | | | | | | | | Change-Id: I22376d96fe575bc00a55094c06af80e32a5587e6 Reviewed-on: http://codereview.qt-project.org/6238 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
* | QmlJS: Allow 'var' property type.Christian Kamm2011-10-061-1/+2
|/ | | | | | | | It's new in Qt 5. Change-Id: If3e670d42528ca6996ae280d96077ce744d281d9 Reviewed-on: http://codereview.qt-project.org/6121 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* QmlJS checks: Add tests and fix small bugs for 'unreachable'.Christian Kamm2011-09-201-11/+22
| | | | | | | Change-Id: Iaf9febc841130fa913fcc071ed0bf28ff9e0b63b Reviewed-on: http://codereview.qt-project.org/5149 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
* QmlJS: Change from QMap to QHash for QString keys.Christian Kamm2011-09-191-1/+1
| | | | | | | | | Tests indicate that lookup in QHash<QString, ...> is more performant even for short strings. Change-Id: I8e5a73d0f1a72e202522f397b16901887f9c3591 Reviewed-on: http://codereview.qt-project.org/5070 Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>