Skip to content

JavaScript: Teach AutoBuild to exclude files from extraction by default.#510

Merged
semmle-qlci merged 1 commit intogithub:masterfrom
xiemaisi:js/exclude-minified
Nov 21, 2018
Merged

JavaScript: Teach AutoBuild to exclude files from extraction by default.#510
semmle-qlci merged 1 commit intogithub:masterfrom
xiemaisi:js/exclude-minified

Conversation

@xiemaisi
Copy link

This adds default exclusion filters for **/*.min.js and **/*-min.js to the JavaScript auto-builder, meaning that files matching these patterns will no longer be extracted, unless they are re-included in the .lgtm.yml file.

Alerts in minified code aren't shown by default anyway, so we can save ourselves some work by not analyzing them in the first place. While including minified files in the snapshot can in theory improve analysis results in non-minified files, this is likely to be rare in practice, and of course the omitted files can always be re-included via .lgtm.yml.

As an extreme example, for https://github.com/docker/docker.github.io the number of extracted files drops from 466 to 377, while total analysis time goes down from 4895 seconds to 2660 seconds, all without affecting results (in non-minified files). Of course, for most other projects the effects are not going to be this dramatic.

… by default .

This adds default exclusion filters for `**/*.min.js` and `**/*-min.js` to the JavaScript auto-builder, meaning that files matching these patterns will no longer be extracted,
unless they are re-included in the `.lgtm.yml` file.

Alerts in minified code aren't shown by default anyway, so we can save ourselves some work by not analyzing them in the first place.

While including minified files in the snapshot can in theory improve analysis results in non-minified files, this is likely to be rare in practice.
@xiemaisi xiemaisi added the JS label Nov 21, 2018
@xiemaisi xiemaisi requested a review from a team as a code owner November 21, 2018 12:34
@asger-semmle
Copy link
Contributor

LGTM

I personally think we could go even further and exclude things like build, dist, node_modules and bower_components.

@semmle-qlci semmle-qlci merged commit 746b13a into github:master Nov 21, 2018
@xiemaisi xiemaisi deleted the js/exclude-minified branch November 26, 2018 16:18
cklin pushed a commit that referenced this pull request May 23, 2022
Add an example query for catching cases where defer is used in a loop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants