mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
Merge pull request #657 from esben-semmle/js/classify-more-files
JS: classify additional files
This commit is contained in:
@@ -42,8 +42,8 @@ class CodeGeneratorMarkerComment extends GeneratedCodeMarkerComment {
|
||||
*/
|
||||
private predicate codeGeneratorMarkerComment(Comment c, string tool) {
|
||||
exists (string toolPattern |
|
||||
toolPattern = "js_of_ocaml|CoffeeScript|LiveScript|dart2js|ANTLR|PEG\\.js|Opal|JSX|jison(?:-lex)?" and
|
||||
tool = c.getText().regexpCapture("(?s)[\\s*]*(?:parser )?[gG]eneratedy? (?:from .*)?by (" + toolPattern + ")\\b.*", 1)
|
||||
toolPattern = "js_of_ocaml|CoffeeScript|LiveScript|dart2js|ANTLR|PEG\\.js|Opal|JSX|jison(?:-lex)?|(?:Microsoft \\(R\\) AutoRest Code Generator)|purs" and
|
||||
tool = c.getText().regexpCapture("(?s)[\\s*]*(?:parser |Code )?[gG]eneratedy? (?:from .*)?by (" + toolPattern + ")\\b.*", 1)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -114,6 +114,17 @@ private predicate isData(File f) {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `f` is a generated HTML file.
|
||||
*/
|
||||
private predicate isGeneratedHtml(File f) {
|
||||
exists(HTML::Element e |
|
||||
e.getFile() = f and
|
||||
e.getName() = "meta" and
|
||||
e.getAttributeByName("name").getValue() = "generator"
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `tl` looks like it contains generated code.
|
||||
*/
|
||||
@@ -124,12 +135,14 @@ predicate isGenerated(TopLevel tl) {
|
||||
tl instanceof DartGeneratedTopLevel or
|
||||
exists (GeneratedCodeMarkerComment gcmc | tl = gcmc.getTopLevel()) or
|
||||
hasManyInvocations(tl) or
|
||||
isData(tl.getFile())
|
||||
isData(tl.getFile()) or
|
||||
isGeneratedHtml(tl.getFile())
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if `file` look like it contains generated code.
|
||||
*/
|
||||
predicate isGeneratedCode(File file) {
|
||||
isGenerated(file.getATopLevel())
|
||||
isGenerated(file.getATopLevel()) or
|
||||
isGeneratedHtml(file)
|
||||
}
|
||||
|
||||
@@ -222,10 +222,10 @@ predicate isMultiLicenseBundle(TopLevel tl) {
|
||||
)
|
||||
) > 1
|
||||
or
|
||||
// case: ordinary block comments with "@license" lines
|
||||
// case: ordinary block comments lines that start with a license
|
||||
count(BlockComment head |
|
||||
head.getTopLevel() = tl and
|
||||
head.getLine(_).regexpMatch("(?i) *\\* @license .*")
|
||||
head.getLine(_).regexpMatch("(?i)[\\s*]*(@license\\b.*|The [a-z0-9-]+ License (\\([a-z0-9-]+\\))?\\s*)")
|
||||
) > 1
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
/*
|
||||
* Code generated by Microsoft (R) AutoRest Code Generator.
|
||||
* Changes may cause incorrect behavior and will be lost if the code is
|
||||
* regenerated.
|
||||
*/
|
||||
@@ -1,7 +1,10 @@
|
||||
| AutoRest.js:0:0:0:0 | AutoRest.js | generated |
|
||||
| ai.1.2.3-build0123.js:0:0:0:0 | ai.1.2.3-build0123.js | library |
|
||||
| bundle-directive.js:0:0:0:0 | bundle-directive.js | generated |
|
||||
| data.js:0:0:0:0 | data.js | generated |
|
||||
| etherpad.html:0:0:0:0 | etherpad.html | generated |
|
||||
| exported-data.js:0:0:0:0 | exported-data.js | generated |
|
||||
| htmltidy.html:0:0:0:0 | htmltidy.html | generated |
|
||||
| jison-lex.js:0:0:0:0 | jison-lex.js | generated |
|
||||
| jison.js:0:0:0:0 | jison.js | generated |
|
||||
| jquery-datatables.js:0:0:0:0 | jquery-datatables.js | library |
|
||||
@@ -12,12 +15,19 @@
|
||||
| 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-3.js:0:0:0:0 | multiple-licenses-3.js | generated |
|
||||
| multiple-licenses-4.js:0:0:0:0 | multiple-licenses-4.js | generated |
|
||||
| multiple-licenses.js:0:0:0:0 | multiple-licenses.js | generated |
|
||||
| opal-test.js:0:0:0:0 | opal-test.js | generated |
|
||||
| orgmode.html:0:0:0:0 | orgmode.html | generated |
|
||||
| pandoc.html:0:0:0:0 | pandoc.html | generated |
|
||||
| peg-js.js:0:0:0:0 | peg-js.js | generated |
|
||||
| polymer.html:0:0:0:0 | polymer.html | template |
|
||||
| purs-bundle.js:0:0:0:0 | purs-bundle.js | generated |
|
||||
| purs.js:0:0:0:0 | purs.js | generated |
|
||||
| some-template.html:0:0:0:0 | some-template.html | template |
|
||||
| templ.js:0:0:0:0 | templ.js | template |
|
||||
| textmate.html:0:0:0:0 | textmate.html | generated |
|
||||
| tmpl2.html:0:0:0:0 | tmpl2.html | template |
|
||||
| tmpl.html:0:0:0:0 | tmpl.html | template |
|
||||
| tst.browserify.js:0:0:0:0 | tst.browserify.js | generated |
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
| AutoRest.js:1:1:5:3 | /*\\n * C ... ed.\\n */ | Microsoft (R) AutoRest Code Generator |
|
||||
| jison-lex.js:1:1:1:34 | /* gene ... .2.1 */ | jison-lex |
|
||||
| jison.js:1:1:1:38 | /* pars ... 4.13 */ | jison |
|
||||
| jsx-old.js:1:1:1:106 | // gene ... 977102) | JSX |
|
||||
| jsx.js:1:1:1:105 | // gene ... 977102) | JSX |
|
||||
| opal-test.js:1:1:1:30 | /* Gene ... 10.3 */ | Opal |
|
||||
| peg-js.js:2:3:6:5 | /*\\n * ... /\\n */ | PEG.js |
|
||||
| purs-bundle.js:1:1:1:34 | // Gene ... 0.11.7 | purs |
|
||||
| purs.js:1:1:1:35 | // Gene ... 0.11.7 | purs |
|
||||
| tst.dart.js:1:1:1:57 | // Gene ... mpiler. | dart2js |
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title><%- padId %></title>
|
||||
<meta name="generator" content="Etherpad">
|
||||
<script type="text/javascript">//</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="generator" content="HTML Tidy for Linux/x86 (vers 25 March 2009), see www.w3.org">
|
||||
<script type="text/javascript">//</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* @license
|
||||
*/
|
||||
/**
|
||||
* @license
|
||||
*/
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*/
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*/
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* The MIT License (MIT)
|
||||
*/
|
||||
/**
|
||||
* The user needs to accept the licence.
|
||||
*/
|
||||
function hasAcceptedLicense(){
|
||||
// ...
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<meta name="generator" content="Org-mode"/>
|
||||
<script type="text/javascript">//</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="generator" content="pandoc" />
|
||||
<script type="text/javascript">//</script>
|
||||
</head>
|
||||
<body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
// Generated by purs bundle 0.11.7
|
||||
@@ -0,0 +1 @@
|
||||
// Generated by purs version 0.11.7
|
||||
@@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta name="generator" content="TextMate http://macromates.com/">
|
||||
<script type="text/javascript">//</script>
|
||||
</head>
|
||||
<body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user