suggestions from @max-schaefer

Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
This commit is contained in:
Erik Krogh Kristensen
2019-10-29 12:10:12 +01:00
committed by GitHub
parent 92cebea235
commit 563f32193c
2 changed files with 4 additions and 4 deletions

View File

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

View File

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