Skip to content

Commit 5b1af0c

Browse files
committed
Added detection of custom gulp-plumber sanitizer, thus one would not flag such instances.
1 parent b104871 commit 5b1af0c

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

javascript/ql/src/Quality/UnhandledStreamPipe.ql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,15 @@ predicate hasErrorHandlerRegistered(PipeCall pipeCall) {
188188
handler = streamRef(pipeCall).getAMethodCall(getEventHandlerMethodName()) and
189189
handler.getArgument(0).getStringValue() = "error"
190190
)
191+
or
192+
hasPlumber(pipeCall)
193+
}
194+
195+
/**
196+
* Holds if one of the arguments of the pipe call is a `gulp-plumber` monkey patch.
197+
*/
198+
predicate hasPlumber(PipeCall pipeCall) {
199+
streamRef+(pipeCall) = API::moduleImport("gulp-plumber").getACall()
191200
}
192201

193202
/**

javascript/ql/test/query-tests/Quality/UnhandledStreamPipe/test.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,3 @@
1313
| test.js:185:5:185:32 | copyStr ... nation) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
1414
| test.js:190:17:190:40 | notStre ... itable) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
1515
| test.js:195:17:195:40 | notStre ... itable) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
16-
| test.js:207:5:207:64 | getStre ... e(dest) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |
17-
| test.js:212:5:212:56 | getStre ... e(dest) | Stream pipe without error handling on the source stream. Errors won't propagate downstream and may be silently dropped. |

javascript/ql/test/query-tests/Quality/UnhandledStreamPipe/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,11 @@ function test() {
204204
}
205205
{
206206
const plumber = require('gulp-plumber');
207-
getStream().pipe(plumber()).pipe(dest).pipe(dest).pipe(dest); // $SPURIOUS:Alert
207+
getStream().pipe(plumber()).pipe(dest).pipe(dest).pipe(dest);
208208
}
209209
{
210210
const plumber = require('gulp-plumber');
211211
const p = plumber();
212-
getStream().pipe(p).pipe(dest).pipe(dest).pipe(dest); // $SPURIOUS:Alert
212+
getStream().pipe(p).pipe(dest).pipe(dest).pipe(dest);
213213
}
214214
}

0 commit comments

Comments
 (0)