mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
JS: classify bundle files based on multiple license comments
This commit is contained in:
@@ -213,6 +213,7 @@ 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 |
|
||||
@@ -220,6 +221,12 @@ predicate isMultiLicenseBundle(TopLevel tl) {
|
||||
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
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user