| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
It otherwise went unused.
Pick-to: 6.10 6.9 6.8 6.5
Change-Id: I255a53247d0cfce29d958425d1f8f2895eb093e7
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As a comment already points out, having an empty replacement message is
possible. In that case, we shouldn't attempt to print it.
Add a dedicated test-setup for QQmlJSLogger, to make it easier to expand
tests there.
Pick-to: 6.10 6.9 6.8
Fixes: QTBUG-138871
Change-Id: I55c5de140fe8175e9deaca519bb734654dc366f4
Reviewed-by: Sami Shalayel <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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]>
|
|
|
|
|
|
|
|
| |
Amends 959836a5b3e2cc106ed8c05649c81ed873aa12e2
Change-Id: I64a04f20beed34cb853e69a356734bcb6f7f0349
Reviewed-by: Semih Yavuz <[email protected]>
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]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow warnings to be emitted in multiple parts, as a preparation step to
have two warnings for "var-used-before-declaration": one of the usage
and one for the declaration.
Added an extra parameter to log that overrides the line number used to
determine whether the current warning is ignored or not. This assumes
that both main and secondary messages both use the same warning
category.
Task-number: QTBUG-129307
Change-Id: I82ed01d417070b13e3c91ea82218e0d858e10d24
Reviewed-by: Olivier De Cannière <[email protected]>
Reviewed-by: Ulf Hermann <[email protected]>
Reviewed-by: Fabian Kosmale <[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]>
|
|
|
|
|
|
|
|
|
|
|
| |
Added some macros to static_assert that the logging categories are
unique in name, settings name and description. This excludes empty
strings.
A duplicate description was already found and fixed thanks to this.
Change-Id: I9fd689065f5bb3a567143ed78211800f88543408
Reviewed-by: Sami Shalayel <[email protected]>
|
|
|
|
|
|
|
|
| |
Warn for assignments inside of if-statement conditions.
Task-number: QTBUG-129307
Change-Id: If1e4d85b6cdbf4f076d91dcf8d7600988f51d6a1
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
| |
Fix a typo in the top-level-component description.
Pick-to: 6.8 6.9
Task-number: QTBUG-135020
Change-Id: I22b0e83567fa71346486d206e21e182fabde2718
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
|
|
|
| |
The category is default, it has no setting name and also no commandline
parameter. Remove the bogus ones and use empty strings instead.
Task-number: QTBUG-135020
Change-Id: Ie8847a379c86f705cb7883615bb71b76e08ec4ce
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
| |
Make sure both have their own setting key, but still support the
previous "buggy" setting key. Print a deprecated warning when finding
the buggy setting key in a setting file.
Task-number: QTBUG-135020
Change-Id: I364e7e41380de43a0883bcf4d3f6cefcf11b6c90
Reviewed-by: Olivier De Cannière <[email protected]>
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Amends d876ce343d5875ec132aa1b878970f03cbae353d and add a description
and a settingname to the missing-enum-entry category, so that it can get
registered into qmllint.
Also fix the test to expect a warning instead of an info message. Info
messages are selected by default for unregistered categories.
Task-number: QTBUG-135020
Change-Id: I1fe3684bb12c198633bb86e1cb96a390f352739b
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before this commit, adding one warning category required changing three
different code locations. This makes adding new categories complicated
and error-prone. We will need to potentially add a lot of new categories
for QTBUG-129307, and d876ce343d5875ec132aa1b878970f03cbae353d is an
example where a warning category was introduced but not registered into
qmllint (it can't be controlled with commandline parameters, nor
settings, nor is it listed by qmllints --help method...).
With this commit, new warning categories only need to be added in two places:
the QMLLINT_DEFAULT_CATEGORIES macro and the public header
qqmljsloggingcategories.h.
Task-number: QTBUG-135020
Task-number: QTBUG-129307
Change-Id: I915ae8da7fe0a01b7518ed8c113be5bb640de75b
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a new disabled mode to qqmljslogger that is used when warnings
emitted by qqmljsimportvisitor are actually not shown to the user. Add a
comment explaining the difference to a silenced logger (that still
processes warnings and can be used to generate a JSON representation of
the warnings) and a disabled logger (that does not contain any warning).
Disable the logger in QQmlJSTypeReader that is only used for the (lazy
file creation.
This avoids expensive didYouMean() calls that slow down the linter and
only create warnings that are ignored by the linter.
Also add some ifs to qqmljslogger to avoid any useless computations when
the logger is disabled anyway.
This commit makes the runtime of tst_qmllint_benchmark:onlyQdsLintPlugin
on qtdesign-studio/examples/DesignEffectsDemo/content/Gallery.ui.qml go
from 500ms to 135ms (mean over 3 iterations) when the QtDesign studio
modules import paths are unavailable.
Task-number: QTBUG-133349
Change-Id: I5abaa5e6776e39f2dee7f1a92577a240dd5c61c1
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We should only have one way to handle diagnostic messages: The
QQmlJSLogger. In addition each compile pass may result in an error that
prevents the running of further passes. But that error should not rely
on the selection of messages posted earlier.
For this to work we need to introduce a further state transition into
the logger. The logger now "archives" messages after compiling each
function, so that only the current function's compile errors are taken
into account as result of the current function's compilation.
Task-number: QTBUG-124913
Change-Id: I4b6d9910b80527cefb1aba02598114d1fe5ba172
Reviewed-by: Olivier De Cannière <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Certain compile passes may be run multiple times and only the last run
counts. We need to be able to roll back the logger to the state before
the pass in that case.
Amends commit d70abd83dc94d722cde6d4b19b9d35c5f4f19946
Pick-to: 6.9
Task-number: QTBUG-124913
Change-Id: Ie6174fc3d6ce60ca3f0a3fa27484a58e6febcc17
Reviewed-by: Olivier De Cannière <[email protected]>
Reviewed-by: Fabian Kosmale <[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]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In qmllint, the import warnings are printed right after the "warnings
occurred while importing" warning despite them having no sourcelocation.
This warning gets a default sourcelocation when used in qmlls which
points to the first line of the file, so the "Failed to import" warning
ends up an the first line of a file, and not on the same line as the
"warnings occurred while importing" warning. This is confusing for users.
Modify a test to expect that the "Failed to import" warning has a valid
sourcelocation, so that it is shown on the correct line in qmlls.
Fixes: QTBUG-131958
Pick-to: 6.8 6.9
Change-Id: Ia0c327b82e89cd0a003d05b4c3efe693fb3b3ed7
Reviewed-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, it would hold the location of the copy in the build
directory or in the resource file system.
This should improve the accuracy of the information that we can report
back. For example, the file location of files reported in aotstats will
now be those in the source folder.
The changes necessary for this patch were found through trial and error
by asserting that the filePath respect a certain form and fixing what I
could. There remain cases where the filePath still contains a location
in the build directory. We would need some other change to report those
accurately as well.
Finally, sometimes the filePath is empty or does not contain a valid
path at all but instead what seems to be the location of an included
file. It can have the form "private/..._p.h" for example.
Pick-to: 6.8
Change-Id: I77a2596f6c4a179580d924a6e9324e43dbb86c0c
Reviewed-by: Ulf Hermann <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
| |
This is done in prepartion for the following patch in the chain.
Pick-to: 6.8
Change-Id: If8ce75be8ba00e7e4cdd5a0f5e66319ab0d36755
Reviewed-by: Sami Shalayel <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
| |
This causes the lines logged to be shown in Qt Creator's issues pane.
Fixes: QTCREATORBUG-31526
Change-Id: I2c55d09a779cd4a51df5dda0e4ef894de235f974
Reviewed-by: Sami Shalayel <[email protected]>
Reviewed-by: Olivier De Cannière <[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's still happening with GCC 13.
My guess is that the includes changed so the disabling wasn't applying.
Amends 067d5a3334558c378dd67246e26cce78650e78cc.
Pick-to: 6.5 6.6
Change-Id: I80612a7d275c41f1baf0fffd177a234b8fd398e1
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
| |
Change-Id: Ib9ffe5e604ccbdb7e841b28111954e38b862b15a
Reviewed-by: Sami Shalayel <[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]>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Most checks in isRestricted were redundant. Only those related to enums
seem to be useful. These are kept in the new checkForEnumProblems while
isRestricted is removed.
The error checking in checkForEnumProblems should also provide better
error messages for enum problems.
Pick-to: 6.5
Change-Id: Ic3f3589464ebe519bee8b4c580b2e80d310c937f
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move the detection into the QtQuick lint plugin. It's mostly meant for
QQC, so let's auto-enable it for attached types derived from
QQuickAttachedPropertyPropagator.
To this end, two new categories are introduced: The Quick lint plugin
gets its own attached-property-reuse category which is synonymous to the
default category of the same name. Furthermore, we add a
controls-attached-property-reuse category for only checking controls.
That one is implied by either of the others.
Finally, fix the id vs. scope resolution to actually do something.
This way we can give appropriate hints when the outer type has an ID
already.
Pick-to: 6.5
Fixes: QTBUG-110834
Change-Id: Ib71a9e3bbc10bac77f36db6cc441af88df20fd33
Reviewed-by: Fabian Kosmale <[email protected]>
|
|
|
|
|
|
|
|
|
| |
In this form we can expose it in QQmlSA.
Pick-to: 6.5
Task-number: QTBUG-110834
Change-Id: Ieb0cf31b6e86379c0d80f89bc6c63b129f269798
Reviewed-by: Fabian Kosmale <[email protected]>
|