mirror of
https://github.com/github/codeql.git
synced 2025-12-24 12:46:34 +01:00
suggestions from @max-schaefer
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
92cebea235
commit
563f32193c
@@ -5,7 +5,7 @@
|
||||
<overview>
|
||||
<p>
|
||||
The <code>concat</code>, <code>join</code> and <code>slice</code> methods are
|
||||
pure and does not modify any of the inputs or the array the method was called
|
||||
pure and do not modify any of the inputs or the array the method was called
|
||||
on. It is therefore generally an error to ignore the return value from a call
|
||||
to one of these methods.
|
||||
</p>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* @name Ignoring result from pure array method
|
||||
* @description The array methods do not modify the array, ignoring the result of such a call is therefore generally an error.
|
||||
* @description Ignoring the result of an array method that does not modify its receiver is generally an error.
|
||||
* @kind problem
|
||||
* @problem.severity warning
|
||||
* @id js/ignore-array-result
|
||||
* @tags maintainability,
|
||||
* @tags maintainability
|
||||
* correctness
|
||||
* @precision high
|
||||
*/
|
||||
@@ -16,7 +16,7 @@ DataFlow::SourceNode callsArray(DataFlow::TypeBackTracker t, DataFlow::MethodCal
|
||||
isIgnoredPureArrayCall(call) and
|
||||
(
|
||||
t.start() and
|
||||
result = call.getReceiver()
|
||||
result = call.getReceiver().getALocalSource()
|
||||
or
|
||||
exists(DataFlow::TypeBackTracker t2 | result = callsArray(t2, call).backtrack(t2, t))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user