Skip to content

Commit ccde7cf

Browse files
committed
Add @id to example queries
1 parent bdce7d0 commit ccde7cf

File tree

142 files changed

+142
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+142
-0
lines changed

cpp/ql/examples/snippets/addressof.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/addressof
23
* @name Address of reference variable
34
* @description Finds address-of expressions (`&`) that take the address
45
* of a reference variable

cpp/ql/examples/snippets/arrayaccess.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/arrayaccess
23
* @name Array access
34
* @description Finds array access expressions with an index expression
45
* consisting of a postfix increment (`++`) expression.

cpp/ql/examples/snippets/castexpr.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/castexpr
23
* @name Cast expressions
34
* @description Finds casts from a floating point type to an integer type
45
* @tags cast

cpp/ql/examples/snippets/catch_exception.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/catch-exception
23
* @name Catch exception
34
* @description Finds places where we catch exceptions of type `parse_error`
45
* @tags catch

cpp/ql/examples/snippets/constructor_call.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/constructor-call
23
* @name Call to constructor
34
* @description Finds places where we call `new MyClass(...)`
45
* @tags call

cpp/ql/examples/snippets/derives_from_class.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/derives-from-class
23
* @name Class derives from
34
* @description Finds classes that derive from `std::exception`
45
* @tags base

cpp/ql/examples/snippets/emptyblock.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/emptyblock
23
* @name Empty blocks
34
* @description Finds empty block statements
45
* @tags empty

cpp/ql/examples/snippets/emptythen.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/emptythen
23
* @name If statements with empty then branch
34
* @description Finds `if` statements where the `then` branch is
45
* an empty block statement

cpp/ql/examples/snippets/eq_true.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/eq-true
23
* @name Equality test on boolean
34
* @description Finds tests like `==true`, `!=true`
45
* @tags equal

cpp/ql/examples/snippets/field_access.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/field-access
23
* @name Access of field
34
* @description Finds reads of `aDate` (defined on class `Order`)
45
* @tags access

cpp/ql/examples/snippets/function_call.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/function-call
23
* @name Call to function
34
* @description Finds calls to `std::map<...>::find()`
45
* @tags call

cpp/ql/examples/snippets/integer_literal.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/integer-literal
23
* @name Integer literal
34
* @description Finds places where we use the integer literal `2`
45
* @tags integer

cpp/ql/examples/snippets/mutualrecursion.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/mutualrecursion
23
* @name Mutual recursion
34
* @description Finds pairs of functions that call each other
45
* @tags function

cpp/ql/examples/snippets/override_method.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/override-method
23
* @name Override of method
34
* @description Finds methods that override `std::exception::what()`
45
* @tags function

cpp/ql/examples/snippets/returnstatement.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/returnstatement
23
* @name Return statements
34
* @description Finds return statements that return `0`
45
* @tags return

cpp/ql/examples/snippets/singletonblock.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/singletonblock
23
* @name Singleton blocks
34
* @description Finds block statements containing a single statement
45
* @tags block

cpp/ql/examples/snippets/switchcase.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/switchcase
23
* @name Switch statement case missing
34
* @description Finds switch statements with a missing enum constant case
45
* and no default case

cpp/ql/examples/snippets/ternaryconditional.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/ternaryconditional
23
* @name Conditional expressions
34
* @description Finds conditional expressions of the form `... ? ... : ...`
45
* where the types of the resulting expressions differ

cpp/ql/examples/snippets/throw_exception.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/throw-exception
23
* @name Throw exception of type
34
* @description Finds places where we throw `parse_error` or one of its sub-types
45
* @tags base

cpp/ql/examples/snippets/todocomment.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/todocomment
23
* @name TODO comments
34
* @description Finds comments containing the word "TODO"
45
* @tags comment

cpp/ql/examples/snippets/toomanyparams.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/toomanyparams
23
* @name Functions with many parameters
34
* @description Finds functions or methods with more than 10 parameters
45
* @tags function

cpp/ql/examples/snippets/unusedlocalvar.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/unusedlocalvar
23
* @name Unused local variable
34
* @description Finds local variables that are not accessed
45
* @tags variable

