Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions javascript/ql/src/semmle/javascript/frameworks/Bundling.qll
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,20 @@ Comment getExclamationPointCommentInRun(ExclamationPointComment head) {
* Holds if this is a bundle containing multiple licenses.
*/
predicate isMultiLicenseBundle(TopLevel tl) {
// case: comments preserved by minifiers
count(ExclamationPointComment head |
head.getTopLevel() = tl and
exists(ExclamationPointComment licenseIndicator |
licenseIndicator = getExclamationPointCommentInRun(head) and
licenseIndicator.getLine(_).regexpMatch("(?i).*\\b(copyright|license|\\d+\\.\\d+)\\b.*")
)
) > 1
or
// case: ordinary block comments with "@license" lines
count(BlockComment head |
head.getTopLevel() = tl and
head.getLine(_).regexpMatch("(?i) *\\* @license .*")
) > 1
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
| jsx.js:0:0:0:0 | jsx.js | generated |
| multi-part-bundle.html:0:0:0:0 | multi-part-bundle.html | generated |
| multi-part-bundle.js:0:0:0:0 | multi-part-bundle.js | generated |
| multiple-licenses-2.js:0:0:0:0 | multiple-licenses-2.js | generated |
| multiple-licenses.js:0:0:0:0 | multiple-licenses.js | generated |
| opal-test.js:0:0:0:0 | opal-test.js | generated |
| peg-js.js:0:0:0:0 | peg-js.js | generated |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* @copyright (c) ...
* @copyright (c) ...
* @license ...
*/

/**
* @copyright ...
* @license ...
*/