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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,7 @@ ClojureScript (cljs)
CMake (cmake, cmake.in, CMakeLists.txt)
COBOL (CBL, cbl, ccp, COB, cob, cobol, cpy)
CoCoA 5 (c5, cocoa5, cocoa5server, cpkg5)
CodeQL (ql, qll)
CoffeeScript (_coffee, cakefile, cjsx, coffee, iced)
ColdFusion (cfm, cfml)
ColdFusion CFScript (cfc)
Expand Down
5 changes: 5 additions & 0 deletions Unix/t/00_C.t
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ my @Tests = (
'ref' => '../tests/outputs/Buchberger.cocoa5.yaml',
'args' => '../tests/inputs/Buchberger.cocoa5',
},
{
'name' => 'CodeQL',
'ref' => '../tests/outputs/CodeQL.ql.yaml',
'args' => '../tests/inputs/CodeQL.ql',
},
{
'name' => 'ColdFusion',
'ref' => '../tests/outputs/ColdFusion.cfm.yaml',
Expand Down
8 changes: 8 additions & 0 deletions cloc
Original file line number Diff line number Diff line change
Expand Up @@ -8950,6 +8950,8 @@ sub set_constants { # {{{1
'COB' => 'COBOL' ,
'cocoa5' => 'CoCoA 5' ,
'code-workspace' => 'VSCode Workspace' ,
'ql' => 'CodeQL' ,
'qll' => 'CodeQL' ,
'c5' => 'CoCoA 5' ,
'cpkg5' => 'CoCoA 5' ,
'cocoa5server'=> 'CoCoA 5' ,
Expand Down Expand Up @@ -10222,6 +10224,11 @@ sub set_constants { # {{{1
[ 'remove_matches' , '^\s*--' ],
[ 'remove_inline' , '--.*$' ],
],
'CodeQL' => [
[ 'rm_comments_in_strings', '"', '/*', '*/' ],
[ 'rm_comments_in_strings', '"', '//', '' ],
[ 'call_regexp_common' , 'C++' ],
],
'CoffeeScript' => [
[ 'remove_matches' , '^\s*#' ],
[ 'remove_inline' , '#.*$' ],
Expand Down Expand Up @@ -12050,6 +12057,7 @@ sub set_constants { # {{{1
'CMake' => 1.00,
'COBOL' => 1.04,
'CoCoA 5' => 1.04,
'CodeQL' => 2.50,
'CoffeeScript' => 2.00,
'Constraint Grammar' => 4.00,
'Containerfile' => 2.00,
Expand Down
16 changes: 16 additions & 0 deletions tests/inputs/CodeQL.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* @name Find unused variables
* @description Finds local variables that are defined but never used.
* @kind problem
* @problem.severity warning
*/

import javascript

// Find all variable declarations
from Variable v, DeclStmt decl
where
decl.getADecl().getBindingPattern() = v.getADeclaration() and
not exists(VarAccess access | access.getVariable() = v) and
not v.getName().matches("\\_%")
select v, "Variable '" + v.getName() + "' is declared but never used."
21 changes: 21 additions & 0 deletions tests/outputs/CodeQL.ql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# github.com/AlDanial/cloc
header :
cloc_url : github.com/AlDanial/cloc
cloc_version : 2.09
elapsed_seconds : 0.00732088088989258
n_files : 1
n_lines : 16
files_per_second : 136.595583924966
lines_per_second : 2185.52934279945
report_file : tests/outputs/CodeQL.ql.yaml
'CodeQL' :
nFiles: 1
blank: 2
comment: 7
code: 7
SUM:
blank: 2
comment: 7
code: 7
nFiles: 1