Skip to content

Commit 4d97570

Browse files
authored
Merge pull request #17 from xiemaisi/js/rename-unused-var
Approved by esben-semmle
2 parents 87f9ecb + 06f4374 commit 4d97570

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

change-notes/1.18/analysis-javascript.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
| Server-side URL redirect | More true-positive results | This rule now treats header names case-insensitively. |
4747
| Uncontrolled command line | More true-positive results | This rule now recognizes indirect command injection through `sh -c` and similar. |
4848
| Unused variable | Fewer results | This rule no longer flags class expressions that could be made anonymous. While technically true, these results are not interesting. |
49+
| 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. |
4950

5051
## Changes to QL libraries
5152

javascript/ql/src/Declarations/UnusedVariable.qhelp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@
77
Unused local variables make code hard to read and understand. Any computation used to initialize
88
an unused variable is wasted, which may lead to performance problems.
99
</p>
10+
<p>
11+
Similarly, unused imports and unused functions or classes can be confusing. They may even be
12+
a symptom of a bug caused, for example, by an incomplete refactoring.
13+
</p>
1014

1115
</overview>
1216
<recommendation>
1317

14-
<p>Remove the unused variable.</p>
18+
<p>Remove the unused program element.</p>
1519

1620
</recommendation>
1721
<example>

javascript/ql/src/Declarations/UnusedVariable.ql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
2-
* @name Unused variable
3-
* @description Unused variables may be a symptom of a bug and should be examined carefully.
2+
* @name Unused variable, import, function or class
3+
* @description Unused variables, imports, functions or classes may be a symptom of a bug
4+
* and should be examined carefully.
45
* @kind problem
56
* @problem.severity recommendation
67
* @id js/unused-local-variable

0 commit comments

Comments
 (0)