-
Notifications
You must be signed in to change notification settings - Fork 8
MTA-5290 Rules Development Modularization Work #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MTA-5290 Rules Development Modularization Work #280
Conversation
d1b70a7 to
9d3e214
Compare
ibragins
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
docs/topics/rules-development/create-basic-yaml-rule-template.adoc
Outdated
Show resolved
Hide resolved
06a9acb to
9613c25
Compare
| For instance, looking for a method named `method` declared on | ||
| `org.konveyor.MyClass` that returns a `List` of a type that extends | ||
| `java.lang.String` and accepts a single parameter: | ||
|
|
||
| [source,yaml] | ||
| ---- | ||
| java.referenced: | ||
| location: METHOD | ||
| pattern: 'org.konveyor.Myclass.method(*) java.util.List<? extends java.lang.String>' | ||
| ---- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to change this whole paragraph to what I said in the coment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, reversed the error while modifying the example. Please check again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem here is that this example is not METHOD_CALL or CONSTRUCTOR_CALL, but just METHOD (which looks for method declarations, not calls). I can't remember now what I said in the earlier comment because it has disappeared for some reason. We need here a METHOD_CALL example, I think I have provided you one somewhere else? We can move this example to the METHOD section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh ok, understood. I have removed these descriptions of method_call and constructor_call in the introduction. These locations are explained with examples in the following table.
It's an old introduction and I think it can be modified to be more relevant later.
| pattern: javax.xml.* | ||
| ---- | ||
| + | ||
| [WARNING] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmle Could you let me know if this warning here is correct? If not, I can remove it. It says dot must not be placed after the javax.xml package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove this for the moment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, thanks!
| `annotated` :: Checks for specific annotations and their elements, such as name and value, in the Java code using a query. For example, the following query matches the `Bean` (url = “http://www.example.com”) annotation in the method. | ||
| + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected it, thanks!
|
|
||
| `labels` :: List of string labels for the rule. | ||
| `effort` :: Number of expected story points to fix this issue. | ||
| `links` :: One or more hyperlinks pointing to documentation around the migration issues that you find.+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected, thanks!
| * Estimate the total migration effort | ||
| * Prioritize issues that must be resolved based on the effort | ||
| * Evaluate if a resolution is mandatory through rule category before migrating the applications to the target technologies or platforms | ||
| * Define labels for which {ProductShortName} filters rules to trigger a violation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * Define labels for which {ProductShortName} filters rules to trigger a violation. | |
| * Define labels for which {ProductShortName} filter rules trigger a violation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified the sentence, thanks!
| *ruleID* :: This is a unique ID for the rule. It must be unique within the ruleset. | ||
| *labels* :: A list of string labels associated with the rule. (See xref:yaml-rule-labels_rule-yaml-metadata[Labels]). | ||
| *effort* :: Effort is an integer value that indicates the level of effort needed to resolve this issue. | ||
| *category* :: Category describes severity of the issue for migration. Values can be one of `mandatory`, `potential` or `optional`. For more details, see xref:yaml-rule-categories_rule-yaml-metadata[Rule categories]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| *category* :: Category describes severity of the issue for migration. Values can be one of `mandatory`, `potential` or `optional`. For more details, see xref:yaml-rule-categories_rule-yaml-metadata[Rule categories]. | |
| *category* :: Category describes the severity of the issue for migration. Values can be one of `mandatory`, `potential` or `optional`. For more details, see xref:yaml-rule-categories_rule-yaml-metadata[Rule categories]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the article, thanks!
|
|
||
| .Using the provider capability in custom rules | ||
|
|
||
| In a rule, the when block is where the conditions for matching the rule are specified. Each provider offers a series of capabilities to do matching.. The search query in the rule condition can contain patterns, code locations, specific dependencies to be found, etc, to evaluate the source code and dependencies. The provider sends the LSP server a request to check the search query against the application being analyzed. When the LSP server returns a match for the search in the source code, the analyzer triggers a violation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| In a rule, the when block is where the conditions for matching the rule are specified. Each provider offers a series of capabilities to do matching.. The search query in the rule condition can contain patterns, code locations, specific dependencies to be found, etc, to evaluate the source code and dependencies. The provider sends the LSP server a request to check the search query against the application being analyzed. When the LSP server returns a match for the search in the source code, the analyzer triggers a violation. | |
| In a rule, the when block is where the conditions for matching the rule are specified. Each provider offers a series of capabilities to do matching.. The search query in the rule condition can contain patterns, code locations, specific dependencies to be found, and so on, to evaluate the source code and dependencies. The provider sends the LSP server a request to check the search query against the application being analyzed. When the LSP server returns a match for the search in the source code, the analyzer triggers a violation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced etc, thanks!
| |Location |Description |Rule condition example | ||
|
|
||
| |TYPE|Matches against all types including classes, interfaces, enum, and annotation types that appear anywhere. | ||
| a|The following example looks for occurences of `java.util.List`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| a|The following example looks for occurences of `java.util.List`. | |
| a|The following example looks for occurrences of `java.util.List`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected the spelling, thanks!
| location: PACKAGE | ||
| ---- | ||
|
|
||
| would match on each of the following import and the FQN usage: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| would match on each of the following import and the FQN usage: | |
| would match on each of the following imports and the FQN usage: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected, thanks!
| |=== | ||
| |Location |Description |Rule condition example | ||
|
|
||
| |TYPE|Matches against all types including classes, interfaces, enum, and annotation types that appear anywhere. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| |TYPE|Matches against all types including classes, interfaces, enum, and annotation types that appear anywhere. | |
| |TYPE|Matches against all types, including classes, interfaces, enums, and annotation types that appear anywhere. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made the change, thanks!
| |FIELD|Matches against a type appearing in a field | ||
| declaration. It can be coupled with an annotation match happening on the field. See | ||
| xref:yaml-annotation-inspection_java-conditions-capabilities[Annotation inspection] | ||
| a|The following example searches if `QueueConnectionFactory` appears in a field declaration and is used to obtain connection to JMS queues. Replace the string `QueueConnectionFactory` with `ConnectionFactory`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| a|The following example searches if `QueueConnectionFactory` appears in a field declaration and is used to obtain connection to JMS queues. Replace the string `QueueConnectionFactory` with `ConnectionFactory`. | |
| a|The following example searches if `QueueConnectionFactory` appears in a field declaration and is used to obtain a connection to JMS queues. Replace the string `QueueConnectionFactory` with `ConnectionFactory`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the article, thanks!
| |CLASS (declaration)|Matches against a given method declaration. Can | ||
| be coupled with an annotation match. See | ||
| xref:yaml-annotation-inspection_java-conditions-capabilities[Annotation inspection]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| |CLASS (declaration)|Matches against a given method declaration. Can | |
| be coupled with an annotation match. See | |
| xref:yaml-annotation-inspection_java-conditions-capabilities[Annotation inspection]. | |
| |CLASS (declaration)|Matches against a given method declaration. It can be coupled with an annotation match. See xref:yaml-annotation-inspection_java-conditions-capabilities[Annotation inspection]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed extra spaces, thanks!
| pattern: java.io.FileOutputStream(java.lang.String, boolean) | ||
| ---- | ||
| |IMPORT|Matches against class imports. You can use it with FQNs or an asterisk (*) to allow for wider matches. | ||
| a|The following example matches with the import of `org.apache.lucene.search` package and sub packages in the source code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| a|The following example matches with the import of `org.apache.lucene.search` package and sub packages in the source code. | |
| a|The following example matches with the import of `org.apache.lucene.search` package and subpackages in the source code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combined the word, thanks!
| value: a Java regular expression to match the value of the element | ||
| ---- | ||
|
|
||
| It is also possible to match an annotation with specific elements, without having to specify the symbol it annotates. The following example would also match on the `@Bean` annotation in the same code as the previous example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| It is also possible to match an annotation with specific elements, without having to specify the symbol it annotates. The following example would also match on the `@Bean` annotation in the same code as the previous example: | |
| It is also possible to match an annotation with specific elements without having to specify the symbol it annotates. The following example would also match on the `@Bean` annotation in the same code as the previous example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the comma, thanks!
| [role="_abstract"] | ||
| The `or` condition performs a logical OR operation on the results of an array of conditions. | ||
|
|
||
| The `or` condition matches when _any_ of its child conditions matches, for example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The `or` condition matches when _any_ of its child conditions matches, for example: | |
| The `or` condition matches when _any_ of its child conditions match, for example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected the error, thanks!
| = Chaining in the Java provider | ||
|
|
||
| [role="_abstract"] | ||
| In the `java` provider, the `filepaths` variable must be uppercased. for example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| In the `java` provider, the `filepaths` variable must be uppercased. for example: | |
| In the `java` provider, the `filepaths` variable must be uppercased, for example: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced the period with a comma, thanks!
| = Hyperlinks | ||
|
|
||
| [role="_abstract"] | ||
| Hyperlinks can be provided along with a `message` or `tag` action to provide relevant information about the issue, which has been discovered: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Hyperlinks can be provided along with a `message` or `tag` action to provide relevant information about the issue, which has been discovered: | |
| Hyperlinks can be provided along with a `message` or `tag` action to provide relevant information about the issue that has been discovered: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced which with that, thanks!
| ---- | ||
| # links point to external hyperlinks | ||
| # rule authors are expected to provide | ||
| # relevant hyperlinks for quick fixes, docs and so on. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # relevant hyperlinks for quick fixes, docs and so on. | |
| # relevant hyperlinks for quick fixes, docs, and so on. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the comma, thanks!
| ---- | ||
|
|
||
| `labels` :: List of string labels for the rule. | ||
| `effort` :: Number of expected story points to fix this issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `effort` :: Number of expected story points to fix this issue. | |
| `effort` :: Number of expected story points to resolve this issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced fix with resolve, thanks!
| = Creating a custom Node.js rule | ||
|
|
||
| [role="_abstract"] | ||
| You must create custom rules to analyze `Node.js` applications by using {ProductShortName}. A `Node.js` rule can contain the `nodejs.referenced` capability which supports the `pattern` field. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| You must create custom rules to analyze `Node.js` applications by using {ProductShortName}. A `Node.js` rule can contain the `nodejs.referenced` capability which supports the `pattern` field. | |
| You must create custom rules to analyze `Node.js` applications by using {ProductShortName}. A `Node.js` rule can contain the `nodejs.referenced` capability that supports the `pattern` field. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced which with that, thanks!
anarnold97
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small issues, nothing major
Feel free to merge once you have dealt with these issues
2874bed to
b108dcc
Compare
Thank you for the corrections! I have updated the suggested changes in the document. |
Signed-off-by: Prabha Kylasamiyer Sundara Rajan <pkylasam@pkylasam-thinkpadp16vgen1.bengluru.csb>
5007009 to
84f500c
Compare


JIRA
Version
Preview
What changed