cpp/ql/examples/snippets/unusedmethod.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/unusedmethod
23
* @name Unused private method
34
* @description Finds private non-virtual methods that are not accessed
45
* @tags method

cpp/ql/examples/snippets/unusedparam.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/unusedparam
23
* @name Unused parameter
34
* @description Finds parameters that are not accessed
45
* @tags parameter

cpp/ql/examples/snippets/voidreturntype.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/voidreturntype
23
* @name Const method without return type
34
* @description Finds const methods whose return type is `void`
45
* @tags const

cpp/ql/examples/snippets/volatilevariable.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cpp/examples/volatilevariable
23
* @name Variable declared volatile
34
* @description Finds variables with a `volatile` modifier
45
* @tags variable

csharp/ql/examples/snippets/array_access.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/array-access
23
* @name Array access
34
* @description Finds array access expressions with an index expression
45
* consisting of a unary increment or decrement, e.g. 'a[i++]'.

csharp/ql/examples/snippets/cast_expr.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/cast-expr
23
* @name Cast expressions
34
* @description Finds casts from a floating point type to an integer type.
45
* @tags cast

csharp/ql/examples/snippets/catch_exception.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/catch-exception
23
* @name Catch exception
34
* @description Finds places where we catch exceptions of type 'System.IO.IOException'.
45
* @tags catch

csharp/ql/examples/snippets/constructor_call.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/constructor-call
23
* @name Call to constructor
34
* @description Finds places where we call 'new System.Exception(...)'.
45
* @tags call

csharp/ql/examples/snippets/empty_block.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/empty-block
23
* @name Empty blocks
34
* @description Finds empty block statements.
45
* @tags empty

csharp/ql/examples/snippets/empty_then.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/empty-then
23
* @name If statements with empty then branch
34
* @description Finds 'if' statements where the 'then' branch is
45
* an empty block statement.

csharp/ql/examples/snippets/eq_true.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/eq-true
23
* @name Equality test on Boolean
34
* @description Finds tests like 'x==true', 'x==false', 'x!=true', '!=false'.
45
* @tags equals

csharp/ql/examples/snippets/extend_class.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/extend-class
23
* @name Class extends/implements
34
* @description Finds classes/interfaces that extend/implement 'System.Collections.IEnumerator'.
45
* @tags class

csharp/ql/examples/snippets/extern_method.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/extern-method
23
* @name Extern methods
34
* @description Finds methods that are 'extern'.
45
* @tags method

csharp/ql/examples/snippets/field_read.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/field-read
23
* @name Read of field
34
* @description Finds reads of 'VirtualAddress' (defined on 'Mono.Cecil.PE.Section').
45
* @tags field

csharp/ql/examples/snippets/integer_literal.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/integer-literal
23
* @name Integer literal
34
* @description Finds places where we use the integer literal '0'.
45
* @tags integer

csharp/ql/examples/snippets/method_call.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/method-call
23
* @name Call to method
34
* @description Finds calls to method 'Company.Class.MethodName'.
45
* @tags call

csharp/ql/examples/snippets/mutual_recursion.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/mutual-recursion
23
* @name Mutual recursion
34
* @description Finds pairs of methods that call each other.
45
* @tags method

csharp/ql/examples/snippets/null_argument.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/null-argument
23
* @name Add null to collection
34
* @description Finds places where we add 'null' to a collection.
45
* @tags null

csharp/ql/examples/snippets/override_method.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/override-method
23
* @name Override of method
34
* @description Finds methods that directly override 'Object.ToString'.
45
* @tags method

csharp/ql/examples/snippets/qualifier.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/qualifier
23
* @name Expression qualifier
34
* @description Finds qualified expressions (e.g. 'a.b()') and their qualifiers ('a').
45
* @tags qualifier

csharp/ql/examples/snippets/return_statement.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/return-statement
23
* @name Return statements
34
* @description Finds return statements that return 'null'.
45
* @tags return

csharp/ql/examples/snippets/singleton_block.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/singleton-block
23
* @name Singleton blocks
34
* @description Finds block statements containing a single statement.
45
* @tags block

