Skip to content

Commit 487c308

Browse files
committed
add
Signed-off-by: A.Arnold <[email protected]>
1 parent 957d94d commit 487c308

File tree

1 file changed

+1
-29
lines changed

1 file changed

+1
-29
lines changed

docs/topics/yaml-rule-structure-syntax.adoc

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ java.referenced:
431431
pattern: java.util.List
432432
----
433433

434+
=====
434435
====== `java` locations
435436
436437
The Java provider allows scoping down the search to certain source code locations. You can scope down Java searches from any one of the following search locations:
@@ -519,35 +520,6 @@ In the current release of {ProductShortName}, fully qualified static method matc
519520
* *CLASS* (declaration): matches against a given method declaration. It can be coupled with an annotation match.
520521
521522
522-
523-
// Module included in the following assemblies:
524-
//
525-
// * docs/rules-development-guide/master.adoc
526-
527-
:_mod-docs-content-type: REFERENCE
528-
[id="yaml-custom-variables_{context}"]
529-
= Custom variables
530-
531-
Provider conditions can have associated custom variables. You can use custom variables to capture relevant information from the matched line in the source code. The values of these variables are interpolated with data matched in the source code.
532-
533-
These values can be used to generate detailed template messages in a rule's action (see xref:yaml-rule-actions_{context}[Message actions]). They can be added to a rule in the `customVariables` field:
534-
535-
[source,yaml]
536-
----
537-
- ruleID: lang-ref-004
538-
customVariables:
539-
- pattern: '([A-z]+)\.get\(\)' # <1>
540-
name: VariableName # <2>
541-
message: "Found generic call - {{ VariableName }}" # <3>
542-
when:
543-
java.referenced:
544-
location: METHOD_CALL
545-
pattern: com.example.apps.GenericClass.get
546-
----
547-
<1> `pattern`: A regular expression pattern that is matched on the source code line when a match is found.
548-
<2> `name`: The name of the variable that can be used in templates.
549-
<3> `message`: A template for a message using a custom variable.
550-
551523
===== `go` provider
552524
553525
The `go` provider analyzes Go source code. This provider's capabilities are `referenced` and `dependency`.

0 commit comments

Comments
 (0)