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
parent d91218e248
commit 06f43748b8
3 changed files with 9 additions and 3 deletions

View File

@@ -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>

View File

@@ -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