csharp/ql/examples/snippets/switch_case.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/switch-case
23
* @name Switch statement case missing
34
* @description Finds switch statements with a missing enum constant case and no default case.
45
* @tags switch

csharp/ql/examples/snippets/ternary_conditional.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/ternary-conditional
23
* @name Conditional expressions
34
* @description Finds conditional expressions of the form '... ? ... : ...'
45
* where the types of the resulting expressions differ.

csharp/ql/examples/snippets/throw_exception.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/throw-exception
23
* @name Throw exception of given type
34
* @description Finds places where we throw 'System.IO.IOException' or one of its subtypes.
45
* @tags throw

csharp/ql/examples/snippets/todo_comment.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/todo-comment
23
* @name TODO comments
34
* @description Finds comments containing the word "TODO".
45
* @tags comment

csharp/ql/examples/snippets/too_many_params.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/too-many-params
23
* @name Methods with many parameters
34
* @description Finds methods with more than ten parameters.
45
* @tags method

csharp/ql/examples/snippets/try_finally.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/try-finally
23
* @name Try-finally statements
34
* @description Finds try-finally statements without a catch clause.
45
* @tags try

csharp/ql/examples/snippets/unused_local_var.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/unused-local-var
23
* @name Unused local variable
34
* @description Finds local variables that are not accessed.
45
* @tags variable

csharp/ql/examples/snippets/unused_param.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/unused-param
23
* @name Unused parameter
34
* @description Finds parameters that are not accessed.
45
* @tags parameter

csharp/ql/examples/snippets/void_return_type.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/void-return-type
23
* @name Methods without return type
34
* @description Finds methods whose return type is 'void'.
45
* @tags method

csharp/ql/examples/snippets/volatile_field.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id cs/examples/volatile-field
23
* @name Fields declared volatile
34
* @description Finds fields with a 'volatile' modifier.
45
* @tags field

java/ql/examples/snippets/arrayaccess.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id java/examples/arrayaccess
23
* @name Array access
34
* @description Finds array access expressions with an index expression
45
* consisting of a unary assignment

java/ql/examples/snippets/castexpr.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id java/examples/castexpr
23
* @name Cast expressions
34
* @description Finds casts from a floating point type to an integer type
45
* @tags cast

java/ql/examples/snippets/catch_exception.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id java/examples/catch-exception
23
* @name Catch exception
34
* @description Finds places where we catch exceptions of type com.example.AnException
45
* @tags catch

java/ql/examples/snippets/constructor_call.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id java/examples/constructor-call
23
* @name Call to constructor
34
* @description Finds places where we call `new com.example.Class(...)`
45
* @tags call

java/ql/examples/snippets/emptyblock.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id java/examples/emptyblock
23
* @name Empty blocks
34
* @description Finds empty block statements
45
* @tags empty

java/ql/examples/snippets/emptythen.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id java/examples/emptythen
23
* @name If statements with empty then branch
34
* @description Finds 'if' statements where the 'then' branch is
45
* an empty block statement

java/ql/examples/snippets/eq_true.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id java/examples/eq-true
23
* @name Equality test on boolean
34
* @description Finds tests like `==true`, `==false`, `!=true`, `!=false`
45
* @tags equals

java/ql/examples/snippets/extend_class.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id java/examples/extend-class
23
* @name Class extends/implements
34
* @description Finds classes/interfaces that extend/implement com.example.Class
45
* @tags class

java/ql/examples/snippets/field_read.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id java/examples/field-read
23
* @name Read of field
34
* @description Finds reads of aField (defined on com.example.Class)
45
* @tags field

java/ql/examples/snippets/integer_literal.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id java/examples/integer-literal
23
* @name Integer literal
34
* @description Finds places where we use the integer literal `0`
45
* @tags integer

java/ql/examples/snippets/method_call.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id java/examples/method-call
23
* @name Call to method
34
* @description Finds calls to com.example.Class.methodName
45
* @tags call

java/ql/examples/snippets/mutualrecursion.ql

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* @id java/examples/mutualrecursion
23
* @name Mutual recursion
34
* @description Finds pairs of methods that call each other
45
* @tags method

0 commit comments

Comments
 (0)