Skip to content

Commit

Permalink
:docs: Improve condition matching docs (#771)
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Manuel Leflet Estrada <jleflete@redhat.com>
  • Loading branch information
jmle authored Feb 12, 2025
1 parent 02ecd53 commit 11fbe7b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions docs/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ For instance, the `java` provider provides `referenced` capability. To search th
```yaml
when:
java.referenced:
pattern: org.kubernetes.*
pattern: org.kubernetes*
location: IMPORT
```

Expand Down Expand Up @@ -202,7 +202,7 @@ With the information above, we should be able to complete `java` condition we cr
when:
java.referenced:
location: PACKAGE
pattern: org.jboss.*
pattern: org.jboss*
```

##### Java Locations
Expand Down Expand Up @@ -284,14 +284,23 @@ in the `createPattern(String, int, int, int)` section.

Here are some examples of what can be used:

- Look for any class under the `javax.xml` package, occurring in any location:
```yaml
java.referenced:
pattern: javax.xml*
```
:warning: when matching against packages, as in the previous example, the asterisk must not be after a dot:
- :green_circle: `pattern: javax.xml*`
- :red_circle: `pattern: javax.xml.*`

- Look for method declarations that return `java.lang.String`:
```yaml
java.referenced:
location: METHOD
pattern: '* java.lang.String'
```

- Look for a method named "method" declared on `org.konveyor.MyClass` that returns a `List` of a type that extendes `java.lang.String`:
- Look for a method named "method" declared on `org.konveyor.MyClass` that returns a `List` of a type that extends `java.lang.String`:
```yaml
java.referenced:
location: METHOD
Expand Down

0 comments on commit 11fbe7b

Please sign in to comment.