| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When file selectors are used, we loose too much information currently,
as we completely discard everything we know about the type.
[ChangeLog][qmllint] qmllint and the LSP now no longer print warnings
about ambiguous types if file selectors are used, and instead use the
"plain" version. The QML script compiler will still conservatively
reject such QML files. If warnings about such cases are desired,
the new "importFileSelector" warning category can be enabled.
Task-number: QTBUG-137075
Pick-to: 6.10
Change-Id: Ia87d5ab62003fe8d7d2ab9569fac2942fb1c7c14
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Until we support a proper representation of enums in the type system,
all we can do is warn the user that enums can't be used as types.
After the improved runtime warning added in a recent commit, this patch
adds a qmllint warning to warn about the same issue but at
'compile time'.
Fixes: QTBUG-135255
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I02266f21266e59eb6d4a4dbe0e4335b845c62133
Reviewed-by: Sami Shalayel <[email protected]>
|
|
|
|
|
|
|
|
|
| |
Warn in qmllint when encountering "==" or "!=" about possible type
coercions between JS objects, numbers, strings and booleans.
Task-number: QTBUG-129307
Change-Id: Ib9b8057c1b4eca760c4f40825f4053aa35f1680b
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
If a property binding is a js block without any statements, it could
mean that the user intended to create an object literal instead of an
empty block that returns undefined.
Task-number: QTBUG-129307
Change-Id: If242ddac140cce6479062194b785096ba1f6c0a6
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
| |
A test was slightly adapted as a result.
Task-number: QTBUG-129307
Change-Id: I07ac61b183d9d7d237e9cf51ce3a0c6c280daa45
Reviewed-by: Sami Shalayel <[email protected]>
|
|
|
|
|
|
|
|
| |
Two other tests needed to be updated as a result.
Task-number: QTBUG-129307
Change-Id: I1470a5ae93cc20ef90ffd63471bd36408b61af57
Reviewed-by: Sami Shalayel <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Warn about ExpressionStatements that has no obvious effect in qmllint,
for example "x * 3;" is an expression statement that is either useless
or that potentially triggers user code with potential side-effects
during the custom coercion of "x". Warn that the expression statement
has no obvious effect.
Don't warn about expression statements inside of bindings: "y: x * 3" is
completely fine, for example.
Task-number: QTBUG-129307
Change-Id: I065ddce7394276296062545c1516ab9b4ad9f24d
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Warn in QQmlJSTypePropagator::generate_LoadQmlContextPropertyLookup()
about usages of context properties that were found. Also treat context
properties as var.
Add the (C++) location of the "setContextProperty()" call to the
warning, and also hint that a property is assumed to be a context
property when inside a top-level component (capital C Component, inline
component or implicitly wrapped as component) because it is not
declared as required property.
Still print the accompanying unqualified warnings next to the new
context property warning.
Add a test.
Later patches will add the support to qmlls and qmllint by passing
the workspace folders to the new functionality.
Task-number: QTBUG-128232
Change-Id: I26e39e0bce8c6e9f203962a091209c7acd15d445
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
| |
Task-number: QTBUG-129307
Change-Id: I95f633299ca94cb27c545a97a465bb5e24b5e3e8
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
| |
Fixes: QTBUG-119781
Task-number: QTBUG-119890
Change-Id: I392819ad0a47e0457c4b888894893ac37a77fa11
Reviewed-by: Ulf Hermann <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
| |
Fixes: QTBUG-117300
Task-number: QTBUG-119890
Change-Id: If503b3dbfe9c8ad916afa3b570861f62c33e1fbd
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The warnings should be part of the linting visitor.
Introduce a new warning category for the exising warning about
duplicate enum entries.
Amends bbce9ea73fcb060916b75094f5a7fc64be5d7edd
This also (re)moves the test for warnings about enums in inline
components from qmltc. These warnings should be generated by qmllint.
Some files that had enum inside of inline components may no longer fail
to compile because of the warning. This is fine as the enum is not
accessible anyways.
Amends f368be4320306b637bdd5d7d8318cdb75406f2e4
Task-number: QTBUG-119890
Change-Id: I90f280e2e443504ab336b4c2ad85bf7e53e4544f
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
| |
Fixes: QTBUG-127325
Task-number: QTBUG-119890
Change-Id: I20b497da025dec8050ea94fc604db33a3ebdde77
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
Implement the confusing pluses and minuses warnings. Those are triggered
for weird combinations of unary pluses and pre increments inside of
additions. (same for unary minuses and pre decrements).
Task-number: QTBUG-129307
Change-Id: I45c202efa58a588090d872f0bf8f43523c24a957
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
| |
Warn about usages of the void keyword. This warning is off by default,
mirroring the behavior of eslint.
Task-number: QTBUG-129307
Change-Id: Iba1cc09e028d5053ef1aa28f01f1694efa5c250f
Reviewed-by: Semih Yavuz <[email protected]>
|
|
|
|
|
|
|
|
|
| |
Implement the WarnXConstructor and complain about a specific set of
constructors.
Task-number: QTBUG-129307
Change-Id: I27e0cfcb1f061bb2efff1721da4a2bbdb01fcf2f
Reviewed-by: Semih Yavuz <[email protected]>
|
|
|
|
|
|
|
|
| |
Warn when comma expressions are used outside of for-loops.
Task-number: QTBUG-129307
Change-Id: Ic86bf3af7f122f73b70e18c728c72f64c355f982
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
| |
Fixes: QTBUG-126715
Task-number: QTBUG-129307
Change-Id: I739587bf6d44131d9a0bdcec4df60ab3f53e1a12
Reviewed-by: Sami Shalayel <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
Merge conflicts are slowing us down quite a bit when working on
qmllint. Sorting the logging categories will reduce their number.
As a drive-by: fix macro
Change-Id: Ibee997c79b29128c209018a2aa010a35e7d13991
Reviewed-by: Sami Shalayel <[email protected]>
|
|
|
|
|
|
|
|
| |
The binding might not update if their value changes.
Fixes: QTBUG-112508
Change-Id: I27801d662117a89c0fdddc2aaa2f1dde21b238df
Reviewed-by: Sami Shalayel <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The compiler is very polite and does not tell the user about its useless
code. Codegen::statementList(StatementList *ast) silently discards
unreachable statements during byte code generation.
Warn the user that their code is unreachable. Don't warn about
function definitions because these ones are "hoisted" up,
which means that their definition is supposed to be pushed up, so that
they can be used even if they are behind a "return" or "throw"
statement.
Don't use the qqmljsbasicblock analysis for that, it reports too many
"false positives" where the compiler generates dead code that can't be
fixed by the user.
Task-number: QTBUG-129307
Change-Id: Ia26e8af1adf4e63b26dcaa7fb10be73b7eb084d7
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Warn about functions used before their declaration. Its not technically
an error like the "var used before declaration" because functions are
"hoisted up" and therefore available even before their declaration, so
create a new warning category for it instead of reusing the "var used
before declaration" category. Disable the warning by default: Qt Creator
used to have it as default, while other tools like eslint don't.
For the same reason, don't warn about functions used before declaration
during codegen, and add a method to warn about it in
CodeGenWarningInterface. The code for "var used before declaration"
can be reused by function declarations by adding a sourcelocation for
function declarations in the "addLocalVar"-call, so make sure to
differentiate between functions and vars by adding an extra member to
Context::ResolvedName.
Task-number: QTBUG-129307
Change-Id: I83a4f8cd00c120db23a0cec3365a00ed44de2836
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
| |
Using an optional lookup '?.' on a base type that cannot be null or
undefined or when looking up an enum value is pointless. We generate a
normal lookup for this in the compiler, but the bytecode keeps these
redundant instructions in.
Task-number: QTBUG-135649
Change-Id: I95d8b4ed22afa1bdc46a3f8b3d60a499d43931ac
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
Complain about usages of Eval in qmllint, and make the
qqmljstypepropagator analyze eval calls.
Task-number: QTBUG-129307
Change-Id: I577612220383c624e960db60ed755e0f2dbc59aa
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
| |
Warn for assignments inside of if-statement conditions.
Task-number: QTBUG-129307
Change-Id: If1e4d85b6cdbf4f076d91dcf8d7600988f51d6a1
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It seems that mixing different translation functions (id-based with
non-id based translations) is not supported in the same qml file.
Therefore, emit a warning when mixing up id and non-id translation
methods.
Currently, it is not possible to have warnings for mixing usages of
QT_TRANSLATE_NOOP(), QT_QSTR_NOOP(), QT_QSTRID_NOOP() but that
should not be too important for the actual feature, as calls to
QT_QSTR_NOOP and QT_TRANSLATE_NOOP only make sense when there is
a qsTr or qsTranslate around.
Add a QEXPECT_FAIL test for that.
Task-number: QTBUG-129308
Change-Id: I8b19ca997cd6b4b8619c53c079dd72b9510fb904
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
QQmlSA is meant as the public namespace, QQmlJS is (at least currently)
completely internal. However, LoggerWarningID currently only existed in
QQmlJS.
Move it into QQmlSA, add some minimal class documentation and add a
typedef in QQmlJS (inside a private header) to avoid the need to modify
all users.
Pick-to: 6.6.0 6.6
Change-Id: Icff860c92054ac810c6e15eb26090d38fbc2c965
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It now has public API, and users shouldn't need to link against
QmlCompilerPrivate to gain access to that API.
Change some includes to avoid syncqt complaints, and remove a
superfluous const to avoid pedantic warnings.
Pick-to: 6.6
Change-Id: I00ac8713f6bd9d1437300bc833cf16b62216caa0
Reviewed-by: Ulf Hermann <[email protected]>
Reviewed-by: Qt CI Bot <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
| |
It is not needed by the QQmlSA API. Additionally, remove the comparison
operator for LoggerCategory and LoggerId, and replace its users by
getting the id from the category before comparing.
Pick-to: 6.6
Change-Id: I7747b09b941cfd5326b95d2ee2f78b0ee10991d3
Reviewed-by: Ulf Hermann <[email protected]>
Reviewed-by: Semih Yavuz <[email protected]>
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
| |
Change-Id: Ia3dc17a31856047b9fd7c5da89320c7234847a59
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
This patch adds abstractions for QML Elements, Bindings, Methods and
Properties. This abstraction layer avoids exposing internal details and
should be more suited for static analysis tasks. It is now possible to
write qmllint plugins without including private headers.
As a drive-by, change tst_qmllint:verifyJsRoot to open files in text
mode instead of binary. This fixes an issue where line endings cause
issues on Windows.
Fixes: QTBUG-102276
Change-Id: I6b6e53f1e0078734a18f3aa51807fbe875b375f0
Reviewed-by: Fabian Kosmale <[email protected]>
|