From ee93ee65e24bf44e83a6a6b1ca562e0f48bd8dfd Mon Sep 17 00:00:00 2001 From: Michael Rodler Date: Wed, 5 Aug 2020 12:02:36 +0200 Subject: [PATCH] Added CodeQL language support --- languages.json | 6 ++++++ tests/data/codeql.ql | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/data/codeql.ql diff --git a/languages.json b/languages.json index d9b5d556a..1719b5654 100644 --- a/languages.json +++ b/languages.json @@ -185,6 +185,12 @@ "line_comment": ["*"], "extensions": ["cob", "cbl", "ccp", "cobol", "cpy"] }, + "CodeQL": { + "line_comment": ["//"], + "multi_line_comments": [["/*", "*/"]], + "quotes": [["\\\"", "\\\""]], + "extensions": ["ql", "qll"] + }, "CoffeeScript": { "line_comment": ["#"], "multi_line_comments": [["###", "###"]], diff --git a/tests/data/codeql.ql b/tests/data/codeql.ql new file mode 100644 index 000000000..8c7bd3dd5 --- /dev/null +++ b/tests/data/codeql.ql @@ -0,0 +1,40 @@ +//! 40 lines 17 code 15 comments 8 blanks + +/** + * @name fu + * @description bar + * + * Rerum similique consequatur non dolor sit. Autem doloribus sed in sint + * ratione sit voluptates at. Nihil ut fugiat ab ut aliquid consequatur sunt + * ullam. Adipisci voluptatem hic dicta. + */ + +// asdf + +import cpp +private import test.foo.bar.baz + +/** + * Another comment. + */ +class C extends Expr { + C () { + // single comment + not this.test() and + not this.what() + } + + private predicate what() { + /* TODO */ + this.isAbstract() + } + + predicate test() { this = "what" } +} + +from Function f +where + f.getName() = "function" and /* inline comment */ + f.getArgument(0).asExpr() instanceof FooBar +select f, "function" +