Skip to content

Commit

Permalink
👻 Revert "Revert "🐛 Be able to process FIELD rules"" (#644)
Browse files Browse the repository at this point in the history
Reverts #639
  • Loading branch information
pranavgaikwad authored Jul 8, 2024
1 parent fa18ec0 commit 1473d21
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
13 changes: 13 additions & 0 deletions demo-output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,19 @@
matchingXML: ""
effort: 1
insights:
field-rule-00001:
description: Sample field declaration rule
category: mandatory
incidents:
- uri: file:///examples/customers-tomcat-legacy/src/main/java/io/konveyor/demo/ordermanagement/service/CustomerService.java
message: Field found
codeSnip: " 8 import org.springframework.data.domain.Page;\n 9 import org.springframework.data.domain.Pageable;\n10 import org.springframework.stereotype.Service;\n11 import org.springframework.transaction.annotation.Transactional;\n12 \n13 @Service\n14 @Transactional\n15 public class CustomerService implements ICustomerService{\n16 \t\n17 \t@Autowired\n18 \tprivate CustomerRepository repository;\n19 \t\n20 \tprivate static Logger logger = Logger.getLogger( CustomerService.class.getName() );\n21 \t\n22 \tpublic Customer findById(Long id) {\n23 \t\tlogger.debug(\"Entering CustomerService.findById()\");\n24 \t\tCustomer c = repository.findById(id).orElse(null);\n25 \t\tlogger.debug(\"Returning element: \" + c);\n26 \t\treturn c;\n27 \t}\n28 \t"
lineNumber: 18
variables:
file: file:///examples/customers-tomcat-legacy/src/main/java/io/konveyor/demo/ordermanagement/service/CustomerService.java
kind: Field
name: repository
package: io.konveyor.demo.ordermanagement.service
java-downloaded-maven-artifact:
description: |
This rule tests the application downloaded from maven artifact
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ var locationToCode = map[string]int{
"variable_declaration": 9,
"type": 10,
"package": 11,
"field": 12,
}

type javaProvider struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ func (p *javaServiceClient) Evaluate(ctx context.Context, cap string, conditionI
incidents, err = p.filterDefault(symbols)
case 11:
incidents, err = p.filterDefault(symbols)
case 12:
incidents, err = p.filterDefault(symbols)
default:

}
Expand Down
10 changes: 9 additions & 1 deletion rule-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -329,4 +329,12 @@
ruleID: java-downloaded-maven-artifact
when:
java.referenced:
pattern: io.javaoperatorsdk.operator.Operator
pattern: io.javaoperatorsdk.operator.Operator
- category: mandatory
description: Sample field declaration rule
message: "Field found"
ruleID: field-rule-00001
when:
java.referenced:
pattern: io.konveyor.demo.ordermanagement.repository.CustomerRepository
location: FIELD

0 comments on commit 1473d21

Please sign in to comment.