diff --git a/docs/rules-development-guide/master.adoc b/docs/rules-development-guide/master.adoc index 559d4df6..64efa4b5 100644 --- a/docs/rules-development-guide/master.adoc +++ b/docs/rules-development-guide/master.adoc @@ -40,8 +40,8 @@ The analyzer CLI takes rulesets as input arguments. include::topics/yaml-rule-structure-syntax.adoc[leveloffset=+2] -include::topics/yaml-rule-labels.adoc[leveloffset=+2] - +include::topics/ref_yaml-rule-labels.adoc[leveloffset=+2] + [id="creating-basic-yaml-rules_{context}"] === Creating a basic YAML rule diff --git a/docs/topics/ref_yaml-rule-labels.adoc b/docs/topics/ref_yaml-rule-labels.adoc new file mode 100644 index 00000000..073332c6 --- /dev/null +++ b/docs/topics/ref_yaml-rule-labels.adoc @@ -0,0 +1,109 @@ +:_newdoc-version: 2.18.5 +:_template-generated: 2025-12-05 +:_mod-docs-content-type: REFERENCE + +[id="yaml-rule-labels_{context}"] += Rule labels + +[role="_abstract"] +Labels are `key=val` pairs specified for rules or rulesets as well as dependencies. For dependencies, a provider adds the labels to the dependencies when retrieving them. Labels on a ruleset are automatically inherited by all the rules that belong to it. + +.Label format + +Labels are specified under the `labels` field as a list of strings in `key=val` format as follows: + +[source,yaml] +---- +labels: +- "key1=val1" +- "key2=val2" +---- + +The key of a label can be subdomain-prefixed: + +[source,yaml] +---- +labels: +- "konveyor.io/key1=val1" +---- + +The value of a label can be empty: + +[source,yaml] +---- +labels: +- "konveyor.io/key=" +---- + +The value of a label can be omitted. In that case, it is treated as an empty value: + +[source,yaml] +---- +labels: +- "konveyor.io/key" +---- + +.Reserved labels + +The analyzer defines some labels that have special meaning as follows: + +* `konveyor.io/source`: Identifies the source technology to which a rule or a ruleset applies. + +* `konveyor.io/target`: Identifies the target technology to which a rule or a ruleset applies. + +.Label selector + +The analyzer CLI takes the `--label-selector` field as an option. It is a string expression that supports logical AND, OR, and NOT operations. You can use it to filter-in or filter-out rules by their labels. + +_Examples:_ + +* To filter-in all rules that have a label with the key `konveyor.io/source` and value `eap6`: ++ +`--label-selector="konveyor.io/source=eap6"` + +* To filter-in all rules that have a label with the key `konveyor.io/source` and any value: ++ +`--label-selector="konveyor.io/source"` + +* To perform logical AND operations on matches of multiple rules by using the `&&` operator: ++ +`--label-selector="key1=val1 && key2"` + +* To perform logical OR operations on matches of multiple rules by using the `||` operator: ++ +`--label-selector="key1=val1 || key2"` + +* To perform a NOT operation to filter-out rules that have `key1=val1` label set by using the `!` operator: ++ +`--label-selector="!key1=val1"` + +* To group sub-expressions and control precedence by using AND: ++ +`--label-selector="(key1=val1 || key2=val2) && !val3"` + +.Dependency labels + +The analyzer engine adds labels to dependencies. These labels provide additional information about a dependency, such as its programming language and whether the dependency is open source or internal. + +Currently, the analyzer adds the following labels to dependencies: + +[source,yaml] +---- +labels: +- konveyor.io/dep-source=internal +- konveyor.io/language=java +---- + +.Dependency label selector + +The analyzer CLI accepts the `--dep-label-selector` option, which allows filtering-in or filtering-out incidents generated from a dependency by their labels. + +For example, the analyzer adds a `konveyor.io/dep-source` label to dependencies with a value that indicates whether the dependency is a known open source dependency. + +To exclude incidents for all such open source dependencies, you can use `--dep-label-selector` as follows: + +`konveyor-analyzer ... --dep-label-selector !konveyor.io/dep-source=open-source` + +The Java provider in the analyzer can also add an exclude label to a list of packages. To exclude all such packages, you can use `--dep-label-selector` and the `!` operator as follows: + +`konveyor-analyzer ... --dep-label-selector !konveyor.io/exclude` \ No newline at end of file diff --git a/docs/topics/yaml-provider-conditions.adoc b/docs/topics/yaml-provider-conditions.adoc index 580b43ae..71bd0c9a 100644 --- a/docs/topics/yaml-provider-conditions.adoc +++ b/docs/topics/yaml-provider-conditions.adoc @@ -28,7 +28,7 @@ The analyzer currently supports the following `provider` conditions: * `dotnet` + :FeatureName: dotnet provider -include::technology-preview.adoc[] +include::snippets/technology-preview-admonition.adoc[] [[table-Supported-providers-and-rule-conditions]]