JavaScript: Generalize description of `js/unused-local-variable`.

The query also flags unused imports, functions and classes (which, of course, are just unused variables at the end of the day). This is now made more explicit in the description.
This commit is contained in:
Max Schaefer 2018-08-06 09:31:32 +01:00
Родитель d91218e248
Коммит 06f43748b8
3 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -45,6 +45,7 @@
| Server-side URL redirect | More true-positive results | This rule now treats header names case-insensitively. |
| Uncontrolled command line | More true-positive results | This rule now recognizes indirect command injection through `sh -c` and similar. |
| Unused variable | Fewer results | This rule no longer flags class expressions that could be made anonymous. While technically true, these results are not interesting. |
| Unused variable | Renamed | This rule has been renamed to "Unused variable, import, function or class" to reflect the fact that it flags different kinds of unused program elements. |
## Changes to QL libraries

Просмотреть файл

@ -7,11 +7,15 @@
Unused local variables make code hard to read and understand. Any computation used to initialize
an unused variable is wasted, which may lead to performance problems.
</p>
<p>
Similarly, unused imports and unused functions or classes can be confusing. They may even be
a symptom of a bug caused, for example, by an incomplete refactoring.
</p>
</overview>
<recommendation>
<p>Remove the unused variable.</p>
<p>Remove the unused program element.</p>
</recommendation>
<example>

Просмотреть файл

@ -1,6 +1,7 @@
/**
* @name Unused variable
* @description Unused variables may be a symptom of a bug and should be examined carefully.
* @name Unused variable, import, function or class
* @description Unused variables, imports, functions or classes may be a symptom of a bug
* and should be examined carefully.
* @kind problem
* @problem.severity recommendation
* @id js/unused-local-variable